1*971bb1a5SLionel Sambuc /* 2*971bb1a5SLionel Sambuc * This file generated automatically from xselinux.xml by c_client.py. 3*971bb1a5SLionel Sambuc * Edit at your peril. 4*971bb1a5SLionel Sambuc */ 5*971bb1a5SLionel Sambuc 6*971bb1a5SLionel Sambuc #ifdef HAVE_CONFIG_H 7*971bb1a5SLionel Sambuc #include "config.h" 8*971bb1a5SLionel Sambuc #endif 9*971bb1a5SLionel Sambuc #include <stdlib.h> 10*971bb1a5SLionel Sambuc #include <string.h> 11*971bb1a5SLionel Sambuc #include <assert.h> 12*971bb1a5SLionel Sambuc #include <stddef.h> /* for offsetof() */ 13*971bb1a5SLionel Sambuc #include "xcbext.h" 14*971bb1a5SLionel Sambuc #include "xselinux.h" 15*971bb1a5SLionel Sambuc 16*971bb1a5SLionel Sambuc #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) 17*971bb1a5SLionel Sambuc #include "xproto.h" 18*971bb1a5SLionel Sambuc 19*971bb1a5SLionel Sambuc xcb_extension_t xcb_selinux_id = { "SELinux", 0 }; 20*971bb1a5SLionel Sambuc 21*971bb1a5SLionel Sambuc 22*971bb1a5SLionel Sambuc /***************************************************************************** 23*971bb1a5SLionel Sambuc ** 24*971bb1a5SLionel Sambuc ** xcb_selinux_query_version_cookie_t xcb_selinux_query_version 25*971bb1a5SLionel Sambuc ** 26*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 27*971bb1a5SLionel Sambuc ** @param uint8_t client_major 28*971bb1a5SLionel Sambuc ** @param uint8_t client_minor 29*971bb1a5SLionel Sambuc ** @returns xcb_selinux_query_version_cookie_t 30*971bb1a5SLionel Sambuc ** 31*971bb1a5SLionel Sambuc *****************************************************************************/ 32*971bb1a5SLionel Sambuc 33*971bb1a5SLionel Sambuc xcb_selinux_query_version_cookie_t 34*971bb1a5SLionel Sambuc xcb_selinux_query_version (xcb_connection_t *c /**< */, 35*971bb1a5SLionel Sambuc uint8_t client_major /**< */, 36*971bb1a5SLionel Sambuc uint8_t client_minor /**< */) 37*971bb1a5SLionel Sambuc { 38*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 39*971bb1a5SLionel Sambuc /* count */ 2, 40*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 41*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_QUERY_VERSION, 42*971bb1a5SLionel Sambuc /* isvoid */ 0 43*971bb1a5SLionel Sambuc }; 44*971bb1a5SLionel Sambuc 45*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 46*971bb1a5SLionel Sambuc xcb_selinux_query_version_cookie_t xcb_ret; 47*971bb1a5SLionel Sambuc xcb_selinux_query_version_request_t xcb_out; 48*971bb1a5SLionel Sambuc 49*971bb1a5SLionel Sambuc xcb_out.client_major = client_major; 50*971bb1a5SLionel Sambuc xcb_out.client_minor = client_minor; 51*971bb1a5SLionel Sambuc 52*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 53*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 54*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 55*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 56*971bb1a5SLionel Sambuc 57*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 58*971bb1a5SLionel Sambuc return xcb_ret; 59*971bb1a5SLionel Sambuc } 60*971bb1a5SLionel Sambuc 61*971bb1a5SLionel Sambuc 62*971bb1a5SLionel Sambuc /***************************************************************************** 63*971bb1a5SLionel Sambuc ** 64*971bb1a5SLionel Sambuc ** xcb_selinux_query_version_cookie_t xcb_selinux_query_version_unchecked 65*971bb1a5SLionel Sambuc ** 66*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 67*971bb1a5SLionel Sambuc ** @param uint8_t client_major 68*971bb1a5SLionel Sambuc ** @param uint8_t client_minor 69*971bb1a5SLionel Sambuc ** @returns xcb_selinux_query_version_cookie_t 70*971bb1a5SLionel Sambuc ** 71*971bb1a5SLionel Sambuc *****************************************************************************/ 72*971bb1a5SLionel Sambuc 73*971bb1a5SLionel Sambuc xcb_selinux_query_version_cookie_t 74*971bb1a5SLionel Sambuc xcb_selinux_query_version_unchecked (xcb_connection_t *c /**< */, 75*971bb1a5SLionel Sambuc uint8_t client_major /**< */, 76*971bb1a5SLionel Sambuc uint8_t client_minor /**< */) 77*971bb1a5SLionel Sambuc { 78*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 79*971bb1a5SLionel Sambuc /* count */ 2, 80*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 81*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_QUERY_VERSION, 82*971bb1a5SLionel Sambuc /* isvoid */ 0 83*971bb1a5SLionel Sambuc }; 84*971bb1a5SLionel Sambuc 85*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 86*971bb1a5SLionel Sambuc xcb_selinux_query_version_cookie_t xcb_ret; 87*971bb1a5SLionel Sambuc xcb_selinux_query_version_request_t xcb_out; 88*971bb1a5SLionel Sambuc 89*971bb1a5SLionel Sambuc xcb_out.client_major = client_major; 90*971bb1a5SLionel Sambuc xcb_out.client_minor = client_minor; 91*971bb1a5SLionel Sambuc 92*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 93*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 94*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 95*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 96*971bb1a5SLionel Sambuc 97*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 98*971bb1a5SLionel Sambuc return xcb_ret; 99*971bb1a5SLionel Sambuc } 100*971bb1a5SLionel Sambuc 101*971bb1a5SLionel Sambuc 102*971bb1a5SLionel Sambuc /***************************************************************************** 103*971bb1a5SLionel Sambuc ** 104*971bb1a5SLionel Sambuc ** xcb_selinux_query_version_reply_t * xcb_selinux_query_version_reply 105*971bb1a5SLionel Sambuc ** 106*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 107*971bb1a5SLionel Sambuc ** @param xcb_selinux_query_version_cookie_t cookie 108*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 109*971bb1a5SLionel Sambuc ** @returns xcb_selinux_query_version_reply_t * 110*971bb1a5SLionel Sambuc ** 111*971bb1a5SLionel Sambuc *****************************************************************************/ 112*971bb1a5SLionel Sambuc 113*971bb1a5SLionel Sambuc xcb_selinux_query_version_reply_t * 114*971bb1a5SLionel Sambuc xcb_selinux_query_version_reply (xcb_connection_t *c /**< */, 115*971bb1a5SLionel Sambuc xcb_selinux_query_version_cookie_t cookie /**< */, 116*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 117*971bb1a5SLionel Sambuc { 118*971bb1a5SLionel Sambuc return (xcb_selinux_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 119*971bb1a5SLionel Sambuc } 120*971bb1a5SLionel Sambuc 121*971bb1a5SLionel Sambuc int 122*971bb1a5SLionel Sambuc xcb_selinux_set_device_create_context_sizeof (const void *_buffer /**< */) 123*971bb1a5SLionel Sambuc { 124*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 125*971bb1a5SLionel Sambuc const xcb_selinux_set_device_create_context_request_t *_aux = (xcb_selinux_set_device_create_context_request_t *)_buffer; 126*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 127*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 128*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 129*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 130*971bb1a5SLionel Sambuc 131*971bb1a5SLionel Sambuc 132*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_set_device_create_context_request_t); 133*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 134*971bb1a5SLionel Sambuc /* context */ 135*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 136*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 137*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 138*971bb1a5SLionel Sambuc /* insert padding */ 139*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 140*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 141*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 142*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 143*971bb1a5SLionel Sambuc xcb_pad = 0; 144*971bb1a5SLionel Sambuc } 145*971bb1a5SLionel Sambuc xcb_block_len = 0; 146*971bb1a5SLionel Sambuc 147*971bb1a5SLionel Sambuc return xcb_buffer_len; 148*971bb1a5SLionel Sambuc } 149*971bb1a5SLionel Sambuc 150*971bb1a5SLionel Sambuc 151*971bb1a5SLionel Sambuc /***************************************************************************** 152*971bb1a5SLionel Sambuc ** 153*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_device_create_context_checked 154*971bb1a5SLionel Sambuc ** 155*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 156*971bb1a5SLionel Sambuc ** @param uint32_t context_len 157*971bb1a5SLionel Sambuc ** @param const char *context 158*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 159*971bb1a5SLionel Sambuc ** 160*971bb1a5SLionel Sambuc *****************************************************************************/ 161*971bb1a5SLionel Sambuc 162*971bb1a5SLionel Sambuc xcb_void_cookie_t 163*971bb1a5SLionel Sambuc xcb_selinux_set_device_create_context_checked (xcb_connection_t *c /**< */, 164*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 165*971bb1a5SLionel Sambuc const char *context /**< */) 166*971bb1a5SLionel Sambuc { 167*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 168*971bb1a5SLionel Sambuc /* count */ 4, 169*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 170*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_DEVICE_CREATE_CONTEXT, 171*971bb1a5SLionel Sambuc /* isvoid */ 1 172*971bb1a5SLionel Sambuc }; 173*971bb1a5SLionel Sambuc 174*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 175*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 176*971bb1a5SLionel Sambuc xcb_selinux_set_device_create_context_request_t xcb_out; 177*971bb1a5SLionel Sambuc 178*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 179*971bb1a5SLionel Sambuc 180*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 181*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 182*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 183*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 184*971bb1a5SLionel Sambuc /* char context */ 185*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 186*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 187*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 188*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 189*971bb1a5SLionel Sambuc 190*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 191*971bb1a5SLionel Sambuc return xcb_ret; 192*971bb1a5SLionel Sambuc } 193*971bb1a5SLionel Sambuc 194*971bb1a5SLionel Sambuc 195*971bb1a5SLionel Sambuc /***************************************************************************** 196*971bb1a5SLionel Sambuc ** 197*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_device_create_context 198*971bb1a5SLionel Sambuc ** 199*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 200*971bb1a5SLionel Sambuc ** @param uint32_t context_len 201*971bb1a5SLionel Sambuc ** @param const char *context 202*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 203*971bb1a5SLionel Sambuc ** 204*971bb1a5SLionel Sambuc *****************************************************************************/ 205*971bb1a5SLionel Sambuc 206*971bb1a5SLionel Sambuc xcb_void_cookie_t 207*971bb1a5SLionel Sambuc xcb_selinux_set_device_create_context (xcb_connection_t *c /**< */, 208*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 209*971bb1a5SLionel Sambuc const char *context /**< */) 210*971bb1a5SLionel Sambuc { 211*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 212*971bb1a5SLionel Sambuc /* count */ 4, 213*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 214*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_DEVICE_CREATE_CONTEXT, 215*971bb1a5SLionel Sambuc /* isvoid */ 1 216*971bb1a5SLionel Sambuc }; 217*971bb1a5SLionel Sambuc 218*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 219*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 220*971bb1a5SLionel Sambuc xcb_selinux_set_device_create_context_request_t xcb_out; 221*971bb1a5SLionel Sambuc 222*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 223*971bb1a5SLionel Sambuc 224*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 225*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 226*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 227*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 228*971bb1a5SLionel Sambuc /* char context */ 229*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 230*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 231*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 232*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 233*971bb1a5SLionel Sambuc 234*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 235*971bb1a5SLionel Sambuc return xcb_ret; 236*971bb1a5SLionel Sambuc } 237*971bb1a5SLionel Sambuc 238*971bb1a5SLionel Sambuc int 239*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_sizeof (const void *_buffer /**< */) 240*971bb1a5SLionel Sambuc { 241*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 242*971bb1a5SLionel Sambuc const xcb_selinux_get_device_create_context_reply_t *_aux = (xcb_selinux_get_device_create_context_reply_t *)_buffer; 243*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 244*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 245*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 246*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 247*971bb1a5SLionel Sambuc 248*971bb1a5SLionel Sambuc 249*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_device_create_context_reply_t); 250*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 251*971bb1a5SLionel Sambuc /* context */ 252*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 253*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 254*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 255*971bb1a5SLionel Sambuc /* insert padding */ 256*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 257*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 258*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 259*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 260*971bb1a5SLionel Sambuc xcb_pad = 0; 261*971bb1a5SLionel Sambuc } 262*971bb1a5SLionel Sambuc xcb_block_len = 0; 263*971bb1a5SLionel Sambuc 264*971bb1a5SLionel Sambuc return xcb_buffer_len; 265*971bb1a5SLionel Sambuc } 266*971bb1a5SLionel Sambuc 267*971bb1a5SLionel Sambuc 268*971bb1a5SLionel Sambuc /***************************************************************************** 269*971bb1a5SLionel Sambuc ** 270*971bb1a5SLionel Sambuc ** xcb_selinux_get_device_create_context_cookie_t xcb_selinux_get_device_create_context 271*971bb1a5SLionel Sambuc ** 272*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 273*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_device_create_context_cookie_t 274*971bb1a5SLionel Sambuc ** 275*971bb1a5SLionel Sambuc *****************************************************************************/ 276*971bb1a5SLionel Sambuc 277*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_cookie_t 278*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context (xcb_connection_t *c /**< */) 279*971bb1a5SLionel Sambuc { 280*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 281*971bb1a5SLionel Sambuc /* count */ 2, 282*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 283*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_DEVICE_CREATE_CONTEXT, 284*971bb1a5SLionel Sambuc /* isvoid */ 0 285*971bb1a5SLionel Sambuc }; 286*971bb1a5SLionel Sambuc 287*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 288*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_cookie_t xcb_ret; 289*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_request_t xcb_out; 290*971bb1a5SLionel Sambuc 291*971bb1a5SLionel Sambuc 292*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 293*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 294*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 295*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 296*971bb1a5SLionel Sambuc 297*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 298*971bb1a5SLionel Sambuc return xcb_ret; 299*971bb1a5SLionel Sambuc } 300*971bb1a5SLionel Sambuc 301*971bb1a5SLionel Sambuc 302*971bb1a5SLionel Sambuc /***************************************************************************** 303*971bb1a5SLionel Sambuc ** 304*971bb1a5SLionel Sambuc ** xcb_selinux_get_device_create_context_cookie_t xcb_selinux_get_device_create_context_unchecked 305*971bb1a5SLionel Sambuc ** 306*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 307*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_device_create_context_cookie_t 308*971bb1a5SLionel Sambuc ** 309*971bb1a5SLionel Sambuc *****************************************************************************/ 310*971bb1a5SLionel Sambuc 311*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_cookie_t 312*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_unchecked (xcb_connection_t *c /**< */) 313*971bb1a5SLionel Sambuc { 314*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 315*971bb1a5SLionel Sambuc /* count */ 2, 316*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 317*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_DEVICE_CREATE_CONTEXT, 318*971bb1a5SLionel Sambuc /* isvoid */ 0 319*971bb1a5SLionel Sambuc }; 320*971bb1a5SLionel Sambuc 321*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 322*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_cookie_t xcb_ret; 323*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_request_t xcb_out; 324*971bb1a5SLionel Sambuc 325*971bb1a5SLionel Sambuc 326*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 327*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 328*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 329*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 330*971bb1a5SLionel Sambuc 331*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 332*971bb1a5SLionel Sambuc return xcb_ret; 333*971bb1a5SLionel Sambuc } 334*971bb1a5SLionel Sambuc 335*971bb1a5SLionel Sambuc 336*971bb1a5SLionel Sambuc /***************************************************************************** 337*971bb1a5SLionel Sambuc ** 338*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_device_create_context_context 339*971bb1a5SLionel Sambuc ** 340*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_device_create_context_reply_t *R 341*971bb1a5SLionel Sambuc ** @returns char * 342*971bb1a5SLionel Sambuc ** 343*971bb1a5SLionel Sambuc *****************************************************************************/ 344*971bb1a5SLionel Sambuc 345*971bb1a5SLionel Sambuc char * 346*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_context (const xcb_selinux_get_device_create_context_reply_t *R /**< */) 347*971bb1a5SLionel Sambuc { 348*971bb1a5SLionel Sambuc return (char *) (R + 1); 349*971bb1a5SLionel Sambuc } 350*971bb1a5SLionel Sambuc 351*971bb1a5SLionel Sambuc 352*971bb1a5SLionel Sambuc /***************************************************************************** 353*971bb1a5SLionel Sambuc ** 354*971bb1a5SLionel Sambuc ** int xcb_selinux_get_device_create_context_context_length 355*971bb1a5SLionel Sambuc ** 356*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_device_create_context_reply_t *R 357*971bb1a5SLionel Sambuc ** @returns int 358*971bb1a5SLionel Sambuc ** 359*971bb1a5SLionel Sambuc *****************************************************************************/ 360*971bb1a5SLionel Sambuc 361*971bb1a5SLionel Sambuc int 362*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_context_length (const xcb_selinux_get_device_create_context_reply_t *R /**< */) 363*971bb1a5SLionel Sambuc { 364*971bb1a5SLionel Sambuc return R->context_len; 365*971bb1a5SLionel Sambuc } 366*971bb1a5SLionel Sambuc 367*971bb1a5SLionel Sambuc 368*971bb1a5SLionel Sambuc /***************************************************************************** 369*971bb1a5SLionel Sambuc ** 370*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_device_create_context_context_end 371*971bb1a5SLionel Sambuc ** 372*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_device_create_context_reply_t *R 373*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 374*971bb1a5SLionel Sambuc ** 375*971bb1a5SLionel Sambuc *****************************************************************************/ 376*971bb1a5SLionel Sambuc 377*971bb1a5SLionel Sambuc xcb_generic_iterator_t 378*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_context_end (const xcb_selinux_get_device_create_context_reply_t *R /**< */) 379*971bb1a5SLionel Sambuc { 380*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 381*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 382*971bb1a5SLionel Sambuc i.rem = 0; 383*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 384*971bb1a5SLionel Sambuc return i; 385*971bb1a5SLionel Sambuc } 386*971bb1a5SLionel Sambuc 387*971bb1a5SLionel Sambuc 388*971bb1a5SLionel Sambuc /***************************************************************************** 389*971bb1a5SLionel Sambuc ** 390*971bb1a5SLionel Sambuc ** xcb_selinux_get_device_create_context_reply_t * xcb_selinux_get_device_create_context_reply 391*971bb1a5SLionel Sambuc ** 392*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 393*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_device_create_context_cookie_t cookie 394*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 395*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_device_create_context_reply_t * 396*971bb1a5SLionel Sambuc ** 397*971bb1a5SLionel Sambuc *****************************************************************************/ 398*971bb1a5SLionel Sambuc 399*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_reply_t * 400*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_reply (xcb_connection_t *c /**< */, 401*971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_cookie_t cookie /**< */, 402*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 403*971bb1a5SLionel Sambuc { 404*971bb1a5SLionel Sambuc return (xcb_selinux_get_device_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 405*971bb1a5SLionel Sambuc } 406*971bb1a5SLionel Sambuc 407*971bb1a5SLionel Sambuc int 408*971bb1a5SLionel Sambuc xcb_selinux_set_device_context_sizeof (const void *_buffer /**< */) 409*971bb1a5SLionel Sambuc { 410*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 411*971bb1a5SLionel Sambuc const xcb_selinux_set_device_context_request_t *_aux = (xcb_selinux_set_device_context_request_t *)_buffer; 412*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 413*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 414*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 415*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 416*971bb1a5SLionel Sambuc 417*971bb1a5SLionel Sambuc 418*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_set_device_context_request_t); 419*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 420*971bb1a5SLionel Sambuc /* context */ 421*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 422*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 423*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 424*971bb1a5SLionel Sambuc /* insert padding */ 425*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 426*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 427*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 428*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 429*971bb1a5SLionel Sambuc xcb_pad = 0; 430*971bb1a5SLionel Sambuc } 431*971bb1a5SLionel Sambuc xcb_block_len = 0; 432*971bb1a5SLionel Sambuc 433*971bb1a5SLionel Sambuc return xcb_buffer_len; 434*971bb1a5SLionel Sambuc } 435*971bb1a5SLionel Sambuc 436*971bb1a5SLionel Sambuc 437*971bb1a5SLionel Sambuc /***************************************************************************** 438*971bb1a5SLionel Sambuc ** 439*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_device_context_checked 440*971bb1a5SLionel Sambuc ** 441*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 442*971bb1a5SLionel Sambuc ** @param uint32_t device 443*971bb1a5SLionel Sambuc ** @param uint32_t context_len 444*971bb1a5SLionel Sambuc ** @param const char *context 445*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 446*971bb1a5SLionel Sambuc ** 447*971bb1a5SLionel Sambuc *****************************************************************************/ 448*971bb1a5SLionel Sambuc 449*971bb1a5SLionel Sambuc xcb_void_cookie_t 450*971bb1a5SLionel Sambuc xcb_selinux_set_device_context_checked (xcb_connection_t *c /**< */, 451*971bb1a5SLionel Sambuc uint32_t device /**< */, 452*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 453*971bb1a5SLionel Sambuc const char *context /**< */) 454*971bb1a5SLionel Sambuc { 455*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 456*971bb1a5SLionel Sambuc /* count */ 4, 457*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 458*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_DEVICE_CONTEXT, 459*971bb1a5SLionel Sambuc /* isvoid */ 1 460*971bb1a5SLionel Sambuc }; 461*971bb1a5SLionel Sambuc 462*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 463*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 464*971bb1a5SLionel Sambuc xcb_selinux_set_device_context_request_t xcb_out; 465*971bb1a5SLionel Sambuc 466*971bb1a5SLionel Sambuc xcb_out.device = device; 467*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 468*971bb1a5SLionel Sambuc 469*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 470*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 471*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 472*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 473*971bb1a5SLionel Sambuc /* char context */ 474*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 475*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 476*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 477*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 478*971bb1a5SLionel Sambuc 479*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 480*971bb1a5SLionel Sambuc return xcb_ret; 481*971bb1a5SLionel Sambuc } 482*971bb1a5SLionel Sambuc 483*971bb1a5SLionel Sambuc 484*971bb1a5SLionel Sambuc /***************************************************************************** 485*971bb1a5SLionel Sambuc ** 486*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_device_context 487*971bb1a5SLionel Sambuc ** 488*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 489*971bb1a5SLionel Sambuc ** @param uint32_t device 490*971bb1a5SLionel Sambuc ** @param uint32_t context_len 491*971bb1a5SLionel Sambuc ** @param const char *context 492*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 493*971bb1a5SLionel Sambuc ** 494*971bb1a5SLionel Sambuc *****************************************************************************/ 495*971bb1a5SLionel Sambuc 496*971bb1a5SLionel Sambuc xcb_void_cookie_t 497*971bb1a5SLionel Sambuc xcb_selinux_set_device_context (xcb_connection_t *c /**< */, 498*971bb1a5SLionel Sambuc uint32_t device /**< */, 499*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 500*971bb1a5SLionel Sambuc const char *context /**< */) 501*971bb1a5SLionel Sambuc { 502*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 503*971bb1a5SLionel Sambuc /* count */ 4, 504*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 505*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_DEVICE_CONTEXT, 506*971bb1a5SLionel Sambuc /* isvoid */ 1 507*971bb1a5SLionel Sambuc }; 508*971bb1a5SLionel Sambuc 509*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 510*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 511*971bb1a5SLionel Sambuc xcb_selinux_set_device_context_request_t xcb_out; 512*971bb1a5SLionel Sambuc 513*971bb1a5SLionel Sambuc xcb_out.device = device; 514*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 515*971bb1a5SLionel Sambuc 516*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 517*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 518*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 519*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 520*971bb1a5SLionel Sambuc /* char context */ 521*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 522*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 523*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 524*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 525*971bb1a5SLionel Sambuc 526*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 527*971bb1a5SLionel Sambuc return xcb_ret; 528*971bb1a5SLionel Sambuc } 529*971bb1a5SLionel Sambuc 530*971bb1a5SLionel Sambuc int 531*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_sizeof (const void *_buffer /**< */) 532*971bb1a5SLionel Sambuc { 533*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 534*971bb1a5SLionel Sambuc const xcb_selinux_get_device_context_reply_t *_aux = (xcb_selinux_get_device_context_reply_t *)_buffer; 535*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 536*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 537*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 538*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 539*971bb1a5SLionel Sambuc 540*971bb1a5SLionel Sambuc 541*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_device_context_reply_t); 542*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 543*971bb1a5SLionel Sambuc /* context */ 544*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 545*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 546*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 547*971bb1a5SLionel Sambuc /* insert padding */ 548*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 549*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 550*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 551*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 552*971bb1a5SLionel Sambuc xcb_pad = 0; 553*971bb1a5SLionel Sambuc } 554*971bb1a5SLionel Sambuc xcb_block_len = 0; 555*971bb1a5SLionel Sambuc 556*971bb1a5SLionel Sambuc return xcb_buffer_len; 557*971bb1a5SLionel Sambuc } 558*971bb1a5SLionel Sambuc 559*971bb1a5SLionel Sambuc 560*971bb1a5SLionel Sambuc /***************************************************************************** 561*971bb1a5SLionel Sambuc ** 562*971bb1a5SLionel Sambuc ** xcb_selinux_get_device_context_cookie_t xcb_selinux_get_device_context 563*971bb1a5SLionel Sambuc ** 564*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 565*971bb1a5SLionel Sambuc ** @param uint32_t device 566*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_device_context_cookie_t 567*971bb1a5SLionel Sambuc ** 568*971bb1a5SLionel Sambuc *****************************************************************************/ 569*971bb1a5SLionel Sambuc 570*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_cookie_t 571*971bb1a5SLionel Sambuc xcb_selinux_get_device_context (xcb_connection_t *c /**< */, 572*971bb1a5SLionel Sambuc uint32_t device /**< */) 573*971bb1a5SLionel Sambuc { 574*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 575*971bb1a5SLionel Sambuc /* count */ 2, 576*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 577*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_DEVICE_CONTEXT, 578*971bb1a5SLionel Sambuc /* isvoid */ 0 579*971bb1a5SLionel Sambuc }; 580*971bb1a5SLionel Sambuc 581*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 582*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_cookie_t xcb_ret; 583*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_request_t xcb_out; 584*971bb1a5SLionel Sambuc 585*971bb1a5SLionel Sambuc xcb_out.device = device; 586*971bb1a5SLionel Sambuc 587*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 588*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 589*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 590*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 591*971bb1a5SLionel Sambuc 592*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 593*971bb1a5SLionel Sambuc return xcb_ret; 594*971bb1a5SLionel Sambuc } 595*971bb1a5SLionel Sambuc 596*971bb1a5SLionel Sambuc 597*971bb1a5SLionel Sambuc /***************************************************************************** 598*971bb1a5SLionel Sambuc ** 599*971bb1a5SLionel Sambuc ** xcb_selinux_get_device_context_cookie_t xcb_selinux_get_device_context_unchecked 600*971bb1a5SLionel Sambuc ** 601*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 602*971bb1a5SLionel Sambuc ** @param uint32_t device 603*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_device_context_cookie_t 604*971bb1a5SLionel Sambuc ** 605*971bb1a5SLionel Sambuc *****************************************************************************/ 606*971bb1a5SLionel Sambuc 607*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_cookie_t 608*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_unchecked (xcb_connection_t *c /**< */, 609*971bb1a5SLionel Sambuc uint32_t device /**< */) 610*971bb1a5SLionel Sambuc { 611*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 612*971bb1a5SLionel Sambuc /* count */ 2, 613*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 614*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_DEVICE_CONTEXT, 615*971bb1a5SLionel Sambuc /* isvoid */ 0 616*971bb1a5SLionel Sambuc }; 617*971bb1a5SLionel Sambuc 618*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 619*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_cookie_t xcb_ret; 620*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_request_t xcb_out; 621*971bb1a5SLionel Sambuc 622*971bb1a5SLionel Sambuc xcb_out.device = device; 623*971bb1a5SLionel Sambuc 624*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 625*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 626*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 627*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 628*971bb1a5SLionel Sambuc 629*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 630*971bb1a5SLionel Sambuc return xcb_ret; 631*971bb1a5SLionel Sambuc } 632*971bb1a5SLionel Sambuc 633*971bb1a5SLionel Sambuc 634*971bb1a5SLionel Sambuc /***************************************************************************** 635*971bb1a5SLionel Sambuc ** 636*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_device_context_context 637*971bb1a5SLionel Sambuc ** 638*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_device_context_reply_t *R 639*971bb1a5SLionel Sambuc ** @returns char * 640*971bb1a5SLionel Sambuc ** 641*971bb1a5SLionel Sambuc *****************************************************************************/ 642*971bb1a5SLionel Sambuc 643*971bb1a5SLionel Sambuc char * 644*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_context (const xcb_selinux_get_device_context_reply_t *R /**< */) 645*971bb1a5SLionel Sambuc { 646*971bb1a5SLionel Sambuc return (char *) (R + 1); 647*971bb1a5SLionel Sambuc } 648*971bb1a5SLionel Sambuc 649*971bb1a5SLionel Sambuc 650*971bb1a5SLionel Sambuc /***************************************************************************** 651*971bb1a5SLionel Sambuc ** 652*971bb1a5SLionel Sambuc ** int xcb_selinux_get_device_context_context_length 653*971bb1a5SLionel Sambuc ** 654*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_device_context_reply_t *R 655*971bb1a5SLionel Sambuc ** @returns int 656*971bb1a5SLionel Sambuc ** 657*971bb1a5SLionel Sambuc *****************************************************************************/ 658*971bb1a5SLionel Sambuc 659*971bb1a5SLionel Sambuc int 660*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_context_length (const xcb_selinux_get_device_context_reply_t *R /**< */) 661*971bb1a5SLionel Sambuc { 662*971bb1a5SLionel Sambuc return R->context_len; 663*971bb1a5SLionel Sambuc } 664*971bb1a5SLionel Sambuc 665*971bb1a5SLionel Sambuc 666*971bb1a5SLionel Sambuc /***************************************************************************** 667*971bb1a5SLionel Sambuc ** 668*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_device_context_context_end 669*971bb1a5SLionel Sambuc ** 670*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_device_context_reply_t *R 671*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 672*971bb1a5SLionel Sambuc ** 673*971bb1a5SLionel Sambuc *****************************************************************************/ 674*971bb1a5SLionel Sambuc 675*971bb1a5SLionel Sambuc xcb_generic_iterator_t 676*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_context_end (const xcb_selinux_get_device_context_reply_t *R /**< */) 677*971bb1a5SLionel Sambuc { 678*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 679*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 680*971bb1a5SLionel Sambuc i.rem = 0; 681*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 682*971bb1a5SLionel Sambuc return i; 683*971bb1a5SLionel Sambuc } 684*971bb1a5SLionel Sambuc 685*971bb1a5SLionel Sambuc 686*971bb1a5SLionel Sambuc /***************************************************************************** 687*971bb1a5SLionel Sambuc ** 688*971bb1a5SLionel Sambuc ** xcb_selinux_get_device_context_reply_t * xcb_selinux_get_device_context_reply 689*971bb1a5SLionel Sambuc ** 690*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 691*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_device_context_cookie_t cookie 692*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 693*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_device_context_reply_t * 694*971bb1a5SLionel Sambuc ** 695*971bb1a5SLionel Sambuc *****************************************************************************/ 696*971bb1a5SLionel Sambuc 697*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_reply_t * 698*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_reply (xcb_connection_t *c /**< */, 699*971bb1a5SLionel Sambuc xcb_selinux_get_device_context_cookie_t cookie /**< */, 700*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 701*971bb1a5SLionel Sambuc { 702*971bb1a5SLionel Sambuc return (xcb_selinux_get_device_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 703*971bb1a5SLionel Sambuc } 704*971bb1a5SLionel Sambuc 705*971bb1a5SLionel Sambuc int 706*971bb1a5SLionel Sambuc xcb_selinux_set_window_create_context_sizeof (const void *_buffer /**< */) 707*971bb1a5SLionel Sambuc { 708*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 709*971bb1a5SLionel Sambuc const xcb_selinux_set_window_create_context_request_t *_aux = (xcb_selinux_set_window_create_context_request_t *)_buffer; 710*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 711*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 712*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 713*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 714*971bb1a5SLionel Sambuc 715*971bb1a5SLionel Sambuc 716*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_set_window_create_context_request_t); 717*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 718*971bb1a5SLionel Sambuc /* context */ 719*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 720*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 721*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 722*971bb1a5SLionel Sambuc /* insert padding */ 723*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 724*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 725*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 726*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 727*971bb1a5SLionel Sambuc xcb_pad = 0; 728*971bb1a5SLionel Sambuc } 729*971bb1a5SLionel Sambuc xcb_block_len = 0; 730*971bb1a5SLionel Sambuc 731*971bb1a5SLionel Sambuc return xcb_buffer_len; 732*971bb1a5SLionel Sambuc } 733*971bb1a5SLionel Sambuc 734*971bb1a5SLionel Sambuc 735*971bb1a5SLionel Sambuc /***************************************************************************** 736*971bb1a5SLionel Sambuc ** 737*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_window_create_context_checked 738*971bb1a5SLionel Sambuc ** 739*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 740*971bb1a5SLionel Sambuc ** @param uint32_t context_len 741*971bb1a5SLionel Sambuc ** @param const char *context 742*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 743*971bb1a5SLionel Sambuc ** 744*971bb1a5SLionel Sambuc *****************************************************************************/ 745*971bb1a5SLionel Sambuc 746*971bb1a5SLionel Sambuc xcb_void_cookie_t 747*971bb1a5SLionel Sambuc xcb_selinux_set_window_create_context_checked (xcb_connection_t *c /**< */, 748*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 749*971bb1a5SLionel Sambuc const char *context /**< */) 750*971bb1a5SLionel Sambuc { 751*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 752*971bb1a5SLionel Sambuc /* count */ 4, 753*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 754*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_WINDOW_CREATE_CONTEXT, 755*971bb1a5SLionel Sambuc /* isvoid */ 1 756*971bb1a5SLionel Sambuc }; 757*971bb1a5SLionel Sambuc 758*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 759*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 760*971bb1a5SLionel Sambuc xcb_selinux_set_window_create_context_request_t xcb_out; 761*971bb1a5SLionel Sambuc 762*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 763*971bb1a5SLionel Sambuc 764*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 765*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 766*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 767*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 768*971bb1a5SLionel Sambuc /* char context */ 769*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 770*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 771*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 772*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 773*971bb1a5SLionel Sambuc 774*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 775*971bb1a5SLionel Sambuc return xcb_ret; 776*971bb1a5SLionel Sambuc } 777*971bb1a5SLionel Sambuc 778*971bb1a5SLionel Sambuc 779*971bb1a5SLionel Sambuc /***************************************************************************** 780*971bb1a5SLionel Sambuc ** 781*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_window_create_context 782*971bb1a5SLionel Sambuc ** 783*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 784*971bb1a5SLionel Sambuc ** @param uint32_t context_len 785*971bb1a5SLionel Sambuc ** @param const char *context 786*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 787*971bb1a5SLionel Sambuc ** 788*971bb1a5SLionel Sambuc *****************************************************************************/ 789*971bb1a5SLionel Sambuc 790*971bb1a5SLionel Sambuc xcb_void_cookie_t 791*971bb1a5SLionel Sambuc xcb_selinux_set_window_create_context (xcb_connection_t *c /**< */, 792*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 793*971bb1a5SLionel Sambuc const char *context /**< */) 794*971bb1a5SLionel Sambuc { 795*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 796*971bb1a5SLionel Sambuc /* count */ 4, 797*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 798*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_WINDOW_CREATE_CONTEXT, 799*971bb1a5SLionel Sambuc /* isvoid */ 1 800*971bb1a5SLionel Sambuc }; 801*971bb1a5SLionel Sambuc 802*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 803*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 804*971bb1a5SLionel Sambuc xcb_selinux_set_window_create_context_request_t xcb_out; 805*971bb1a5SLionel Sambuc 806*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 807*971bb1a5SLionel Sambuc 808*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 809*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 810*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 811*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 812*971bb1a5SLionel Sambuc /* char context */ 813*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 814*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 815*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 816*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 817*971bb1a5SLionel Sambuc 818*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 819*971bb1a5SLionel Sambuc return xcb_ret; 820*971bb1a5SLionel Sambuc } 821*971bb1a5SLionel Sambuc 822*971bb1a5SLionel Sambuc int 823*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_sizeof (const void *_buffer /**< */) 824*971bb1a5SLionel Sambuc { 825*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 826*971bb1a5SLionel Sambuc const xcb_selinux_get_window_create_context_reply_t *_aux = (xcb_selinux_get_window_create_context_reply_t *)_buffer; 827*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 828*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 829*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 830*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 831*971bb1a5SLionel Sambuc 832*971bb1a5SLionel Sambuc 833*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_window_create_context_reply_t); 834*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 835*971bb1a5SLionel Sambuc /* context */ 836*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 837*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 838*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 839*971bb1a5SLionel Sambuc /* insert padding */ 840*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 841*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 842*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 843*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 844*971bb1a5SLionel Sambuc xcb_pad = 0; 845*971bb1a5SLionel Sambuc } 846*971bb1a5SLionel Sambuc xcb_block_len = 0; 847*971bb1a5SLionel Sambuc 848*971bb1a5SLionel Sambuc return xcb_buffer_len; 849*971bb1a5SLionel Sambuc } 850*971bb1a5SLionel Sambuc 851*971bb1a5SLionel Sambuc 852*971bb1a5SLionel Sambuc /***************************************************************************** 853*971bb1a5SLionel Sambuc ** 854*971bb1a5SLionel Sambuc ** xcb_selinux_get_window_create_context_cookie_t xcb_selinux_get_window_create_context 855*971bb1a5SLionel Sambuc ** 856*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 857*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_window_create_context_cookie_t 858*971bb1a5SLionel Sambuc ** 859*971bb1a5SLionel Sambuc *****************************************************************************/ 860*971bb1a5SLionel Sambuc 861*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_cookie_t 862*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context (xcb_connection_t *c /**< */) 863*971bb1a5SLionel Sambuc { 864*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 865*971bb1a5SLionel Sambuc /* count */ 2, 866*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 867*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_WINDOW_CREATE_CONTEXT, 868*971bb1a5SLionel Sambuc /* isvoid */ 0 869*971bb1a5SLionel Sambuc }; 870*971bb1a5SLionel Sambuc 871*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 872*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_cookie_t xcb_ret; 873*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_request_t xcb_out; 874*971bb1a5SLionel Sambuc 875*971bb1a5SLionel Sambuc 876*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 877*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 878*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 879*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 880*971bb1a5SLionel Sambuc 881*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 882*971bb1a5SLionel Sambuc return xcb_ret; 883*971bb1a5SLionel Sambuc } 884*971bb1a5SLionel Sambuc 885*971bb1a5SLionel Sambuc 886*971bb1a5SLionel Sambuc /***************************************************************************** 887*971bb1a5SLionel Sambuc ** 888*971bb1a5SLionel Sambuc ** xcb_selinux_get_window_create_context_cookie_t xcb_selinux_get_window_create_context_unchecked 889*971bb1a5SLionel Sambuc ** 890*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 891*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_window_create_context_cookie_t 892*971bb1a5SLionel Sambuc ** 893*971bb1a5SLionel Sambuc *****************************************************************************/ 894*971bb1a5SLionel Sambuc 895*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_cookie_t 896*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_unchecked (xcb_connection_t *c /**< */) 897*971bb1a5SLionel Sambuc { 898*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 899*971bb1a5SLionel Sambuc /* count */ 2, 900*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 901*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_WINDOW_CREATE_CONTEXT, 902*971bb1a5SLionel Sambuc /* isvoid */ 0 903*971bb1a5SLionel Sambuc }; 904*971bb1a5SLionel Sambuc 905*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 906*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_cookie_t xcb_ret; 907*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_request_t xcb_out; 908*971bb1a5SLionel Sambuc 909*971bb1a5SLionel Sambuc 910*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 911*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 912*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 913*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 914*971bb1a5SLionel Sambuc 915*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 916*971bb1a5SLionel Sambuc return xcb_ret; 917*971bb1a5SLionel Sambuc } 918*971bb1a5SLionel Sambuc 919*971bb1a5SLionel Sambuc 920*971bb1a5SLionel Sambuc /***************************************************************************** 921*971bb1a5SLionel Sambuc ** 922*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_window_create_context_context 923*971bb1a5SLionel Sambuc ** 924*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_window_create_context_reply_t *R 925*971bb1a5SLionel Sambuc ** @returns char * 926*971bb1a5SLionel Sambuc ** 927*971bb1a5SLionel Sambuc *****************************************************************************/ 928*971bb1a5SLionel Sambuc 929*971bb1a5SLionel Sambuc char * 930*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_context (const xcb_selinux_get_window_create_context_reply_t *R /**< */) 931*971bb1a5SLionel Sambuc { 932*971bb1a5SLionel Sambuc return (char *) (R + 1); 933*971bb1a5SLionel Sambuc } 934*971bb1a5SLionel Sambuc 935*971bb1a5SLionel Sambuc 936*971bb1a5SLionel Sambuc /***************************************************************************** 937*971bb1a5SLionel Sambuc ** 938*971bb1a5SLionel Sambuc ** int xcb_selinux_get_window_create_context_context_length 939*971bb1a5SLionel Sambuc ** 940*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_window_create_context_reply_t *R 941*971bb1a5SLionel Sambuc ** @returns int 942*971bb1a5SLionel Sambuc ** 943*971bb1a5SLionel Sambuc *****************************************************************************/ 944*971bb1a5SLionel Sambuc 945*971bb1a5SLionel Sambuc int 946*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_context_length (const xcb_selinux_get_window_create_context_reply_t *R /**< */) 947*971bb1a5SLionel Sambuc { 948*971bb1a5SLionel Sambuc return R->context_len; 949*971bb1a5SLionel Sambuc } 950*971bb1a5SLionel Sambuc 951*971bb1a5SLionel Sambuc 952*971bb1a5SLionel Sambuc /***************************************************************************** 953*971bb1a5SLionel Sambuc ** 954*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_window_create_context_context_end 955*971bb1a5SLionel Sambuc ** 956*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_window_create_context_reply_t *R 957*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 958*971bb1a5SLionel Sambuc ** 959*971bb1a5SLionel Sambuc *****************************************************************************/ 960*971bb1a5SLionel Sambuc 961*971bb1a5SLionel Sambuc xcb_generic_iterator_t 962*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_context_end (const xcb_selinux_get_window_create_context_reply_t *R /**< */) 963*971bb1a5SLionel Sambuc { 964*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 965*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 966*971bb1a5SLionel Sambuc i.rem = 0; 967*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 968*971bb1a5SLionel Sambuc return i; 969*971bb1a5SLionel Sambuc } 970*971bb1a5SLionel Sambuc 971*971bb1a5SLionel Sambuc 972*971bb1a5SLionel Sambuc /***************************************************************************** 973*971bb1a5SLionel Sambuc ** 974*971bb1a5SLionel Sambuc ** xcb_selinux_get_window_create_context_reply_t * xcb_selinux_get_window_create_context_reply 975*971bb1a5SLionel Sambuc ** 976*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 977*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_window_create_context_cookie_t cookie 978*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 979*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_window_create_context_reply_t * 980*971bb1a5SLionel Sambuc ** 981*971bb1a5SLionel Sambuc *****************************************************************************/ 982*971bb1a5SLionel Sambuc 983*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_reply_t * 984*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_reply (xcb_connection_t *c /**< */, 985*971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_cookie_t cookie /**< */, 986*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 987*971bb1a5SLionel Sambuc { 988*971bb1a5SLionel Sambuc return (xcb_selinux_get_window_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 989*971bb1a5SLionel Sambuc } 990*971bb1a5SLionel Sambuc 991*971bb1a5SLionel Sambuc int 992*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_sizeof (const void *_buffer /**< */) 993*971bb1a5SLionel Sambuc { 994*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 995*971bb1a5SLionel Sambuc const xcb_selinux_get_window_context_reply_t *_aux = (xcb_selinux_get_window_context_reply_t *)_buffer; 996*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 997*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 998*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 999*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 1000*971bb1a5SLionel Sambuc 1001*971bb1a5SLionel Sambuc 1002*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_window_context_reply_t); 1003*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1004*971bb1a5SLionel Sambuc /* context */ 1005*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 1006*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1007*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 1008*971bb1a5SLionel Sambuc /* insert padding */ 1009*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1010*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 1011*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 1012*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 1013*971bb1a5SLionel Sambuc xcb_pad = 0; 1014*971bb1a5SLionel Sambuc } 1015*971bb1a5SLionel Sambuc xcb_block_len = 0; 1016*971bb1a5SLionel Sambuc 1017*971bb1a5SLionel Sambuc return xcb_buffer_len; 1018*971bb1a5SLionel Sambuc } 1019*971bb1a5SLionel Sambuc 1020*971bb1a5SLionel Sambuc 1021*971bb1a5SLionel Sambuc /***************************************************************************** 1022*971bb1a5SLionel Sambuc ** 1023*971bb1a5SLionel Sambuc ** xcb_selinux_get_window_context_cookie_t xcb_selinux_get_window_context 1024*971bb1a5SLionel Sambuc ** 1025*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1026*971bb1a5SLionel Sambuc ** @param xcb_window_t window 1027*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_window_context_cookie_t 1028*971bb1a5SLionel Sambuc ** 1029*971bb1a5SLionel Sambuc *****************************************************************************/ 1030*971bb1a5SLionel Sambuc 1031*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_cookie_t 1032*971bb1a5SLionel Sambuc xcb_selinux_get_window_context (xcb_connection_t *c /**< */, 1033*971bb1a5SLionel Sambuc xcb_window_t window /**< */) 1034*971bb1a5SLionel Sambuc { 1035*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1036*971bb1a5SLionel Sambuc /* count */ 2, 1037*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1038*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_WINDOW_CONTEXT, 1039*971bb1a5SLionel Sambuc /* isvoid */ 0 1040*971bb1a5SLionel Sambuc }; 1041*971bb1a5SLionel Sambuc 1042*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 1043*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_cookie_t xcb_ret; 1044*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_request_t xcb_out; 1045*971bb1a5SLionel Sambuc 1046*971bb1a5SLionel Sambuc xcb_out.window = window; 1047*971bb1a5SLionel Sambuc 1048*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1049*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1050*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1051*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1052*971bb1a5SLionel Sambuc 1053*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1054*971bb1a5SLionel Sambuc return xcb_ret; 1055*971bb1a5SLionel Sambuc } 1056*971bb1a5SLionel Sambuc 1057*971bb1a5SLionel Sambuc 1058*971bb1a5SLionel Sambuc /***************************************************************************** 1059*971bb1a5SLionel Sambuc ** 1060*971bb1a5SLionel Sambuc ** xcb_selinux_get_window_context_cookie_t xcb_selinux_get_window_context_unchecked 1061*971bb1a5SLionel Sambuc ** 1062*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1063*971bb1a5SLionel Sambuc ** @param xcb_window_t window 1064*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_window_context_cookie_t 1065*971bb1a5SLionel Sambuc ** 1066*971bb1a5SLionel Sambuc *****************************************************************************/ 1067*971bb1a5SLionel Sambuc 1068*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_cookie_t 1069*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_unchecked (xcb_connection_t *c /**< */, 1070*971bb1a5SLionel Sambuc xcb_window_t window /**< */) 1071*971bb1a5SLionel Sambuc { 1072*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1073*971bb1a5SLionel Sambuc /* count */ 2, 1074*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1075*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_WINDOW_CONTEXT, 1076*971bb1a5SLionel Sambuc /* isvoid */ 0 1077*971bb1a5SLionel Sambuc }; 1078*971bb1a5SLionel Sambuc 1079*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 1080*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_cookie_t xcb_ret; 1081*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_request_t xcb_out; 1082*971bb1a5SLionel Sambuc 1083*971bb1a5SLionel Sambuc xcb_out.window = window; 1084*971bb1a5SLionel Sambuc 1085*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1086*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1087*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1088*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1089*971bb1a5SLionel Sambuc 1090*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1091*971bb1a5SLionel Sambuc return xcb_ret; 1092*971bb1a5SLionel Sambuc } 1093*971bb1a5SLionel Sambuc 1094*971bb1a5SLionel Sambuc 1095*971bb1a5SLionel Sambuc /***************************************************************************** 1096*971bb1a5SLionel Sambuc ** 1097*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_window_context_context 1098*971bb1a5SLionel Sambuc ** 1099*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_window_context_reply_t *R 1100*971bb1a5SLionel Sambuc ** @returns char * 1101*971bb1a5SLionel Sambuc ** 1102*971bb1a5SLionel Sambuc *****************************************************************************/ 1103*971bb1a5SLionel Sambuc 1104*971bb1a5SLionel Sambuc char * 1105*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_context (const xcb_selinux_get_window_context_reply_t *R /**< */) 1106*971bb1a5SLionel Sambuc { 1107*971bb1a5SLionel Sambuc return (char *) (R + 1); 1108*971bb1a5SLionel Sambuc } 1109*971bb1a5SLionel Sambuc 1110*971bb1a5SLionel Sambuc 1111*971bb1a5SLionel Sambuc /***************************************************************************** 1112*971bb1a5SLionel Sambuc ** 1113*971bb1a5SLionel Sambuc ** int xcb_selinux_get_window_context_context_length 1114*971bb1a5SLionel Sambuc ** 1115*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_window_context_reply_t *R 1116*971bb1a5SLionel Sambuc ** @returns int 1117*971bb1a5SLionel Sambuc ** 1118*971bb1a5SLionel Sambuc *****************************************************************************/ 1119*971bb1a5SLionel Sambuc 1120*971bb1a5SLionel Sambuc int 1121*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_context_length (const xcb_selinux_get_window_context_reply_t *R /**< */) 1122*971bb1a5SLionel Sambuc { 1123*971bb1a5SLionel Sambuc return R->context_len; 1124*971bb1a5SLionel Sambuc } 1125*971bb1a5SLionel Sambuc 1126*971bb1a5SLionel Sambuc 1127*971bb1a5SLionel Sambuc /***************************************************************************** 1128*971bb1a5SLionel Sambuc ** 1129*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_window_context_context_end 1130*971bb1a5SLionel Sambuc ** 1131*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_window_context_reply_t *R 1132*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 1133*971bb1a5SLionel Sambuc ** 1134*971bb1a5SLionel Sambuc *****************************************************************************/ 1135*971bb1a5SLionel Sambuc 1136*971bb1a5SLionel Sambuc xcb_generic_iterator_t 1137*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_context_end (const xcb_selinux_get_window_context_reply_t *R /**< */) 1138*971bb1a5SLionel Sambuc { 1139*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 1140*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 1141*971bb1a5SLionel Sambuc i.rem = 0; 1142*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 1143*971bb1a5SLionel Sambuc return i; 1144*971bb1a5SLionel Sambuc } 1145*971bb1a5SLionel Sambuc 1146*971bb1a5SLionel Sambuc 1147*971bb1a5SLionel Sambuc /***************************************************************************** 1148*971bb1a5SLionel Sambuc ** 1149*971bb1a5SLionel Sambuc ** xcb_selinux_get_window_context_reply_t * xcb_selinux_get_window_context_reply 1150*971bb1a5SLionel Sambuc ** 1151*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1152*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_window_context_cookie_t cookie 1153*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 1154*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_window_context_reply_t * 1155*971bb1a5SLionel Sambuc ** 1156*971bb1a5SLionel Sambuc *****************************************************************************/ 1157*971bb1a5SLionel Sambuc 1158*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_reply_t * 1159*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_reply (xcb_connection_t *c /**< */, 1160*971bb1a5SLionel Sambuc xcb_selinux_get_window_context_cookie_t cookie /**< */, 1161*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 1162*971bb1a5SLionel Sambuc { 1163*971bb1a5SLionel Sambuc return (xcb_selinux_get_window_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 1164*971bb1a5SLionel Sambuc } 1165*971bb1a5SLionel Sambuc 1166*971bb1a5SLionel Sambuc int 1167*971bb1a5SLionel Sambuc xcb_selinux_list_item_sizeof (const void *_buffer /**< */) 1168*971bb1a5SLionel Sambuc { 1169*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 1170*971bb1a5SLionel Sambuc const xcb_selinux_list_item_t *_aux = (xcb_selinux_list_item_t *)_buffer; 1171*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 1172*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 1173*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 1174*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 1175*971bb1a5SLionel Sambuc 1176*971bb1a5SLionel Sambuc 1177*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_list_item_t); 1178*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1179*971bb1a5SLionel Sambuc /* object_context */ 1180*971bb1a5SLionel Sambuc xcb_block_len += _aux->object_context_len * sizeof(char); 1181*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1182*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 1183*971bb1a5SLionel Sambuc /* insert padding */ 1184*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1185*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 1186*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 1187*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 1188*971bb1a5SLionel Sambuc xcb_pad = 0; 1189*971bb1a5SLionel Sambuc } 1190*971bb1a5SLionel Sambuc xcb_block_len = 0; 1191*971bb1a5SLionel Sambuc /* data_context */ 1192*971bb1a5SLionel Sambuc xcb_block_len += _aux->data_context_len * sizeof(char); 1193*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1194*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 1195*971bb1a5SLionel Sambuc /* insert padding */ 1196*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1197*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 1198*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 1199*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 1200*971bb1a5SLionel Sambuc xcb_pad = 0; 1201*971bb1a5SLionel Sambuc } 1202*971bb1a5SLionel Sambuc xcb_block_len = 0; 1203*971bb1a5SLionel Sambuc 1204*971bb1a5SLionel Sambuc return xcb_buffer_len; 1205*971bb1a5SLionel Sambuc } 1206*971bb1a5SLionel Sambuc 1207*971bb1a5SLionel Sambuc 1208*971bb1a5SLionel Sambuc /***************************************************************************** 1209*971bb1a5SLionel Sambuc ** 1210*971bb1a5SLionel Sambuc ** char * xcb_selinux_list_item_object_context 1211*971bb1a5SLionel Sambuc ** 1212*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_item_t *R 1213*971bb1a5SLionel Sambuc ** @returns char * 1214*971bb1a5SLionel Sambuc ** 1215*971bb1a5SLionel Sambuc *****************************************************************************/ 1216*971bb1a5SLionel Sambuc 1217*971bb1a5SLionel Sambuc char * 1218*971bb1a5SLionel Sambuc xcb_selinux_list_item_object_context (const xcb_selinux_list_item_t *R /**< */) 1219*971bb1a5SLionel Sambuc { 1220*971bb1a5SLionel Sambuc return (char *) (R + 1); 1221*971bb1a5SLionel Sambuc } 1222*971bb1a5SLionel Sambuc 1223*971bb1a5SLionel Sambuc 1224*971bb1a5SLionel Sambuc /***************************************************************************** 1225*971bb1a5SLionel Sambuc ** 1226*971bb1a5SLionel Sambuc ** int xcb_selinux_list_item_object_context_length 1227*971bb1a5SLionel Sambuc ** 1228*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_item_t *R 1229*971bb1a5SLionel Sambuc ** @returns int 1230*971bb1a5SLionel Sambuc ** 1231*971bb1a5SLionel Sambuc *****************************************************************************/ 1232*971bb1a5SLionel Sambuc 1233*971bb1a5SLionel Sambuc int 1234*971bb1a5SLionel Sambuc xcb_selinux_list_item_object_context_length (const xcb_selinux_list_item_t *R /**< */) 1235*971bb1a5SLionel Sambuc { 1236*971bb1a5SLionel Sambuc return R->object_context_len; 1237*971bb1a5SLionel Sambuc } 1238*971bb1a5SLionel Sambuc 1239*971bb1a5SLionel Sambuc 1240*971bb1a5SLionel Sambuc /***************************************************************************** 1241*971bb1a5SLionel Sambuc ** 1242*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_list_item_object_context_end 1243*971bb1a5SLionel Sambuc ** 1244*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_item_t *R 1245*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 1246*971bb1a5SLionel Sambuc ** 1247*971bb1a5SLionel Sambuc *****************************************************************************/ 1248*971bb1a5SLionel Sambuc 1249*971bb1a5SLionel Sambuc xcb_generic_iterator_t 1250*971bb1a5SLionel Sambuc xcb_selinux_list_item_object_context_end (const xcb_selinux_list_item_t *R /**< */) 1251*971bb1a5SLionel Sambuc { 1252*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 1253*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->object_context_len); 1254*971bb1a5SLionel Sambuc i.rem = 0; 1255*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 1256*971bb1a5SLionel Sambuc return i; 1257*971bb1a5SLionel Sambuc } 1258*971bb1a5SLionel Sambuc 1259*971bb1a5SLionel Sambuc 1260*971bb1a5SLionel Sambuc /***************************************************************************** 1261*971bb1a5SLionel Sambuc ** 1262*971bb1a5SLionel Sambuc ** char * xcb_selinux_list_item_data_context 1263*971bb1a5SLionel Sambuc ** 1264*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_item_t *R 1265*971bb1a5SLionel Sambuc ** @returns char * 1266*971bb1a5SLionel Sambuc ** 1267*971bb1a5SLionel Sambuc *****************************************************************************/ 1268*971bb1a5SLionel Sambuc 1269*971bb1a5SLionel Sambuc char * 1270*971bb1a5SLionel Sambuc xcb_selinux_list_item_data_context (const xcb_selinux_list_item_t *R /**< */) 1271*971bb1a5SLionel Sambuc { 1272*971bb1a5SLionel Sambuc xcb_generic_iterator_t prev = xcb_selinux_list_item_object_context_end(R); 1273*971bb1a5SLionel Sambuc return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); 1274*971bb1a5SLionel Sambuc } 1275*971bb1a5SLionel Sambuc 1276*971bb1a5SLionel Sambuc 1277*971bb1a5SLionel Sambuc /***************************************************************************** 1278*971bb1a5SLionel Sambuc ** 1279*971bb1a5SLionel Sambuc ** int xcb_selinux_list_item_data_context_length 1280*971bb1a5SLionel Sambuc ** 1281*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_item_t *R 1282*971bb1a5SLionel Sambuc ** @returns int 1283*971bb1a5SLionel Sambuc ** 1284*971bb1a5SLionel Sambuc *****************************************************************************/ 1285*971bb1a5SLionel Sambuc 1286*971bb1a5SLionel Sambuc int 1287*971bb1a5SLionel Sambuc xcb_selinux_list_item_data_context_length (const xcb_selinux_list_item_t *R /**< */) 1288*971bb1a5SLionel Sambuc { 1289*971bb1a5SLionel Sambuc return R->data_context_len; 1290*971bb1a5SLionel Sambuc } 1291*971bb1a5SLionel Sambuc 1292*971bb1a5SLionel Sambuc 1293*971bb1a5SLionel Sambuc /***************************************************************************** 1294*971bb1a5SLionel Sambuc ** 1295*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_list_item_data_context_end 1296*971bb1a5SLionel Sambuc ** 1297*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_item_t *R 1298*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 1299*971bb1a5SLionel Sambuc ** 1300*971bb1a5SLionel Sambuc *****************************************************************************/ 1301*971bb1a5SLionel Sambuc 1302*971bb1a5SLionel Sambuc xcb_generic_iterator_t 1303*971bb1a5SLionel Sambuc xcb_selinux_list_item_data_context_end (const xcb_selinux_list_item_t *R /**< */) 1304*971bb1a5SLionel Sambuc { 1305*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 1306*971bb1a5SLionel Sambuc xcb_generic_iterator_t child = xcb_selinux_list_item_object_context_end(R); 1307*971bb1a5SLionel Sambuc i.data = ((char *) child.data) + (R->data_context_len); 1308*971bb1a5SLionel Sambuc i.rem = 0; 1309*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 1310*971bb1a5SLionel Sambuc return i; 1311*971bb1a5SLionel Sambuc } 1312*971bb1a5SLionel Sambuc 1313*971bb1a5SLionel Sambuc 1314*971bb1a5SLionel Sambuc /***************************************************************************** 1315*971bb1a5SLionel Sambuc ** 1316*971bb1a5SLionel Sambuc ** void xcb_selinux_list_item_next 1317*971bb1a5SLionel Sambuc ** 1318*971bb1a5SLionel Sambuc ** @param xcb_selinux_list_item_iterator_t *i 1319*971bb1a5SLionel Sambuc ** @returns void 1320*971bb1a5SLionel Sambuc ** 1321*971bb1a5SLionel Sambuc *****************************************************************************/ 1322*971bb1a5SLionel Sambuc 1323*971bb1a5SLionel Sambuc void 1324*971bb1a5SLionel Sambuc xcb_selinux_list_item_next (xcb_selinux_list_item_iterator_t *i /**< */) 1325*971bb1a5SLionel Sambuc { 1326*971bb1a5SLionel Sambuc xcb_selinux_list_item_t *R = i->data; 1327*971bb1a5SLionel Sambuc xcb_generic_iterator_t child; 1328*971bb1a5SLionel Sambuc child.data = (xcb_selinux_list_item_t *)(((char *)R) + xcb_selinux_list_item_sizeof(R)); 1329*971bb1a5SLionel Sambuc i->index = (char *) child.data - (char *) i->data; 1330*971bb1a5SLionel Sambuc --i->rem; 1331*971bb1a5SLionel Sambuc i->data = (xcb_selinux_list_item_t *) child.data; 1332*971bb1a5SLionel Sambuc } 1333*971bb1a5SLionel Sambuc 1334*971bb1a5SLionel Sambuc 1335*971bb1a5SLionel Sambuc /***************************************************************************** 1336*971bb1a5SLionel Sambuc ** 1337*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_list_item_end 1338*971bb1a5SLionel Sambuc ** 1339*971bb1a5SLionel Sambuc ** @param xcb_selinux_list_item_iterator_t i 1340*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 1341*971bb1a5SLionel Sambuc ** 1342*971bb1a5SLionel Sambuc *****************************************************************************/ 1343*971bb1a5SLionel Sambuc 1344*971bb1a5SLionel Sambuc xcb_generic_iterator_t 1345*971bb1a5SLionel Sambuc xcb_selinux_list_item_end (xcb_selinux_list_item_iterator_t i /**< */) 1346*971bb1a5SLionel Sambuc { 1347*971bb1a5SLionel Sambuc xcb_generic_iterator_t ret; 1348*971bb1a5SLionel Sambuc while(i.rem > 0) 1349*971bb1a5SLionel Sambuc xcb_selinux_list_item_next(&i); 1350*971bb1a5SLionel Sambuc ret.data = i.data; 1351*971bb1a5SLionel Sambuc ret.rem = i.rem; 1352*971bb1a5SLionel Sambuc ret.index = i.index; 1353*971bb1a5SLionel Sambuc return ret; 1354*971bb1a5SLionel Sambuc } 1355*971bb1a5SLionel Sambuc 1356*971bb1a5SLionel Sambuc int 1357*971bb1a5SLionel Sambuc xcb_selinux_set_property_create_context_sizeof (const void *_buffer /**< */) 1358*971bb1a5SLionel Sambuc { 1359*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 1360*971bb1a5SLionel Sambuc const xcb_selinux_set_property_create_context_request_t *_aux = (xcb_selinux_set_property_create_context_request_t *)_buffer; 1361*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 1362*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 1363*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 1364*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 1365*971bb1a5SLionel Sambuc 1366*971bb1a5SLionel Sambuc 1367*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_set_property_create_context_request_t); 1368*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1369*971bb1a5SLionel Sambuc /* context */ 1370*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 1371*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1372*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 1373*971bb1a5SLionel Sambuc /* insert padding */ 1374*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1375*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 1376*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 1377*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 1378*971bb1a5SLionel Sambuc xcb_pad = 0; 1379*971bb1a5SLionel Sambuc } 1380*971bb1a5SLionel Sambuc xcb_block_len = 0; 1381*971bb1a5SLionel Sambuc 1382*971bb1a5SLionel Sambuc return xcb_buffer_len; 1383*971bb1a5SLionel Sambuc } 1384*971bb1a5SLionel Sambuc 1385*971bb1a5SLionel Sambuc 1386*971bb1a5SLionel Sambuc /***************************************************************************** 1387*971bb1a5SLionel Sambuc ** 1388*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_property_create_context_checked 1389*971bb1a5SLionel Sambuc ** 1390*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1391*971bb1a5SLionel Sambuc ** @param uint32_t context_len 1392*971bb1a5SLionel Sambuc ** @param const char *context 1393*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 1394*971bb1a5SLionel Sambuc ** 1395*971bb1a5SLionel Sambuc *****************************************************************************/ 1396*971bb1a5SLionel Sambuc 1397*971bb1a5SLionel Sambuc xcb_void_cookie_t 1398*971bb1a5SLionel Sambuc xcb_selinux_set_property_create_context_checked (xcb_connection_t *c /**< */, 1399*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 1400*971bb1a5SLionel Sambuc const char *context /**< */) 1401*971bb1a5SLionel Sambuc { 1402*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1403*971bb1a5SLionel Sambuc /* count */ 4, 1404*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1405*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_PROPERTY_CREATE_CONTEXT, 1406*971bb1a5SLionel Sambuc /* isvoid */ 1 1407*971bb1a5SLionel Sambuc }; 1408*971bb1a5SLionel Sambuc 1409*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 1410*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 1411*971bb1a5SLionel Sambuc xcb_selinux_set_property_create_context_request_t xcb_out; 1412*971bb1a5SLionel Sambuc 1413*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 1414*971bb1a5SLionel Sambuc 1415*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1416*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1417*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1418*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1419*971bb1a5SLionel Sambuc /* char context */ 1420*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 1421*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 1422*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 1423*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 1424*971bb1a5SLionel Sambuc 1425*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1426*971bb1a5SLionel Sambuc return xcb_ret; 1427*971bb1a5SLionel Sambuc } 1428*971bb1a5SLionel Sambuc 1429*971bb1a5SLionel Sambuc 1430*971bb1a5SLionel Sambuc /***************************************************************************** 1431*971bb1a5SLionel Sambuc ** 1432*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_property_create_context 1433*971bb1a5SLionel Sambuc ** 1434*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1435*971bb1a5SLionel Sambuc ** @param uint32_t context_len 1436*971bb1a5SLionel Sambuc ** @param const char *context 1437*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 1438*971bb1a5SLionel Sambuc ** 1439*971bb1a5SLionel Sambuc *****************************************************************************/ 1440*971bb1a5SLionel Sambuc 1441*971bb1a5SLionel Sambuc xcb_void_cookie_t 1442*971bb1a5SLionel Sambuc xcb_selinux_set_property_create_context (xcb_connection_t *c /**< */, 1443*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 1444*971bb1a5SLionel Sambuc const char *context /**< */) 1445*971bb1a5SLionel Sambuc { 1446*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1447*971bb1a5SLionel Sambuc /* count */ 4, 1448*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1449*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_PROPERTY_CREATE_CONTEXT, 1450*971bb1a5SLionel Sambuc /* isvoid */ 1 1451*971bb1a5SLionel Sambuc }; 1452*971bb1a5SLionel Sambuc 1453*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 1454*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 1455*971bb1a5SLionel Sambuc xcb_selinux_set_property_create_context_request_t xcb_out; 1456*971bb1a5SLionel Sambuc 1457*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 1458*971bb1a5SLionel Sambuc 1459*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1460*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1461*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1462*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1463*971bb1a5SLionel Sambuc /* char context */ 1464*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 1465*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 1466*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 1467*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 1468*971bb1a5SLionel Sambuc 1469*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1470*971bb1a5SLionel Sambuc return xcb_ret; 1471*971bb1a5SLionel Sambuc } 1472*971bb1a5SLionel Sambuc 1473*971bb1a5SLionel Sambuc int 1474*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_sizeof (const void *_buffer /**< */) 1475*971bb1a5SLionel Sambuc { 1476*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 1477*971bb1a5SLionel Sambuc const xcb_selinux_get_property_create_context_reply_t *_aux = (xcb_selinux_get_property_create_context_reply_t *)_buffer; 1478*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 1479*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 1480*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 1481*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 1482*971bb1a5SLionel Sambuc 1483*971bb1a5SLionel Sambuc 1484*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_property_create_context_reply_t); 1485*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1486*971bb1a5SLionel Sambuc /* context */ 1487*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 1488*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1489*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 1490*971bb1a5SLionel Sambuc /* insert padding */ 1491*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1492*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 1493*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 1494*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 1495*971bb1a5SLionel Sambuc xcb_pad = 0; 1496*971bb1a5SLionel Sambuc } 1497*971bb1a5SLionel Sambuc xcb_block_len = 0; 1498*971bb1a5SLionel Sambuc 1499*971bb1a5SLionel Sambuc return xcb_buffer_len; 1500*971bb1a5SLionel Sambuc } 1501*971bb1a5SLionel Sambuc 1502*971bb1a5SLionel Sambuc 1503*971bb1a5SLionel Sambuc /***************************************************************************** 1504*971bb1a5SLionel Sambuc ** 1505*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_create_context_cookie_t xcb_selinux_get_property_create_context 1506*971bb1a5SLionel Sambuc ** 1507*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1508*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_create_context_cookie_t 1509*971bb1a5SLionel Sambuc ** 1510*971bb1a5SLionel Sambuc *****************************************************************************/ 1511*971bb1a5SLionel Sambuc 1512*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_cookie_t 1513*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context (xcb_connection_t *c /**< */) 1514*971bb1a5SLionel Sambuc { 1515*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1516*971bb1a5SLionel Sambuc /* count */ 2, 1517*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1518*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_PROPERTY_CREATE_CONTEXT, 1519*971bb1a5SLionel Sambuc /* isvoid */ 0 1520*971bb1a5SLionel Sambuc }; 1521*971bb1a5SLionel Sambuc 1522*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 1523*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_cookie_t xcb_ret; 1524*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_request_t xcb_out; 1525*971bb1a5SLionel Sambuc 1526*971bb1a5SLionel Sambuc 1527*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1528*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1529*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1530*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1531*971bb1a5SLionel Sambuc 1532*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1533*971bb1a5SLionel Sambuc return xcb_ret; 1534*971bb1a5SLionel Sambuc } 1535*971bb1a5SLionel Sambuc 1536*971bb1a5SLionel Sambuc 1537*971bb1a5SLionel Sambuc /***************************************************************************** 1538*971bb1a5SLionel Sambuc ** 1539*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_create_context_cookie_t xcb_selinux_get_property_create_context_unchecked 1540*971bb1a5SLionel Sambuc ** 1541*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1542*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_create_context_cookie_t 1543*971bb1a5SLionel Sambuc ** 1544*971bb1a5SLionel Sambuc *****************************************************************************/ 1545*971bb1a5SLionel Sambuc 1546*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_cookie_t 1547*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_unchecked (xcb_connection_t *c /**< */) 1548*971bb1a5SLionel Sambuc { 1549*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1550*971bb1a5SLionel Sambuc /* count */ 2, 1551*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1552*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_PROPERTY_CREATE_CONTEXT, 1553*971bb1a5SLionel Sambuc /* isvoid */ 0 1554*971bb1a5SLionel Sambuc }; 1555*971bb1a5SLionel Sambuc 1556*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 1557*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_cookie_t xcb_ret; 1558*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_request_t xcb_out; 1559*971bb1a5SLionel Sambuc 1560*971bb1a5SLionel Sambuc 1561*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1562*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1563*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1564*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1565*971bb1a5SLionel Sambuc 1566*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1567*971bb1a5SLionel Sambuc return xcb_ret; 1568*971bb1a5SLionel Sambuc } 1569*971bb1a5SLionel Sambuc 1570*971bb1a5SLionel Sambuc 1571*971bb1a5SLionel Sambuc /***************************************************************************** 1572*971bb1a5SLionel Sambuc ** 1573*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_property_create_context_context 1574*971bb1a5SLionel Sambuc ** 1575*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_create_context_reply_t *R 1576*971bb1a5SLionel Sambuc ** @returns char * 1577*971bb1a5SLionel Sambuc ** 1578*971bb1a5SLionel Sambuc *****************************************************************************/ 1579*971bb1a5SLionel Sambuc 1580*971bb1a5SLionel Sambuc char * 1581*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_context (const xcb_selinux_get_property_create_context_reply_t *R /**< */) 1582*971bb1a5SLionel Sambuc { 1583*971bb1a5SLionel Sambuc return (char *) (R + 1); 1584*971bb1a5SLionel Sambuc } 1585*971bb1a5SLionel Sambuc 1586*971bb1a5SLionel Sambuc 1587*971bb1a5SLionel Sambuc /***************************************************************************** 1588*971bb1a5SLionel Sambuc ** 1589*971bb1a5SLionel Sambuc ** int xcb_selinux_get_property_create_context_context_length 1590*971bb1a5SLionel Sambuc ** 1591*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_create_context_reply_t *R 1592*971bb1a5SLionel Sambuc ** @returns int 1593*971bb1a5SLionel Sambuc ** 1594*971bb1a5SLionel Sambuc *****************************************************************************/ 1595*971bb1a5SLionel Sambuc 1596*971bb1a5SLionel Sambuc int 1597*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_context_length (const xcb_selinux_get_property_create_context_reply_t *R /**< */) 1598*971bb1a5SLionel Sambuc { 1599*971bb1a5SLionel Sambuc return R->context_len; 1600*971bb1a5SLionel Sambuc } 1601*971bb1a5SLionel Sambuc 1602*971bb1a5SLionel Sambuc 1603*971bb1a5SLionel Sambuc /***************************************************************************** 1604*971bb1a5SLionel Sambuc ** 1605*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_property_create_context_context_end 1606*971bb1a5SLionel Sambuc ** 1607*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_create_context_reply_t *R 1608*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 1609*971bb1a5SLionel Sambuc ** 1610*971bb1a5SLionel Sambuc *****************************************************************************/ 1611*971bb1a5SLionel Sambuc 1612*971bb1a5SLionel Sambuc xcb_generic_iterator_t 1613*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_context_end (const xcb_selinux_get_property_create_context_reply_t *R /**< */) 1614*971bb1a5SLionel Sambuc { 1615*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 1616*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 1617*971bb1a5SLionel Sambuc i.rem = 0; 1618*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 1619*971bb1a5SLionel Sambuc return i; 1620*971bb1a5SLionel Sambuc } 1621*971bb1a5SLionel Sambuc 1622*971bb1a5SLionel Sambuc 1623*971bb1a5SLionel Sambuc /***************************************************************************** 1624*971bb1a5SLionel Sambuc ** 1625*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_create_context_reply_t * xcb_selinux_get_property_create_context_reply 1626*971bb1a5SLionel Sambuc ** 1627*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1628*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_property_create_context_cookie_t cookie 1629*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 1630*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_create_context_reply_t * 1631*971bb1a5SLionel Sambuc ** 1632*971bb1a5SLionel Sambuc *****************************************************************************/ 1633*971bb1a5SLionel Sambuc 1634*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_reply_t * 1635*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_reply (xcb_connection_t *c /**< */, 1636*971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_cookie_t cookie /**< */, 1637*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 1638*971bb1a5SLionel Sambuc { 1639*971bb1a5SLionel Sambuc return (xcb_selinux_get_property_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 1640*971bb1a5SLionel Sambuc } 1641*971bb1a5SLionel Sambuc 1642*971bb1a5SLionel Sambuc int 1643*971bb1a5SLionel Sambuc xcb_selinux_set_property_use_context_sizeof (const void *_buffer /**< */) 1644*971bb1a5SLionel Sambuc { 1645*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 1646*971bb1a5SLionel Sambuc const xcb_selinux_set_property_use_context_request_t *_aux = (xcb_selinux_set_property_use_context_request_t *)_buffer; 1647*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 1648*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 1649*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 1650*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 1651*971bb1a5SLionel Sambuc 1652*971bb1a5SLionel Sambuc 1653*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_set_property_use_context_request_t); 1654*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1655*971bb1a5SLionel Sambuc /* context */ 1656*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 1657*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1658*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 1659*971bb1a5SLionel Sambuc /* insert padding */ 1660*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1661*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 1662*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 1663*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 1664*971bb1a5SLionel Sambuc xcb_pad = 0; 1665*971bb1a5SLionel Sambuc } 1666*971bb1a5SLionel Sambuc xcb_block_len = 0; 1667*971bb1a5SLionel Sambuc 1668*971bb1a5SLionel Sambuc return xcb_buffer_len; 1669*971bb1a5SLionel Sambuc } 1670*971bb1a5SLionel Sambuc 1671*971bb1a5SLionel Sambuc 1672*971bb1a5SLionel Sambuc /***************************************************************************** 1673*971bb1a5SLionel Sambuc ** 1674*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_property_use_context_checked 1675*971bb1a5SLionel Sambuc ** 1676*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1677*971bb1a5SLionel Sambuc ** @param uint32_t context_len 1678*971bb1a5SLionel Sambuc ** @param const char *context 1679*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 1680*971bb1a5SLionel Sambuc ** 1681*971bb1a5SLionel Sambuc *****************************************************************************/ 1682*971bb1a5SLionel Sambuc 1683*971bb1a5SLionel Sambuc xcb_void_cookie_t 1684*971bb1a5SLionel Sambuc xcb_selinux_set_property_use_context_checked (xcb_connection_t *c /**< */, 1685*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 1686*971bb1a5SLionel Sambuc const char *context /**< */) 1687*971bb1a5SLionel Sambuc { 1688*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1689*971bb1a5SLionel Sambuc /* count */ 4, 1690*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1691*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_PROPERTY_USE_CONTEXT, 1692*971bb1a5SLionel Sambuc /* isvoid */ 1 1693*971bb1a5SLionel Sambuc }; 1694*971bb1a5SLionel Sambuc 1695*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 1696*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 1697*971bb1a5SLionel Sambuc xcb_selinux_set_property_use_context_request_t xcb_out; 1698*971bb1a5SLionel Sambuc 1699*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 1700*971bb1a5SLionel Sambuc 1701*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1702*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1703*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1704*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1705*971bb1a5SLionel Sambuc /* char context */ 1706*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 1707*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 1708*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 1709*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 1710*971bb1a5SLionel Sambuc 1711*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1712*971bb1a5SLionel Sambuc return xcb_ret; 1713*971bb1a5SLionel Sambuc } 1714*971bb1a5SLionel Sambuc 1715*971bb1a5SLionel Sambuc 1716*971bb1a5SLionel Sambuc /***************************************************************************** 1717*971bb1a5SLionel Sambuc ** 1718*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_property_use_context 1719*971bb1a5SLionel Sambuc ** 1720*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1721*971bb1a5SLionel Sambuc ** @param uint32_t context_len 1722*971bb1a5SLionel Sambuc ** @param const char *context 1723*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 1724*971bb1a5SLionel Sambuc ** 1725*971bb1a5SLionel Sambuc *****************************************************************************/ 1726*971bb1a5SLionel Sambuc 1727*971bb1a5SLionel Sambuc xcb_void_cookie_t 1728*971bb1a5SLionel Sambuc xcb_selinux_set_property_use_context (xcb_connection_t *c /**< */, 1729*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 1730*971bb1a5SLionel Sambuc const char *context /**< */) 1731*971bb1a5SLionel Sambuc { 1732*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1733*971bb1a5SLionel Sambuc /* count */ 4, 1734*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1735*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_PROPERTY_USE_CONTEXT, 1736*971bb1a5SLionel Sambuc /* isvoid */ 1 1737*971bb1a5SLionel Sambuc }; 1738*971bb1a5SLionel Sambuc 1739*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 1740*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 1741*971bb1a5SLionel Sambuc xcb_selinux_set_property_use_context_request_t xcb_out; 1742*971bb1a5SLionel Sambuc 1743*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 1744*971bb1a5SLionel Sambuc 1745*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1746*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1747*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1748*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1749*971bb1a5SLionel Sambuc /* char context */ 1750*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 1751*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 1752*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 1753*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 1754*971bb1a5SLionel Sambuc 1755*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1756*971bb1a5SLionel Sambuc return xcb_ret; 1757*971bb1a5SLionel Sambuc } 1758*971bb1a5SLionel Sambuc 1759*971bb1a5SLionel Sambuc int 1760*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_sizeof (const void *_buffer /**< */) 1761*971bb1a5SLionel Sambuc { 1762*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 1763*971bb1a5SLionel Sambuc const xcb_selinux_get_property_use_context_reply_t *_aux = (xcb_selinux_get_property_use_context_reply_t *)_buffer; 1764*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 1765*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 1766*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 1767*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 1768*971bb1a5SLionel Sambuc 1769*971bb1a5SLionel Sambuc 1770*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_property_use_context_reply_t); 1771*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1772*971bb1a5SLionel Sambuc /* context */ 1773*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 1774*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1775*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 1776*971bb1a5SLionel Sambuc /* insert padding */ 1777*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1778*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 1779*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 1780*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 1781*971bb1a5SLionel Sambuc xcb_pad = 0; 1782*971bb1a5SLionel Sambuc } 1783*971bb1a5SLionel Sambuc xcb_block_len = 0; 1784*971bb1a5SLionel Sambuc 1785*971bb1a5SLionel Sambuc return xcb_buffer_len; 1786*971bb1a5SLionel Sambuc } 1787*971bb1a5SLionel Sambuc 1788*971bb1a5SLionel Sambuc 1789*971bb1a5SLionel Sambuc /***************************************************************************** 1790*971bb1a5SLionel Sambuc ** 1791*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_use_context_cookie_t xcb_selinux_get_property_use_context 1792*971bb1a5SLionel Sambuc ** 1793*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1794*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_use_context_cookie_t 1795*971bb1a5SLionel Sambuc ** 1796*971bb1a5SLionel Sambuc *****************************************************************************/ 1797*971bb1a5SLionel Sambuc 1798*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_cookie_t 1799*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context (xcb_connection_t *c /**< */) 1800*971bb1a5SLionel Sambuc { 1801*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1802*971bb1a5SLionel Sambuc /* count */ 2, 1803*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1804*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_PROPERTY_USE_CONTEXT, 1805*971bb1a5SLionel Sambuc /* isvoid */ 0 1806*971bb1a5SLionel Sambuc }; 1807*971bb1a5SLionel Sambuc 1808*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 1809*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_cookie_t xcb_ret; 1810*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_request_t xcb_out; 1811*971bb1a5SLionel Sambuc 1812*971bb1a5SLionel Sambuc 1813*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1814*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1815*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1816*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1817*971bb1a5SLionel Sambuc 1818*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1819*971bb1a5SLionel Sambuc return xcb_ret; 1820*971bb1a5SLionel Sambuc } 1821*971bb1a5SLionel Sambuc 1822*971bb1a5SLionel Sambuc 1823*971bb1a5SLionel Sambuc /***************************************************************************** 1824*971bb1a5SLionel Sambuc ** 1825*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_use_context_cookie_t xcb_selinux_get_property_use_context_unchecked 1826*971bb1a5SLionel Sambuc ** 1827*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1828*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_use_context_cookie_t 1829*971bb1a5SLionel Sambuc ** 1830*971bb1a5SLionel Sambuc *****************************************************************************/ 1831*971bb1a5SLionel Sambuc 1832*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_cookie_t 1833*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_unchecked (xcb_connection_t *c /**< */) 1834*971bb1a5SLionel Sambuc { 1835*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1836*971bb1a5SLionel Sambuc /* count */ 2, 1837*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1838*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_PROPERTY_USE_CONTEXT, 1839*971bb1a5SLionel Sambuc /* isvoid */ 0 1840*971bb1a5SLionel Sambuc }; 1841*971bb1a5SLionel Sambuc 1842*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 1843*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_cookie_t xcb_ret; 1844*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_request_t xcb_out; 1845*971bb1a5SLionel Sambuc 1846*971bb1a5SLionel Sambuc 1847*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1848*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1849*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1850*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1851*971bb1a5SLionel Sambuc 1852*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1853*971bb1a5SLionel Sambuc return xcb_ret; 1854*971bb1a5SLionel Sambuc } 1855*971bb1a5SLionel Sambuc 1856*971bb1a5SLionel Sambuc 1857*971bb1a5SLionel Sambuc /***************************************************************************** 1858*971bb1a5SLionel Sambuc ** 1859*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_property_use_context_context 1860*971bb1a5SLionel Sambuc ** 1861*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_use_context_reply_t *R 1862*971bb1a5SLionel Sambuc ** @returns char * 1863*971bb1a5SLionel Sambuc ** 1864*971bb1a5SLionel Sambuc *****************************************************************************/ 1865*971bb1a5SLionel Sambuc 1866*971bb1a5SLionel Sambuc char * 1867*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_context (const xcb_selinux_get_property_use_context_reply_t *R /**< */) 1868*971bb1a5SLionel Sambuc { 1869*971bb1a5SLionel Sambuc return (char *) (R + 1); 1870*971bb1a5SLionel Sambuc } 1871*971bb1a5SLionel Sambuc 1872*971bb1a5SLionel Sambuc 1873*971bb1a5SLionel Sambuc /***************************************************************************** 1874*971bb1a5SLionel Sambuc ** 1875*971bb1a5SLionel Sambuc ** int xcb_selinux_get_property_use_context_context_length 1876*971bb1a5SLionel Sambuc ** 1877*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_use_context_reply_t *R 1878*971bb1a5SLionel Sambuc ** @returns int 1879*971bb1a5SLionel Sambuc ** 1880*971bb1a5SLionel Sambuc *****************************************************************************/ 1881*971bb1a5SLionel Sambuc 1882*971bb1a5SLionel Sambuc int 1883*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_context_length (const xcb_selinux_get_property_use_context_reply_t *R /**< */) 1884*971bb1a5SLionel Sambuc { 1885*971bb1a5SLionel Sambuc return R->context_len; 1886*971bb1a5SLionel Sambuc } 1887*971bb1a5SLionel Sambuc 1888*971bb1a5SLionel Sambuc 1889*971bb1a5SLionel Sambuc /***************************************************************************** 1890*971bb1a5SLionel Sambuc ** 1891*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_property_use_context_context_end 1892*971bb1a5SLionel Sambuc ** 1893*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_use_context_reply_t *R 1894*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 1895*971bb1a5SLionel Sambuc ** 1896*971bb1a5SLionel Sambuc *****************************************************************************/ 1897*971bb1a5SLionel Sambuc 1898*971bb1a5SLionel Sambuc xcb_generic_iterator_t 1899*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_context_end (const xcb_selinux_get_property_use_context_reply_t *R /**< */) 1900*971bb1a5SLionel Sambuc { 1901*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 1902*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 1903*971bb1a5SLionel Sambuc i.rem = 0; 1904*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 1905*971bb1a5SLionel Sambuc return i; 1906*971bb1a5SLionel Sambuc } 1907*971bb1a5SLionel Sambuc 1908*971bb1a5SLionel Sambuc 1909*971bb1a5SLionel Sambuc /***************************************************************************** 1910*971bb1a5SLionel Sambuc ** 1911*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_use_context_reply_t * xcb_selinux_get_property_use_context_reply 1912*971bb1a5SLionel Sambuc ** 1913*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1914*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_property_use_context_cookie_t cookie 1915*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 1916*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_use_context_reply_t * 1917*971bb1a5SLionel Sambuc ** 1918*971bb1a5SLionel Sambuc *****************************************************************************/ 1919*971bb1a5SLionel Sambuc 1920*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_reply_t * 1921*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_reply (xcb_connection_t *c /**< */, 1922*971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_cookie_t cookie /**< */, 1923*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 1924*971bb1a5SLionel Sambuc { 1925*971bb1a5SLionel Sambuc return (xcb_selinux_get_property_use_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 1926*971bb1a5SLionel Sambuc } 1927*971bb1a5SLionel Sambuc 1928*971bb1a5SLionel Sambuc int 1929*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_sizeof (const void *_buffer /**< */) 1930*971bb1a5SLionel Sambuc { 1931*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 1932*971bb1a5SLionel Sambuc const xcb_selinux_get_property_context_reply_t *_aux = (xcb_selinux_get_property_context_reply_t *)_buffer; 1933*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 1934*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 1935*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 1936*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 1937*971bb1a5SLionel Sambuc 1938*971bb1a5SLionel Sambuc 1939*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_property_context_reply_t); 1940*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1941*971bb1a5SLionel Sambuc /* context */ 1942*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 1943*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 1944*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 1945*971bb1a5SLionel Sambuc /* insert padding */ 1946*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1947*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 1948*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 1949*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 1950*971bb1a5SLionel Sambuc xcb_pad = 0; 1951*971bb1a5SLionel Sambuc } 1952*971bb1a5SLionel Sambuc xcb_block_len = 0; 1953*971bb1a5SLionel Sambuc 1954*971bb1a5SLionel Sambuc return xcb_buffer_len; 1955*971bb1a5SLionel Sambuc } 1956*971bb1a5SLionel Sambuc 1957*971bb1a5SLionel Sambuc 1958*971bb1a5SLionel Sambuc /***************************************************************************** 1959*971bb1a5SLionel Sambuc ** 1960*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_context_cookie_t xcb_selinux_get_property_context 1961*971bb1a5SLionel Sambuc ** 1962*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 1963*971bb1a5SLionel Sambuc ** @param xcb_window_t window 1964*971bb1a5SLionel Sambuc ** @param xcb_atom_t property 1965*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_context_cookie_t 1966*971bb1a5SLionel Sambuc ** 1967*971bb1a5SLionel Sambuc *****************************************************************************/ 1968*971bb1a5SLionel Sambuc 1969*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_cookie_t 1970*971bb1a5SLionel Sambuc xcb_selinux_get_property_context (xcb_connection_t *c /**< */, 1971*971bb1a5SLionel Sambuc xcb_window_t window /**< */, 1972*971bb1a5SLionel Sambuc xcb_atom_t property /**< */) 1973*971bb1a5SLionel Sambuc { 1974*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 1975*971bb1a5SLionel Sambuc /* count */ 2, 1976*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 1977*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_PROPERTY_CONTEXT, 1978*971bb1a5SLionel Sambuc /* isvoid */ 0 1979*971bb1a5SLionel Sambuc }; 1980*971bb1a5SLionel Sambuc 1981*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 1982*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_cookie_t xcb_ret; 1983*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_request_t xcb_out; 1984*971bb1a5SLionel Sambuc 1985*971bb1a5SLionel Sambuc xcb_out.window = window; 1986*971bb1a5SLionel Sambuc xcb_out.property = property; 1987*971bb1a5SLionel Sambuc 1988*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 1989*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 1990*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 1991*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1992*971bb1a5SLionel Sambuc 1993*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1994*971bb1a5SLionel Sambuc return xcb_ret; 1995*971bb1a5SLionel Sambuc } 1996*971bb1a5SLionel Sambuc 1997*971bb1a5SLionel Sambuc 1998*971bb1a5SLionel Sambuc /***************************************************************************** 1999*971bb1a5SLionel Sambuc ** 2000*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_context_cookie_t xcb_selinux_get_property_context_unchecked 2001*971bb1a5SLionel Sambuc ** 2002*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2003*971bb1a5SLionel Sambuc ** @param xcb_window_t window 2004*971bb1a5SLionel Sambuc ** @param xcb_atom_t property 2005*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_context_cookie_t 2006*971bb1a5SLionel Sambuc ** 2007*971bb1a5SLionel Sambuc *****************************************************************************/ 2008*971bb1a5SLionel Sambuc 2009*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_cookie_t 2010*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_unchecked (xcb_connection_t *c /**< */, 2011*971bb1a5SLionel Sambuc xcb_window_t window /**< */, 2012*971bb1a5SLionel Sambuc xcb_atom_t property /**< */) 2013*971bb1a5SLionel Sambuc { 2014*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2015*971bb1a5SLionel Sambuc /* count */ 2, 2016*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2017*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_PROPERTY_CONTEXT, 2018*971bb1a5SLionel Sambuc /* isvoid */ 0 2019*971bb1a5SLionel Sambuc }; 2020*971bb1a5SLionel Sambuc 2021*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2022*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_cookie_t xcb_ret; 2023*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_request_t xcb_out; 2024*971bb1a5SLionel Sambuc 2025*971bb1a5SLionel Sambuc xcb_out.window = window; 2026*971bb1a5SLionel Sambuc xcb_out.property = property; 2027*971bb1a5SLionel Sambuc 2028*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2029*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2030*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2031*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2032*971bb1a5SLionel Sambuc 2033*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2034*971bb1a5SLionel Sambuc return xcb_ret; 2035*971bb1a5SLionel Sambuc } 2036*971bb1a5SLionel Sambuc 2037*971bb1a5SLionel Sambuc 2038*971bb1a5SLionel Sambuc /***************************************************************************** 2039*971bb1a5SLionel Sambuc ** 2040*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_property_context_context 2041*971bb1a5SLionel Sambuc ** 2042*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_context_reply_t *R 2043*971bb1a5SLionel Sambuc ** @returns char * 2044*971bb1a5SLionel Sambuc ** 2045*971bb1a5SLionel Sambuc *****************************************************************************/ 2046*971bb1a5SLionel Sambuc 2047*971bb1a5SLionel Sambuc char * 2048*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_context (const xcb_selinux_get_property_context_reply_t *R /**< */) 2049*971bb1a5SLionel Sambuc { 2050*971bb1a5SLionel Sambuc return (char *) (R + 1); 2051*971bb1a5SLionel Sambuc } 2052*971bb1a5SLionel Sambuc 2053*971bb1a5SLionel Sambuc 2054*971bb1a5SLionel Sambuc /***************************************************************************** 2055*971bb1a5SLionel Sambuc ** 2056*971bb1a5SLionel Sambuc ** int xcb_selinux_get_property_context_context_length 2057*971bb1a5SLionel Sambuc ** 2058*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_context_reply_t *R 2059*971bb1a5SLionel Sambuc ** @returns int 2060*971bb1a5SLionel Sambuc ** 2061*971bb1a5SLionel Sambuc *****************************************************************************/ 2062*971bb1a5SLionel Sambuc 2063*971bb1a5SLionel Sambuc int 2064*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_context_length (const xcb_selinux_get_property_context_reply_t *R /**< */) 2065*971bb1a5SLionel Sambuc { 2066*971bb1a5SLionel Sambuc return R->context_len; 2067*971bb1a5SLionel Sambuc } 2068*971bb1a5SLionel Sambuc 2069*971bb1a5SLionel Sambuc 2070*971bb1a5SLionel Sambuc /***************************************************************************** 2071*971bb1a5SLionel Sambuc ** 2072*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_property_context_context_end 2073*971bb1a5SLionel Sambuc ** 2074*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_context_reply_t *R 2075*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 2076*971bb1a5SLionel Sambuc ** 2077*971bb1a5SLionel Sambuc *****************************************************************************/ 2078*971bb1a5SLionel Sambuc 2079*971bb1a5SLionel Sambuc xcb_generic_iterator_t 2080*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_context_end (const xcb_selinux_get_property_context_reply_t *R /**< */) 2081*971bb1a5SLionel Sambuc { 2082*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 2083*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 2084*971bb1a5SLionel Sambuc i.rem = 0; 2085*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 2086*971bb1a5SLionel Sambuc return i; 2087*971bb1a5SLionel Sambuc } 2088*971bb1a5SLionel Sambuc 2089*971bb1a5SLionel Sambuc 2090*971bb1a5SLionel Sambuc /***************************************************************************** 2091*971bb1a5SLionel Sambuc ** 2092*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_context_reply_t * xcb_selinux_get_property_context_reply 2093*971bb1a5SLionel Sambuc ** 2094*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2095*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_property_context_cookie_t cookie 2096*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 2097*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_context_reply_t * 2098*971bb1a5SLionel Sambuc ** 2099*971bb1a5SLionel Sambuc *****************************************************************************/ 2100*971bb1a5SLionel Sambuc 2101*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_reply_t * 2102*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_reply (xcb_connection_t *c /**< */, 2103*971bb1a5SLionel Sambuc xcb_selinux_get_property_context_cookie_t cookie /**< */, 2104*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 2105*971bb1a5SLionel Sambuc { 2106*971bb1a5SLionel Sambuc return (xcb_selinux_get_property_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 2107*971bb1a5SLionel Sambuc } 2108*971bb1a5SLionel Sambuc 2109*971bb1a5SLionel Sambuc int 2110*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_sizeof (const void *_buffer /**< */) 2111*971bb1a5SLionel Sambuc { 2112*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 2113*971bb1a5SLionel Sambuc const xcb_selinux_get_property_data_context_reply_t *_aux = (xcb_selinux_get_property_data_context_reply_t *)_buffer; 2114*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 2115*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 2116*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 2117*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 2118*971bb1a5SLionel Sambuc 2119*971bb1a5SLionel Sambuc 2120*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_property_data_context_reply_t); 2121*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2122*971bb1a5SLionel Sambuc /* context */ 2123*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 2124*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2125*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 2126*971bb1a5SLionel Sambuc /* insert padding */ 2127*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2128*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 2129*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 2130*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 2131*971bb1a5SLionel Sambuc xcb_pad = 0; 2132*971bb1a5SLionel Sambuc } 2133*971bb1a5SLionel Sambuc xcb_block_len = 0; 2134*971bb1a5SLionel Sambuc 2135*971bb1a5SLionel Sambuc return xcb_buffer_len; 2136*971bb1a5SLionel Sambuc } 2137*971bb1a5SLionel Sambuc 2138*971bb1a5SLionel Sambuc 2139*971bb1a5SLionel Sambuc /***************************************************************************** 2140*971bb1a5SLionel Sambuc ** 2141*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_data_context_cookie_t xcb_selinux_get_property_data_context 2142*971bb1a5SLionel Sambuc ** 2143*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2144*971bb1a5SLionel Sambuc ** @param xcb_window_t window 2145*971bb1a5SLionel Sambuc ** @param xcb_atom_t property 2146*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_data_context_cookie_t 2147*971bb1a5SLionel Sambuc ** 2148*971bb1a5SLionel Sambuc *****************************************************************************/ 2149*971bb1a5SLionel Sambuc 2150*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_cookie_t 2151*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context (xcb_connection_t *c /**< */, 2152*971bb1a5SLionel Sambuc xcb_window_t window /**< */, 2153*971bb1a5SLionel Sambuc xcb_atom_t property /**< */) 2154*971bb1a5SLionel Sambuc { 2155*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2156*971bb1a5SLionel Sambuc /* count */ 2, 2157*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2158*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_PROPERTY_DATA_CONTEXT, 2159*971bb1a5SLionel Sambuc /* isvoid */ 0 2160*971bb1a5SLionel Sambuc }; 2161*971bb1a5SLionel Sambuc 2162*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2163*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_cookie_t xcb_ret; 2164*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_request_t xcb_out; 2165*971bb1a5SLionel Sambuc 2166*971bb1a5SLionel Sambuc xcb_out.window = window; 2167*971bb1a5SLionel Sambuc xcb_out.property = property; 2168*971bb1a5SLionel Sambuc 2169*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2170*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2171*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2172*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2173*971bb1a5SLionel Sambuc 2174*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2175*971bb1a5SLionel Sambuc return xcb_ret; 2176*971bb1a5SLionel Sambuc } 2177*971bb1a5SLionel Sambuc 2178*971bb1a5SLionel Sambuc 2179*971bb1a5SLionel Sambuc /***************************************************************************** 2180*971bb1a5SLionel Sambuc ** 2181*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_data_context_cookie_t xcb_selinux_get_property_data_context_unchecked 2182*971bb1a5SLionel Sambuc ** 2183*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2184*971bb1a5SLionel Sambuc ** @param xcb_window_t window 2185*971bb1a5SLionel Sambuc ** @param xcb_atom_t property 2186*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_data_context_cookie_t 2187*971bb1a5SLionel Sambuc ** 2188*971bb1a5SLionel Sambuc *****************************************************************************/ 2189*971bb1a5SLionel Sambuc 2190*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_cookie_t 2191*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_unchecked (xcb_connection_t *c /**< */, 2192*971bb1a5SLionel Sambuc xcb_window_t window /**< */, 2193*971bb1a5SLionel Sambuc xcb_atom_t property /**< */) 2194*971bb1a5SLionel Sambuc { 2195*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2196*971bb1a5SLionel Sambuc /* count */ 2, 2197*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2198*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_PROPERTY_DATA_CONTEXT, 2199*971bb1a5SLionel Sambuc /* isvoid */ 0 2200*971bb1a5SLionel Sambuc }; 2201*971bb1a5SLionel Sambuc 2202*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2203*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_cookie_t xcb_ret; 2204*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_request_t xcb_out; 2205*971bb1a5SLionel Sambuc 2206*971bb1a5SLionel Sambuc xcb_out.window = window; 2207*971bb1a5SLionel Sambuc xcb_out.property = property; 2208*971bb1a5SLionel Sambuc 2209*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2210*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2211*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2212*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2213*971bb1a5SLionel Sambuc 2214*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2215*971bb1a5SLionel Sambuc return xcb_ret; 2216*971bb1a5SLionel Sambuc } 2217*971bb1a5SLionel Sambuc 2218*971bb1a5SLionel Sambuc 2219*971bb1a5SLionel Sambuc /***************************************************************************** 2220*971bb1a5SLionel Sambuc ** 2221*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_property_data_context_context 2222*971bb1a5SLionel Sambuc ** 2223*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_data_context_reply_t *R 2224*971bb1a5SLionel Sambuc ** @returns char * 2225*971bb1a5SLionel Sambuc ** 2226*971bb1a5SLionel Sambuc *****************************************************************************/ 2227*971bb1a5SLionel Sambuc 2228*971bb1a5SLionel Sambuc char * 2229*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_context (const xcb_selinux_get_property_data_context_reply_t *R /**< */) 2230*971bb1a5SLionel Sambuc { 2231*971bb1a5SLionel Sambuc return (char *) (R + 1); 2232*971bb1a5SLionel Sambuc } 2233*971bb1a5SLionel Sambuc 2234*971bb1a5SLionel Sambuc 2235*971bb1a5SLionel Sambuc /***************************************************************************** 2236*971bb1a5SLionel Sambuc ** 2237*971bb1a5SLionel Sambuc ** int xcb_selinux_get_property_data_context_context_length 2238*971bb1a5SLionel Sambuc ** 2239*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_data_context_reply_t *R 2240*971bb1a5SLionel Sambuc ** @returns int 2241*971bb1a5SLionel Sambuc ** 2242*971bb1a5SLionel Sambuc *****************************************************************************/ 2243*971bb1a5SLionel Sambuc 2244*971bb1a5SLionel Sambuc int 2245*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_context_length (const xcb_selinux_get_property_data_context_reply_t *R /**< */) 2246*971bb1a5SLionel Sambuc { 2247*971bb1a5SLionel Sambuc return R->context_len; 2248*971bb1a5SLionel Sambuc } 2249*971bb1a5SLionel Sambuc 2250*971bb1a5SLionel Sambuc 2251*971bb1a5SLionel Sambuc /***************************************************************************** 2252*971bb1a5SLionel Sambuc ** 2253*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_property_data_context_context_end 2254*971bb1a5SLionel Sambuc ** 2255*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_property_data_context_reply_t *R 2256*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 2257*971bb1a5SLionel Sambuc ** 2258*971bb1a5SLionel Sambuc *****************************************************************************/ 2259*971bb1a5SLionel Sambuc 2260*971bb1a5SLionel Sambuc xcb_generic_iterator_t 2261*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_context_end (const xcb_selinux_get_property_data_context_reply_t *R /**< */) 2262*971bb1a5SLionel Sambuc { 2263*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 2264*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 2265*971bb1a5SLionel Sambuc i.rem = 0; 2266*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 2267*971bb1a5SLionel Sambuc return i; 2268*971bb1a5SLionel Sambuc } 2269*971bb1a5SLionel Sambuc 2270*971bb1a5SLionel Sambuc 2271*971bb1a5SLionel Sambuc /***************************************************************************** 2272*971bb1a5SLionel Sambuc ** 2273*971bb1a5SLionel Sambuc ** xcb_selinux_get_property_data_context_reply_t * xcb_selinux_get_property_data_context_reply 2274*971bb1a5SLionel Sambuc ** 2275*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2276*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_property_data_context_cookie_t cookie 2277*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 2278*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_property_data_context_reply_t * 2279*971bb1a5SLionel Sambuc ** 2280*971bb1a5SLionel Sambuc *****************************************************************************/ 2281*971bb1a5SLionel Sambuc 2282*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_reply_t * 2283*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_reply (xcb_connection_t *c /**< */, 2284*971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_cookie_t cookie /**< */, 2285*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 2286*971bb1a5SLionel Sambuc { 2287*971bb1a5SLionel Sambuc return (xcb_selinux_get_property_data_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 2288*971bb1a5SLionel Sambuc } 2289*971bb1a5SLionel Sambuc 2290*971bb1a5SLionel Sambuc int 2291*971bb1a5SLionel Sambuc xcb_selinux_list_properties_sizeof (const void *_buffer /**< */) 2292*971bb1a5SLionel Sambuc { 2293*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 2294*971bb1a5SLionel Sambuc const xcb_selinux_list_properties_reply_t *_aux = (xcb_selinux_list_properties_reply_t *)_buffer; 2295*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 2296*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 2297*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 2298*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 2299*971bb1a5SLionel Sambuc 2300*971bb1a5SLionel Sambuc unsigned int i; 2301*971bb1a5SLionel Sambuc unsigned int xcb_tmp_len; 2302*971bb1a5SLionel Sambuc 2303*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_list_properties_reply_t); 2304*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2305*971bb1a5SLionel Sambuc /* properties */ 2306*971bb1a5SLionel Sambuc for(i=0; i<_aux->properties_len; i++) { 2307*971bb1a5SLionel Sambuc xcb_tmp_len = xcb_selinux_list_item_sizeof(xcb_tmp); 2308*971bb1a5SLionel Sambuc xcb_block_len += xcb_tmp_len; 2309*971bb1a5SLionel Sambuc xcb_tmp += xcb_tmp_len; 2310*971bb1a5SLionel Sambuc } 2311*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(xcb_selinux_list_item_t); 2312*971bb1a5SLionel Sambuc /* insert padding */ 2313*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2314*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 2315*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 2316*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 2317*971bb1a5SLionel Sambuc xcb_pad = 0; 2318*971bb1a5SLionel Sambuc } 2319*971bb1a5SLionel Sambuc xcb_block_len = 0; 2320*971bb1a5SLionel Sambuc 2321*971bb1a5SLionel Sambuc return xcb_buffer_len; 2322*971bb1a5SLionel Sambuc } 2323*971bb1a5SLionel Sambuc 2324*971bb1a5SLionel Sambuc 2325*971bb1a5SLionel Sambuc /***************************************************************************** 2326*971bb1a5SLionel Sambuc ** 2327*971bb1a5SLionel Sambuc ** xcb_selinux_list_properties_cookie_t xcb_selinux_list_properties 2328*971bb1a5SLionel Sambuc ** 2329*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2330*971bb1a5SLionel Sambuc ** @param xcb_window_t window 2331*971bb1a5SLionel Sambuc ** @returns xcb_selinux_list_properties_cookie_t 2332*971bb1a5SLionel Sambuc ** 2333*971bb1a5SLionel Sambuc *****************************************************************************/ 2334*971bb1a5SLionel Sambuc 2335*971bb1a5SLionel Sambuc xcb_selinux_list_properties_cookie_t 2336*971bb1a5SLionel Sambuc xcb_selinux_list_properties (xcb_connection_t *c /**< */, 2337*971bb1a5SLionel Sambuc xcb_window_t window /**< */) 2338*971bb1a5SLionel Sambuc { 2339*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2340*971bb1a5SLionel Sambuc /* count */ 2, 2341*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2342*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_LIST_PROPERTIES, 2343*971bb1a5SLionel Sambuc /* isvoid */ 0 2344*971bb1a5SLionel Sambuc }; 2345*971bb1a5SLionel Sambuc 2346*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2347*971bb1a5SLionel Sambuc xcb_selinux_list_properties_cookie_t xcb_ret; 2348*971bb1a5SLionel Sambuc xcb_selinux_list_properties_request_t xcb_out; 2349*971bb1a5SLionel Sambuc 2350*971bb1a5SLionel Sambuc xcb_out.window = window; 2351*971bb1a5SLionel Sambuc 2352*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2353*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2354*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2355*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2356*971bb1a5SLionel Sambuc 2357*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2358*971bb1a5SLionel Sambuc return xcb_ret; 2359*971bb1a5SLionel Sambuc } 2360*971bb1a5SLionel Sambuc 2361*971bb1a5SLionel Sambuc 2362*971bb1a5SLionel Sambuc /***************************************************************************** 2363*971bb1a5SLionel Sambuc ** 2364*971bb1a5SLionel Sambuc ** xcb_selinux_list_properties_cookie_t xcb_selinux_list_properties_unchecked 2365*971bb1a5SLionel Sambuc ** 2366*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2367*971bb1a5SLionel Sambuc ** @param xcb_window_t window 2368*971bb1a5SLionel Sambuc ** @returns xcb_selinux_list_properties_cookie_t 2369*971bb1a5SLionel Sambuc ** 2370*971bb1a5SLionel Sambuc *****************************************************************************/ 2371*971bb1a5SLionel Sambuc 2372*971bb1a5SLionel Sambuc xcb_selinux_list_properties_cookie_t 2373*971bb1a5SLionel Sambuc xcb_selinux_list_properties_unchecked (xcb_connection_t *c /**< */, 2374*971bb1a5SLionel Sambuc xcb_window_t window /**< */) 2375*971bb1a5SLionel Sambuc { 2376*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2377*971bb1a5SLionel Sambuc /* count */ 2, 2378*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2379*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_LIST_PROPERTIES, 2380*971bb1a5SLionel Sambuc /* isvoid */ 0 2381*971bb1a5SLionel Sambuc }; 2382*971bb1a5SLionel Sambuc 2383*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2384*971bb1a5SLionel Sambuc xcb_selinux_list_properties_cookie_t xcb_ret; 2385*971bb1a5SLionel Sambuc xcb_selinux_list_properties_request_t xcb_out; 2386*971bb1a5SLionel Sambuc 2387*971bb1a5SLionel Sambuc xcb_out.window = window; 2388*971bb1a5SLionel Sambuc 2389*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2390*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2391*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2392*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2393*971bb1a5SLionel Sambuc 2394*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2395*971bb1a5SLionel Sambuc return xcb_ret; 2396*971bb1a5SLionel Sambuc } 2397*971bb1a5SLionel Sambuc 2398*971bb1a5SLionel Sambuc 2399*971bb1a5SLionel Sambuc /***************************************************************************** 2400*971bb1a5SLionel Sambuc ** 2401*971bb1a5SLionel Sambuc ** int xcb_selinux_list_properties_properties_length 2402*971bb1a5SLionel Sambuc ** 2403*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_properties_reply_t *R 2404*971bb1a5SLionel Sambuc ** @returns int 2405*971bb1a5SLionel Sambuc ** 2406*971bb1a5SLionel Sambuc *****************************************************************************/ 2407*971bb1a5SLionel Sambuc 2408*971bb1a5SLionel Sambuc int 2409*971bb1a5SLionel Sambuc xcb_selinux_list_properties_properties_length (const xcb_selinux_list_properties_reply_t *R /**< */) 2410*971bb1a5SLionel Sambuc { 2411*971bb1a5SLionel Sambuc return R->properties_len; 2412*971bb1a5SLionel Sambuc } 2413*971bb1a5SLionel Sambuc 2414*971bb1a5SLionel Sambuc 2415*971bb1a5SLionel Sambuc /***************************************************************************** 2416*971bb1a5SLionel Sambuc ** 2417*971bb1a5SLionel Sambuc ** xcb_selinux_list_item_iterator_t xcb_selinux_list_properties_properties_iterator 2418*971bb1a5SLionel Sambuc ** 2419*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_properties_reply_t *R 2420*971bb1a5SLionel Sambuc ** @returns xcb_selinux_list_item_iterator_t 2421*971bb1a5SLionel Sambuc ** 2422*971bb1a5SLionel Sambuc *****************************************************************************/ 2423*971bb1a5SLionel Sambuc 2424*971bb1a5SLionel Sambuc xcb_selinux_list_item_iterator_t 2425*971bb1a5SLionel Sambuc xcb_selinux_list_properties_properties_iterator (const xcb_selinux_list_properties_reply_t *R /**< */) 2426*971bb1a5SLionel Sambuc { 2427*971bb1a5SLionel Sambuc xcb_selinux_list_item_iterator_t i; 2428*971bb1a5SLionel Sambuc i.data = (xcb_selinux_list_item_t *) (R + 1); 2429*971bb1a5SLionel Sambuc i.rem = R->properties_len; 2430*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 2431*971bb1a5SLionel Sambuc return i; 2432*971bb1a5SLionel Sambuc } 2433*971bb1a5SLionel Sambuc 2434*971bb1a5SLionel Sambuc 2435*971bb1a5SLionel Sambuc /***************************************************************************** 2436*971bb1a5SLionel Sambuc ** 2437*971bb1a5SLionel Sambuc ** xcb_selinux_list_properties_reply_t * xcb_selinux_list_properties_reply 2438*971bb1a5SLionel Sambuc ** 2439*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2440*971bb1a5SLionel Sambuc ** @param xcb_selinux_list_properties_cookie_t cookie 2441*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 2442*971bb1a5SLionel Sambuc ** @returns xcb_selinux_list_properties_reply_t * 2443*971bb1a5SLionel Sambuc ** 2444*971bb1a5SLionel Sambuc *****************************************************************************/ 2445*971bb1a5SLionel Sambuc 2446*971bb1a5SLionel Sambuc xcb_selinux_list_properties_reply_t * 2447*971bb1a5SLionel Sambuc xcb_selinux_list_properties_reply (xcb_connection_t *c /**< */, 2448*971bb1a5SLionel Sambuc xcb_selinux_list_properties_cookie_t cookie /**< */, 2449*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 2450*971bb1a5SLionel Sambuc { 2451*971bb1a5SLionel Sambuc return (xcb_selinux_list_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 2452*971bb1a5SLionel Sambuc } 2453*971bb1a5SLionel Sambuc 2454*971bb1a5SLionel Sambuc int 2455*971bb1a5SLionel Sambuc xcb_selinux_set_selection_create_context_sizeof (const void *_buffer /**< */) 2456*971bb1a5SLionel Sambuc { 2457*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 2458*971bb1a5SLionel Sambuc const xcb_selinux_set_selection_create_context_request_t *_aux = (xcb_selinux_set_selection_create_context_request_t *)_buffer; 2459*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 2460*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 2461*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 2462*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 2463*971bb1a5SLionel Sambuc 2464*971bb1a5SLionel Sambuc 2465*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_set_selection_create_context_request_t); 2466*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2467*971bb1a5SLionel Sambuc /* context */ 2468*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 2469*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2470*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 2471*971bb1a5SLionel Sambuc /* insert padding */ 2472*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2473*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 2474*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 2475*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 2476*971bb1a5SLionel Sambuc xcb_pad = 0; 2477*971bb1a5SLionel Sambuc } 2478*971bb1a5SLionel Sambuc xcb_block_len = 0; 2479*971bb1a5SLionel Sambuc 2480*971bb1a5SLionel Sambuc return xcb_buffer_len; 2481*971bb1a5SLionel Sambuc } 2482*971bb1a5SLionel Sambuc 2483*971bb1a5SLionel Sambuc 2484*971bb1a5SLionel Sambuc /***************************************************************************** 2485*971bb1a5SLionel Sambuc ** 2486*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_selection_create_context_checked 2487*971bb1a5SLionel Sambuc ** 2488*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2489*971bb1a5SLionel Sambuc ** @param uint32_t context_len 2490*971bb1a5SLionel Sambuc ** @param const char *context 2491*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 2492*971bb1a5SLionel Sambuc ** 2493*971bb1a5SLionel Sambuc *****************************************************************************/ 2494*971bb1a5SLionel Sambuc 2495*971bb1a5SLionel Sambuc xcb_void_cookie_t 2496*971bb1a5SLionel Sambuc xcb_selinux_set_selection_create_context_checked (xcb_connection_t *c /**< */, 2497*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 2498*971bb1a5SLionel Sambuc const char *context /**< */) 2499*971bb1a5SLionel Sambuc { 2500*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2501*971bb1a5SLionel Sambuc /* count */ 4, 2502*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2503*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_SELECTION_CREATE_CONTEXT, 2504*971bb1a5SLionel Sambuc /* isvoid */ 1 2505*971bb1a5SLionel Sambuc }; 2506*971bb1a5SLionel Sambuc 2507*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 2508*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 2509*971bb1a5SLionel Sambuc xcb_selinux_set_selection_create_context_request_t xcb_out; 2510*971bb1a5SLionel Sambuc 2511*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 2512*971bb1a5SLionel Sambuc 2513*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2514*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2515*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2516*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2517*971bb1a5SLionel Sambuc /* char context */ 2518*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 2519*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 2520*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 2521*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2522*971bb1a5SLionel Sambuc 2523*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2524*971bb1a5SLionel Sambuc return xcb_ret; 2525*971bb1a5SLionel Sambuc } 2526*971bb1a5SLionel Sambuc 2527*971bb1a5SLionel Sambuc 2528*971bb1a5SLionel Sambuc /***************************************************************************** 2529*971bb1a5SLionel Sambuc ** 2530*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_selection_create_context 2531*971bb1a5SLionel Sambuc ** 2532*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2533*971bb1a5SLionel Sambuc ** @param uint32_t context_len 2534*971bb1a5SLionel Sambuc ** @param const char *context 2535*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 2536*971bb1a5SLionel Sambuc ** 2537*971bb1a5SLionel Sambuc *****************************************************************************/ 2538*971bb1a5SLionel Sambuc 2539*971bb1a5SLionel Sambuc xcb_void_cookie_t 2540*971bb1a5SLionel Sambuc xcb_selinux_set_selection_create_context (xcb_connection_t *c /**< */, 2541*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 2542*971bb1a5SLionel Sambuc const char *context /**< */) 2543*971bb1a5SLionel Sambuc { 2544*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2545*971bb1a5SLionel Sambuc /* count */ 4, 2546*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2547*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_SELECTION_CREATE_CONTEXT, 2548*971bb1a5SLionel Sambuc /* isvoid */ 1 2549*971bb1a5SLionel Sambuc }; 2550*971bb1a5SLionel Sambuc 2551*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 2552*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 2553*971bb1a5SLionel Sambuc xcb_selinux_set_selection_create_context_request_t xcb_out; 2554*971bb1a5SLionel Sambuc 2555*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 2556*971bb1a5SLionel Sambuc 2557*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2558*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2559*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2560*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2561*971bb1a5SLionel Sambuc /* char context */ 2562*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 2563*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 2564*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 2565*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2566*971bb1a5SLionel Sambuc 2567*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2568*971bb1a5SLionel Sambuc return xcb_ret; 2569*971bb1a5SLionel Sambuc } 2570*971bb1a5SLionel Sambuc 2571*971bb1a5SLionel Sambuc int 2572*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_sizeof (const void *_buffer /**< */) 2573*971bb1a5SLionel Sambuc { 2574*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 2575*971bb1a5SLionel Sambuc const xcb_selinux_get_selection_create_context_reply_t *_aux = (xcb_selinux_get_selection_create_context_reply_t *)_buffer; 2576*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 2577*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 2578*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 2579*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 2580*971bb1a5SLionel Sambuc 2581*971bb1a5SLionel Sambuc 2582*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_selection_create_context_reply_t); 2583*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2584*971bb1a5SLionel Sambuc /* context */ 2585*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 2586*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2587*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 2588*971bb1a5SLionel Sambuc /* insert padding */ 2589*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2590*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 2591*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 2592*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 2593*971bb1a5SLionel Sambuc xcb_pad = 0; 2594*971bb1a5SLionel Sambuc } 2595*971bb1a5SLionel Sambuc xcb_block_len = 0; 2596*971bb1a5SLionel Sambuc 2597*971bb1a5SLionel Sambuc return xcb_buffer_len; 2598*971bb1a5SLionel Sambuc } 2599*971bb1a5SLionel Sambuc 2600*971bb1a5SLionel Sambuc 2601*971bb1a5SLionel Sambuc /***************************************************************************** 2602*971bb1a5SLionel Sambuc ** 2603*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_create_context_cookie_t xcb_selinux_get_selection_create_context 2604*971bb1a5SLionel Sambuc ** 2605*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2606*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_create_context_cookie_t 2607*971bb1a5SLionel Sambuc ** 2608*971bb1a5SLionel Sambuc *****************************************************************************/ 2609*971bb1a5SLionel Sambuc 2610*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_cookie_t 2611*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context (xcb_connection_t *c /**< */) 2612*971bb1a5SLionel Sambuc { 2613*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2614*971bb1a5SLionel Sambuc /* count */ 2, 2615*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2616*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_SELECTION_CREATE_CONTEXT, 2617*971bb1a5SLionel Sambuc /* isvoid */ 0 2618*971bb1a5SLionel Sambuc }; 2619*971bb1a5SLionel Sambuc 2620*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2621*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_cookie_t xcb_ret; 2622*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_request_t xcb_out; 2623*971bb1a5SLionel Sambuc 2624*971bb1a5SLionel Sambuc 2625*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2626*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2627*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2628*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2629*971bb1a5SLionel Sambuc 2630*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2631*971bb1a5SLionel Sambuc return xcb_ret; 2632*971bb1a5SLionel Sambuc } 2633*971bb1a5SLionel Sambuc 2634*971bb1a5SLionel Sambuc 2635*971bb1a5SLionel Sambuc /***************************************************************************** 2636*971bb1a5SLionel Sambuc ** 2637*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_create_context_cookie_t xcb_selinux_get_selection_create_context_unchecked 2638*971bb1a5SLionel Sambuc ** 2639*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2640*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_create_context_cookie_t 2641*971bb1a5SLionel Sambuc ** 2642*971bb1a5SLionel Sambuc *****************************************************************************/ 2643*971bb1a5SLionel Sambuc 2644*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_cookie_t 2645*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_unchecked (xcb_connection_t *c /**< */) 2646*971bb1a5SLionel Sambuc { 2647*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2648*971bb1a5SLionel Sambuc /* count */ 2, 2649*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2650*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_SELECTION_CREATE_CONTEXT, 2651*971bb1a5SLionel Sambuc /* isvoid */ 0 2652*971bb1a5SLionel Sambuc }; 2653*971bb1a5SLionel Sambuc 2654*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2655*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_cookie_t xcb_ret; 2656*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_request_t xcb_out; 2657*971bb1a5SLionel Sambuc 2658*971bb1a5SLionel Sambuc 2659*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2660*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2661*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2662*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2663*971bb1a5SLionel Sambuc 2664*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2665*971bb1a5SLionel Sambuc return xcb_ret; 2666*971bb1a5SLionel Sambuc } 2667*971bb1a5SLionel Sambuc 2668*971bb1a5SLionel Sambuc 2669*971bb1a5SLionel Sambuc /***************************************************************************** 2670*971bb1a5SLionel Sambuc ** 2671*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_selection_create_context_context 2672*971bb1a5SLionel Sambuc ** 2673*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_create_context_reply_t *R 2674*971bb1a5SLionel Sambuc ** @returns char * 2675*971bb1a5SLionel Sambuc ** 2676*971bb1a5SLionel Sambuc *****************************************************************************/ 2677*971bb1a5SLionel Sambuc 2678*971bb1a5SLionel Sambuc char * 2679*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_context (const xcb_selinux_get_selection_create_context_reply_t *R /**< */) 2680*971bb1a5SLionel Sambuc { 2681*971bb1a5SLionel Sambuc return (char *) (R + 1); 2682*971bb1a5SLionel Sambuc } 2683*971bb1a5SLionel Sambuc 2684*971bb1a5SLionel Sambuc 2685*971bb1a5SLionel Sambuc /***************************************************************************** 2686*971bb1a5SLionel Sambuc ** 2687*971bb1a5SLionel Sambuc ** int xcb_selinux_get_selection_create_context_context_length 2688*971bb1a5SLionel Sambuc ** 2689*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_create_context_reply_t *R 2690*971bb1a5SLionel Sambuc ** @returns int 2691*971bb1a5SLionel Sambuc ** 2692*971bb1a5SLionel Sambuc *****************************************************************************/ 2693*971bb1a5SLionel Sambuc 2694*971bb1a5SLionel Sambuc int 2695*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_context_length (const xcb_selinux_get_selection_create_context_reply_t *R /**< */) 2696*971bb1a5SLionel Sambuc { 2697*971bb1a5SLionel Sambuc return R->context_len; 2698*971bb1a5SLionel Sambuc } 2699*971bb1a5SLionel Sambuc 2700*971bb1a5SLionel Sambuc 2701*971bb1a5SLionel Sambuc /***************************************************************************** 2702*971bb1a5SLionel Sambuc ** 2703*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_selection_create_context_context_end 2704*971bb1a5SLionel Sambuc ** 2705*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_create_context_reply_t *R 2706*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 2707*971bb1a5SLionel Sambuc ** 2708*971bb1a5SLionel Sambuc *****************************************************************************/ 2709*971bb1a5SLionel Sambuc 2710*971bb1a5SLionel Sambuc xcb_generic_iterator_t 2711*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_context_end (const xcb_selinux_get_selection_create_context_reply_t *R /**< */) 2712*971bb1a5SLionel Sambuc { 2713*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 2714*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 2715*971bb1a5SLionel Sambuc i.rem = 0; 2716*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 2717*971bb1a5SLionel Sambuc return i; 2718*971bb1a5SLionel Sambuc } 2719*971bb1a5SLionel Sambuc 2720*971bb1a5SLionel Sambuc 2721*971bb1a5SLionel Sambuc /***************************************************************************** 2722*971bb1a5SLionel Sambuc ** 2723*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_create_context_reply_t * xcb_selinux_get_selection_create_context_reply 2724*971bb1a5SLionel Sambuc ** 2725*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2726*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_selection_create_context_cookie_t cookie 2727*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 2728*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_create_context_reply_t * 2729*971bb1a5SLionel Sambuc ** 2730*971bb1a5SLionel Sambuc *****************************************************************************/ 2731*971bb1a5SLionel Sambuc 2732*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_reply_t * 2733*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_reply (xcb_connection_t *c /**< */, 2734*971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_cookie_t cookie /**< */, 2735*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 2736*971bb1a5SLionel Sambuc { 2737*971bb1a5SLionel Sambuc return (xcb_selinux_get_selection_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 2738*971bb1a5SLionel Sambuc } 2739*971bb1a5SLionel Sambuc 2740*971bb1a5SLionel Sambuc int 2741*971bb1a5SLionel Sambuc xcb_selinux_set_selection_use_context_sizeof (const void *_buffer /**< */) 2742*971bb1a5SLionel Sambuc { 2743*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 2744*971bb1a5SLionel Sambuc const xcb_selinux_set_selection_use_context_request_t *_aux = (xcb_selinux_set_selection_use_context_request_t *)_buffer; 2745*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 2746*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 2747*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 2748*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 2749*971bb1a5SLionel Sambuc 2750*971bb1a5SLionel Sambuc 2751*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_set_selection_use_context_request_t); 2752*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2753*971bb1a5SLionel Sambuc /* context */ 2754*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 2755*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2756*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 2757*971bb1a5SLionel Sambuc /* insert padding */ 2758*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2759*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 2760*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 2761*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 2762*971bb1a5SLionel Sambuc xcb_pad = 0; 2763*971bb1a5SLionel Sambuc } 2764*971bb1a5SLionel Sambuc xcb_block_len = 0; 2765*971bb1a5SLionel Sambuc 2766*971bb1a5SLionel Sambuc return xcb_buffer_len; 2767*971bb1a5SLionel Sambuc } 2768*971bb1a5SLionel Sambuc 2769*971bb1a5SLionel Sambuc 2770*971bb1a5SLionel Sambuc /***************************************************************************** 2771*971bb1a5SLionel Sambuc ** 2772*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_selection_use_context_checked 2773*971bb1a5SLionel Sambuc ** 2774*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2775*971bb1a5SLionel Sambuc ** @param uint32_t context_len 2776*971bb1a5SLionel Sambuc ** @param const char *context 2777*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 2778*971bb1a5SLionel Sambuc ** 2779*971bb1a5SLionel Sambuc *****************************************************************************/ 2780*971bb1a5SLionel Sambuc 2781*971bb1a5SLionel Sambuc xcb_void_cookie_t 2782*971bb1a5SLionel Sambuc xcb_selinux_set_selection_use_context_checked (xcb_connection_t *c /**< */, 2783*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 2784*971bb1a5SLionel Sambuc const char *context /**< */) 2785*971bb1a5SLionel Sambuc { 2786*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2787*971bb1a5SLionel Sambuc /* count */ 4, 2788*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2789*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_SELECTION_USE_CONTEXT, 2790*971bb1a5SLionel Sambuc /* isvoid */ 1 2791*971bb1a5SLionel Sambuc }; 2792*971bb1a5SLionel Sambuc 2793*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 2794*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 2795*971bb1a5SLionel Sambuc xcb_selinux_set_selection_use_context_request_t xcb_out; 2796*971bb1a5SLionel Sambuc 2797*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 2798*971bb1a5SLionel Sambuc 2799*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2800*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2801*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2802*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2803*971bb1a5SLionel Sambuc /* char context */ 2804*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 2805*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 2806*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 2807*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2808*971bb1a5SLionel Sambuc 2809*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2810*971bb1a5SLionel Sambuc return xcb_ret; 2811*971bb1a5SLionel Sambuc } 2812*971bb1a5SLionel Sambuc 2813*971bb1a5SLionel Sambuc 2814*971bb1a5SLionel Sambuc /***************************************************************************** 2815*971bb1a5SLionel Sambuc ** 2816*971bb1a5SLionel Sambuc ** xcb_void_cookie_t xcb_selinux_set_selection_use_context 2817*971bb1a5SLionel Sambuc ** 2818*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2819*971bb1a5SLionel Sambuc ** @param uint32_t context_len 2820*971bb1a5SLionel Sambuc ** @param const char *context 2821*971bb1a5SLionel Sambuc ** @returns xcb_void_cookie_t 2822*971bb1a5SLionel Sambuc ** 2823*971bb1a5SLionel Sambuc *****************************************************************************/ 2824*971bb1a5SLionel Sambuc 2825*971bb1a5SLionel Sambuc xcb_void_cookie_t 2826*971bb1a5SLionel Sambuc xcb_selinux_set_selection_use_context (xcb_connection_t *c /**< */, 2827*971bb1a5SLionel Sambuc uint32_t context_len /**< */, 2828*971bb1a5SLionel Sambuc const char *context /**< */) 2829*971bb1a5SLionel Sambuc { 2830*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2831*971bb1a5SLionel Sambuc /* count */ 4, 2832*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2833*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_SET_SELECTION_USE_CONTEXT, 2834*971bb1a5SLionel Sambuc /* isvoid */ 1 2835*971bb1a5SLionel Sambuc }; 2836*971bb1a5SLionel Sambuc 2837*971bb1a5SLionel Sambuc struct iovec xcb_parts[6]; 2838*971bb1a5SLionel Sambuc xcb_void_cookie_t xcb_ret; 2839*971bb1a5SLionel Sambuc xcb_selinux_set_selection_use_context_request_t xcb_out; 2840*971bb1a5SLionel Sambuc 2841*971bb1a5SLionel Sambuc xcb_out.context_len = context_len; 2842*971bb1a5SLionel Sambuc 2843*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2844*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2845*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2846*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2847*971bb1a5SLionel Sambuc /* char context */ 2848*971bb1a5SLionel Sambuc xcb_parts[4].iov_base = (char *) context; 2849*971bb1a5SLionel Sambuc xcb_parts[4].iov_len = context_len * sizeof(char); 2850*971bb1a5SLionel Sambuc xcb_parts[5].iov_base = 0; 2851*971bb1a5SLionel Sambuc xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2852*971bb1a5SLionel Sambuc 2853*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2854*971bb1a5SLionel Sambuc return xcb_ret; 2855*971bb1a5SLionel Sambuc } 2856*971bb1a5SLionel Sambuc 2857*971bb1a5SLionel Sambuc int 2858*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_sizeof (const void *_buffer /**< */) 2859*971bb1a5SLionel Sambuc { 2860*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 2861*971bb1a5SLionel Sambuc const xcb_selinux_get_selection_use_context_reply_t *_aux = (xcb_selinux_get_selection_use_context_reply_t *)_buffer; 2862*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 2863*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 2864*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 2865*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 2866*971bb1a5SLionel Sambuc 2867*971bb1a5SLionel Sambuc 2868*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_selection_use_context_reply_t); 2869*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2870*971bb1a5SLionel Sambuc /* context */ 2871*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 2872*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 2873*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 2874*971bb1a5SLionel Sambuc /* insert padding */ 2875*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2876*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 2877*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 2878*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 2879*971bb1a5SLionel Sambuc xcb_pad = 0; 2880*971bb1a5SLionel Sambuc } 2881*971bb1a5SLionel Sambuc xcb_block_len = 0; 2882*971bb1a5SLionel Sambuc 2883*971bb1a5SLionel Sambuc return xcb_buffer_len; 2884*971bb1a5SLionel Sambuc } 2885*971bb1a5SLionel Sambuc 2886*971bb1a5SLionel Sambuc 2887*971bb1a5SLionel Sambuc /***************************************************************************** 2888*971bb1a5SLionel Sambuc ** 2889*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_use_context_cookie_t xcb_selinux_get_selection_use_context 2890*971bb1a5SLionel Sambuc ** 2891*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2892*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_use_context_cookie_t 2893*971bb1a5SLionel Sambuc ** 2894*971bb1a5SLionel Sambuc *****************************************************************************/ 2895*971bb1a5SLionel Sambuc 2896*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_cookie_t 2897*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context (xcb_connection_t *c /**< */) 2898*971bb1a5SLionel Sambuc { 2899*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2900*971bb1a5SLionel Sambuc /* count */ 2, 2901*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2902*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_SELECTION_USE_CONTEXT, 2903*971bb1a5SLionel Sambuc /* isvoid */ 0 2904*971bb1a5SLionel Sambuc }; 2905*971bb1a5SLionel Sambuc 2906*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2907*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_cookie_t xcb_ret; 2908*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_request_t xcb_out; 2909*971bb1a5SLionel Sambuc 2910*971bb1a5SLionel Sambuc 2911*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2912*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2913*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2914*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2915*971bb1a5SLionel Sambuc 2916*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2917*971bb1a5SLionel Sambuc return xcb_ret; 2918*971bb1a5SLionel Sambuc } 2919*971bb1a5SLionel Sambuc 2920*971bb1a5SLionel Sambuc 2921*971bb1a5SLionel Sambuc /***************************************************************************** 2922*971bb1a5SLionel Sambuc ** 2923*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_use_context_cookie_t xcb_selinux_get_selection_use_context_unchecked 2924*971bb1a5SLionel Sambuc ** 2925*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 2926*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_use_context_cookie_t 2927*971bb1a5SLionel Sambuc ** 2928*971bb1a5SLionel Sambuc *****************************************************************************/ 2929*971bb1a5SLionel Sambuc 2930*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_cookie_t 2931*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_unchecked (xcb_connection_t *c /**< */) 2932*971bb1a5SLionel Sambuc { 2933*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 2934*971bb1a5SLionel Sambuc /* count */ 2, 2935*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 2936*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_SELECTION_USE_CONTEXT, 2937*971bb1a5SLionel Sambuc /* isvoid */ 0 2938*971bb1a5SLionel Sambuc }; 2939*971bb1a5SLionel Sambuc 2940*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 2941*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_cookie_t xcb_ret; 2942*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_request_t xcb_out; 2943*971bb1a5SLionel Sambuc 2944*971bb1a5SLionel Sambuc 2945*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 2946*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 2947*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 2948*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2949*971bb1a5SLionel Sambuc 2950*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2951*971bb1a5SLionel Sambuc return xcb_ret; 2952*971bb1a5SLionel Sambuc } 2953*971bb1a5SLionel Sambuc 2954*971bb1a5SLionel Sambuc 2955*971bb1a5SLionel Sambuc /***************************************************************************** 2956*971bb1a5SLionel Sambuc ** 2957*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_selection_use_context_context 2958*971bb1a5SLionel Sambuc ** 2959*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_use_context_reply_t *R 2960*971bb1a5SLionel Sambuc ** @returns char * 2961*971bb1a5SLionel Sambuc ** 2962*971bb1a5SLionel Sambuc *****************************************************************************/ 2963*971bb1a5SLionel Sambuc 2964*971bb1a5SLionel Sambuc char * 2965*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_context (const xcb_selinux_get_selection_use_context_reply_t *R /**< */) 2966*971bb1a5SLionel Sambuc { 2967*971bb1a5SLionel Sambuc return (char *) (R + 1); 2968*971bb1a5SLionel Sambuc } 2969*971bb1a5SLionel Sambuc 2970*971bb1a5SLionel Sambuc 2971*971bb1a5SLionel Sambuc /***************************************************************************** 2972*971bb1a5SLionel Sambuc ** 2973*971bb1a5SLionel Sambuc ** int xcb_selinux_get_selection_use_context_context_length 2974*971bb1a5SLionel Sambuc ** 2975*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_use_context_reply_t *R 2976*971bb1a5SLionel Sambuc ** @returns int 2977*971bb1a5SLionel Sambuc ** 2978*971bb1a5SLionel Sambuc *****************************************************************************/ 2979*971bb1a5SLionel Sambuc 2980*971bb1a5SLionel Sambuc int 2981*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_context_length (const xcb_selinux_get_selection_use_context_reply_t *R /**< */) 2982*971bb1a5SLionel Sambuc { 2983*971bb1a5SLionel Sambuc return R->context_len; 2984*971bb1a5SLionel Sambuc } 2985*971bb1a5SLionel Sambuc 2986*971bb1a5SLionel Sambuc 2987*971bb1a5SLionel Sambuc /***************************************************************************** 2988*971bb1a5SLionel Sambuc ** 2989*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_selection_use_context_context_end 2990*971bb1a5SLionel Sambuc ** 2991*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_use_context_reply_t *R 2992*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 2993*971bb1a5SLionel Sambuc ** 2994*971bb1a5SLionel Sambuc *****************************************************************************/ 2995*971bb1a5SLionel Sambuc 2996*971bb1a5SLionel Sambuc xcb_generic_iterator_t 2997*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_context_end (const xcb_selinux_get_selection_use_context_reply_t *R /**< */) 2998*971bb1a5SLionel Sambuc { 2999*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 3000*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 3001*971bb1a5SLionel Sambuc i.rem = 0; 3002*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 3003*971bb1a5SLionel Sambuc return i; 3004*971bb1a5SLionel Sambuc } 3005*971bb1a5SLionel Sambuc 3006*971bb1a5SLionel Sambuc 3007*971bb1a5SLionel Sambuc /***************************************************************************** 3008*971bb1a5SLionel Sambuc ** 3009*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_use_context_reply_t * xcb_selinux_get_selection_use_context_reply 3010*971bb1a5SLionel Sambuc ** 3011*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3012*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_selection_use_context_cookie_t cookie 3013*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 3014*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_use_context_reply_t * 3015*971bb1a5SLionel Sambuc ** 3016*971bb1a5SLionel Sambuc *****************************************************************************/ 3017*971bb1a5SLionel Sambuc 3018*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_reply_t * 3019*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_reply (xcb_connection_t *c /**< */, 3020*971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_cookie_t cookie /**< */, 3021*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 3022*971bb1a5SLionel Sambuc { 3023*971bb1a5SLionel Sambuc return (xcb_selinux_get_selection_use_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 3024*971bb1a5SLionel Sambuc } 3025*971bb1a5SLionel Sambuc 3026*971bb1a5SLionel Sambuc int 3027*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_sizeof (const void *_buffer /**< */) 3028*971bb1a5SLionel Sambuc { 3029*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 3030*971bb1a5SLionel Sambuc const xcb_selinux_get_selection_context_reply_t *_aux = (xcb_selinux_get_selection_context_reply_t *)_buffer; 3031*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 3032*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 3033*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 3034*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 3035*971bb1a5SLionel Sambuc 3036*971bb1a5SLionel Sambuc 3037*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_selection_context_reply_t); 3038*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 3039*971bb1a5SLionel Sambuc /* context */ 3040*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 3041*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 3042*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 3043*971bb1a5SLionel Sambuc /* insert padding */ 3044*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3045*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 3046*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 3047*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 3048*971bb1a5SLionel Sambuc xcb_pad = 0; 3049*971bb1a5SLionel Sambuc } 3050*971bb1a5SLionel Sambuc xcb_block_len = 0; 3051*971bb1a5SLionel Sambuc 3052*971bb1a5SLionel Sambuc return xcb_buffer_len; 3053*971bb1a5SLionel Sambuc } 3054*971bb1a5SLionel Sambuc 3055*971bb1a5SLionel Sambuc 3056*971bb1a5SLionel Sambuc /***************************************************************************** 3057*971bb1a5SLionel Sambuc ** 3058*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_context_cookie_t xcb_selinux_get_selection_context 3059*971bb1a5SLionel Sambuc ** 3060*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3061*971bb1a5SLionel Sambuc ** @param xcb_atom_t selection 3062*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_context_cookie_t 3063*971bb1a5SLionel Sambuc ** 3064*971bb1a5SLionel Sambuc *****************************************************************************/ 3065*971bb1a5SLionel Sambuc 3066*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_cookie_t 3067*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context (xcb_connection_t *c /**< */, 3068*971bb1a5SLionel Sambuc xcb_atom_t selection /**< */) 3069*971bb1a5SLionel Sambuc { 3070*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 3071*971bb1a5SLionel Sambuc /* count */ 2, 3072*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 3073*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_SELECTION_CONTEXT, 3074*971bb1a5SLionel Sambuc /* isvoid */ 0 3075*971bb1a5SLionel Sambuc }; 3076*971bb1a5SLionel Sambuc 3077*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 3078*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_cookie_t xcb_ret; 3079*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_request_t xcb_out; 3080*971bb1a5SLionel Sambuc 3081*971bb1a5SLionel Sambuc xcb_out.selection = selection; 3082*971bb1a5SLionel Sambuc 3083*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 3084*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 3085*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 3086*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3087*971bb1a5SLionel Sambuc 3088*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3089*971bb1a5SLionel Sambuc return xcb_ret; 3090*971bb1a5SLionel Sambuc } 3091*971bb1a5SLionel Sambuc 3092*971bb1a5SLionel Sambuc 3093*971bb1a5SLionel Sambuc /***************************************************************************** 3094*971bb1a5SLionel Sambuc ** 3095*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_context_cookie_t xcb_selinux_get_selection_context_unchecked 3096*971bb1a5SLionel Sambuc ** 3097*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3098*971bb1a5SLionel Sambuc ** @param xcb_atom_t selection 3099*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_context_cookie_t 3100*971bb1a5SLionel Sambuc ** 3101*971bb1a5SLionel Sambuc *****************************************************************************/ 3102*971bb1a5SLionel Sambuc 3103*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_cookie_t 3104*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_unchecked (xcb_connection_t *c /**< */, 3105*971bb1a5SLionel Sambuc xcb_atom_t selection /**< */) 3106*971bb1a5SLionel Sambuc { 3107*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 3108*971bb1a5SLionel Sambuc /* count */ 2, 3109*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 3110*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_SELECTION_CONTEXT, 3111*971bb1a5SLionel Sambuc /* isvoid */ 0 3112*971bb1a5SLionel Sambuc }; 3113*971bb1a5SLionel Sambuc 3114*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 3115*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_cookie_t xcb_ret; 3116*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_request_t xcb_out; 3117*971bb1a5SLionel Sambuc 3118*971bb1a5SLionel Sambuc xcb_out.selection = selection; 3119*971bb1a5SLionel Sambuc 3120*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 3121*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 3122*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 3123*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3124*971bb1a5SLionel Sambuc 3125*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3126*971bb1a5SLionel Sambuc return xcb_ret; 3127*971bb1a5SLionel Sambuc } 3128*971bb1a5SLionel Sambuc 3129*971bb1a5SLionel Sambuc 3130*971bb1a5SLionel Sambuc /***************************************************************************** 3131*971bb1a5SLionel Sambuc ** 3132*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_selection_context_context 3133*971bb1a5SLionel Sambuc ** 3134*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_context_reply_t *R 3135*971bb1a5SLionel Sambuc ** @returns char * 3136*971bb1a5SLionel Sambuc ** 3137*971bb1a5SLionel Sambuc *****************************************************************************/ 3138*971bb1a5SLionel Sambuc 3139*971bb1a5SLionel Sambuc char * 3140*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_context (const xcb_selinux_get_selection_context_reply_t *R /**< */) 3141*971bb1a5SLionel Sambuc { 3142*971bb1a5SLionel Sambuc return (char *) (R + 1); 3143*971bb1a5SLionel Sambuc } 3144*971bb1a5SLionel Sambuc 3145*971bb1a5SLionel Sambuc 3146*971bb1a5SLionel Sambuc /***************************************************************************** 3147*971bb1a5SLionel Sambuc ** 3148*971bb1a5SLionel Sambuc ** int xcb_selinux_get_selection_context_context_length 3149*971bb1a5SLionel Sambuc ** 3150*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_context_reply_t *R 3151*971bb1a5SLionel Sambuc ** @returns int 3152*971bb1a5SLionel Sambuc ** 3153*971bb1a5SLionel Sambuc *****************************************************************************/ 3154*971bb1a5SLionel Sambuc 3155*971bb1a5SLionel Sambuc int 3156*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_context_length (const xcb_selinux_get_selection_context_reply_t *R /**< */) 3157*971bb1a5SLionel Sambuc { 3158*971bb1a5SLionel Sambuc return R->context_len; 3159*971bb1a5SLionel Sambuc } 3160*971bb1a5SLionel Sambuc 3161*971bb1a5SLionel Sambuc 3162*971bb1a5SLionel Sambuc /***************************************************************************** 3163*971bb1a5SLionel Sambuc ** 3164*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_selection_context_context_end 3165*971bb1a5SLionel Sambuc ** 3166*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_context_reply_t *R 3167*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 3168*971bb1a5SLionel Sambuc ** 3169*971bb1a5SLionel Sambuc *****************************************************************************/ 3170*971bb1a5SLionel Sambuc 3171*971bb1a5SLionel Sambuc xcb_generic_iterator_t 3172*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_context_end (const xcb_selinux_get_selection_context_reply_t *R /**< */) 3173*971bb1a5SLionel Sambuc { 3174*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 3175*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 3176*971bb1a5SLionel Sambuc i.rem = 0; 3177*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 3178*971bb1a5SLionel Sambuc return i; 3179*971bb1a5SLionel Sambuc } 3180*971bb1a5SLionel Sambuc 3181*971bb1a5SLionel Sambuc 3182*971bb1a5SLionel Sambuc /***************************************************************************** 3183*971bb1a5SLionel Sambuc ** 3184*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_context_reply_t * xcb_selinux_get_selection_context_reply 3185*971bb1a5SLionel Sambuc ** 3186*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3187*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_selection_context_cookie_t cookie 3188*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 3189*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_context_reply_t * 3190*971bb1a5SLionel Sambuc ** 3191*971bb1a5SLionel Sambuc *****************************************************************************/ 3192*971bb1a5SLionel Sambuc 3193*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_reply_t * 3194*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_reply (xcb_connection_t *c /**< */, 3195*971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_cookie_t cookie /**< */, 3196*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 3197*971bb1a5SLionel Sambuc { 3198*971bb1a5SLionel Sambuc return (xcb_selinux_get_selection_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 3199*971bb1a5SLionel Sambuc } 3200*971bb1a5SLionel Sambuc 3201*971bb1a5SLionel Sambuc int 3202*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_sizeof (const void *_buffer /**< */) 3203*971bb1a5SLionel Sambuc { 3204*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 3205*971bb1a5SLionel Sambuc const xcb_selinux_get_selection_data_context_reply_t *_aux = (xcb_selinux_get_selection_data_context_reply_t *)_buffer; 3206*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 3207*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 3208*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 3209*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 3210*971bb1a5SLionel Sambuc 3211*971bb1a5SLionel Sambuc 3212*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_selection_data_context_reply_t); 3213*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 3214*971bb1a5SLionel Sambuc /* context */ 3215*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 3216*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 3217*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 3218*971bb1a5SLionel Sambuc /* insert padding */ 3219*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3220*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 3221*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 3222*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 3223*971bb1a5SLionel Sambuc xcb_pad = 0; 3224*971bb1a5SLionel Sambuc } 3225*971bb1a5SLionel Sambuc xcb_block_len = 0; 3226*971bb1a5SLionel Sambuc 3227*971bb1a5SLionel Sambuc return xcb_buffer_len; 3228*971bb1a5SLionel Sambuc } 3229*971bb1a5SLionel Sambuc 3230*971bb1a5SLionel Sambuc 3231*971bb1a5SLionel Sambuc /***************************************************************************** 3232*971bb1a5SLionel Sambuc ** 3233*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_data_context_cookie_t xcb_selinux_get_selection_data_context 3234*971bb1a5SLionel Sambuc ** 3235*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3236*971bb1a5SLionel Sambuc ** @param xcb_atom_t selection 3237*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_data_context_cookie_t 3238*971bb1a5SLionel Sambuc ** 3239*971bb1a5SLionel Sambuc *****************************************************************************/ 3240*971bb1a5SLionel Sambuc 3241*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_cookie_t 3242*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context (xcb_connection_t *c /**< */, 3243*971bb1a5SLionel Sambuc xcb_atom_t selection /**< */) 3244*971bb1a5SLionel Sambuc { 3245*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 3246*971bb1a5SLionel Sambuc /* count */ 2, 3247*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 3248*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_SELECTION_DATA_CONTEXT, 3249*971bb1a5SLionel Sambuc /* isvoid */ 0 3250*971bb1a5SLionel Sambuc }; 3251*971bb1a5SLionel Sambuc 3252*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 3253*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_cookie_t xcb_ret; 3254*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_request_t xcb_out; 3255*971bb1a5SLionel Sambuc 3256*971bb1a5SLionel Sambuc xcb_out.selection = selection; 3257*971bb1a5SLionel Sambuc 3258*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 3259*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 3260*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 3261*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3262*971bb1a5SLionel Sambuc 3263*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3264*971bb1a5SLionel Sambuc return xcb_ret; 3265*971bb1a5SLionel Sambuc } 3266*971bb1a5SLionel Sambuc 3267*971bb1a5SLionel Sambuc 3268*971bb1a5SLionel Sambuc /***************************************************************************** 3269*971bb1a5SLionel Sambuc ** 3270*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_data_context_cookie_t xcb_selinux_get_selection_data_context_unchecked 3271*971bb1a5SLionel Sambuc ** 3272*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3273*971bb1a5SLionel Sambuc ** @param xcb_atom_t selection 3274*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_data_context_cookie_t 3275*971bb1a5SLionel Sambuc ** 3276*971bb1a5SLionel Sambuc *****************************************************************************/ 3277*971bb1a5SLionel Sambuc 3278*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_cookie_t 3279*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_unchecked (xcb_connection_t *c /**< */, 3280*971bb1a5SLionel Sambuc xcb_atom_t selection /**< */) 3281*971bb1a5SLionel Sambuc { 3282*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 3283*971bb1a5SLionel Sambuc /* count */ 2, 3284*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 3285*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_SELECTION_DATA_CONTEXT, 3286*971bb1a5SLionel Sambuc /* isvoid */ 0 3287*971bb1a5SLionel Sambuc }; 3288*971bb1a5SLionel Sambuc 3289*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 3290*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_cookie_t xcb_ret; 3291*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_request_t xcb_out; 3292*971bb1a5SLionel Sambuc 3293*971bb1a5SLionel Sambuc xcb_out.selection = selection; 3294*971bb1a5SLionel Sambuc 3295*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 3296*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 3297*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 3298*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3299*971bb1a5SLionel Sambuc 3300*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3301*971bb1a5SLionel Sambuc return xcb_ret; 3302*971bb1a5SLionel Sambuc } 3303*971bb1a5SLionel Sambuc 3304*971bb1a5SLionel Sambuc 3305*971bb1a5SLionel Sambuc /***************************************************************************** 3306*971bb1a5SLionel Sambuc ** 3307*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_selection_data_context_context 3308*971bb1a5SLionel Sambuc ** 3309*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_data_context_reply_t *R 3310*971bb1a5SLionel Sambuc ** @returns char * 3311*971bb1a5SLionel Sambuc ** 3312*971bb1a5SLionel Sambuc *****************************************************************************/ 3313*971bb1a5SLionel Sambuc 3314*971bb1a5SLionel Sambuc char * 3315*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_context (const xcb_selinux_get_selection_data_context_reply_t *R /**< */) 3316*971bb1a5SLionel Sambuc { 3317*971bb1a5SLionel Sambuc return (char *) (R + 1); 3318*971bb1a5SLionel Sambuc } 3319*971bb1a5SLionel Sambuc 3320*971bb1a5SLionel Sambuc 3321*971bb1a5SLionel Sambuc /***************************************************************************** 3322*971bb1a5SLionel Sambuc ** 3323*971bb1a5SLionel Sambuc ** int xcb_selinux_get_selection_data_context_context_length 3324*971bb1a5SLionel Sambuc ** 3325*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_data_context_reply_t *R 3326*971bb1a5SLionel Sambuc ** @returns int 3327*971bb1a5SLionel Sambuc ** 3328*971bb1a5SLionel Sambuc *****************************************************************************/ 3329*971bb1a5SLionel Sambuc 3330*971bb1a5SLionel Sambuc int 3331*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_context_length (const xcb_selinux_get_selection_data_context_reply_t *R /**< */) 3332*971bb1a5SLionel Sambuc { 3333*971bb1a5SLionel Sambuc return R->context_len; 3334*971bb1a5SLionel Sambuc } 3335*971bb1a5SLionel Sambuc 3336*971bb1a5SLionel Sambuc 3337*971bb1a5SLionel Sambuc /***************************************************************************** 3338*971bb1a5SLionel Sambuc ** 3339*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_selection_data_context_context_end 3340*971bb1a5SLionel Sambuc ** 3341*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_selection_data_context_reply_t *R 3342*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 3343*971bb1a5SLionel Sambuc ** 3344*971bb1a5SLionel Sambuc *****************************************************************************/ 3345*971bb1a5SLionel Sambuc 3346*971bb1a5SLionel Sambuc xcb_generic_iterator_t 3347*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_context_end (const xcb_selinux_get_selection_data_context_reply_t *R /**< */) 3348*971bb1a5SLionel Sambuc { 3349*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 3350*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 3351*971bb1a5SLionel Sambuc i.rem = 0; 3352*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 3353*971bb1a5SLionel Sambuc return i; 3354*971bb1a5SLionel Sambuc } 3355*971bb1a5SLionel Sambuc 3356*971bb1a5SLionel Sambuc 3357*971bb1a5SLionel Sambuc /***************************************************************************** 3358*971bb1a5SLionel Sambuc ** 3359*971bb1a5SLionel Sambuc ** xcb_selinux_get_selection_data_context_reply_t * xcb_selinux_get_selection_data_context_reply 3360*971bb1a5SLionel Sambuc ** 3361*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3362*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_selection_data_context_cookie_t cookie 3363*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 3364*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_selection_data_context_reply_t * 3365*971bb1a5SLionel Sambuc ** 3366*971bb1a5SLionel Sambuc *****************************************************************************/ 3367*971bb1a5SLionel Sambuc 3368*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_reply_t * 3369*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_reply (xcb_connection_t *c /**< */, 3370*971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_cookie_t cookie /**< */, 3371*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 3372*971bb1a5SLionel Sambuc { 3373*971bb1a5SLionel Sambuc return (xcb_selinux_get_selection_data_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 3374*971bb1a5SLionel Sambuc } 3375*971bb1a5SLionel Sambuc 3376*971bb1a5SLionel Sambuc int 3377*971bb1a5SLionel Sambuc xcb_selinux_list_selections_sizeof (const void *_buffer /**< */) 3378*971bb1a5SLionel Sambuc { 3379*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 3380*971bb1a5SLionel Sambuc const xcb_selinux_list_selections_reply_t *_aux = (xcb_selinux_list_selections_reply_t *)_buffer; 3381*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 3382*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 3383*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 3384*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 3385*971bb1a5SLionel Sambuc 3386*971bb1a5SLionel Sambuc unsigned int i; 3387*971bb1a5SLionel Sambuc unsigned int xcb_tmp_len; 3388*971bb1a5SLionel Sambuc 3389*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_list_selections_reply_t); 3390*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 3391*971bb1a5SLionel Sambuc /* selections */ 3392*971bb1a5SLionel Sambuc for(i=0; i<_aux->selections_len; i++) { 3393*971bb1a5SLionel Sambuc xcb_tmp_len = xcb_selinux_list_item_sizeof(xcb_tmp); 3394*971bb1a5SLionel Sambuc xcb_block_len += xcb_tmp_len; 3395*971bb1a5SLionel Sambuc xcb_tmp += xcb_tmp_len; 3396*971bb1a5SLionel Sambuc } 3397*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(xcb_selinux_list_item_t); 3398*971bb1a5SLionel Sambuc /* insert padding */ 3399*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3400*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 3401*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 3402*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 3403*971bb1a5SLionel Sambuc xcb_pad = 0; 3404*971bb1a5SLionel Sambuc } 3405*971bb1a5SLionel Sambuc xcb_block_len = 0; 3406*971bb1a5SLionel Sambuc 3407*971bb1a5SLionel Sambuc return xcb_buffer_len; 3408*971bb1a5SLionel Sambuc } 3409*971bb1a5SLionel Sambuc 3410*971bb1a5SLionel Sambuc 3411*971bb1a5SLionel Sambuc /***************************************************************************** 3412*971bb1a5SLionel Sambuc ** 3413*971bb1a5SLionel Sambuc ** xcb_selinux_list_selections_cookie_t xcb_selinux_list_selections 3414*971bb1a5SLionel Sambuc ** 3415*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3416*971bb1a5SLionel Sambuc ** @returns xcb_selinux_list_selections_cookie_t 3417*971bb1a5SLionel Sambuc ** 3418*971bb1a5SLionel Sambuc *****************************************************************************/ 3419*971bb1a5SLionel Sambuc 3420*971bb1a5SLionel Sambuc xcb_selinux_list_selections_cookie_t 3421*971bb1a5SLionel Sambuc xcb_selinux_list_selections (xcb_connection_t *c /**< */) 3422*971bb1a5SLionel Sambuc { 3423*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 3424*971bb1a5SLionel Sambuc /* count */ 2, 3425*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 3426*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_LIST_SELECTIONS, 3427*971bb1a5SLionel Sambuc /* isvoid */ 0 3428*971bb1a5SLionel Sambuc }; 3429*971bb1a5SLionel Sambuc 3430*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 3431*971bb1a5SLionel Sambuc xcb_selinux_list_selections_cookie_t xcb_ret; 3432*971bb1a5SLionel Sambuc xcb_selinux_list_selections_request_t xcb_out; 3433*971bb1a5SLionel Sambuc 3434*971bb1a5SLionel Sambuc 3435*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 3436*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 3437*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 3438*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3439*971bb1a5SLionel Sambuc 3440*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3441*971bb1a5SLionel Sambuc return xcb_ret; 3442*971bb1a5SLionel Sambuc } 3443*971bb1a5SLionel Sambuc 3444*971bb1a5SLionel Sambuc 3445*971bb1a5SLionel Sambuc /***************************************************************************** 3446*971bb1a5SLionel Sambuc ** 3447*971bb1a5SLionel Sambuc ** xcb_selinux_list_selections_cookie_t xcb_selinux_list_selections_unchecked 3448*971bb1a5SLionel Sambuc ** 3449*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3450*971bb1a5SLionel Sambuc ** @returns xcb_selinux_list_selections_cookie_t 3451*971bb1a5SLionel Sambuc ** 3452*971bb1a5SLionel Sambuc *****************************************************************************/ 3453*971bb1a5SLionel Sambuc 3454*971bb1a5SLionel Sambuc xcb_selinux_list_selections_cookie_t 3455*971bb1a5SLionel Sambuc xcb_selinux_list_selections_unchecked (xcb_connection_t *c /**< */) 3456*971bb1a5SLionel Sambuc { 3457*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 3458*971bb1a5SLionel Sambuc /* count */ 2, 3459*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 3460*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_LIST_SELECTIONS, 3461*971bb1a5SLionel Sambuc /* isvoid */ 0 3462*971bb1a5SLionel Sambuc }; 3463*971bb1a5SLionel Sambuc 3464*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 3465*971bb1a5SLionel Sambuc xcb_selinux_list_selections_cookie_t xcb_ret; 3466*971bb1a5SLionel Sambuc xcb_selinux_list_selections_request_t xcb_out; 3467*971bb1a5SLionel Sambuc 3468*971bb1a5SLionel Sambuc 3469*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 3470*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 3471*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 3472*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3473*971bb1a5SLionel Sambuc 3474*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3475*971bb1a5SLionel Sambuc return xcb_ret; 3476*971bb1a5SLionel Sambuc } 3477*971bb1a5SLionel Sambuc 3478*971bb1a5SLionel Sambuc 3479*971bb1a5SLionel Sambuc /***************************************************************************** 3480*971bb1a5SLionel Sambuc ** 3481*971bb1a5SLionel Sambuc ** int xcb_selinux_list_selections_selections_length 3482*971bb1a5SLionel Sambuc ** 3483*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_selections_reply_t *R 3484*971bb1a5SLionel Sambuc ** @returns int 3485*971bb1a5SLionel Sambuc ** 3486*971bb1a5SLionel Sambuc *****************************************************************************/ 3487*971bb1a5SLionel Sambuc 3488*971bb1a5SLionel Sambuc int 3489*971bb1a5SLionel Sambuc xcb_selinux_list_selections_selections_length (const xcb_selinux_list_selections_reply_t *R /**< */) 3490*971bb1a5SLionel Sambuc { 3491*971bb1a5SLionel Sambuc return R->selections_len; 3492*971bb1a5SLionel Sambuc } 3493*971bb1a5SLionel Sambuc 3494*971bb1a5SLionel Sambuc 3495*971bb1a5SLionel Sambuc /***************************************************************************** 3496*971bb1a5SLionel Sambuc ** 3497*971bb1a5SLionel Sambuc ** xcb_selinux_list_item_iterator_t xcb_selinux_list_selections_selections_iterator 3498*971bb1a5SLionel Sambuc ** 3499*971bb1a5SLionel Sambuc ** @param const xcb_selinux_list_selections_reply_t *R 3500*971bb1a5SLionel Sambuc ** @returns xcb_selinux_list_item_iterator_t 3501*971bb1a5SLionel Sambuc ** 3502*971bb1a5SLionel Sambuc *****************************************************************************/ 3503*971bb1a5SLionel Sambuc 3504*971bb1a5SLionel Sambuc xcb_selinux_list_item_iterator_t 3505*971bb1a5SLionel Sambuc xcb_selinux_list_selections_selections_iterator (const xcb_selinux_list_selections_reply_t *R /**< */) 3506*971bb1a5SLionel Sambuc { 3507*971bb1a5SLionel Sambuc xcb_selinux_list_item_iterator_t i; 3508*971bb1a5SLionel Sambuc i.data = (xcb_selinux_list_item_t *) (R + 1); 3509*971bb1a5SLionel Sambuc i.rem = R->selections_len; 3510*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 3511*971bb1a5SLionel Sambuc return i; 3512*971bb1a5SLionel Sambuc } 3513*971bb1a5SLionel Sambuc 3514*971bb1a5SLionel Sambuc 3515*971bb1a5SLionel Sambuc /***************************************************************************** 3516*971bb1a5SLionel Sambuc ** 3517*971bb1a5SLionel Sambuc ** xcb_selinux_list_selections_reply_t * xcb_selinux_list_selections_reply 3518*971bb1a5SLionel Sambuc ** 3519*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3520*971bb1a5SLionel Sambuc ** @param xcb_selinux_list_selections_cookie_t cookie 3521*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 3522*971bb1a5SLionel Sambuc ** @returns xcb_selinux_list_selections_reply_t * 3523*971bb1a5SLionel Sambuc ** 3524*971bb1a5SLionel Sambuc *****************************************************************************/ 3525*971bb1a5SLionel Sambuc 3526*971bb1a5SLionel Sambuc xcb_selinux_list_selections_reply_t * 3527*971bb1a5SLionel Sambuc xcb_selinux_list_selections_reply (xcb_connection_t *c /**< */, 3528*971bb1a5SLionel Sambuc xcb_selinux_list_selections_cookie_t cookie /**< */, 3529*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 3530*971bb1a5SLionel Sambuc { 3531*971bb1a5SLionel Sambuc return (xcb_selinux_list_selections_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 3532*971bb1a5SLionel Sambuc } 3533*971bb1a5SLionel Sambuc 3534*971bb1a5SLionel Sambuc int 3535*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_sizeof (const void *_buffer /**< */) 3536*971bb1a5SLionel Sambuc { 3537*971bb1a5SLionel Sambuc char *xcb_tmp = (char *)_buffer; 3538*971bb1a5SLionel Sambuc const xcb_selinux_get_client_context_reply_t *_aux = (xcb_selinux_get_client_context_reply_t *)_buffer; 3539*971bb1a5SLionel Sambuc unsigned int xcb_buffer_len = 0; 3540*971bb1a5SLionel Sambuc unsigned int xcb_block_len = 0; 3541*971bb1a5SLionel Sambuc unsigned int xcb_pad = 0; 3542*971bb1a5SLionel Sambuc unsigned int xcb_align_to; 3543*971bb1a5SLionel Sambuc 3544*971bb1a5SLionel Sambuc 3545*971bb1a5SLionel Sambuc xcb_block_len += sizeof(xcb_selinux_get_client_context_reply_t); 3546*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 3547*971bb1a5SLionel Sambuc /* context */ 3548*971bb1a5SLionel Sambuc xcb_block_len += _aux->context_len * sizeof(char); 3549*971bb1a5SLionel Sambuc xcb_tmp += xcb_block_len; 3550*971bb1a5SLionel Sambuc xcb_align_to = ALIGNOF(char); 3551*971bb1a5SLionel Sambuc /* insert padding */ 3552*971bb1a5SLionel Sambuc xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3553*971bb1a5SLionel Sambuc xcb_buffer_len += xcb_block_len + xcb_pad; 3554*971bb1a5SLionel Sambuc if (0 != xcb_pad) { 3555*971bb1a5SLionel Sambuc xcb_tmp += xcb_pad; 3556*971bb1a5SLionel Sambuc xcb_pad = 0; 3557*971bb1a5SLionel Sambuc } 3558*971bb1a5SLionel Sambuc xcb_block_len = 0; 3559*971bb1a5SLionel Sambuc 3560*971bb1a5SLionel Sambuc return xcb_buffer_len; 3561*971bb1a5SLionel Sambuc } 3562*971bb1a5SLionel Sambuc 3563*971bb1a5SLionel Sambuc 3564*971bb1a5SLionel Sambuc /***************************************************************************** 3565*971bb1a5SLionel Sambuc ** 3566*971bb1a5SLionel Sambuc ** xcb_selinux_get_client_context_cookie_t xcb_selinux_get_client_context 3567*971bb1a5SLionel Sambuc ** 3568*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3569*971bb1a5SLionel Sambuc ** @param uint32_t resource 3570*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_client_context_cookie_t 3571*971bb1a5SLionel Sambuc ** 3572*971bb1a5SLionel Sambuc *****************************************************************************/ 3573*971bb1a5SLionel Sambuc 3574*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_cookie_t 3575*971bb1a5SLionel Sambuc xcb_selinux_get_client_context (xcb_connection_t *c /**< */, 3576*971bb1a5SLionel Sambuc uint32_t resource /**< */) 3577*971bb1a5SLionel Sambuc { 3578*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 3579*971bb1a5SLionel Sambuc /* count */ 2, 3580*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 3581*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_CLIENT_CONTEXT, 3582*971bb1a5SLionel Sambuc /* isvoid */ 0 3583*971bb1a5SLionel Sambuc }; 3584*971bb1a5SLionel Sambuc 3585*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 3586*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_cookie_t xcb_ret; 3587*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_request_t xcb_out; 3588*971bb1a5SLionel Sambuc 3589*971bb1a5SLionel Sambuc xcb_out.resource = resource; 3590*971bb1a5SLionel Sambuc 3591*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 3592*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 3593*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 3594*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3595*971bb1a5SLionel Sambuc 3596*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3597*971bb1a5SLionel Sambuc return xcb_ret; 3598*971bb1a5SLionel Sambuc } 3599*971bb1a5SLionel Sambuc 3600*971bb1a5SLionel Sambuc 3601*971bb1a5SLionel Sambuc /***************************************************************************** 3602*971bb1a5SLionel Sambuc ** 3603*971bb1a5SLionel Sambuc ** xcb_selinux_get_client_context_cookie_t xcb_selinux_get_client_context_unchecked 3604*971bb1a5SLionel Sambuc ** 3605*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3606*971bb1a5SLionel Sambuc ** @param uint32_t resource 3607*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_client_context_cookie_t 3608*971bb1a5SLionel Sambuc ** 3609*971bb1a5SLionel Sambuc *****************************************************************************/ 3610*971bb1a5SLionel Sambuc 3611*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_cookie_t 3612*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_unchecked (xcb_connection_t *c /**< */, 3613*971bb1a5SLionel Sambuc uint32_t resource /**< */) 3614*971bb1a5SLionel Sambuc { 3615*971bb1a5SLionel Sambuc static const xcb_protocol_request_t xcb_req = { 3616*971bb1a5SLionel Sambuc /* count */ 2, 3617*971bb1a5SLionel Sambuc /* ext */ &xcb_selinux_id, 3618*971bb1a5SLionel Sambuc /* opcode */ XCB_SELINUX_GET_CLIENT_CONTEXT, 3619*971bb1a5SLionel Sambuc /* isvoid */ 0 3620*971bb1a5SLionel Sambuc }; 3621*971bb1a5SLionel Sambuc 3622*971bb1a5SLionel Sambuc struct iovec xcb_parts[4]; 3623*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_cookie_t xcb_ret; 3624*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_request_t xcb_out; 3625*971bb1a5SLionel Sambuc 3626*971bb1a5SLionel Sambuc xcb_out.resource = resource; 3627*971bb1a5SLionel Sambuc 3628*971bb1a5SLionel Sambuc xcb_parts[2].iov_base = (char *) &xcb_out; 3629*971bb1a5SLionel Sambuc xcb_parts[2].iov_len = sizeof(xcb_out); 3630*971bb1a5SLionel Sambuc xcb_parts[3].iov_base = 0; 3631*971bb1a5SLionel Sambuc xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3632*971bb1a5SLionel Sambuc 3633*971bb1a5SLionel Sambuc xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3634*971bb1a5SLionel Sambuc return xcb_ret; 3635*971bb1a5SLionel Sambuc } 3636*971bb1a5SLionel Sambuc 3637*971bb1a5SLionel Sambuc 3638*971bb1a5SLionel Sambuc /***************************************************************************** 3639*971bb1a5SLionel Sambuc ** 3640*971bb1a5SLionel Sambuc ** char * xcb_selinux_get_client_context_context 3641*971bb1a5SLionel Sambuc ** 3642*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_client_context_reply_t *R 3643*971bb1a5SLionel Sambuc ** @returns char * 3644*971bb1a5SLionel Sambuc ** 3645*971bb1a5SLionel Sambuc *****************************************************************************/ 3646*971bb1a5SLionel Sambuc 3647*971bb1a5SLionel Sambuc char * 3648*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_context (const xcb_selinux_get_client_context_reply_t *R /**< */) 3649*971bb1a5SLionel Sambuc { 3650*971bb1a5SLionel Sambuc return (char *) (R + 1); 3651*971bb1a5SLionel Sambuc } 3652*971bb1a5SLionel Sambuc 3653*971bb1a5SLionel Sambuc 3654*971bb1a5SLionel Sambuc /***************************************************************************** 3655*971bb1a5SLionel Sambuc ** 3656*971bb1a5SLionel Sambuc ** int xcb_selinux_get_client_context_context_length 3657*971bb1a5SLionel Sambuc ** 3658*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_client_context_reply_t *R 3659*971bb1a5SLionel Sambuc ** @returns int 3660*971bb1a5SLionel Sambuc ** 3661*971bb1a5SLionel Sambuc *****************************************************************************/ 3662*971bb1a5SLionel Sambuc 3663*971bb1a5SLionel Sambuc int 3664*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_context_length (const xcb_selinux_get_client_context_reply_t *R /**< */) 3665*971bb1a5SLionel Sambuc { 3666*971bb1a5SLionel Sambuc return R->context_len; 3667*971bb1a5SLionel Sambuc } 3668*971bb1a5SLionel Sambuc 3669*971bb1a5SLionel Sambuc 3670*971bb1a5SLionel Sambuc /***************************************************************************** 3671*971bb1a5SLionel Sambuc ** 3672*971bb1a5SLionel Sambuc ** xcb_generic_iterator_t xcb_selinux_get_client_context_context_end 3673*971bb1a5SLionel Sambuc ** 3674*971bb1a5SLionel Sambuc ** @param const xcb_selinux_get_client_context_reply_t *R 3675*971bb1a5SLionel Sambuc ** @returns xcb_generic_iterator_t 3676*971bb1a5SLionel Sambuc ** 3677*971bb1a5SLionel Sambuc *****************************************************************************/ 3678*971bb1a5SLionel Sambuc 3679*971bb1a5SLionel Sambuc xcb_generic_iterator_t 3680*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_context_end (const xcb_selinux_get_client_context_reply_t *R /**< */) 3681*971bb1a5SLionel Sambuc { 3682*971bb1a5SLionel Sambuc xcb_generic_iterator_t i; 3683*971bb1a5SLionel Sambuc i.data = ((char *) (R + 1)) + (R->context_len); 3684*971bb1a5SLionel Sambuc i.rem = 0; 3685*971bb1a5SLionel Sambuc i.index = (char *) i.data - (char *) R; 3686*971bb1a5SLionel Sambuc return i; 3687*971bb1a5SLionel Sambuc } 3688*971bb1a5SLionel Sambuc 3689*971bb1a5SLionel Sambuc 3690*971bb1a5SLionel Sambuc /***************************************************************************** 3691*971bb1a5SLionel Sambuc ** 3692*971bb1a5SLionel Sambuc ** xcb_selinux_get_client_context_reply_t * xcb_selinux_get_client_context_reply 3693*971bb1a5SLionel Sambuc ** 3694*971bb1a5SLionel Sambuc ** @param xcb_connection_t *c 3695*971bb1a5SLionel Sambuc ** @param xcb_selinux_get_client_context_cookie_t cookie 3696*971bb1a5SLionel Sambuc ** @param xcb_generic_error_t **e 3697*971bb1a5SLionel Sambuc ** @returns xcb_selinux_get_client_context_reply_t * 3698*971bb1a5SLionel Sambuc ** 3699*971bb1a5SLionel Sambuc *****************************************************************************/ 3700*971bb1a5SLionel Sambuc 3701*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_reply_t * 3702*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_reply (xcb_connection_t *c /**< */, 3703*971bb1a5SLionel Sambuc xcb_selinux_get_client_context_cookie_t cookie /**< */, 3704*971bb1a5SLionel Sambuc xcb_generic_error_t **e /**< */) 3705*971bb1a5SLionel Sambuc { 3706*971bb1a5SLionel Sambuc return (xcb_selinux_get_client_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 3707*971bb1a5SLionel Sambuc } 3708*971bb1a5SLionel Sambuc 3709