1*2d543d20SAndroid Build Coastguard Worker #ifndef _SEPOL_IBPKEYS_H_ 2*2d543d20SAndroid Build Coastguard Worker #define _SEPOL_IBPKEYS_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/ibpkey_record.h> 7*2d543d20SAndroid Build Coastguard Worker 8*2d543d20SAndroid Build Coastguard Worker 9*2d543d20SAndroid Build Coastguard Worker #ifdef __cplusplus 10*2d543d20SAndroid Build Coastguard Worker extern "C" { 11*2d543d20SAndroid Build Coastguard Worker #endif 12*2d543d20SAndroid Build Coastguard Worker 13*2d543d20SAndroid Build Coastguard Worker /* Return the number of ibpkeys */ 14*2d543d20SAndroid Build Coastguard Worker extern int sepol_ibpkey_count(sepol_handle_t *handle, 15*2d543d20SAndroid Build Coastguard Worker const sepol_policydb_t *p, unsigned int *response); 16*2d543d20SAndroid Build Coastguard Worker 17*2d543d20SAndroid Build Coastguard Worker /* Check if a ibpkey exists */ 18*2d543d20SAndroid Build Coastguard Worker extern int sepol_ibpkey_exists(sepol_handle_t *handle, 19*2d543d20SAndroid Build Coastguard Worker const sepol_policydb_t *policydb, 20*2d543d20SAndroid Build Coastguard Worker const sepol_ibpkey_key_t *key, int *response); 21*2d543d20SAndroid Build Coastguard Worker 22*2d543d20SAndroid Build Coastguard Worker /* Query a ibpkey - returns the ibpkey, or NULL if not found */ 23*2d543d20SAndroid Build Coastguard Worker extern int sepol_ibpkey_query(sepol_handle_t *handle, 24*2d543d20SAndroid Build Coastguard Worker const sepol_policydb_t *policydb, 25*2d543d20SAndroid Build Coastguard Worker const sepol_ibpkey_key_t *key, 26*2d543d20SAndroid Build Coastguard Worker sepol_ibpkey_t **response); 27*2d543d20SAndroid Build Coastguard Worker 28*2d543d20SAndroid Build Coastguard Worker /* Modify a ibpkey, or add it, if the key is not found */ 29*2d543d20SAndroid Build Coastguard Worker extern int sepol_ibpkey_modify(sepol_handle_t *handle, 30*2d543d20SAndroid Build Coastguard Worker sepol_policydb_t *policydb, 31*2d543d20SAndroid Build Coastguard Worker const sepol_ibpkey_key_t *key, 32*2d543d20SAndroid Build Coastguard Worker const sepol_ibpkey_t *data); 33*2d543d20SAndroid Build Coastguard Worker 34*2d543d20SAndroid Build Coastguard Worker /* Iterate the ibpkeys 35*2d543d20SAndroid Build Coastguard Worker * The handler may return: 36*2d543d20SAndroid Build Coastguard Worker * -1 to signal an error condition, 37*2d543d20SAndroid Build Coastguard Worker * 1 to signal successful exit 38*2d543d20SAndroid Build Coastguard Worker * 0 to signal continue 39*2d543d20SAndroid Build Coastguard Worker */ 40*2d543d20SAndroid Build Coastguard Worker extern int sepol_ibpkey_iterate(sepol_handle_t *handle, 41*2d543d20SAndroid Build Coastguard Worker const sepol_policydb_t *policydb, 42*2d543d20SAndroid Build Coastguard Worker int (*fn)(const sepol_ibpkey_t *ibpkey, 43*2d543d20SAndroid Build Coastguard Worker void *fn_arg), void *arg); 44*2d543d20SAndroid Build Coastguard Worker 45*2d543d20SAndroid Build Coastguard Worker 46*2d543d20SAndroid Build Coastguard Worker #ifdef __cplusplus 47*2d543d20SAndroid Build Coastguard Worker } 48*2d543d20SAndroid Build Coastguard Worker #endif 49*2d543d20SAndroid Build Coastguard Worker 50*2d543d20SAndroid Build Coastguard Worker #endif 51