1 /* Copyright (C) 2017 Mellanox Technologies Inc */ 2 3 #ifndef _SEMANAGE_IBPKEY_RECORD_H_ 4 #define _SEMANAGE_IBPKEY_RECORD_H_ 5 6 #include <semanage/context_record.h> 7 #include <semanage/handle.h> 8 #include <stddef.h> 9 #include <stdint.h> 10 11 #ifndef _SEMANAGE_IBPKEY_DEFINED_ 12 struct semanage_ibpkey; 13 struct semanage_ibpkey_key; 14 typedef struct semanage_ibpkey semanage_ibpkey_t; 15 typedef struct semanage_ibpkey_key semanage_ibpkey_key_t; 16 #define _SEMANAGE_IBPKEY_DEFINED_ 17 #endif 18 19 extern int semanage_ibpkey_compare(const semanage_ibpkey_t *ibpkey, 20 const semanage_ibpkey_key_t *key); 21 22 extern int semanage_ibpkey_compare2(const semanage_ibpkey_t *ibpkey, 23 const semanage_ibpkey_t *ibpkey2); 24 25 extern int semanage_ibpkey_key_create(semanage_handle_t *handle, 26 const char *subnet_prefix, 27 int low, int high, 28 semanage_ibpkey_key_t **key_ptr); 29 30 extern int semanage_ibpkey_key_extract(semanage_handle_t *handle, 31 const semanage_ibpkey_t *ibpkey, 32 semanage_ibpkey_key_t **key_ptr); 33 34 extern void semanage_ibpkey_key_free(semanage_ibpkey_key_t *key); 35 36 extern int semanage_ibpkey_get_subnet_prefix(semanage_handle_t *handle, 37 const semanage_ibpkey_t *ibpkey, 38 char **subnet_prefix_ptr); 39 40 extern uint64_t semanage_ibpkey_get_subnet_prefix_bytes(const semanage_ibpkey_t *ibpkey); 41 42 extern int semanage_ibpkey_set_subnet_prefix(semanage_handle_t *handle, 43 semanage_ibpkey_t *ibpkey, 44 const char *subnet_prefix); 45 46 extern void semanage_ibpkey_set_subnet_prefix_bytes(semanage_ibpkey_t *ibpkey, 47 uint64_t subnet_prefix); 48 49 extern int semanage_ibpkey_get_low(const semanage_ibpkey_t *ibpkey); 50 51 extern int semanage_ibpkey_get_high(const semanage_ibpkey_t *ibpkey); 52 53 extern void semanage_ibpkey_set_pkey(semanage_ibpkey_t *ibpkey, int pkey_num); 54 55 extern void semanage_ibpkey_set_range(semanage_ibpkey_t *ibpkey, int low, int high); 56 57 extern semanage_context_t *semanage_ibpkey_get_con(const semanage_ibpkey_t *ibpkey); 58 59 extern int semanage_ibpkey_set_con(semanage_handle_t *handle, 60 semanage_ibpkey_t *ibpkey, 61 semanage_context_t *con); 62 63 extern int semanage_ibpkey_create(semanage_handle_t *handle, 64 semanage_ibpkey_t **ibpkey_ptr); 65 66 extern int semanage_ibpkey_clone(semanage_handle_t *handle, 67 const semanage_ibpkey_t *ibpkey, 68 semanage_ibpkey_t **ibpkey_ptr); 69 70 extern void semanage_ibpkey_free(semanage_ibpkey_t *ibpkey); 71 72 #endif 73