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
11struct sepol_module_package;
12typedef struct sepol_module_package sepol_module_package_t;
13
14/* Module package public interfaces. */
15
16extern int sepol_module_package_create(sepol_module_package_t ** p);
17
18extern void sepol_module_package_free(sepol_module_package_t * p);
19
20extern char *sepol_module_package_get_file_contexts(sepol_module_package_t * p);
21
22extern size_t sepol_module_package_get_file_contexts_len(sepol_module_package_t
23							 * p);
24
25extern int sepol_module_package_set_file_contexts(sepol_module_package_t * p,
26						  char *data, size_t len);
27
28extern char *sepol_module_package_get_seusers(sepol_module_package_t * p);
29
30extern size_t sepol_module_package_get_seusers_len(sepol_module_package_t * p);
31
32extern int sepol_module_package_set_seusers(sepol_module_package_t * p,
33					    char *data, size_t len);
34
35extern char *sepol_module_package_get_user_extra(sepol_module_package_t * p);
36
37extern size_t sepol_module_package_get_user_extra_len(sepol_module_package_t *
38						      p);
39
40extern int sepol_module_package_set_user_extra(sepol_module_package_t * p,
41					       char *data, size_t len);
42
43extern char *sepol_module_package_get_netfilter_contexts(sepol_module_package_t
44							 * p);
45
46extern size_t
47sepol_module_package_get_netfilter_contexts_len(sepol_module_package_t * p);
48
49extern int sepol_module_package_set_netfilter_contexts(sepol_module_package_t *
50						       p, char *data,
51						       size_t len);
52
53extern sepol_policydb_t *sepol_module_package_get_policy(sepol_module_package_t
54							 * p);
55
56extern int sepol_link_packages(sepol_handle_t * handle,
57			       sepol_module_package_t * base,
58			       sepol_module_package_t ** modules,
59			       int num_modules, int verbose);
60
61extern int sepol_module_package_read(sepol_module_package_t * mod,
62				     struct sepol_policy_file *file,
63				     int verbose);
64
65extern int sepol_module_package_info(struct sepol_policy_file *file,
66				     int *type, char **name, char **version);
67
68extern int sepol_module_package_write(sepol_module_package_t * p,
69				      struct sepol_policy_file *file);
70
71/* Module linking/expanding public interfaces. */
72
73extern int sepol_link_modules(sepol_handle_t * handle,
74			      sepol_policydb_t * base,
75			      sepol_policydb_t ** modules,
76			      size_t len, int verbose);
77
78extern int sepol_expand_module(sepol_handle_t * handle,
79			       sepol_policydb_t * base,
80			       sepol_policydb_t * out, int verbose, int check);
81
82#endif
83