1 #ifndef _SEPOL_NODES_H_
2 #define _SEPOL_NODES_H_
3 
4 #include <sepol/handle.h>
5 #include <sepol/policydb.h>
6 #include <sepol/node_record.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /* Return the number of nodes */
13 extern int sepol_node_count(sepol_handle_t * handle,
14 			    const sepol_policydb_t * p, unsigned int *response);
15 
16 /* Check if a node exists */
17 extern int sepol_node_exists(sepol_handle_t * handle,
18 			     const sepol_policydb_t * policydb,
19 			     const sepol_node_key_t * key, int *response);
20 
21 /* Query a node - returns the node, or NULL if not found */
22 extern int sepol_node_query(sepol_handle_t * handle,
23 			    const sepol_policydb_t * policydb,
24 			    const sepol_node_key_t * key,
25 			    sepol_node_t ** response);
26 
27 /* Modify a node, or add it, if the key is not found */
28 extern int sepol_node_modify(sepol_handle_t * handle,
29 			     sepol_policydb_t * policydb,
30 			     const sepol_node_key_t * key,
31 			     const sepol_node_t * data);
32 
33 /* Iterate the nodes
34  * The handler may return:
35  * -1 to signal an error condition,
36  * 1 to signal successful exit
37  * 0 to signal continue */
38 
39 extern int sepol_node_iterate(sepol_handle_t * handle,
40 			      const sepol_policydb_t * policydb,
41 			      int (*fn) (const sepol_node_t * node,
42 					 void *fn_arg), void *arg);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif
49