16cd6a6acSopenharmony_ci/*
26cd6a6acSopenharmony_ci * A security identifier table (sidtab) is a hash table
36cd6a6acSopenharmony_ci * of security context structures indexed by SID value.
46cd6a6acSopenharmony_ci */
56cd6a6acSopenharmony_ci#ifndef _SELINUX_AVC_SIDTAB_H_
66cd6a6acSopenharmony_ci#define _SELINUX_AVC_SIDTAB_H_
76cd6a6acSopenharmony_ci
86cd6a6acSopenharmony_ci#include <selinux/selinux.h>
96cd6a6acSopenharmony_ci#include <selinux/avc.h>
106cd6a6acSopenharmony_ci
116cd6a6acSopenharmony_cistruct sidtab_node {
126cd6a6acSopenharmony_ci	struct security_id sid_s;
136cd6a6acSopenharmony_ci	struct sidtab_node *next;
146cd6a6acSopenharmony_ci};
156cd6a6acSopenharmony_ci
166cd6a6acSopenharmony_ci#define SIDTAB_HASH_BITS 7
176cd6a6acSopenharmony_ci#define SIDTAB_HASH_BUCKETS (1 << SIDTAB_HASH_BITS)
186cd6a6acSopenharmony_ci#define SIDTAB_HASH_MASK (SIDTAB_HASH_BUCKETS-1)
196cd6a6acSopenharmony_ci#define SIDTAB_SIZE SIDTAB_HASH_BUCKETS
206cd6a6acSopenharmony_ci
216cd6a6acSopenharmony_cistruct sidtab {
226cd6a6acSopenharmony_ci	struct sidtab_node **htable;
236cd6a6acSopenharmony_ci	unsigned nel;
246cd6a6acSopenharmony_ci};
256cd6a6acSopenharmony_ci
266cd6a6acSopenharmony_ciint sidtab_init(struct sidtab *s) ;
276cd6a6acSopenharmony_ciint sidtab_insert(struct sidtab *s, const char * ctx) ;
286cd6a6acSopenharmony_ci
296cd6a6acSopenharmony_ciint sidtab_context_to_sid(struct sidtab *s,
306cd6a6acSopenharmony_ci			  const char * ctx, security_id_t * sid) ;
316cd6a6acSopenharmony_ci
326cd6a6acSopenharmony_civoid sidtab_sid_stats(struct sidtab *s, char *buf, int buflen) ;
336cd6a6acSopenharmony_civoid sidtab_destroy(struct sidtab *s) ;
346cd6a6acSopenharmony_ci
356cd6a6acSopenharmony_ci#endif				/* _SELINUX_AVC_SIDTAB_H_ */
36