16cd6a6acSopenharmony_ci#ifndef _SEPOL_IBENDPORTS_H_
26cd6a6acSopenharmony_ci#define _SEPOL_IBENDPORTS_H_
36cd6a6acSopenharmony_ci
46cd6a6acSopenharmony_ci#include <sepol/handle.h>
56cd6a6acSopenharmony_ci#include <sepol/policydb.h>
66cd6a6acSopenharmony_ci#include <sepol/ibendport_record.h>
76cd6a6acSopenharmony_ci
86cd6a6acSopenharmony_ci#ifdef __cplusplus
96cd6a6acSopenharmony_ciextern "C" {
106cd6a6acSopenharmony_ci#endif
116cd6a6acSopenharmony_ci
126cd6a6acSopenharmony_ci/* Return the number of ibendports */
136cd6a6acSopenharmony_ciextern int sepol_ibendport_count(sepol_handle_t *handle,
146cd6a6acSopenharmony_ci				 const sepol_policydb_t *p,
156cd6a6acSopenharmony_ci				 unsigned int *response);
166cd6a6acSopenharmony_ci
176cd6a6acSopenharmony_ci/* Check if a ibendport exists */
186cd6a6acSopenharmony_ciextern int sepol_ibendport_exists(sepol_handle_t *handle,
196cd6a6acSopenharmony_ci				  const sepol_policydb_t *policydb,
206cd6a6acSopenharmony_ci				  const sepol_ibendport_key_t *key, int *response);
216cd6a6acSopenharmony_ci
226cd6a6acSopenharmony_ci/* Query a ibendport - returns the ibendport, or NULL if not found */
236cd6a6acSopenharmony_ciextern int sepol_ibendport_query(sepol_handle_t *handle,
246cd6a6acSopenharmony_ci				 const sepol_policydb_t *policydb,
256cd6a6acSopenharmony_ci				 const sepol_ibendport_key_t *key,
266cd6a6acSopenharmony_ci				 sepol_ibendport_t **response);
276cd6a6acSopenharmony_ci
286cd6a6acSopenharmony_ci/* Modify a ibendport, or add it, if the key is not found */
296cd6a6acSopenharmony_ciextern int sepol_ibendport_modify(sepol_handle_t *handle,
306cd6a6acSopenharmony_ci				  sepol_policydb_t *policydb,
316cd6a6acSopenharmony_ci				  const sepol_ibendport_key_t *key,
326cd6a6acSopenharmony_ci				  const sepol_ibendport_t *data);
336cd6a6acSopenharmony_ci
346cd6a6acSopenharmony_ci/* Iterate the ibendports
356cd6a6acSopenharmony_ci * The handler may return:
366cd6a6acSopenharmony_ci * -1 to signal an error condition,
376cd6a6acSopenharmony_ci * 1 to signal successful exit
386cd6a6acSopenharmony_ci * 0 to signal continue
396cd6a6acSopenharmony_ci */
406cd6a6acSopenharmony_ciextern int sepol_ibendport_iterate(sepol_handle_t *handle,
416cd6a6acSopenharmony_ci				   const sepol_policydb_t *policydb,
426cd6a6acSopenharmony_ci				   int (*fn)(const sepol_ibendport_t *ibendport,
436cd6a6acSopenharmony_ci					     void *fn_arg), void *arg);
446cd6a6acSopenharmony_ci
456cd6a6acSopenharmony_ci
466cd6a6acSopenharmony_ci#ifdef __cplusplus
476cd6a6acSopenharmony_ci}
486cd6a6acSopenharmony_ci#endif
496cd6a6acSopenharmony_ci
506cd6a6acSopenharmony_ci#endif
51