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