Home | History | Annotate | Download | only in selinux
      1 #ifndef _SELINUX_CONTEXT_H_
      2 #define _SELINUX_CONTEXT_H_
      3 
      4 #ifdef __cplusplus
      5 extern "C" {
      6 #endif
      7 
      8 /*
      9  * Functions to deal with security contexts in user space.
     10  */
     11 
     12 	typedef struct {
     13 		void *ptr;
     14 	} context_s_t;
     15 
     16 	typedef context_s_t *context_t;
     17 
     18 /* Return a new context initialized to a context string */
     19 
     20 	extern context_t context_new(const char *);
     21 
     22 /*
     23  * Return a pointer to the string value of the context_t
     24  * Valid until the next call to context_str or context_free
     25  * for the same context_t*
     26  */
     27 
     28 	extern char *context_str(context_t);
     29 
     30 /* Free the storage used by a context */
     31 	extern void context_free(context_t);
     32 
     33 /* Get a pointer to the string value of a context component */
     34 
     35 	extern const char *context_type_get(context_t);
     36 	extern const char *context_range_get(context_t);
     37 	extern const char *context_role_get(context_t);
     38 	extern const char *context_user_get(context_t);
     39 
     40 /* Set a context component.  Returns nonzero if unsuccessful */
     41 
     42 	extern int context_type_set(context_t, const char *);
     43 	extern int context_range_set(context_t, const char *);
     44 	extern int context_role_set(context_t, const char *);
     45 	extern int context_user_set(context_t, const char *);
     46 
     47 #ifdef __cplusplus
     48 }
     49 #endif
     50 #endif
     51