• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _SEPOL_INTERNAL_CONTEXT_H_
2 #define _SEPOL_INTERNAL_CONTEXT_H_
3 
4 #include <stddef.h>
5 #include "context_internal.h"
6 #include <sepol/policydb/context.h>
7 #include <sepol/policydb/policydb.h>
8 #include <sepol/handle.h>
9 
10 /* Create a context structure from high level representation */
11 extern int context_from_record(sepol_handle_t * handle,
12 			       const policydb_t * policydb,
13 			       context_struct_t ** cptr,
14 			       const sepol_context_t * data);
15 
16 extern int context_to_record(sepol_handle_t * handle,
17 			     const policydb_t * policydb,
18 			     const context_struct_t * context,
19 			     sepol_context_t ** record);
20 
21 /* Create a context structure from string representation */
22 extern int context_from_string(sepol_handle_t * handle,
23 			       const policydb_t * policydb,
24 			       context_struct_t ** cptr,
25 			       const char *con_str, size_t con_str_len);
26 
27 /* Check if the provided context is valid for this policy */
28 extern int context_is_valid(const policydb_t * policydb,
29 			    const context_struct_t * context);
30 
31 /* Extract the context as string */
32 extern int context_to_string(sepol_handle_t * handle,
33 			     const policydb_t * policydb,
34 			     const context_struct_t * context,
35 			     char **result, size_t * result_len);
36 
37 #endif
38