2019-07-01 02:09:31 +00:00
|
|
|
#pragma once
|
2017-04-15 11:26:29 +00:00
|
|
|
|
|
|
|
#include <sepol/policydb/policydb.h>
|
|
|
|
|
2019-07-01 02:09:31 +00:00
|
|
|
__BEGIN_DECLS
|
2018-11-08 09:20:16 +00:00
|
|
|
|
2018-07-20 21:12:22 +00:00
|
|
|
// Global policydb
|
|
|
|
extern policydb_t *policydb;
|
2017-04-15 11:26:29 +00:00
|
|
|
|
2018-12-01 08:53:58 +00:00
|
|
|
// General hash table traversal
|
|
|
|
#define hash_for_each(table, slots, tab, cur, block) \
|
|
|
|
for (int __i = 0; __i < (tab)->slots; ++__i) { \
|
|
|
|
__typeof__(cur) __next; \
|
|
|
|
for (cur = (tab)->table[__i]; cur; cur = __next) { \
|
|
|
|
__next = cur->next; \
|
|
|
|
block \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
|
|
|
|
// hashtab traversal
|
2019-11-19 07:04:47 +00:00
|
|
|
#define hashtab_for_each(hashtab, cur, block) \
|
|
|
|
hash_for_each(htable, size, hashtab, cur, block)
|
2018-12-01 08:53:58 +00:00
|
|
|
|
|
|
|
// avtab traversal
|
2019-11-19 07:04:47 +00:00
|
|
|
#define avtab_for_each(avtab, cur, block) \
|
|
|
|
hash_for_each(htable, nslot, avtab, cur, block)
|
2017-04-15 11:26:29 +00:00
|
|
|
|
2018-11-08 09:20:16 +00:00
|
|
|
int create_domain(const char *d);
|
|
|
|
int set_domain_state(const char *s, int state);
|
|
|
|
int add_typeattribute(const char *domainS, const char *attr);
|
|
|
|
int add_rule(const char *s, const char *t, const char *c, const char *p, int effect, int n);
|
|
|
|
int add_xperm_rule(const char *s, const char *t, const char *c, const char *range, int effect, int n);
|
2018-11-29 08:46:29 +00:00
|
|
|
int add_type_rule(const char *s, const char *t, const char *c, const char *d, int effect);
|
2019-11-19 07:04:47 +00:00
|
|
|
int add_filename_trans(const char *s, const char *t, const char *c, const char *d, const char *o);
|
2018-11-08 09:20:16 +00:00
|
|
|
|
2019-07-01 02:09:31 +00:00
|
|
|
__END_DECLS
|