• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Author Dave Quigley
2  * based on semanageswig_python.i by Spencer Shimko
3  */
4 
5 %header %{
6         #include <stdlib.h>
7         #include <semanage/semanage.h>
8 
9         #define STATUS_SUCCESS 0
10         #define STATUS_ERR -1
11 %}
12 /* a few helpful typemaps are available in this library */
13 %include <typemaps.i>
14 
15 /* wrap all int*'s so they can be used for results
16    if it becomes necessary to send in data this should be changed to INOUT */
17 %apply int *OUTPUT { int * };
18 %apply int *OUTPUT { size_t * };
19 %apply int *OUTPUT { unsigned int * };
20 
21 %typemap(in, numinputs=0) char **(char *temp=NULL) {
22         $1 = &temp;
23 }
24 
25 %typemap(argout) char** {
26         %append_output(SWIG_FromCharPtr(*$1));
27         free(*$1);
28 }
29 
30 %typemap(in, numinputs=0) char ***(char **temp=NULL) {
31         $1 = &temp;
32 }
33 
34 /* the wrapper will setup this parameter for passing... the resulting ruby functions
35    will not take the semanage_module_info_t ** parameter */
36 %typemap(in, numinputs=0) semanage_module_info_t **(semanage_module_info_t *temp=NULL) {
37         $1 = &temp;
38 }
39 
40 %typemap(argout) semanage_module_info_t ** {
41         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
42 }
43 
44 /** context typemaps **/
45 
46 /* the wrapper will setup this parameter for passing... the resulting python functions
47    will not take the semanage_context_t ** parameter */
48 %typemap(in, numinputs=0) semanage_context_t **(semanage_context_t *temp=NULL) {
49         $1 = &temp;
50 }
51 
52 %typemap(argout) semanage_context_t** {
53         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
54 }
55 
56 /** boolean typemaps **/
57 
58 /* the wrapper will setup this parameter for passing... the resulting python functions
59    will not take the semanage_bool_t *** parameter */
60 %typemap(in, numinputs=0) semanage_bool_t ***(semanage_bool_t **temp=NULL) {
61         $1 = &temp;
62 }
63 
64 %typemap(in, numinputs=0) semanage_bool_t **(semanage_bool_t *temp=NULL) {
65         $1 = &temp;
66 }
67 
68 %typemap(argout) semanage_bool_t ** {
69         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
70 }
71 
72 %typemap(argout) semanage_bool_key_t ** {
73         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
74 }
75 
76 %typemap(in, numinputs=0) semanage_bool_key_t **(semanage_bool_key_t *temp=NULL) {
77         $1 = &temp;
78 }
79 
80 /** fcontext typemaps **/
81 
82 /* the wrapper will setup this parameter for passing... the resulting python functions
83    will not take the semanage_fcontext_t *** parameter */
84 %typemap(in, numinputs=0) semanage_fcontext_t ***(semanage_fcontext_t **temp=NULL) {
85         $1 = &temp;
86 }
87 
88 %typemap(in, numinputs=0) semanage_fcontext_t **(semanage_fcontext_t *temp=NULL) {
89         $1 = &temp;
90 }
91 
92 %typemap(argout) semanage_fcontext_t ** {
93         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
94 }
95 
96 %typemap(argout) semanage_fcontext_key_t ** {
97         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
98 }
99 
100 %typemap(in, numinputs=0) semanage_fcontext_key_t **(semanage_fcontext_key_t *temp=NULL) {
101         $1 = &temp;
102 }
103 
104 /** interface typemaps **/
105 
106 /* the wrapper will setup this parameter for passing... the resulting python functions
107    will not take the semanage_iface_t *** parameter */
108 %typemap(in, numinputs=0) semanage_iface_t ***(semanage_iface_t **temp=NULL) {
109         $1 = &temp;
110 }
111 
112 %typemap(in, numinputs=0) semanage_iface_t **(semanage_iface_t *temp=NULL) {
113         $1 = &temp;
114 }
115 
116 %typemap(argout) semanage_iface_t ** {
117         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
118 }
119 
120 %typemap(argout) semanage_iface_key_t ** {
121         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
122 }
123 
124 %typemap(in, numinputs=0) semanage_iface_key_t **(semanage_iface_key_t *temp=NULL) {
125         $1 = &temp;
126 }
127 
128 /** seuser typemaps **/
129 
130 /* the wrapper will setup this parameter for passing... the resulting python functions
131    will not take the semanage_seuser_t *** parameter */
132 %typemap(in, numinputs=0) semanage_seuser_t ***(semanage_seuser_t **temp=NULL) {
133         $1 = &temp;
134 }
135 
136 %typemap(in, numinputs=0) semanage_seuser_t **(semanage_seuser_t *temp=NULL) {
137         $1 = &temp;
138 }
139 
140 %typemap(argout) semanage_seuser_t ** {
141         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
142 }
143 
144 %typemap(argout) semanage_seuser_key_t ** {
145         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
146 }
147 
148 %typemap(in, numinputs=0) semanage_seuser_key_t **(semanage_seuser_key_t *temp=NULL) {
149         $1 = &temp;
150 }
151 
152 /** user typemaps **/
153 
154 /* the wrapper will setup this parameter for passing... the resulting python functions
155    will not take the semanage_user_t *** parameter */
156 %typemap(in, numinputs=0) semanage_user_t ***(semanage_user_t **temp=NULL) {
157         $1 = &temp;
158 }
159 
160 %typemap(in, numinputs=0) semanage_user_t **(semanage_user_t *temp=NULL) {
161         $1 = &temp;
162 }
163 
164 %typemap(argout) semanage_user_t ** {
165         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
166 }
167 
168 %typemap(argout) semanage_user_key_t ** {
169         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
170 }
171 
172 %typemap(in, numinputs=0) semanage_user_key_t **(semanage_user_key_t *temp=NULL) {
173         $1 = &temp;
174 }
175 
176 /** port typemaps **/
177 
178 /* the wrapper will setup this parameter for passing... the resulting python functions
179    will not take the semanage_port_t *** parameter */
180 %typemap(in, numinputs=0) semanage_port_t ***(semanage_port_t **temp=NULL) {
181         $1 = &temp;
182 }
183 
184 %typemap(in, numinputs=0) semanage_port_t **(semanage_port_t *temp=NULL) {
185         $1 = &temp;
186 }
187 
188 %typemap(argout) semanage_port_t ** {
189         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
190 }
191 
192 %typemap(argout) semanage_port_key_t ** {
193         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
194 }
195 
196 %typemap(in, numinputs=0) semanage_port_key_t **(semanage_port_key_t *temp=NULL) {
197         $1 = &temp;
198 }
199 
200 /** node typemaps **/
201 
202 /* the wrapper will setup this parameter for passing... the resulting python functions
203    will not take the semanage_node_t *** parameter */
204 %typemap(in, numinputs=0) semanage_node_t ***(semanage_node_t **temp=NULL) {
205         $1 = &temp;
206 }
207 
208 %typemap(in, numinputs=0) semanage_node_t **(semanage_node_t *temp=NULL) {
209         $1 = &temp;
210 }
211 
212 %typemap(argout) semanage_node_t ** {
213         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
214 }
215 
216 
217 %typemap(argout) semanage_node_key_t ** {
218         $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
219 }
220 
221 %typemap(in, numinputs=0) semanage_node_key_t **(semanage_node_key_t *temp=NULL) {
222         $1 = &temp;
223 }
224 
225 %include "semanageswig.i"
226