2017-04-15 11:26:29 +00:00
|
|
|
/* sepolicy.h - Header for magiskpolicy non-public APIs
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SEPOLICY_H
|
|
|
|
#define _SEPOLICY_H
|
|
|
|
|
|
|
|
#include <sepol/policydb/policydb.h>
|
|
|
|
|
2018-11-08 09:20:16 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-07-20 21:12:22 +00:00
|
|
|
// Global policydb
|
|
|
|
extern policydb_t *policydb;
|
2017-04-15 11:26:29 +00:00
|
|
|
|
|
|
|
// hashtab traversal macro
|
|
|
|
#define hashtab_for_each(table, ptr) \
|
|
|
|
for (int _i = 0; _i < table->size; ++_i) \
|
|
|
|
for (*ptr = table->htable[_i]; *ptr != NULL; *ptr = (*ptr)->next)
|
|
|
|
|
|
|
|
// sepolicy manipulation functions
|
2018-11-29 11:28:37 +00:00
|
|
|
void for_each_avtab_node(void (*callback)(avtab_ptr_t));
|
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);
|
2018-11-08 09:20:16 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
};
|
|
|
|
#endif
|
2017-04-15 11:26:29 +00:00
|
|
|
|
|
|
|
#endif
|