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