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 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /* Return the number of interfaces */
13 extern int sepol_iface_count(sepol_handle_t * handle,
14 			     const sepol_policydb_t * policydb,
15 			     unsigned int *response);
16 
17 /* Check if an interface exists */
18 extern int sepol_iface_exists(sepol_handle_t * handle,
19 			      const sepol_policydb_t * policydb,
20 			      const sepol_iface_key_t * key, int *response);
21 
22 /* Query an interface - returns the interface,
23  * or NULL if not found */
24 extern int sepol_iface_query(sepol_handle_t * handle,
25 			     const sepol_policydb_t * policydb,
26 			     const sepol_iface_key_t * key,
27 			     sepol_iface_t ** response);
28 
29 /* Modify an interface, or add it, if the key
30  * is not found */
31 extern int sepol_iface_modify(sepol_handle_t * handle,
32 			      sepol_policydb_t * policydb,
33 			      const sepol_iface_key_t * key,
34 			      const sepol_iface_t * data);
35 
36 /* Iterate the interfaces
37  * The handler may return:
38  * -1 to signal an error condition,
39  * 1 to signal successful exit
40  * 0 to signal continue */
41 
42 extern int sepol_iface_iterate(sepol_handle_t * handle,
43 			       const sepol_policydb_t * policydb,
44 			       int (*fn) (const sepol_iface_t * iface,
45 					  void *fn_arg), void *arg);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51 #endif
52