nodes.h revision 255e72915d4cbddceb435e13d81601755714e9f3
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/* Return the number of nodes */
9extern int sepol_node_count(sepol_handle_t * handle,
10			    const sepol_policydb_t * p, unsigned int *response);
11
12/* Check if a node exists */
13extern int sepol_node_exists(sepol_handle_t * handle,
14			     const sepol_policydb_t * policydb,
15			     const sepol_node_key_t * key, int *response);
16
17/* Query a node - returns the node, or NULL if not found */
18extern int sepol_node_query(sepol_handle_t * handle,
19			    const sepol_policydb_t * policydb,
20			    const sepol_node_key_t * key,
21			    sepol_node_t ** response);
22
23/* Modify a node, or add it, if the key is not found */
24extern int sepol_node_modify(sepol_handle_t * handle,
25			     sepol_policydb_t * policydb,
26			     const sepol_node_key_t * key,
27			     const sepol_node_t * data);
28
29/* Iterate the nodes
30 * The handler may return:
31 * -1 to signal an error condition,
32 * 1 to signal successful exit
33 * 0 to signal continue */
34
35extern int sepol_node_iterate(sepol_handle_t * handle,
36			      const sepol_policydb_t * policydb,
37			      int (*fn) (const sepol_node_t * node,
38					 void *fn_arg), void *arg);
39
40#endif
41