16cd6a6acSopenharmony_ci/* Author: Dan Walsh
26cd6a6acSopenharmony_ci   Based on selinuxswig_python.i by James Athey
36cd6a6acSopenharmony_ci */
46cd6a6acSopenharmony_ci
56cd6a6acSopenharmony_ci/* Never build rpm_execcon interface */
66cd6a6acSopenharmony_ci#ifndef DISABLE_RPM
76cd6a6acSopenharmony_ci#define DISABLE_RPM
86cd6a6acSopenharmony_ci#endif
96cd6a6acSopenharmony_ci
106cd6a6acSopenharmony_ci%module selinux
116cd6a6acSopenharmony_ci%{
126cd6a6acSopenharmony_ci	#include "selinux/selinux.h"
136cd6a6acSopenharmony_ci%}
146cd6a6acSopenharmony_ci
156cd6a6acSopenharmony_ci/* return a sid along with the result */
166cd6a6acSopenharmony_ci%typemap(argout) (security_id_t * sid) {
176cd6a6acSopenharmony_ci	if (*$1) {
186cd6a6acSopenharmony_ci                %append_output(SWIG_NewPointerObj(*$1, $descriptor(security_id_t), 0));
196cd6a6acSopenharmony_ci	}
206cd6a6acSopenharmony_ci}
216cd6a6acSopenharmony_ci
226cd6a6acSopenharmony_ci%typemap(in,numinputs=0) security_id_t *(security_id_t temp) {
236cd6a6acSopenharmony_ci  $1 = &temp;
246cd6a6acSopenharmony_ci}
256cd6a6acSopenharmony_ci
266cd6a6acSopenharmony_ci%typemap(in,noblock=1,numinputs=0) char ** (char * temp = 0) {
276cd6a6acSopenharmony_ci	$1 = &temp;
286cd6a6acSopenharmony_ci}
296cd6a6acSopenharmony_ci%typemap(freearg,match="in") char ** "";
306cd6a6acSopenharmony_ci%typemap(argout,noblock=1) char ** {
316cd6a6acSopenharmony_ci	if (*$1) {
326cd6a6acSopenharmony_ci		%append_output(SWIG_FromCharPtr(*$1));
336cd6a6acSopenharmony_ci		freecon(*$1);
346cd6a6acSopenharmony_ci	}
356cd6a6acSopenharmony_ci}
366cd6a6acSopenharmony_ci
376cd6a6acSopenharmony_ci%typemap(in,noblock=1,numinputs=0) char ** (char * temp = 0) {
386cd6a6acSopenharmony_ci	$1 = &temp;
396cd6a6acSopenharmony_ci}
406cd6a6acSopenharmony_ci%typemap(freearg,match="in") char ** "";
416cd6a6acSopenharmony_ci%typemap(argout,noblock=1) char ** {
426cd6a6acSopenharmony_ci	if (*$1) {
436cd6a6acSopenharmony_ci		%append_output(SWIG_FromCharPtr(*$1));
446cd6a6acSopenharmony_ci		free(*$1);
456cd6a6acSopenharmony_ci	}
466cd6a6acSopenharmony_ci}
476cd6a6acSopenharmony_ci
486cd6a6acSopenharmony_ci%include "selinuxswig.i"
49