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