Chris PeBenito 473ea7
/*
Chris PeBenito 473ea7
 * A security identifier table (sidtab) is a hash table
Chris PeBenito 473ea7
 * of security context structures indexed by SID value.
Chris PeBenito 473ea7
 */
Chris PeBenito 473ea7
#ifndef _SELINUX_AVC_SIDTAB_H_
Chris PeBenito 473ea7
#define _SELINUX_AVC_SIDTAB_H_
Chris PeBenito 473ea7
Chris PeBenito 473ea7
#include <selinux/selinux.h>
Chris PeBenito 473ea7
#include <selinux/avc.h>
Chris PeBenito 473ea7
#include "dso.h"
Chris PeBenito 473ea7
Chris PeBenito 473ea7
struct sidtab_node {
Chris PeBenito 473ea7
  struct security_id sid_s;
Chris PeBenito 473ea7
  struct sidtab_node *next;
Chris PeBenito 473ea7
};
Chris PeBenito 473ea7
Chris PeBenito 473ea7
#define SIDTAB_HASH_BITS 7
Chris PeBenito 473ea7
#define SIDTAB_HASH_BUCKETS (1 << SIDTAB_HASH_BITS)
Chris PeBenito 473ea7
#define SIDTAB_HASH_MASK (SIDTAB_HASH_BUCKETS-1)
Chris PeBenito 473ea7
#define SIDTAB_SIZE SIDTAB_HASH_BUCKETS
Chris PeBenito 473ea7
Chris PeBenito 473ea7
struct sidtab {
Chris PeBenito 473ea7
  struct sidtab_node **htable;
Chris PeBenito 473ea7
  unsigned nel;
Chris PeBenito 473ea7
};
Chris PeBenito 473ea7
Chris PeBenito 473ea7
int sidtab_init(struct sidtab *s) hidden;
Chris PeBenito 473ea7
int sidtab_insert(struct sidtab *s, security_context_t ctx) hidden;
Chris PeBenito 473ea7
void sidtab_remove(struct sidtab *s, security_id_t sid) hidden;
Chris PeBenito 473ea7
security_id_t sidtab_claim_sid(struct sidtab *s) hidden;
Chris PeBenito 473ea7
Chris PeBenito 473ea7
int sidtab_context_to_sid(struct sidtab *s,
Chris PeBenito 473ea7
			  security_context_t ctx,
Chris PeBenito 473ea7
			  security_id_t *sid) hidden;
Chris PeBenito 473ea7
Chris PeBenito 473ea7
void sidtab_sid_stats(struct sidtab *s, char *buf, int buflen) hidden;
Chris PeBenito 473ea7
void sidtab_destroy(struct sidtab *s) hidden;
Chris PeBenito 473ea7
Chris PeBenito 473ea7
#endif	/* _SELINUX_AVC_SIDTAB_H_ */