• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _SEPOL_PORTS_H_
2 #define _SEPOL_PORTS_H_
3 
4 #include <sepol/handle.h>
5 #include <sepol/policydb.h>
6 #include <sepol/port_record.h>
7 #include <sys/cdefs.h>
8 
9 __BEGIN_DECLS
10 
11 /* Return the number of ports */
12 extern int sepol_port_count(sepol_handle_t * handle,
13 			    const sepol_policydb_t * p, unsigned int *response);
14 
15 /* Check if a port exists */
16 extern int sepol_port_exists(sepol_handle_t * handle,
17 			     const sepol_policydb_t * policydb,
18 			     const sepol_port_key_t * key, int *response);
19 
20 /* Query a port - returns the port, or NULL if not found */
21 extern int sepol_port_query(sepol_handle_t * handle,
22 			    const sepol_policydb_t * policydb,
23 			    const sepol_port_key_t * key,
24 			    sepol_port_t ** response);
25 
26 /* Modify a port, or add it, if the key is not found */
27 extern int sepol_port_modify(sepol_handle_t * handle,
28 			     sepol_policydb_t * policydb,
29 			     const sepol_port_key_t * key,
30 			     const sepol_port_t * data);
31 
32 /* Iterate the ports
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_port_iterate(sepol_handle_t * handle,
39 			      const sepol_policydb_t * policydb,
40 			      int (*fn) (const sepol_port_t * port,
41 					 void *fn_arg), void *arg);
42 
43 __END_DECLS
44 #endif
45