xref: /aosp_15_r20/external/selinux/libsepol/include/sepol/booleans.h (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1 #ifndef _SEPOL_BOOLEANS_H_
2 #define _SEPOL_BOOLEANS_H_
3 
4 #include <stddef.h>
5 #include <sepol/policydb.h>
6 #include <sepol/boolean_record.h>
7 #include <sepol/handle.h>
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /* Set the specified boolean */
14 extern int sepol_bool_set(sepol_handle_t * handle,
15 			  sepol_policydb_t * policydb,
16 			  const sepol_bool_key_t * key,
17 			  const sepol_bool_t * data);
18 
19 /* Return the number of booleans */
20 extern int sepol_bool_count(sepol_handle_t * handle,
21 			    const sepol_policydb_t * p, unsigned int *response);
22 
23 /* Check if the specified boolean exists */
24 extern int sepol_bool_exists(sepol_handle_t * handle,
25 			     const sepol_policydb_t * policydb,
26 			     const sepol_bool_key_t * key, int *response);
27 
28 /* Query a boolean - returns the boolean, or NULL if not found */
29 extern int sepol_bool_query(sepol_handle_t * handle,
30 			    const sepol_policydb_t * p,
31 			    const sepol_bool_key_t * key,
32 			    sepol_bool_t ** response);
33 
34 /* Iterate the booleans
35  * The handler may return:
36  * -1 to signal an error condition,
37  * 1 to signal successful exit
38  * 0 to signal continue */
39 
40 extern int sepol_bool_iterate(sepol_handle_t * handle,
41 			      const sepol_policydb_t * policydb,
42 			      int (*fn) (const sepol_bool_t * boolean,
43 					 void *fn_arg), void *arg);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif
50