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