Home | History | Annotate | Download | only in src
      1 /*
      2  * A security identifier table (sidtab) is a hash table
      3  * of security context structures indexed by SID value.
      4  */
      5 #ifndef _SELINUX_AVC_SIDTAB_H_
      6 #define _SELINUX_AVC_SIDTAB_H_
      7 
      8 #include <selinux/selinux.h>
      9 #include <selinux/avc.h>
     10 #include "dso.h"
     11 
     12 struct sidtab_node {
     13 	struct security_id sid_s;
     14 	struct sidtab_node *next;
     15 };
     16 
     17 #define SIDTAB_HASH_BITS 7
     18 #define SIDTAB_HASH_BUCKETS (1 << SIDTAB_HASH_BITS)
     19 #define SIDTAB_HASH_MASK (SIDTAB_HASH_BUCKETS-1)
     20 #define SIDTAB_SIZE SIDTAB_HASH_BUCKETS
     21 
     22 struct sidtab {
     23 	struct sidtab_node **htable;
     24 	unsigned nel;
     25 };
     26 
     27 int sidtab_init(struct sidtab *s) hidden;
     28 int sidtab_insert(struct sidtab *s, const char * ctx) hidden;
     29 
     30 int sidtab_context_to_sid(struct sidtab *s,
     31 			  const char * ctx, security_id_t * sid) hidden;
     32 
     33 void sidtab_sid_stats(struct sidtab *s, char *buf, int buflen) hidden;
     34 void sidtab_destroy(struct sidtab *s) hidden;
     35 
     36 #endif				/* _SELINUX_AVC_SIDTAB_H_ */
     37