1 #ifndef __SEPOL_INTERFACES_H_
2 #define __SEPOL_INTERFACES_H_
3 
4 #include <sepol/policydb.h>
5 #include <sepol/iface_record.h>
6 #include <sepol/handle.h>
7 #include <sys/cdefs.h>
8 
9 __BEGIN_DECLS
10 
11 /* Return the number of interfaces */
12 extern int sepol_iface_count(sepol_handle_t * handle,
13 			     const sepol_policydb_t * policydb,
14 			     unsigned int *response);
15 
16 /* Check if an interface exists */
17 extern int sepol_iface_exists(sepol_handle_t * handle,
18 			      const sepol_policydb_t * policydb,
19 			      const sepol_iface_key_t * key, int *response);
20 
21 /* Query an interface - returns the interface,
22  * or NULL if not found */
23 extern int sepol_iface_query(sepol_handle_t * handle,
24 			     const sepol_policydb_t * policydb,
25 			     const sepol_iface_key_t * key,
26 			     sepol_iface_t ** response);
27 
28 /* Modify an interface, or add it, if the key
29  * is not found */
30 extern int sepol_iface_modify(sepol_handle_t * handle,
31 			      sepol_policydb_t * policydb,
32 			      const sepol_iface_key_t * key,
33 			      const sepol_iface_t * data);
34 
35 /* Iterate the interfaces
36  * The handler may return:
37  * -1 to signal an error condition,
38  * 1 to signal successful exit
39  * 0 to signal continue */
40 
41 extern int sepol_iface_iterate(sepol_handle_t * handle,
42 			       const sepol_policydb_t * policydb,
43 			       int (*fn) (const sepol_iface_t * iface,
44 					  void *fn_arg), void *arg);
45 
46 __END_DECLS
47 #endif
48