1 #ifndef _SEPOL_MODULE_H_ 2 #define _SEPOL_MODULE_H_ 3 4 #include <stddef.h> 5 #include <stdio.h> 6 #include <stdint.h> 7 8 #include <sepol/handle.h> 9 #include <sepol/policydb.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 struct sepol_module_package; 16 typedef struct sepol_module_package sepol_module_package_t; 17 18 /* Module package public interfaces. */ 19 20 extern int sepol_module_package_create(sepol_module_package_t ** p); 21 22 extern void sepol_module_package_free(sepol_module_package_t * p); 23 24 extern char *sepol_module_package_get_file_contexts(sepol_module_package_t * p); 25 26 extern size_t sepol_module_package_get_file_contexts_len(sepol_module_package_t 27 * p); 28 29 extern int sepol_module_package_set_file_contexts(sepol_module_package_t * p, 30 char *data, size_t len); 31 32 extern char *sepol_module_package_get_seusers(sepol_module_package_t * p); 33 34 extern size_t sepol_module_package_get_seusers_len(sepol_module_package_t * p); 35 36 extern int sepol_module_package_set_seusers(sepol_module_package_t * p, 37 char *data, size_t len); 38 39 extern char *sepol_module_package_get_user_extra(sepol_module_package_t * p); 40 41 extern size_t sepol_module_package_get_user_extra_len(sepol_module_package_t * 42 p); 43 44 extern int sepol_module_package_set_user_extra(sepol_module_package_t * p, 45 char *data, size_t len); 46 47 extern char *sepol_module_package_get_netfilter_contexts(sepol_module_package_t 48 * p); 49 50 extern size_t 51 sepol_module_package_get_netfilter_contexts_len(sepol_module_package_t * p); 52 53 extern int sepol_module_package_set_netfilter_contexts(sepol_module_package_t * 54 p, char *data, 55 size_t len); 56 57 extern sepol_policydb_t *sepol_module_package_get_policy(sepol_module_package_t 58 * p); 59 60 extern int sepol_link_packages(sepol_handle_t * handle, 61 sepol_module_package_t * base, 62 sepol_module_package_t ** modules, 63 int num_modules, int verbose); 64 65 extern int sepol_module_package_read(sepol_module_package_t * mod, 66 struct sepol_policy_file *file, 67 int verbose); 68 69 extern int sepol_module_package_info(struct sepol_policy_file *file, 70 int *type, char **name, char **version); 71 72 extern int sepol_module_package_write(sepol_module_package_t * p, 73 struct sepol_policy_file *file); 74 75 /* Module linking/expanding public interfaces. */ 76 77 extern int sepol_link_modules(sepol_handle_t * handle, 78 sepol_policydb_t * base, 79 sepol_policydb_t ** modules, 80 size_t len, int verbose); 81 82 extern int sepol_expand_module(sepol_handle_t * handle, 83 sepol_policydb_t * base, 84 sepol_policydb_t * out, int verbose, int check); 85 86 #ifdef __cplusplus 87 } 88 #endif 89 90 #endif 91