1 /************************************************************
2 
3 Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
4 
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 this permission notice appear in supporting documentation.  This permission
8 notice shall be included in all copies or substantial portions of the
9 Software.
10 
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
14 AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
15 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 
18 ********************************************************/
19 
20 #ifndef _XSELINUX_H
21 #define _XSELINUX_H
22 
23 /* Extension info */
24 #define SELINUX_EXTENSION_NAME		"SELinux"
25 #define SELINUX_MAJOR_VERSION		1
26 #define SELINUX_MINOR_VERSION		1
27 #define SELinuxNumberEvents		0
28 #define SELinuxNumberErrors		0
29 
30 /* Extension protocol */
31 #define X_SELinuxQueryVersion			0
32 #define X_SELinuxSetDeviceCreateContext		1
33 #define X_SELinuxGetDeviceCreateContext		2
34 #define X_SELinuxSetDeviceContext		3
35 #define X_SELinuxGetDeviceContext		4
36 #define X_SELinuxSetDrawableCreateContext	5
37 #define X_SELinuxGetDrawableCreateContext	6
38 #define X_SELinuxGetDrawableContext		7
39 #define X_SELinuxSetPropertyCreateContext	8
40 #define X_SELinuxGetPropertyCreateContext	9
41 #define X_SELinuxSetPropertyUseContext		10
42 #define X_SELinuxGetPropertyUseContext		11
43 #define X_SELinuxGetPropertyContext		12
44 #define X_SELinuxGetPropertyDataContext		13
45 #define X_SELinuxListProperties			14
46 #define X_SELinuxSetSelectionCreateContext	15
47 #define X_SELinuxGetSelectionCreateContext	16
48 #define X_SELinuxSetSelectionUseContext		17
49 #define X_SELinuxGetSelectionUseContext		18
50 #define X_SELinuxGetSelectionContext		19
51 #define X_SELinuxGetSelectionDataContext	20
52 #define X_SELinuxListSelections			21
53 #define X_SELinuxGetClientContext		22
54 
55 typedef struct {
56     CARD8 reqType;
57     CARD8 SELinuxReqType;
58     CARD16 length;
59     CARD8 client_major;
60     CARD8 client_minor;
61 } SELinuxQueryVersionReq;
62 
63 typedef struct {
64     CARD8 type;
65     CARD8 pad1;
66     CARD16 sequenceNumber;
67     CARD32 length;
68     CARD16 server_major;
69     CARD16 server_minor;
70     CARD32 pad2;
71     CARD32 pad3;
72     CARD32 pad4;
73     CARD32 pad5;
74     CARD32 pad6;
75 } SELinuxQueryVersionReply;
76 
77 typedef struct {
78     CARD8 reqType;
79     CARD8 SELinuxReqType;
80     CARD16 length;
81     CARD32 context_len;
82 } SELinuxSetCreateContextReq;
83 
84 typedef struct {
85     CARD8 reqType;
86     CARD8 SELinuxReqType;
87     CARD16 length;
88 } SELinuxGetCreateContextReq;
89 
90 typedef struct {
91     CARD8 reqType;
92     CARD8 SELinuxReqType;
93     CARD16 length;
94     CARD32 id;
95     CARD32 context_len;
96 } SELinuxSetContextReq;
97 
98 typedef struct {
99     CARD8 reqType;
100     CARD8 SELinuxReqType;
101     CARD16 length;
102     CARD32 id;
103 } SELinuxGetContextReq;
104 
105 typedef struct {
106     CARD8 reqType;
107     CARD8 SELinuxReqType;
108     CARD16 length;
109     CARD32 window;
110     CARD32 property;
111 } SELinuxGetPropertyContextReq;
112 
113 typedef struct {
114     CARD8 type;
115     CARD8 pad1;
116     CARD16 sequenceNumber;
117     CARD32 length;
118     CARD32 context_len;
119     CARD32 pad2;
120     CARD32 pad3;
121     CARD32 pad4;
122     CARD32 pad5;
123     CARD32 pad6;
124 } SELinuxGetContextReply;
125 
126 typedef struct {
127     CARD8 type;
128     CARD8 pad1;
129     CARD16 sequenceNumber;
130     CARD32 length;
131     CARD32 count;
132     CARD32 pad2;
133     CARD32 pad3;
134     CARD32 pad4;
135     CARD32 pad5;
136     CARD32 pad6;
137 } SELinuxListItemsReply;
138 
139 #endif                          /* _XSELINUX_H */
140