ports.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _SEPOL_PORTS_H_
  2. #define _SEPOL_PORTS_H_
  3. #include <sepol/handle.h>
  4. #include <sepol/policydb.h>
  5. #include <sepol/port_record.h>
  6. /* Return the number of ports */
  7. extern int sepol_port_count(sepol_handle_t * handle,
  8. const sepol_policydb_t * p, unsigned int *response);
  9. /* Check if a port exists */
  10. extern int sepol_port_exists(sepol_handle_t * handle,
  11. const sepol_policydb_t * policydb,
  12. const sepol_port_key_t * key, int *response);
  13. /* Query a port - returns the port, or NULL if not found */
  14. extern int sepol_port_query(sepol_handle_t * handle,
  15. const sepol_policydb_t * policydb,
  16. const sepol_port_key_t * key,
  17. sepol_port_t ** response);
  18. /* Modify a port, or add it, if the key is not found */
  19. extern int sepol_port_modify(sepol_handle_t * handle,
  20. sepol_policydb_t * policydb,
  21. const sepol_port_key_t * key,
  22. const sepol_port_t * data);
  23. /* Iterate the ports
  24. * The handler may return:
  25. * -1 to signal an error condition,
  26. * 1 to signal successful exit
  27. * 0 to signal continue */
  28. extern int sepol_port_iterate(sepol_handle_t * handle,
  29. const sepol_policydb_t * policydb,
  30. int (*fn) (const sepol_port_t * port,
  31. void *fn_arg), void *arg);
  32. #endif