blob: 3cf99d25489e7dac0114c50140bdf07473f244f1 [file] [log] [blame]
Joshua Brindle13cd4c82008-08-19 15:30:36 -04001#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>
dcashmaned7a6ba2014-12-16 11:44:41 -08007
Stephen Smalleycf8625b2016-11-29 10:57:48 -05008#ifdef __cplusplus
9extern "C" {
10#endif
Joshua Brindle13cd4c82008-08-19 15:30:36 -040011
12/* Return the number of nodes */
13extern int sepol_node_count(sepol_handle_t * handle,
14 const sepol_policydb_t * p, unsigned int *response);
15
16/* Check if a node exists */
17extern 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 */
22extern 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 */
28extern 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
39extern 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
Stephen Smalleycf8625b2016-11-29 10:57:48 -050044#ifdef __cplusplus
45}
46#endif
47
Joshua Brindle13cd4c82008-08-19 15:30:36 -040048#endif