context_record.h 1.6 KB

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