16cd6a6acSopenharmony_ci#ifndef _SEPOL_MODULE_H_
26cd6a6acSopenharmony_ci#define _SEPOL_MODULE_H_
36cd6a6acSopenharmony_ci
46cd6a6acSopenharmony_ci#include <stddef.h>
56cd6a6acSopenharmony_ci#include <stdio.h>
66cd6a6acSopenharmony_ci#include <stdint.h>
76cd6a6acSopenharmony_ci
86cd6a6acSopenharmony_ci#include <sepol/handle.h>
96cd6a6acSopenharmony_ci#include <sepol/policydb.h>
106cd6a6acSopenharmony_ci
116cd6a6acSopenharmony_ci#ifdef __cplusplus
126cd6a6acSopenharmony_ciextern "C" {
136cd6a6acSopenharmony_ci#endif
146cd6a6acSopenharmony_ci
156cd6a6acSopenharmony_cistruct sepol_module_package;
166cd6a6acSopenharmony_citypedef struct sepol_module_package sepol_module_package_t;
176cd6a6acSopenharmony_ci
186cd6a6acSopenharmony_ci/* Module package public interfaces. */
196cd6a6acSopenharmony_ci
206cd6a6acSopenharmony_ciextern int sepol_module_package_create(sepol_module_package_t ** p);
216cd6a6acSopenharmony_ci
226cd6a6acSopenharmony_ciextern void sepol_module_package_free(sepol_module_package_t * p);
236cd6a6acSopenharmony_ci
246cd6a6acSopenharmony_ciextern char *sepol_module_package_get_file_contexts(sepol_module_package_t * p);
256cd6a6acSopenharmony_ci
266cd6a6acSopenharmony_ciextern size_t sepol_module_package_get_file_contexts_len(sepol_module_package_t
276cd6a6acSopenharmony_ci							 * p);
286cd6a6acSopenharmony_ci
296cd6a6acSopenharmony_ciextern int sepol_module_package_set_file_contexts(sepol_module_package_t * p,
306cd6a6acSopenharmony_ci						  char *data, size_t len);
316cd6a6acSopenharmony_ci
326cd6a6acSopenharmony_ciextern char *sepol_module_package_get_seusers(sepol_module_package_t * p);
336cd6a6acSopenharmony_ci
346cd6a6acSopenharmony_ciextern size_t sepol_module_package_get_seusers_len(sepol_module_package_t * p);
356cd6a6acSopenharmony_ci
366cd6a6acSopenharmony_ciextern int sepol_module_package_set_seusers(sepol_module_package_t * p,
376cd6a6acSopenharmony_ci					    char *data, size_t len);
386cd6a6acSopenharmony_ci
396cd6a6acSopenharmony_ciextern char *sepol_module_package_get_user_extra(sepol_module_package_t * p);
406cd6a6acSopenharmony_ci
416cd6a6acSopenharmony_ciextern size_t sepol_module_package_get_user_extra_len(sepol_module_package_t *
426cd6a6acSopenharmony_ci						      p);
436cd6a6acSopenharmony_ci
446cd6a6acSopenharmony_ciextern int sepol_module_package_set_user_extra(sepol_module_package_t * p,
456cd6a6acSopenharmony_ci					       char *data, size_t len);
466cd6a6acSopenharmony_ci
476cd6a6acSopenharmony_ciextern char *sepol_module_package_get_netfilter_contexts(sepol_module_package_t
486cd6a6acSopenharmony_ci							 * p);
496cd6a6acSopenharmony_ci
506cd6a6acSopenharmony_ciextern size_t
516cd6a6acSopenharmony_cisepol_module_package_get_netfilter_contexts_len(sepol_module_package_t * p);
526cd6a6acSopenharmony_ci
536cd6a6acSopenharmony_ciextern int sepol_module_package_set_netfilter_contexts(sepol_module_package_t *
546cd6a6acSopenharmony_ci						       p, char *data,
556cd6a6acSopenharmony_ci						       size_t len);
566cd6a6acSopenharmony_ci
576cd6a6acSopenharmony_ciextern sepol_policydb_t *sepol_module_package_get_policy(sepol_module_package_t
586cd6a6acSopenharmony_ci							 * p);
596cd6a6acSopenharmony_ci
606cd6a6acSopenharmony_ciextern int sepol_link_packages(sepol_handle_t * handle,
616cd6a6acSopenharmony_ci			       sepol_module_package_t * base,
626cd6a6acSopenharmony_ci			       sepol_module_package_t ** modules,
636cd6a6acSopenharmony_ci			       int num_modules, int verbose);
646cd6a6acSopenharmony_ci
656cd6a6acSopenharmony_ciextern int sepol_module_package_read(sepol_module_package_t * mod,
666cd6a6acSopenharmony_ci				     struct sepol_policy_file *file,
676cd6a6acSopenharmony_ci				     int verbose);
686cd6a6acSopenharmony_ci
696cd6a6acSopenharmony_ciextern int sepol_module_package_info(struct sepol_policy_file *file,
706cd6a6acSopenharmony_ci				     int *type, char **name, char **version);
716cd6a6acSopenharmony_ci
726cd6a6acSopenharmony_ciextern int sepol_module_package_write(sepol_module_package_t * p,
736cd6a6acSopenharmony_ci				      struct sepol_policy_file *file);
746cd6a6acSopenharmony_ci
756cd6a6acSopenharmony_ci/* Module linking/expanding public interfaces. */
766cd6a6acSopenharmony_ci
776cd6a6acSopenharmony_ciextern int sepol_link_modules(sepol_handle_t * handle,
786cd6a6acSopenharmony_ci			      sepol_policydb_t * base,
796cd6a6acSopenharmony_ci			      sepol_policydb_t ** modules,
806cd6a6acSopenharmony_ci			      size_t len, int verbose);
816cd6a6acSopenharmony_ci
826cd6a6acSopenharmony_ciextern int sepol_expand_module(sepol_handle_t * handle,
836cd6a6acSopenharmony_ci			       sepol_policydb_t * base,
846cd6a6acSopenharmony_ci			       sepol_policydb_t * out, int verbose, int check);
856cd6a6acSopenharmony_ci
866cd6a6acSopenharmony_ci#ifdef __cplusplus
876cd6a6acSopenharmony_ci}
886cd6a6acSopenharmony_ci#endif
896cd6a6acSopenharmony_ci
906cd6a6acSopenharmony_ci#endif
91