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