16cd6a6acSopenharmony_ci#ifndef _SEPOL_INTERNAL_CONTEXT_H_
26cd6a6acSopenharmony_ci#define _SEPOL_INTERNAL_CONTEXT_H_
36cd6a6acSopenharmony_ci
46cd6a6acSopenharmony_ci#include <stddef.h>
56cd6a6acSopenharmony_ci#include "context_internal.h"
66cd6a6acSopenharmony_ci#include <sepol/policydb/context.h>
76cd6a6acSopenharmony_ci#include <sepol/policydb/policydb.h>
86cd6a6acSopenharmony_ci#include <sepol/handle.h>
96cd6a6acSopenharmony_ci
106cd6a6acSopenharmony_ci/* Create a context structure from high level representation */
116cd6a6acSopenharmony_ciextern int context_from_record(sepol_handle_t * handle,
126cd6a6acSopenharmony_ci			       const policydb_t * policydb,
136cd6a6acSopenharmony_ci			       context_struct_t ** cptr,
146cd6a6acSopenharmony_ci			       const sepol_context_t * data);
156cd6a6acSopenharmony_ci
166cd6a6acSopenharmony_ciextern int context_to_record(sepol_handle_t * handle,
176cd6a6acSopenharmony_ci			     const policydb_t * policydb,
186cd6a6acSopenharmony_ci			     const context_struct_t * context,
196cd6a6acSopenharmony_ci			     sepol_context_t ** record);
206cd6a6acSopenharmony_ci
216cd6a6acSopenharmony_ci/* Create a context structure from string representation */
226cd6a6acSopenharmony_ciextern int context_from_string(sepol_handle_t * handle,
236cd6a6acSopenharmony_ci			       const policydb_t * policydb,
246cd6a6acSopenharmony_ci			       context_struct_t ** cptr,
256cd6a6acSopenharmony_ci			       const char *con_str, size_t con_str_len);
266cd6a6acSopenharmony_ci
276cd6a6acSopenharmony_ci/* Check if the provided context is valid for this policy */
286cd6a6acSopenharmony_ciextern int context_is_valid(const policydb_t * policydb,
296cd6a6acSopenharmony_ci			    const context_struct_t * context);
306cd6a6acSopenharmony_ci
316cd6a6acSopenharmony_ci/* Extract the context as string */
326cd6a6acSopenharmony_ciextern int context_to_string(sepol_handle_t * handle,
336cd6a6acSopenharmony_ci			     const policydb_t * policydb,
346cd6a6acSopenharmony_ci			     const context_struct_t * context,
356cd6a6acSopenharmony_ci			     char **result, size_t * result_len);
366cd6a6acSopenharmony_ci
376cd6a6acSopenharmony_ci#endif
38