/**************************************************************************/ /* */ /* The X_SELinux function headers for the Notebook X-Windows demos. */ /* */ /* Copyright (C) 2010 Richard Haines */ /* */ /* Note that the X_SELinux function Request and Reply structure */ /* definitions have been taken from the XSELinux object manager source. */ /* */ /* This program is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation, either version 3 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program. If not, see . */ /* */ /**************************************************************************/ /* Extension protocol IDs (struct entry for req->SELinuxReqType) */ #define X_SELinuxQueryVersion 0 #define X_SELinuxSetDeviceCreateContext 1 #define X_SELinuxGetDeviceCreateContext 2 #define X_SELinuxSetDeviceContext 3 #define X_SELinuxGetDeviceContext 4 #define X_SELinuxSetWindowCreateContext 5 #define X_SELinuxGetWindowCreateContext 6 #define X_SELinuxGetWindowContext 7 #define X_SELinuxSetPropertyCreateContext 8 #define X_SELinuxGetPropertyCreateContext 9 #define X_SELinuxSetPropertyUseContext 10 #define X_SELinuxGetPropertyUseContext 11 #define X_SELinuxGetPropertyContext 12 #define X_SELinuxGetPropertyDataContext 13 #define X_SELinuxListProperties 14 #define X_SELinuxSetSelectionCreateContext 15 #define X_SELinuxGetSelectionCreateContext 16 #define X_SELinuxSetSelectionUseContext 17 #define X_SELinuxGetSelectionUseContext 18 #define X_SELinuxGetSelectionContext 19 #define X_SELinuxGetSelectionDataContext 20 #define X_SELinuxListSelections 21 #define X_SELinuxGetClientContext 22 /**************************************************************************/ /* Define SELinux structures for Extension requests & responses and the */ /* structure sizes (used by the SIZEOF macro in Xmd.h) */ /**************************************************************************/ // The structure defined in the XSELinux Object Manager // source (./Xext/xselinux.h) seems wrong as this one works: typedef struct { CARD8 reqType; CARD8 SELinuxReqType; CARD16 length; // CARD8 client_major; // CARD8 client_minor; } xSELinuxQueryVersionReq; // #define sz_xSELinuxQueryVersionReq 6 #define sz_xSELinuxQueryVersionReq 4 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber; CARD32 length; CARD16 server_major; CARD16 server_minor; CARD32 pad2; CARD32 pad3; CARD32 pad4; CARD32 pad5; CARD32 pad6; } xSELinuxQueryVersionReply; #define sz_xSELinuxQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 SELinuxReqType; CARD16 length; CARD32 context_len; } xSELinuxSetCreateContextReq; #define sz_xSELinuxSetCreateContextReq 8 typedef struct { CARD8 reqType; CARD8 SELinuxReqType; CARD16 length; } xSELinuxGetCreateContextReq; #define sz_xSELinuxGetCreateContextReq 4 typedef struct { CARD8 reqType; CARD8 SELinuxReqType; CARD16 length; CARD32 id; CARD32 context_len; } xSELinuxSetContextReq; #define sz_xSELinuxSetContextReq 12 typedef struct { CARD8 reqType; CARD8 SELinuxReqType; CARD16 length; CARD32 id; } xSELinuxGetContextReq; #define sz_xSELinuxGetContextReq 8 typedef struct { CARD8 reqType; CARD8 SELinuxReqType; CARD16 length; CARD32 window; CARD32 property; } xSELinuxGetPropertyContextReq; #define sz_xSELinuxGetPropertyContextReq 12 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber; CARD32 length; CARD32 context_len; CARD32 pad2; CARD32 pad3; CARD32 pad4; CARD32 pad5; CARD32 pad6; } xSELinuxGetContextReply; #define sz_xSELinuxGetContextReply 32 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber; CARD32 length; CARD32 count; CARD32 pad2; CARD32 pad3; CARD32 pad4; CARD32 pad5; CARD32 pad6; } xSELinuxListItemsReply; #define sz_xSELinuxListItemsReply 32 // These are for Get Selection & Property Lists typedef struct { CARD32 name; // Atom name CARD32 object_context_len; CARD32 data_context_len; // Context } xSELinuxListItem; #define sz_xSELinuxListItem 12 // This one holds the list information but needs to be a link list at some stage typedef struct { CARD32 atom_name; CARD32 object_context_len; CARD32 data_context_len; char object_context [100]; char data_context [100]; } xSELinuxListItemEntry; /************************************************************************/ /* */ /* This section defines for each function call: */ /* 1) typedefs to form the structure names in line with Xproto.h */ /* rules. */ /* 2) Defines structure sizes so that SIZEOF macro (defined in Xmd.h) */ /* can work when calling GetReq (); */ /* */ /************************************************************************/ // X_SELinuxQueryVersion = 0 // No typedef or sz_ are required as they are defined at the start of this // header file as they are exclusive to X_SELinuxQueryVersion, whereas the // rest (functions1 - 22) need typedef and sz_ define's as they use // common structures. // X_SELinuxSetDeviceCreateContext = 1 typedef xSELinuxSetCreateContextReq xSELinuxSetDeviceCreateContextReq; #define sz_xSELinuxSetDeviceCreateContextReq sz_xSELinuxSetCreateContextReq // the context is in a char buffer that is sent as additional data by _XSend // X_SELinuxGetDeviceCreateContext = 2 typedef xSELinuxGetCreateContextReq xSELinuxGetDeviceCreateContextReq; typedef xSELinuxGetContextReply xSELinuxGetDeviceCreateContextReply; #define sz_xSELinuxGetDeviceCreateContextReq sz_xSELinuxGetCreateContextReq #define sz_xSELinuxGetDeviceCreateContextReply sz_xSELinuxGetContextReply // X_SELinuxSetDeviceContext = 3 typedef xSELinuxSetContextReq xSELinuxSetDeviceContextReq; #define sz_xSELinuxSetDeviceContextReq sz_xSELinuxSetContextReq // X_SELinuxGetDeviceContext = 4 typedef xSELinuxGetContextReq xSELinuxGetDeviceContextReq; typedef xSELinuxGetContextReply xSELinuxGetDeviceContextReply; #define sz_xSELinuxGetDeviceContextReq sz_xSELinuxGetContextReq #define sz_xSELinuxGetDeviceContextReply sz_xSELinuxGetContextReply // X_SELinuxSetWindowCreateContext = 5 typedef xSELinuxSetCreateContextReq xSELinuxSetWindowCreateContextReq; #define sz_xSELinuxSetWindowCreateContextReq sz_xSELinuxSetCreateContextReq // X_SELinuxGetWindowCreateContext = 6 typedef xSELinuxGetCreateContextReq xSELinuxGetWindowCreateContextReq; typedef xSELinuxGetContextReply xSELinuxGetWindowCreateContextReply; #define sz_xSELinuxGetWindowCreateContextReq sz_xSELinuxGetCreateContextReq #define sz_xSELinuxGetWindowCreateContextReply sz_xSELinuxGetContextReply // X_SELinuxGetWindowContext = 7 typedef xSELinuxGetContextReq xSELinuxGetWindowContextReq; typedef xSELinuxGetContextReply xSELinuxGetWindowContextReply; #define sz_xSELinuxGetWindowContextReq sz_xSELinuxGetContextReq #define sz_xSELinuxGetWindowContextReply sz_xSELinuxGetContextReply // X_SELinuxSetPropertyCreateContext = 8 typedef xSELinuxSetCreateContextReq xSELinuxSetPropertyCreateContextReq; #define sz_xSELinuxSetPropertyCreateContextReq sz_xSELinuxSetCreateContextReq // X_SELinuxGetPropertyCreateContext = 9 typedef xSELinuxGetCreateContextReq xSELinuxGetPropertyCreateContextReq; typedef xSELinuxGetContextReply xSELinuxGetPropertyCreateContextReply; #define sz_xSELinuxGetPropertyCreateContextReq sz_xSELinuxGetCreateContextReq #define sz_xSELinuxGetPropertyCreateContextReply sz_xSELinuxGetContextReply // X_SELinuxSetPropertyUseContext = 10 typedef xSELinuxSetCreateContextReq xSELinuxSetPropertyUseContextReq; #define sz_xSELinuxSetPropertyUseContextReq sz_xSELinuxSetCreateContextReq // X_SELinuxGetPropertyUseContext = 11 typedef xSELinuxGetCreateContextReq xSELinuxGetPropertyUseContextReq; typedef xSELinuxGetContextReply xSELinuxGetPropertyUseContextReply; #define sz_xSELinuxGetPropertyUseContextReq sz_xSELinuxGetCreateContextReq #define sz_xSELinuxGetPropertyUseContextReply sz_xSELinuxGetContextReply // X_SELinuxGetPropertyContext = 12 (the req struct has already been declared) // typedef xSELinuxGetPropertyContextReq xSELinuxGetPropertyContextReq; typedef xSELinuxGetContextReply xSELinuxGetPropertyContextReply; #define sz_xSELinuxGetPropertyContextReply sz_xSELinuxGetContextReply // X_SELinuxGetPropertyDataContext = 13 typedef xSELinuxGetPropertyContextReq xSELinuxGetPropertyDataContextReq; typedef xSELinuxGetContextReply xSELinuxGetPropertyDataContextReply; #define sz_xSELinuxGetPropertyDataContextReq sz_xSELinuxGetPropertyContextReq #define sz_xSELinuxGetPropertyDataContextReply sz_xSELinuxGetContextReply // X_SELinuxListProperties = 14 typedef xSELinuxGetContextReq xSELinuxListPropertiesReq; typedef xSELinuxListItemsReply xSELinuxListPropertiesReply; #define sz_xSELinuxListPropertiesReq sz_xSELinuxGetContextReq #define sz_xSELinuxListPropertiesReply sz_xSELinuxListItemsReply // X_SELinuxSetSelectionCreateContext = 15 typedef xSELinuxSetCreateContextReq xSELinuxSetSelectionCreateContextReq; #define sz_xSELinuxSetSelectionCreateContextReq sz_xSELinuxSetCreateContextReq // X_SELinuxGetSelectionCreateContext = 16 typedef xSELinuxGetCreateContextReq xSELinuxGetSelectionCreateContextReq; typedef xSELinuxGetContextReply xSELinuxGetSelectionCreateContextReply; #define sz_xSELinuxGetSelectionCreateContextReq sz_xSELinuxGetCreateContextReq #define sz_xSELinuxGetSelectionCreateContextReply sz_xSELinuxGetContextReply // X_SELinuxSetSelectionUseContext = 17 typedef xSELinuxSetCreateContextReq xSELinuxSetSelectionUseContextReq; #define sz_xSELinuxSetSelectionUseContextReq sz_xSELinuxSetCreateContextReq // X_SELinuxGetSelectionUseContext = 18 typedef xSELinuxGetCreateContextReq xSELinuxGetSelectionUseContextReq; typedef xSELinuxGetContextReply xSELinuxGetSelectionUseContextReply; #define sz_xSELinuxGetSelectionUseContextReq sz_xSELinuxGetCreateContextReq #define sz_xSELinuxGetSelectionUseContextReply sz_xSELinuxGetContextReply // X_SELinuxGetSelectionContext = 19 typedef xSELinuxGetContextReq xSELinuxGetSelectionContextReq; typedef xSELinuxGetContextReply xSELinuxGetSelectionContextReply; #define sz_xSELinuxGetSelectionContextReq sz_xSELinuxGetContextReq #define sz_xSELinuxGetSelectionContextReply sz_xSELinuxGetContextReply // X_SELinuxGetSelectionDataContext = 20 typedef xSELinuxGetContextReq xSELinuxGetSelectionDataContextReq; typedef xSELinuxGetContextReply xSELinuxGetSelectionDataContextReply; #define sz_xSELinuxGetSelectionDataContextReq sz_xSELinuxGetContextReq #define sz_xSELinuxGetSelectionDataContextReply sz_xSELinuxGetContextReply // X_SELinuxListSelections = 21 typedef xSELinuxGetCreateContextReq xSELinuxListSelectionsReq; typedef xSELinuxListItemsReply xSELinuxListSelectionsReply; #define sz_xSELinuxListSelectionsReq sz_xSELinuxGetCreateContextReq #define sz_xSELinuxListSelectionsRepy sz_xSELinuxListItemsReply // X_SELinuxGetClientContext = 22 typedef xSELinuxGetContextReq xSELinuxGetClientContextReq; typedef xSELinuxGetContextReply xSELinuxGetClientContextReply; #define sz_xSELinuxGetClientContextReq sz_xSELinuxGetContextReq #define sz_xSELinuxGetClientContextReply sz_xSELinuxGetContextReply