blob: dbdb4c3d72d47d5e36fbd53714bd09863a32a564 [file] [log] [blame]
Joshua Brindle13cd4c82008-08-19 15:30:36 -04001/* Authors: Dan Walsh
2 * James Athey
3 */
4
5%module selinux
6%{
Joshua Brindle13cd4c82008-08-19 15:30:36 -04007 #include "../include/selinux/avc.h"
Daniel J Walsh66d07602009-09-16 16:58:12 -04008 #include "../include/selinux/context.h"
Joshua Brindle13cd4c82008-08-19 15:30:36 -04009 #include "../include/selinux/get_context_list.h"
Daniel J Walsh66d07602009-09-16 16:58:12 -040010 #include "../include/selinux/get_default_type.h"
11 #include "../include/selinux/label.h"
Petr Lautrbach0399ec62016-12-22 13:43:08 +010012 #include "../include/selinux/restorecon.h"
Daniel J Walsh66d07602009-09-16 16:58:12 -040013 #include "../include/selinux/selinux.h"
Joshua Brindle13cd4c82008-08-19 15:30:36 -040014%}
15%apply int *OUTPUT { int *enforce };
16%apply int *OUTPUT { size_t * };
17
18%typedef unsigned mode_t;
19%typedef unsigned pid_t;
20
Nicolas Ioossded385d2017-02-27 21:39:35 +010021%typemap(in, numinputs=0) (char ***names, int *len) (char **temp1=NULL, int temp2) {
Joshua Brindle13cd4c82008-08-19 15:30:36 -040022 $1 = &temp1;
23 $2 = &temp2;
24}
25
26%typemap(freearg) (char ***names, int *len) {
27 int i;
28 if (*$1) {
29 for (i = 0; i < *$2; i++) {
30 free((*$1)[i]);
31 }
32 free(*$1);
33 }
34}
35
Nicolas Ioossded385d2017-02-27 21:39:35 +010036%typemap(in, numinputs=0) (char ***) (char **temp=NULL) {
Joshua Brindle13cd4c82008-08-19 15:30:36 -040037 $1 = &temp;
38}
39
Stephen Smalley9eb9c932014-02-19 09:16:17 -050040%typemap(freearg) (char ***) {
Joshua Brindle13cd4c82008-08-19 15:30:36 -040041 if (*$1) freeconary(*$1);
42}
43
44/* Ignore functions that don't make sense when wrapped */
45%ignore freecon;
46%ignore freeconary;
47
48/* Ignore functions that take a function pointer as an argument */
49%ignore set_matchpathcon_printf;
50%ignore set_matchpathcon_invalidcon;
51%ignore set_matchpathcon_canoncon;
52
53%ignore avc_add_callback;
54
Eamon Walsh7ab6b292009-03-10 20:31:38 -040055/* Ignore netlink stuff for now */
56%ignore avc_netlink_acquire_fd;
57%ignore avc_netlink_release_fd;
58%ignore avc_netlink_check_nb;
59
Joshua Brindle13cd4c82008-08-19 15:30:36 -040060%include "../include/selinux/avc.h"
Daniel J Walsh66d07602009-09-16 16:58:12 -040061%include "../include/selinux/context.h"
Joshua Brindle13cd4c82008-08-19 15:30:36 -040062%include "../include/selinux/get_context_list.h"
Daniel J Walsh66d07602009-09-16 16:58:12 -040063%include "../include/selinux/get_default_type.h"
64%include "../include/selinux/label.h"
Petr Lautrbach0399ec62016-12-22 13:43:08 +010065%include "../include/selinux/restorecon.h"
Daniel J Walsh66d07602009-09-16 16:58:12 -040066%include "../include/selinux/selinux.h"