1/* Copyright (C) 2005 Red Hat, Inc. */
2
3#include <sepol/context_record.h>
4#include "handle.h"
5
6typedef sepol_context_t semanage_context_t;
7
8#define _SEMANAGE_CONTEXT_DEFINED_
9#include "context_internal.h"
10
11/* User */
12const char *semanage_context_get_user(const semanage_context_t * con)
13{
14
15	return sepol_context_get_user(con);
16}
17
18int semanage_context_set_user(semanage_handle_t * handle,
19			      semanage_context_t * con, const char *user)
20{
21
22	return sepol_context_set_user(handle->sepolh, con, user);
23}
24
25/* Role */
26const char *semanage_context_get_role(const semanage_context_t * con)
27{
28
29	return sepol_context_get_role(con);
30}
31
32int semanage_context_set_role(semanage_handle_t * handle,
33			      semanage_context_t * con, const char *role)
34{
35
36	return sepol_context_set_role(handle->sepolh, con, role);
37}
38
39/* Type */
40const char *semanage_context_get_type(const semanage_context_t * con)
41{
42
43	return sepol_context_get_type(con);
44}
45
46int semanage_context_set_type(semanage_handle_t * handle,
47			      semanage_context_t * con, const char *type)
48{
49
50	return sepol_context_set_type(handle->sepolh, con, type);
51}
52
53/* MLS */
54const char *semanage_context_get_mls(const semanage_context_t * con)
55{
56
57	return sepol_context_get_mls(con);
58}
59
60int semanage_context_set_mls(semanage_handle_t * handle,
61			     semanage_context_t * con, const char *mls_range)
62{
63
64	return sepol_context_set_mls(handle->sepolh, con, mls_range);
65}
66
67/* Create/Clone/Destroy */
68int semanage_context_create(semanage_handle_t * handle,
69			    semanage_context_t ** con_ptr)
70{
71
72	return sepol_context_create(handle->sepolh, con_ptr);
73}
74
75int semanage_context_clone(semanage_handle_t * handle,
76			   const semanage_context_t * con,
77			   semanage_context_t ** con_ptr)
78{
79
80	return sepol_context_clone(handle->sepolh, con, con_ptr);
81}
82
83hidden_def(semanage_context_clone)
84
85void semanage_context_free(semanage_context_t * con)
86{
87
88	sepol_context_free(con);
89}
90
91hidden_def(semanage_context_free)
92
93/* Parse to/from string */
94int semanage_context_from_string(semanage_handle_t * handle,
95				 const char *str, semanage_context_t ** con)
96{
97
98	return sepol_context_from_string(handle->sepolh, str, con);
99}
100
101hidden_def(semanage_context_from_string)
102
103int semanage_context_to_string(semanage_handle_t * handle,
104			       const semanage_context_t * con, char **str_ptr)
105{
106
107	return sepol_context_to_string(handle->sepolh, con, str_ptr);
108}
109
110hidden_def(semanage_context_to_string)
111