1#ifndef _SELINUX_ANDROID_H_
2#define _SELINUX_ANDROID_H_
3
4#include <stdbool.h>
5#include <sys/types.h>
6#include <unistd.h>
7
8#include <selinux/label.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14extern struct selabel_handle* selinux_android_file_context_handle(void);
15
16extern struct selabel_handle* selinux_android_prop_context_handle(void);
17
18extern struct selabel_handle* selinux_android_service_context_handle(void);
19
20extern struct selabel_handle* selinux_android_hw_service_context_handle(void);
21
22extern struct selabel_handle* selinux_android_vendor_service_context_handle(void);
23
24extern void selinux_android_set_sehandle(const struct selabel_handle *hndl);
25
26extern int selinux_android_load_policy(void);
27
28extern int selinux_android_load_policy_from_fd(int fd, const char *description);
29
30extern int selinux_android_setcon(const char *con);
31
32extern int selinux_android_setcontext(uid_t uid,
33				      bool isSystemServer,
34				      const char *seinfo,
35				      const char *name);
36
37extern int selinux_android_setfilecon(const char *pkgdir,
38				       const char *pkgname,
39				       const char *seinfo,
40				       uid_t uid);
41
42extern int selinux_log_callback(int type, const char *fmt, ...)
43    __attribute__ ((format(printf, 2, 3)));
44
45#define SELINUX_ANDROID_RESTORECON_NOCHANGE 1
46#define SELINUX_ANDROID_RESTORECON_VERBOSE  2
47#define SELINUX_ANDROID_RESTORECON_RECURSE  4
48#define SELINUX_ANDROID_RESTORECON_FORCE    8
49#define SELINUX_ANDROID_RESTORECON_DATADATA 16
50#define SELINUX_ANDROID_RESTORECON_SKIPCE   32
51#define SELINUX_ANDROID_RESTORECON_CROSS_FILESYSTEMS   64
52extern int selinux_android_restorecon(const char *file, unsigned int flags);
53
54extern int selinux_android_restorecon_pkgdir(const char *pkgdir,
55                                             const char *seinfo,
56                                             uid_t uid,
57                                             unsigned int flags);
58
59extern int selinux_android_seapp_context_reload(void);
60
61#ifdef __cplusplus
62}
63#endif
64#endif
65