| 1 |
#ifndef _SEPOL_IBPKEYS_H_ |
| 2 |
#define _SEPOL_IBPKEYS_H_ |
| 3 |
|
| 4 |
#include <sepol/handle.h> |
| 5 |
#include <sepol/policydb.h> |
| 6 |
#include <sepol/ibpkey_record.h> |
| 7 |
|
| 8 |
|
| 9 |
#ifdef __cplusplus |
| 10 |
extern "C" { |
| 11 |
#endif |
| 12 |
|
| 13 |
/* Return the number of ibpkeys */ |
| 14 |
extern int sepol_ibpkey_count(sepol_handle_t *handle, |
| 15 |
const sepol_policydb_t *p, unsigned int *response); |
| 16 |
|
| 17 |
/* Check if a ibpkey exists */ |
| 18 |
extern int sepol_ibpkey_exists(sepol_handle_t *handle, |
| 19 |
const sepol_policydb_t *policydb, |
| 20 |
const sepol_ibpkey_key_t *key, int *response); |
| 21 |
|
| 22 |
/* Query a ibpkey - returns the ibpkey, or NULL if not found */ |
| 23 |
extern int sepol_ibpkey_query(sepol_handle_t *handle, |
| 24 |
const sepol_policydb_t *policydb, |
| 25 |
const sepol_ibpkey_key_t *key, |
| 26 |
sepol_ibpkey_t **response); |
| 27 |
|
| 28 |
/* Modify a ibpkey, or add it, if the key is not found */ |
| 29 |
extern int sepol_ibpkey_modify(sepol_handle_t *handle, |
| 30 |
sepol_policydb_t *policydb, |
| 31 |
const sepol_ibpkey_key_t *key, |
| 32 |
const sepol_ibpkey_t *data); |
| 33 |
|
| 34 |
/* Iterate the ibpkeys |
| 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_ibpkey_iterate(sepol_handle_t *handle, |
| 41 |
const sepol_policydb_t *policydb, |
| 42 |
int (*fn)(const sepol_ibpkey_t *ibpkey, |
| 43 |
void *fn_arg), void *arg); |
| 44 |
|
| 45 |
|
| 46 |
#ifdef __cplusplus |
| 47 |
} |
| 48 |
#endif |
| 49 |
|
| 50 |
#endif |