• 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 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /* Return the number of ports */
13 extern int sepol_port_count(sepol_handle_t * handle,
14 			    const sepol_policydb_t * p, unsigned int *response);
15 
16 /* Check if a port exists */
17 extern int sepol_port_exists(sepol_handle_t * handle,
18 			     const sepol_policydb_t * policydb,
19 			     const sepol_port_key_t * key, int *response);
20 
21 /* Query a port - returns the port, or NULL if not found */
22 extern int sepol_port_query(sepol_handle_t * handle,
23 			    const sepol_policydb_t * policydb,
24 			    const sepol_port_key_t * key,
25 			    sepol_port_t ** response);
26 
27 /* Modify a port, or add it, if the key is not found */
28 extern int sepol_port_modify(sepol_handle_t * handle,
29 			     sepol_policydb_t * policydb,
30 			     const sepol_port_key_t * key,
31 			     const sepol_port_t * data);
32 
33 /* Iterate the ports
34  * The handler may return:
35  * -1 to signal an error condition,
36  * 1 to signal successful exit
37  * 0 to signal continue */
38 
39 extern int sepol_port_iterate(sepol_handle_t * handle,
40 			      const sepol_policydb_t * policydb,
41 			      int (*fn) (const sepol_port_t * port,
42 					 void *fn_arg), void *arg);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif
49