interfaces.h revision 255e72915d4cbddceb435e13d81601755714e9f3
1#ifndef __SEPOL_INTERFACES_H_
2#define __SEPOL_INTERFACES_H_
3
4#include <sepol/policydb.h>
5#include <sepol/iface_record.h>
6#include <sepol/handle.h>
7
8/* Return the number of interfaces */
9extern int sepol_iface_count(sepol_handle_t * handle,
10			     const sepol_policydb_t * policydb,
11			     unsigned int *response);
12
13/* Check if an interface exists */
14extern int sepol_iface_exists(sepol_handle_t * handle,
15			      const sepol_policydb_t * policydb,
16			      const sepol_iface_key_t * key, int *response);
17
18/* Query an interface - returns the interface,
19 * or NULL if not found */
20extern int sepol_iface_query(sepol_handle_t * handle,
21			     const sepol_policydb_t * policydb,
22			     const sepol_iface_key_t * key,
23			     sepol_iface_t ** response);
24
25/* Modify an interface, or add it, if the key
26 * is not found */
27extern int sepol_iface_modify(sepol_handle_t * handle,
28			      sepol_policydb_t * policydb,
29			      const sepol_iface_key_t * key,
30			      const sepol_iface_t * data);
31
32/* Iterate the interfaces
33 * The handler may return:
34 * -1 to signal an error condition,
35 * 1 to signal successful exit
36 * 0 to signal continue */
37
38extern int sepol_iface_iterate(sepol_handle_t * handle,
39			       const sepol_policydb_t * policydb,
40			       int (*fn) (const sepol_iface_t * iface,
41					  void *fn_arg), void *arg);
42
43#endif
44