Joshua Brindle | 13cd4c8 | 2008-08-19 15:30:36 -0400 | [diff] [blame] | 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> |
dcashman | ed7a6ba | 2014-12-16 11:44:41 -0800 | [diff] [blame] | 7 | |
Stephen Smalley | cf8625b | 2016-11-29 10:57:48 -0500 | [diff] [blame] | 8 | #ifdef __cplusplus |
| 9 | extern "C" { |
| 10 | #endif |
Joshua Brindle | 13cd4c8 | 2008-08-19 15:30:36 -0400 | [diff] [blame] | 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 | |
Stephen Smalley | cf8625b | 2016-11-29 10:57:48 -0500 | [diff] [blame] | 44 | #ifdef __cplusplus |
| 45 | } |
| 46 | #endif |
| 47 | |
Joshua Brindle | 13cd4c8 | 2008-08-19 15:30:36 -0400 | [diff] [blame] | 48 | #endif |