| 1 | |
| 2 | /* Author : Stephen Smalley, <[email protected]> */ |
| 3 | |
| 4 | /* FLASK */ |
| 5 | |
| 6 | /* |
| 7 | * A symbol table (symtab) maintains associations between symbol |
| 8 | * strings and datum values. The type of the datum values |
| 9 | * is arbitrary. The symbol table type is implemented |
| 10 | * using the hash table type (hashtab). |
| 11 | */ |
| 12 | |
| 13 | #ifndef _SEPOL_POLICYDB_SYMTAB_H_ |
| 14 | #define _SEPOL_POLICYDB_SYMTAB_H_ |
| 15 | |
| 16 | #include <sepol/policydb/hashtab.h> |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
| 22 | /* The symtab_datum struct stores the common information for |
| 23 | * all symtab datums. It should the first element in every |
| 24 | * struct that will be used in a symtab to allow the specific |
| 25 | * datum types to be freely cast to this type. |
| 26 | * |
| 27 | * The values start at 1 - 0 is never a valid value. |
| 28 | */ |
| 29 | typedef struct symtab_datum { |
| 30 | uint32_t value; |
| 31 | } symtab_datum_t; |
| 32 | |
| 33 | typedef struct { |
| 34 | hashtab_t table; /* hash table (keyed on a string) */ |
| 35 | uint32_t nprim; /* number of primary names in table */ |
| 36 | } symtab_t; |
| 37 | |
| 38 | extern int symtab_init(symtab_t *, unsigned int size); |
| 39 | extern void symtab_destroy(symtab_t *); |
| 40 | |
| 41 | #ifdef __cplusplus |
| 42 | } |
| 43 | #endif |
| 44 | |
| 45 | #endif /* _SYMTAB_H_ */ |
| 46 | |
| 47 | /* FLASK */ |