| 1 |
#ifndef _SEPOL_CONTEXT_RECORD_H_ |
| 2 |
#define _SEPOL_CONTEXT_RECORD_H_ |
| 3 |
|
| 4 |
#include <sepol/handle.h> |
| 5 |
|
| 6 |
#ifdef __cplusplus |
| 7 |
extern "C" { |
| 8 |
#endif |
| 9 |
|
| 10 |
struct sepol_context; |
| 11 |
typedef struct sepol_context sepol_context_t; |
| 12 |
|
| 13 |
/* We don't need a key, because the context is never stored |
| 14 |
* in a data collection by itself */ |
| 15 |
|
| 16 |
/* User */ |
| 17 |
extern const char *sepol_context_get_user(const sepol_context_t * con); |
| 18 |
|
| 19 |
extern int sepol_context_set_user(sepol_handle_t * handle, |
| 20 |
sepol_context_t * con, const char *user); |
| 21 |
|
| 22 |
/* Role */ |
| 23 |
extern const char *sepol_context_get_role(const sepol_context_t * con); |
| 24 |
|
| 25 |
extern int sepol_context_set_role(sepol_handle_t * handle, |
| 26 |
sepol_context_t * con, const char *role); |
| 27 |
|
| 28 |
/* Type */ |
| 29 |
extern const char *sepol_context_get_type(const sepol_context_t * con); |
| 30 |
|
| 31 |
extern int sepol_context_set_type(sepol_handle_t * handle, |
| 32 |
sepol_context_t * con, const char *type); |
| 33 |
|
| 34 |
/* MLS */ |
| 35 |
extern const char *sepol_context_get_mls(const sepol_context_t * con); |
| 36 |
|
| 37 |
extern int sepol_context_set_mls(sepol_handle_t * handle, |
| 38 |
sepol_context_t * con, const char *mls_range); |
| 39 |
|
| 40 |
/* Create/Clone/Destroy */ |
| 41 |
extern int sepol_context_create(sepol_handle_t * handle, |
| 42 |
sepol_context_t ** con_ptr); |
| 43 |
|
| 44 |
extern int sepol_context_clone(sepol_handle_t * handle, |
| 45 |
const sepol_context_t * con, |
| 46 |
sepol_context_t ** con_ptr); |
| 47 |
|
| 48 |
extern void sepol_context_free(sepol_context_t * con); |
| 49 |
|
| 50 |
/* Parse to/from string */ |
| 51 |
extern int sepol_context_from_string(sepol_handle_t * handle, |
| 52 |
const char *str, sepol_context_t ** con); |
| 53 |
|
| 54 |
extern int sepol_context_to_string(sepol_handle_t * handle, |
| 55 |
const sepol_context_t * con, char **str_ptr); |
| 56 |
|
| 57 |
#ifdef __cplusplus |
| 58 |
} |
| 59 |
#endif |
| 60 |
|
| 61 |
#endif |