Home | History | Annotate | Download | only in src
      1 /* Author: Dan Walsh
      2    Based on selinuxswig_python.i by James Athey
      3  */
      4 
      5 %module selinux
      6 %{
      7 	#include "selinux/selinux.h"
      8 %}
      9 
     10 /* return a sid along with the result */
     11 %typemap(argout) (security_id_t * sid) {
     12 	if (*$1) {
     13                 %append_output(SWIG_NewPointerObj(*$1, $descriptor(security_id_t), 0));
     14 	}
     15 }
     16 
     17 %typemap(in,numinputs=0) security_id_t *(security_id_t temp) {
     18   $1 = &temp;
     19 }
     20 
     21 %typemap(in,noblock=1,numinputs=0) char ** (char * temp = 0) {
     22 	$1 = &temp;
     23 }
     24 %typemap(freearg,match="in") char ** "";
     25 %typemap(argout,noblock=1) char ** {
     26 	if (*$1) {
     27 		%append_output(SWIG_FromCharPtr(*$1));
     28 		freecon(*$1);
     29 	}
     30 }
     31 
     32 %typemap(in,noblock=1,numinputs=0) char ** (char * temp = 0) {
     33 	$1 = &temp;
     34 }
     35 %typemap(freearg,match="in") char ** "";
     36 %typemap(argout,noblock=1) char ** {
     37 	if (*$1) {
     38 		%append_output(SWIG_FromCharPtr(*$1));
     39 		free(*$1);
     40 	}
     41 }
     42 
     43 %typemap(freearg,match="in") char * const [] {
     44 	int i = 0;
     45 	while($1[i]) {
     46 		free($1[i]);
     47 		i++;
     48 	}
     49 	free($1);
     50 }
     51 
     52 %include "selinuxswig.i"
     53