xref: /minix3/external/mit/xorg/lib/libxcb/files/xselinux.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1971bb1a5SLionel Sambuc /*
2971bb1a5SLionel Sambuc  * This file generated automatically from xselinux.xml by c_client.py.
3971bb1a5SLionel Sambuc  * Edit at your peril.
4971bb1a5SLionel Sambuc  */
5971bb1a5SLionel Sambuc 
6971bb1a5SLionel Sambuc #ifdef HAVE_CONFIG_H
7971bb1a5SLionel Sambuc #include "config.h"
8971bb1a5SLionel Sambuc #endif
9971bb1a5SLionel Sambuc #include <stdlib.h>
10971bb1a5SLionel Sambuc #include <string.h>
11971bb1a5SLionel Sambuc #include <assert.h>
12971bb1a5SLionel Sambuc #include <stddef.h>  /* for offsetof() */
13971bb1a5SLionel Sambuc #include "xcbext.h"
14971bb1a5SLionel Sambuc #include "xselinux.h"
15971bb1a5SLionel Sambuc 
16971bb1a5SLionel Sambuc #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17971bb1a5SLionel Sambuc #include "xproto.h"
18971bb1a5SLionel Sambuc 
19971bb1a5SLionel Sambuc xcb_extension_t xcb_selinux_id = { "SELinux", 0 };
20971bb1a5SLionel Sambuc 
21971bb1a5SLionel Sambuc xcb_selinux_query_version_cookie_t
xcb_selinux_query_version(xcb_connection_t * c,uint8_t client_major,uint8_t client_minor)22971bb1a5SLionel Sambuc xcb_selinux_query_version (xcb_connection_t *c  /**< */,
23971bb1a5SLionel Sambuc                            uint8_t           client_major  /**< */,
24971bb1a5SLionel Sambuc                            uint8_t           client_minor  /**< */)
25971bb1a5SLionel Sambuc {
26971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
27971bb1a5SLionel Sambuc         /* count */ 2,
28971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
29971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_QUERY_VERSION,
30971bb1a5SLionel Sambuc         /* isvoid */ 0
31971bb1a5SLionel Sambuc     };
32971bb1a5SLionel Sambuc 
33971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
34971bb1a5SLionel Sambuc     xcb_selinux_query_version_cookie_t xcb_ret;
35971bb1a5SLionel Sambuc     xcb_selinux_query_version_request_t xcb_out;
36971bb1a5SLionel Sambuc 
37971bb1a5SLionel Sambuc     xcb_out.client_major = client_major;
38971bb1a5SLionel Sambuc     xcb_out.client_minor = client_minor;
39971bb1a5SLionel Sambuc 
40971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
41971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
42971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
43971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
44971bb1a5SLionel Sambuc 
45971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
46971bb1a5SLionel Sambuc     return xcb_ret;
47971bb1a5SLionel Sambuc }
48971bb1a5SLionel Sambuc 
49971bb1a5SLionel Sambuc xcb_selinux_query_version_cookie_t
xcb_selinux_query_version_unchecked(xcb_connection_t * c,uint8_t client_major,uint8_t client_minor)50971bb1a5SLionel Sambuc xcb_selinux_query_version_unchecked (xcb_connection_t *c  /**< */,
51971bb1a5SLionel Sambuc                                      uint8_t           client_major  /**< */,
52971bb1a5SLionel Sambuc                                      uint8_t           client_minor  /**< */)
53971bb1a5SLionel Sambuc {
54971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
55971bb1a5SLionel Sambuc         /* count */ 2,
56971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
57971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_QUERY_VERSION,
58971bb1a5SLionel Sambuc         /* isvoid */ 0
59971bb1a5SLionel Sambuc     };
60971bb1a5SLionel Sambuc 
61971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
62971bb1a5SLionel Sambuc     xcb_selinux_query_version_cookie_t xcb_ret;
63971bb1a5SLionel Sambuc     xcb_selinux_query_version_request_t xcb_out;
64971bb1a5SLionel Sambuc 
65971bb1a5SLionel Sambuc     xcb_out.client_major = client_major;
66971bb1a5SLionel Sambuc     xcb_out.client_minor = client_minor;
67971bb1a5SLionel Sambuc 
68971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
69971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
70971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
71971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
72971bb1a5SLionel Sambuc 
73971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
74971bb1a5SLionel Sambuc     return xcb_ret;
75971bb1a5SLionel Sambuc }
76971bb1a5SLionel Sambuc 
77971bb1a5SLionel Sambuc xcb_selinux_query_version_reply_t *
xcb_selinux_query_version_reply(xcb_connection_t * c,xcb_selinux_query_version_cookie_t cookie,xcb_generic_error_t ** e)78971bb1a5SLionel Sambuc xcb_selinux_query_version_reply (xcb_connection_t                    *c  /**< */,
79971bb1a5SLionel Sambuc                                  xcb_selinux_query_version_cookie_t   cookie  /**< */,
80971bb1a5SLionel Sambuc                                  xcb_generic_error_t                **e  /**< */)
81971bb1a5SLionel Sambuc {
82971bb1a5SLionel Sambuc     return (xcb_selinux_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
83971bb1a5SLionel Sambuc }
84971bb1a5SLionel Sambuc 
85971bb1a5SLionel Sambuc int
xcb_selinux_set_device_create_context_sizeof(const void * _buffer)86971bb1a5SLionel Sambuc xcb_selinux_set_device_create_context_sizeof (const void  *_buffer  /**< */)
87971bb1a5SLionel Sambuc {
88971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
89971bb1a5SLionel Sambuc     const xcb_selinux_set_device_create_context_request_t *_aux = (xcb_selinux_set_device_create_context_request_t *)_buffer;
90971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
91971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
92971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
93*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
94971bb1a5SLionel Sambuc 
95971bb1a5SLionel Sambuc 
96971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_set_device_create_context_request_t);
97971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
98*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
99*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
100971bb1a5SLionel Sambuc     /* context */
101971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
102971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
103971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
104971bb1a5SLionel Sambuc     /* insert padding */
105971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
106971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
107971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
108971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
109971bb1a5SLionel Sambuc         xcb_pad = 0;
110971bb1a5SLionel Sambuc     }
111971bb1a5SLionel Sambuc     xcb_block_len = 0;
112971bb1a5SLionel Sambuc 
113971bb1a5SLionel Sambuc     return xcb_buffer_len;
114971bb1a5SLionel Sambuc }
115971bb1a5SLionel Sambuc 
116971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_device_create_context_checked(xcb_connection_t * c,uint32_t context_len,const char * context)117971bb1a5SLionel Sambuc xcb_selinux_set_device_create_context_checked (xcb_connection_t *c  /**< */,
118971bb1a5SLionel Sambuc                                                uint32_t          context_len  /**< */,
119971bb1a5SLionel Sambuc                                                const char       *context  /**< */)
120971bb1a5SLionel Sambuc {
121971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
122971bb1a5SLionel Sambuc         /* count */ 4,
123971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
124971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_DEVICE_CREATE_CONTEXT,
125971bb1a5SLionel Sambuc         /* isvoid */ 1
126971bb1a5SLionel Sambuc     };
127971bb1a5SLionel Sambuc 
128971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
129971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
130971bb1a5SLionel Sambuc     xcb_selinux_set_device_create_context_request_t xcb_out;
131971bb1a5SLionel Sambuc 
132971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
133971bb1a5SLionel Sambuc 
134971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
135971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
136971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
137971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
138971bb1a5SLionel Sambuc     /* char context */
139971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
140971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
141971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
142971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
143971bb1a5SLionel Sambuc 
144971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
145971bb1a5SLionel Sambuc     return xcb_ret;
146971bb1a5SLionel Sambuc }
147971bb1a5SLionel Sambuc 
148971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_device_create_context(xcb_connection_t * c,uint32_t context_len,const char * context)149971bb1a5SLionel Sambuc xcb_selinux_set_device_create_context (xcb_connection_t *c  /**< */,
150971bb1a5SLionel Sambuc                                        uint32_t          context_len  /**< */,
151971bb1a5SLionel Sambuc                                        const char       *context  /**< */)
152971bb1a5SLionel Sambuc {
153971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
154971bb1a5SLionel Sambuc         /* count */ 4,
155971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
156971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_DEVICE_CREATE_CONTEXT,
157971bb1a5SLionel Sambuc         /* isvoid */ 1
158971bb1a5SLionel Sambuc     };
159971bb1a5SLionel Sambuc 
160971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
161971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
162971bb1a5SLionel Sambuc     xcb_selinux_set_device_create_context_request_t xcb_out;
163971bb1a5SLionel Sambuc 
164971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
165971bb1a5SLionel Sambuc 
166971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
167971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
168971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
169971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
170971bb1a5SLionel Sambuc     /* char context */
171971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
172971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
173971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
174971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
175971bb1a5SLionel Sambuc 
176971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
177971bb1a5SLionel Sambuc     return xcb_ret;
178971bb1a5SLionel Sambuc }
179971bb1a5SLionel Sambuc 
180971bb1a5SLionel Sambuc int
xcb_selinux_get_device_create_context_sizeof(const void * _buffer)181971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_sizeof (const void  *_buffer  /**< */)
182971bb1a5SLionel Sambuc {
183971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
184971bb1a5SLionel Sambuc     const xcb_selinux_get_device_create_context_reply_t *_aux = (xcb_selinux_get_device_create_context_reply_t *)_buffer;
185971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
186971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
187971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
188*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
189971bb1a5SLionel Sambuc 
190971bb1a5SLionel Sambuc 
191971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_device_create_context_reply_t);
192971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
193*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
194*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
195971bb1a5SLionel Sambuc     /* context */
196971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
197971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
198971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
199971bb1a5SLionel Sambuc     /* insert padding */
200971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
201971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
202971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
203971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
204971bb1a5SLionel Sambuc         xcb_pad = 0;
205971bb1a5SLionel Sambuc     }
206971bb1a5SLionel Sambuc     xcb_block_len = 0;
207971bb1a5SLionel Sambuc 
208971bb1a5SLionel Sambuc     return xcb_buffer_len;
209971bb1a5SLionel Sambuc }
210971bb1a5SLionel Sambuc 
211971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_cookie_t
xcb_selinux_get_device_create_context(xcb_connection_t * c)212971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context (xcb_connection_t *c  /**< */)
213971bb1a5SLionel Sambuc {
214971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
215971bb1a5SLionel Sambuc         /* count */ 2,
216971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
217971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_DEVICE_CREATE_CONTEXT,
218971bb1a5SLionel Sambuc         /* isvoid */ 0
219971bb1a5SLionel Sambuc     };
220971bb1a5SLionel Sambuc 
221971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
222971bb1a5SLionel Sambuc     xcb_selinux_get_device_create_context_cookie_t xcb_ret;
223971bb1a5SLionel Sambuc     xcb_selinux_get_device_create_context_request_t xcb_out;
224971bb1a5SLionel Sambuc 
225971bb1a5SLionel Sambuc 
226971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
227971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
228971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
229971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
230971bb1a5SLionel Sambuc 
231971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
232971bb1a5SLionel Sambuc     return xcb_ret;
233971bb1a5SLionel Sambuc }
234971bb1a5SLionel Sambuc 
235971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_cookie_t
xcb_selinux_get_device_create_context_unchecked(xcb_connection_t * c)236971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_unchecked (xcb_connection_t *c  /**< */)
237971bb1a5SLionel Sambuc {
238971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
239971bb1a5SLionel Sambuc         /* count */ 2,
240971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
241971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_DEVICE_CREATE_CONTEXT,
242971bb1a5SLionel Sambuc         /* isvoid */ 0
243971bb1a5SLionel Sambuc     };
244971bb1a5SLionel Sambuc 
245971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
246971bb1a5SLionel Sambuc     xcb_selinux_get_device_create_context_cookie_t xcb_ret;
247971bb1a5SLionel Sambuc     xcb_selinux_get_device_create_context_request_t xcb_out;
248971bb1a5SLionel Sambuc 
249971bb1a5SLionel Sambuc 
250971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
251971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
252971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
253971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
254971bb1a5SLionel Sambuc 
255971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
256971bb1a5SLionel Sambuc     return xcb_ret;
257971bb1a5SLionel Sambuc }
258971bb1a5SLionel Sambuc 
259971bb1a5SLionel Sambuc char *
xcb_selinux_get_device_create_context_context(const xcb_selinux_get_device_create_context_reply_t * R)260971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_context (const xcb_selinux_get_device_create_context_reply_t *R  /**< */)
261971bb1a5SLionel Sambuc {
262971bb1a5SLionel Sambuc     return (char *) (R + 1);
263971bb1a5SLionel Sambuc }
264971bb1a5SLionel Sambuc 
265971bb1a5SLionel Sambuc int
xcb_selinux_get_device_create_context_context_length(const xcb_selinux_get_device_create_context_reply_t * R)266971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_context_length (const xcb_selinux_get_device_create_context_reply_t *R  /**< */)
267971bb1a5SLionel Sambuc {
268971bb1a5SLionel Sambuc     return R->context_len;
269971bb1a5SLionel Sambuc }
270971bb1a5SLionel Sambuc 
271971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_device_create_context_context_end(const xcb_selinux_get_device_create_context_reply_t * R)272971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_context_end (const xcb_selinux_get_device_create_context_reply_t *R  /**< */)
273971bb1a5SLionel Sambuc {
274971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
275971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
276971bb1a5SLionel Sambuc     i.rem = 0;
277971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
278971bb1a5SLionel Sambuc     return i;
279971bb1a5SLionel Sambuc }
280971bb1a5SLionel Sambuc 
281971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_reply_t *
xcb_selinux_get_device_create_context_reply(xcb_connection_t * c,xcb_selinux_get_device_create_context_cookie_t cookie,xcb_generic_error_t ** e)282971bb1a5SLionel Sambuc xcb_selinux_get_device_create_context_reply (xcb_connection_t                                *c  /**< */,
283971bb1a5SLionel Sambuc                                              xcb_selinux_get_device_create_context_cookie_t   cookie  /**< */,
284971bb1a5SLionel Sambuc                                              xcb_generic_error_t                            **e  /**< */)
285971bb1a5SLionel Sambuc {
286971bb1a5SLionel Sambuc     return (xcb_selinux_get_device_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
287971bb1a5SLionel Sambuc }
288971bb1a5SLionel Sambuc 
289971bb1a5SLionel Sambuc int
xcb_selinux_set_device_context_sizeof(const void * _buffer)290971bb1a5SLionel Sambuc xcb_selinux_set_device_context_sizeof (const void  *_buffer  /**< */)
291971bb1a5SLionel Sambuc {
292971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
293971bb1a5SLionel Sambuc     const xcb_selinux_set_device_context_request_t *_aux = (xcb_selinux_set_device_context_request_t *)_buffer;
294971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
295971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
296971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
297*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
298971bb1a5SLionel Sambuc 
299971bb1a5SLionel Sambuc 
300971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_set_device_context_request_t);
301971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
302*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
303*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
304971bb1a5SLionel Sambuc     /* context */
305971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
306971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
307971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
308971bb1a5SLionel Sambuc     /* insert padding */
309971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
310971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
311971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
312971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
313971bb1a5SLionel Sambuc         xcb_pad = 0;
314971bb1a5SLionel Sambuc     }
315971bb1a5SLionel Sambuc     xcb_block_len = 0;
316971bb1a5SLionel Sambuc 
317971bb1a5SLionel Sambuc     return xcb_buffer_len;
318971bb1a5SLionel Sambuc }
319971bb1a5SLionel Sambuc 
320971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_device_context_checked(xcb_connection_t * c,uint32_t device,uint32_t context_len,const char * context)321971bb1a5SLionel Sambuc xcb_selinux_set_device_context_checked (xcb_connection_t *c  /**< */,
322971bb1a5SLionel Sambuc                                         uint32_t          device  /**< */,
323971bb1a5SLionel Sambuc                                         uint32_t          context_len  /**< */,
324971bb1a5SLionel Sambuc                                         const char       *context  /**< */)
325971bb1a5SLionel Sambuc {
326971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
327971bb1a5SLionel Sambuc         /* count */ 4,
328971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
329971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_DEVICE_CONTEXT,
330971bb1a5SLionel Sambuc         /* isvoid */ 1
331971bb1a5SLionel Sambuc     };
332971bb1a5SLionel Sambuc 
333971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
334971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
335971bb1a5SLionel Sambuc     xcb_selinux_set_device_context_request_t xcb_out;
336971bb1a5SLionel Sambuc 
337971bb1a5SLionel Sambuc     xcb_out.device = device;
338971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
339971bb1a5SLionel Sambuc 
340971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
341971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
342971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
343971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
344971bb1a5SLionel Sambuc     /* char context */
345971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
346971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
347971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
348971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
349971bb1a5SLionel Sambuc 
350971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
351971bb1a5SLionel Sambuc     return xcb_ret;
352971bb1a5SLionel Sambuc }
353971bb1a5SLionel Sambuc 
354971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_device_context(xcb_connection_t * c,uint32_t device,uint32_t context_len,const char * context)355971bb1a5SLionel Sambuc xcb_selinux_set_device_context (xcb_connection_t *c  /**< */,
356971bb1a5SLionel Sambuc                                 uint32_t          device  /**< */,
357971bb1a5SLionel Sambuc                                 uint32_t          context_len  /**< */,
358971bb1a5SLionel Sambuc                                 const char       *context  /**< */)
359971bb1a5SLionel Sambuc {
360971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
361971bb1a5SLionel Sambuc         /* count */ 4,
362971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
363971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_DEVICE_CONTEXT,
364971bb1a5SLionel Sambuc         /* isvoid */ 1
365971bb1a5SLionel Sambuc     };
366971bb1a5SLionel Sambuc 
367971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
368971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
369971bb1a5SLionel Sambuc     xcb_selinux_set_device_context_request_t xcb_out;
370971bb1a5SLionel Sambuc 
371971bb1a5SLionel Sambuc     xcb_out.device = device;
372971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
373971bb1a5SLionel Sambuc 
374971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
375971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
376971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
377971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
378971bb1a5SLionel Sambuc     /* char context */
379971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
380971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
381971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
382971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
383971bb1a5SLionel Sambuc 
384971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
385971bb1a5SLionel Sambuc     return xcb_ret;
386971bb1a5SLionel Sambuc }
387971bb1a5SLionel Sambuc 
388971bb1a5SLionel Sambuc int
xcb_selinux_get_device_context_sizeof(const void * _buffer)389971bb1a5SLionel Sambuc xcb_selinux_get_device_context_sizeof (const void  *_buffer  /**< */)
390971bb1a5SLionel Sambuc {
391971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
392971bb1a5SLionel Sambuc     const xcb_selinux_get_device_context_reply_t *_aux = (xcb_selinux_get_device_context_reply_t *)_buffer;
393971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
394971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
395971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
396*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
397971bb1a5SLionel Sambuc 
398971bb1a5SLionel Sambuc 
399971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_device_context_reply_t);
400971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
401*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
402*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
403971bb1a5SLionel Sambuc     /* context */
404971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
405971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
406971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
407971bb1a5SLionel Sambuc     /* insert padding */
408971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
409971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
410971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
411971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
412971bb1a5SLionel Sambuc         xcb_pad = 0;
413971bb1a5SLionel Sambuc     }
414971bb1a5SLionel Sambuc     xcb_block_len = 0;
415971bb1a5SLionel Sambuc 
416971bb1a5SLionel Sambuc     return xcb_buffer_len;
417971bb1a5SLionel Sambuc }
418971bb1a5SLionel Sambuc 
419971bb1a5SLionel Sambuc xcb_selinux_get_device_context_cookie_t
xcb_selinux_get_device_context(xcb_connection_t * c,uint32_t device)420971bb1a5SLionel Sambuc xcb_selinux_get_device_context (xcb_connection_t *c  /**< */,
421971bb1a5SLionel Sambuc                                 uint32_t          device  /**< */)
422971bb1a5SLionel Sambuc {
423971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
424971bb1a5SLionel Sambuc         /* count */ 2,
425971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
426971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_DEVICE_CONTEXT,
427971bb1a5SLionel Sambuc         /* isvoid */ 0
428971bb1a5SLionel Sambuc     };
429971bb1a5SLionel Sambuc 
430971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
431971bb1a5SLionel Sambuc     xcb_selinux_get_device_context_cookie_t xcb_ret;
432971bb1a5SLionel Sambuc     xcb_selinux_get_device_context_request_t xcb_out;
433971bb1a5SLionel Sambuc 
434971bb1a5SLionel Sambuc     xcb_out.device = device;
435971bb1a5SLionel Sambuc 
436971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
437971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
438971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
439971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
440971bb1a5SLionel Sambuc 
441971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
442971bb1a5SLionel Sambuc     return xcb_ret;
443971bb1a5SLionel Sambuc }
444971bb1a5SLionel Sambuc 
445971bb1a5SLionel Sambuc xcb_selinux_get_device_context_cookie_t
xcb_selinux_get_device_context_unchecked(xcb_connection_t * c,uint32_t device)446971bb1a5SLionel Sambuc xcb_selinux_get_device_context_unchecked (xcb_connection_t *c  /**< */,
447971bb1a5SLionel Sambuc                                           uint32_t          device  /**< */)
448971bb1a5SLionel Sambuc {
449971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
450971bb1a5SLionel Sambuc         /* count */ 2,
451971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
452971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_DEVICE_CONTEXT,
453971bb1a5SLionel Sambuc         /* isvoid */ 0
454971bb1a5SLionel Sambuc     };
455971bb1a5SLionel Sambuc 
456971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
457971bb1a5SLionel Sambuc     xcb_selinux_get_device_context_cookie_t xcb_ret;
458971bb1a5SLionel Sambuc     xcb_selinux_get_device_context_request_t xcb_out;
459971bb1a5SLionel Sambuc 
460971bb1a5SLionel Sambuc     xcb_out.device = device;
461971bb1a5SLionel Sambuc 
462971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
463971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
464971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
465971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
466971bb1a5SLionel Sambuc 
467971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
468971bb1a5SLionel Sambuc     return xcb_ret;
469971bb1a5SLionel Sambuc }
470971bb1a5SLionel Sambuc 
471971bb1a5SLionel Sambuc char *
xcb_selinux_get_device_context_context(const xcb_selinux_get_device_context_reply_t * R)472971bb1a5SLionel Sambuc xcb_selinux_get_device_context_context (const xcb_selinux_get_device_context_reply_t *R  /**< */)
473971bb1a5SLionel Sambuc {
474971bb1a5SLionel Sambuc     return (char *) (R + 1);
475971bb1a5SLionel Sambuc }
476971bb1a5SLionel Sambuc 
477971bb1a5SLionel Sambuc int
xcb_selinux_get_device_context_context_length(const xcb_selinux_get_device_context_reply_t * R)478971bb1a5SLionel Sambuc xcb_selinux_get_device_context_context_length (const xcb_selinux_get_device_context_reply_t *R  /**< */)
479971bb1a5SLionel Sambuc {
480971bb1a5SLionel Sambuc     return R->context_len;
481971bb1a5SLionel Sambuc }
482971bb1a5SLionel Sambuc 
483971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_device_context_context_end(const xcb_selinux_get_device_context_reply_t * R)484971bb1a5SLionel Sambuc xcb_selinux_get_device_context_context_end (const xcb_selinux_get_device_context_reply_t *R  /**< */)
485971bb1a5SLionel Sambuc {
486971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
487971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
488971bb1a5SLionel Sambuc     i.rem = 0;
489971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
490971bb1a5SLionel Sambuc     return i;
491971bb1a5SLionel Sambuc }
492971bb1a5SLionel Sambuc 
493971bb1a5SLionel Sambuc xcb_selinux_get_device_context_reply_t *
xcb_selinux_get_device_context_reply(xcb_connection_t * c,xcb_selinux_get_device_context_cookie_t cookie,xcb_generic_error_t ** e)494971bb1a5SLionel Sambuc xcb_selinux_get_device_context_reply (xcb_connection_t                         *c  /**< */,
495971bb1a5SLionel Sambuc                                       xcb_selinux_get_device_context_cookie_t   cookie  /**< */,
496971bb1a5SLionel Sambuc                                       xcb_generic_error_t                     **e  /**< */)
497971bb1a5SLionel Sambuc {
498971bb1a5SLionel Sambuc     return (xcb_selinux_get_device_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
499971bb1a5SLionel Sambuc }
500971bb1a5SLionel Sambuc 
501971bb1a5SLionel Sambuc int
xcb_selinux_set_window_create_context_sizeof(const void * _buffer)502971bb1a5SLionel Sambuc xcb_selinux_set_window_create_context_sizeof (const void  *_buffer  /**< */)
503971bb1a5SLionel Sambuc {
504971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
505971bb1a5SLionel Sambuc     const xcb_selinux_set_window_create_context_request_t *_aux = (xcb_selinux_set_window_create_context_request_t *)_buffer;
506971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
507971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
508971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
509*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
510971bb1a5SLionel Sambuc 
511971bb1a5SLionel Sambuc 
512971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_set_window_create_context_request_t);
513971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
514*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
515*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
516971bb1a5SLionel Sambuc     /* context */
517971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
518971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
519971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
520971bb1a5SLionel Sambuc     /* insert padding */
521971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
522971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
523971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
524971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
525971bb1a5SLionel Sambuc         xcb_pad = 0;
526971bb1a5SLionel Sambuc     }
527971bb1a5SLionel Sambuc     xcb_block_len = 0;
528971bb1a5SLionel Sambuc 
529971bb1a5SLionel Sambuc     return xcb_buffer_len;
530971bb1a5SLionel Sambuc }
531971bb1a5SLionel Sambuc 
532971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_window_create_context_checked(xcb_connection_t * c,uint32_t context_len,const char * context)533971bb1a5SLionel Sambuc xcb_selinux_set_window_create_context_checked (xcb_connection_t *c  /**< */,
534971bb1a5SLionel Sambuc                                                uint32_t          context_len  /**< */,
535971bb1a5SLionel Sambuc                                                const char       *context  /**< */)
536971bb1a5SLionel Sambuc {
537971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
538971bb1a5SLionel Sambuc         /* count */ 4,
539971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
540971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_WINDOW_CREATE_CONTEXT,
541971bb1a5SLionel Sambuc         /* isvoid */ 1
542971bb1a5SLionel Sambuc     };
543971bb1a5SLionel Sambuc 
544971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
545971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
546971bb1a5SLionel Sambuc     xcb_selinux_set_window_create_context_request_t xcb_out;
547971bb1a5SLionel Sambuc 
548971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
549971bb1a5SLionel Sambuc 
550971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
551971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
552971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
553971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
554971bb1a5SLionel Sambuc     /* char context */
555971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
556971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
557971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
558971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
559971bb1a5SLionel Sambuc 
560971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
561971bb1a5SLionel Sambuc     return xcb_ret;
562971bb1a5SLionel Sambuc }
563971bb1a5SLionel Sambuc 
564971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_window_create_context(xcb_connection_t * c,uint32_t context_len,const char * context)565971bb1a5SLionel Sambuc xcb_selinux_set_window_create_context (xcb_connection_t *c  /**< */,
566971bb1a5SLionel Sambuc                                        uint32_t          context_len  /**< */,
567971bb1a5SLionel Sambuc                                        const char       *context  /**< */)
568971bb1a5SLionel Sambuc {
569971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
570971bb1a5SLionel Sambuc         /* count */ 4,
571971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
572971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_WINDOW_CREATE_CONTEXT,
573971bb1a5SLionel Sambuc         /* isvoid */ 1
574971bb1a5SLionel Sambuc     };
575971bb1a5SLionel Sambuc 
576971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
577971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
578971bb1a5SLionel Sambuc     xcb_selinux_set_window_create_context_request_t xcb_out;
579971bb1a5SLionel Sambuc 
580971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
581971bb1a5SLionel Sambuc 
582971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
583971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
584971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
585971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
586971bb1a5SLionel Sambuc     /* char context */
587971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
588971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
589971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
590971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
591971bb1a5SLionel Sambuc 
592971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
593971bb1a5SLionel Sambuc     return xcb_ret;
594971bb1a5SLionel Sambuc }
595971bb1a5SLionel Sambuc 
596971bb1a5SLionel Sambuc int
xcb_selinux_get_window_create_context_sizeof(const void * _buffer)597971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_sizeof (const void  *_buffer  /**< */)
598971bb1a5SLionel Sambuc {
599971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
600971bb1a5SLionel Sambuc     const xcb_selinux_get_window_create_context_reply_t *_aux = (xcb_selinux_get_window_create_context_reply_t *)_buffer;
601971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
602971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
603971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
604*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
605971bb1a5SLionel Sambuc 
606971bb1a5SLionel Sambuc 
607971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_window_create_context_reply_t);
608971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
609*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
610*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
611971bb1a5SLionel Sambuc     /* context */
612971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
613971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
614971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
615971bb1a5SLionel Sambuc     /* insert padding */
616971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
617971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
618971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
619971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
620971bb1a5SLionel Sambuc         xcb_pad = 0;
621971bb1a5SLionel Sambuc     }
622971bb1a5SLionel Sambuc     xcb_block_len = 0;
623971bb1a5SLionel Sambuc 
624971bb1a5SLionel Sambuc     return xcb_buffer_len;
625971bb1a5SLionel Sambuc }
626971bb1a5SLionel Sambuc 
627971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_cookie_t
xcb_selinux_get_window_create_context(xcb_connection_t * c)628971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context (xcb_connection_t *c  /**< */)
629971bb1a5SLionel Sambuc {
630971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
631971bb1a5SLionel Sambuc         /* count */ 2,
632971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
633971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_WINDOW_CREATE_CONTEXT,
634971bb1a5SLionel Sambuc         /* isvoid */ 0
635971bb1a5SLionel Sambuc     };
636971bb1a5SLionel Sambuc 
637971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
638971bb1a5SLionel Sambuc     xcb_selinux_get_window_create_context_cookie_t xcb_ret;
639971bb1a5SLionel Sambuc     xcb_selinux_get_window_create_context_request_t xcb_out;
640971bb1a5SLionel Sambuc 
641971bb1a5SLionel Sambuc 
642971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
643971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
644971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
645971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
646971bb1a5SLionel Sambuc 
647971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
648971bb1a5SLionel Sambuc     return xcb_ret;
649971bb1a5SLionel Sambuc }
650971bb1a5SLionel Sambuc 
651971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_cookie_t
xcb_selinux_get_window_create_context_unchecked(xcb_connection_t * c)652971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_unchecked (xcb_connection_t *c  /**< */)
653971bb1a5SLionel Sambuc {
654971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
655971bb1a5SLionel Sambuc         /* count */ 2,
656971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
657971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_WINDOW_CREATE_CONTEXT,
658971bb1a5SLionel Sambuc         /* isvoid */ 0
659971bb1a5SLionel Sambuc     };
660971bb1a5SLionel Sambuc 
661971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
662971bb1a5SLionel Sambuc     xcb_selinux_get_window_create_context_cookie_t xcb_ret;
663971bb1a5SLionel Sambuc     xcb_selinux_get_window_create_context_request_t xcb_out;
664971bb1a5SLionel Sambuc 
665971bb1a5SLionel Sambuc 
666971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
667971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
668971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
669971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
670971bb1a5SLionel Sambuc 
671971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
672971bb1a5SLionel Sambuc     return xcb_ret;
673971bb1a5SLionel Sambuc }
674971bb1a5SLionel Sambuc 
675971bb1a5SLionel Sambuc char *
xcb_selinux_get_window_create_context_context(const xcb_selinux_get_window_create_context_reply_t * R)676971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_context (const xcb_selinux_get_window_create_context_reply_t *R  /**< */)
677971bb1a5SLionel Sambuc {
678971bb1a5SLionel Sambuc     return (char *) (R + 1);
679971bb1a5SLionel Sambuc }
680971bb1a5SLionel Sambuc 
681971bb1a5SLionel Sambuc int
xcb_selinux_get_window_create_context_context_length(const xcb_selinux_get_window_create_context_reply_t * R)682971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_context_length (const xcb_selinux_get_window_create_context_reply_t *R  /**< */)
683971bb1a5SLionel Sambuc {
684971bb1a5SLionel Sambuc     return R->context_len;
685971bb1a5SLionel Sambuc }
686971bb1a5SLionel Sambuc 
687971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_window_create_context_context_end(const xcb_selinux_get_window_create_context_reply_t * R)688971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_context_end (const xcb_selinux_get_window_create_context_reply_t *R  /**< */)
689971bb1a5SLionel Sambuc {
690971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
691971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
692971bb1a5SLionel Sambuc     i.rem = 0;
693971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
694971bb1a5SLionel Sambuc     return i;
695971bb1a5SLionel Sambuc }
696971bb1a5SLionel Sambuc 
697971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_reply_t *
xcb_selinux_get_window_create_context_reply(xcb_connection_t * c,xcb_selinux_get_window_create_context_cookie_t cookie,xcb_generic_error_t ** e)698971bb1a5SLionel Sambuc xcb_selinux_get_window_create_context_reply (xcb_connection_t                                *c  /**< */,
699971bb1a5SLionel Sambuc                                              xcb_selinux_get_window_create_context_cookie_t   cookie  /**< */,
700971bb1a5SLionel Sambuc                                              xcb_generic_error_t                            **e  /**< */)
701971bb1a5SLionel Sambuc {
702971bb1a5SLionel Sambuc     return (xcb_selinux_get_window_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
703971bb1a5SLionel Sambuc }
704971bb1a5SLionel Sambuc 
705971bb1a5SLionel Sambuc int
xcb_selinux_get_window_context_sizeof(const void * _buffer)706971bb1a5SLionel Sambuc xcb_selinux_get_window_context_sizeof (const void  *_buffer  /**< */)
707971bb1a5SLionel Sambuc {
708971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
709971bb1a5SLionel Sambuc     const xcb_selinux_get_window_context_reply_t *_aux = (xcb_selinux_get_window_context_reply_t *)_buffer;
710971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
711971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
712971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
713*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
714971bb1a5SLionel Sambuc 
715971bb1a5SLionel Sambuc 
716971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_window_context_reply_t);
717971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
718*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
719*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
720971bb1a5SLionel Sambuc     /* context */
721971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
722971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
723971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
724971bb1a5SLionel Sambuc     /* insert padding */
725971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
726971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
727971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
728971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
729971bb1a5SLionel Sambuc         xcb_pad = 0;
730971bb1a5SLionel Sambuc     }
731971bb1a5SLionel Sambuc     xcb_block_len = 0;
732971bb1a5SLionel Sambuc 
733971bb1a5SLionel Sambuc     return xcb_buffer_len;
734971bb1a5SLionel Sambuc }
735971bb1a5SLionel Sambuc 
736971bb1a5SLionel Sambuc xcb_selinux_get_window_context_cookie_t
xcb_selinux_get_window_context(xcb_connection_t * c,xcb_window_t window)737971bb1a5SLionel Sambuc xcb_selinux_get_window_context (xcb_connection_t *c  /**< */,
738971bb1a5SLionel Sambuc                                 xcb_window_t      window  /**< */)
739971bb1a5SLionel Sambuc {
740971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
741971bb1a5SLionel Sambuc         /* count */ 2,
742971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
743971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_WINDOW_CONTEXT,
744971bb1a5SLionel Sambuc         /* isvoid */ 0
745971bb1a5SLionel Sambuc     };
746971bb1a5SLionel Sambuc 
747971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
748971bb1a5SLionel Sambuc     xcb_selinux_get_window_context_cookie_t xcb_ret;
749971bb1a5SLionel Sambuc     xcb_selinux_get_window_context_request_t xcb_out;
750971bb1a5SLionel Sambuc 
751971bb1a5SLionel Sambuc     xcb_out.window = window;
752971bb1a5SLionel Sambuc 
753971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
754971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
755971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
756971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
757971bb1a5SLionel Sambuc 
758971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
759971bb1a5SLionel Sambuc     return xcb_ret;
760971bb1a5SLionel Sambuc }
761971bb1a5SLionel Sambuc 
762971bb1a5SLionel Sambuc xcb_selinux_get_window_context_cookie_t
xcb_selinux_get_window_context_unchecked(xcb_connection_t * c,xcb_window_t window)763971bb1a5SLionel Sambuc xcb_selinux_get_window_context_unchecked (xcb_connection_t *c  /**< */,
764971bb1a5SLionel Sambuc                                           xcb_window_t      window  /**< */)
765971bb1a5SLionel Sambuc {
766971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
767971bb1a5SLionel Sambuc         /* count */ 2,
768971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
769971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_WINDOW_CONTEXT,
770971bb1a5SLionel Sambuc         /* isvoid */ 0
771971bb1a5SLionel Sambuc     };
772971bb1a5SLionel Sambuc 
773971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
774971bb1a5SLionel Sambuc     xcb_selinux_get_window_context_cookie_t xcb_ret;
775971bb1a5SLionel Sambuc     xcb_selinux_get_window_context_request_t xcb_out;
776971bb1a5SLionel Sambuc 
777971bb1a5SLionel Sambuc     xcb_out.window = window;
778971bb1a5SLionel Sambuc 
779971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
780971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
781971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
782971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
783971bb1a5SLionel Sambuc 
784971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
785971bb1a5SLionel Sambuc     return xcb_ret;
786971bb1a5SLionel Sambuc }
787971bb1a5SLionel Sambuc 
788971bb1a5SLionel Sambuc char *
xcb_selinux_get_window_context_context(const xcb_selinux_get_window_context_reply_t * R)789971bb1a5SLionel Sambuc xcb_selinux_get_window_context_context (const xcb_selinux_get_window_context_reply_t *R  /**< */)
790971bb1a5SLionel Sambuc {
791971bb1a5SLionel Sambuc     return (char *) (R + 1);
792971bb1a5SLionel Sambuc }
793971bb1a5SLionel Sambuc 
794971bb1a5SLionel Sambuc int
xcb_selinux_get_window_context_context_length(const xcb_selinux_get_window_context_reply_t * R)795971bb1a5SLionel Sambuc xcb_selinux_get_window_context_context_length (const xcb_selinux_get_window_context_reply_t *R  /**< */)
796971bb1a5SLionel Sambuc {
797971bb1a5SLionel Sambuc     return R->context_len;
798971bb1a5SLionel Sambuc }
799971bb1a5SLionel Sambuc 
800971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_window_context_context_end(const xcb_selinux_get_window_context_reply_t * R)801971bb1a5SLionel Sambuc xcb_selinux_get_window_context_context_end (const xcb_selinux_get_window_context_reply_t *R  /**< */)
802971bb1a5SLionel Sambuc {
803971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
804971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
805971bb1a5SLionel Sambuc     i.rem = 0;
806971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
807971bb1a5SLionel Sambuc     return i;
808971bb1a5SLionel Sambuc }
809971bb1a5SLionel Sambuc 
810971bb1a5SLionel Sambuc xcb_selinux_get_window_context_reply_t *
xcb_selinux_get_window_context_reply(xcb_connection_t * c,xcb_selinux_get_window_context_cookie_t cookie,xcb_generic_error_t ** e)811971bb1a5SLionel Sambuc xcb_selinux_get_window_context_reply (xcb_connection_t                         *c  /**< */,
812971bb1a5SLionel Sambuc                                       xcb_selinux_get_window_context_cookie_t   cookie  /**< */,
813971bb1a5SLionel Sambuc                                       xcb_generic_error_t                     **e  /**< */)
814971bb1a5SLionel Sambuc {
815971bb1a5SLionel Sambuc     return (xcb_selinux_get_window_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
816971bb1a5SLionel Sambuc }
817971bb1a5SLionel Sambuc 
818971bb1a5SLionel Sambuc int
xcb_selinux_list_item_sizeof(const void * _buffer)819971bb1a5SLionel Sambuc xcb_selinux_list_item_sizeof (const void  *_buffer  /**< */)
820971bb1a5SLionel Sambuc {
821971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
822971bb1a5SLionel Sambuc     const xcb_selinux_list_item_t *_aux = (xcb_selinux_list_item_t *)_buffer;
823971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
824971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
825971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
826*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
827971bb1a5SLionel Sambuc 
828971bb1a5SLionel Sambuc 
829971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_list_item_t);
830971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
831*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
832*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
833971bb1a5SLionel Sambuc     /* object_context */
834971bb1a5SLionel Sambuc     xcb_block_len += _aux->object_context_len * sizeof(char);
835971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
836971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
837971bb1a5SLionel Sambuc     /* insert padding */
838971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
839971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
840971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
841971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
842971bb1a5SLionel Sambuc         xcb_pad = 0;
843971bb1a5SLionel Sambuc     }
844971bb1a5SLionel Sambuc     xcb_block_len = 0;
845971bb1a5SLionel Sambuc     /* data_context */
846971bb1a5SLionel Sambuc     xcb_block_len += _aux->data_context_len * sizeof(char);
847971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
848971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
849971bb1a5SLionel Sambuc     /* insert padding */
850971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
851971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
852971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
853971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
854971bb1a5SLionel Sambuc         xcb_pad = 0;
855971bb1a5SLionel Sambuc     }
856971bb1a5SLionel Sambuc     xcb_block_len = 0;
857971bb1a5SLionel Sambuc 
858971bb1a5SLionel Sambuc     return xcb_buffer_len;
859971bb1a5SLionel Sambuc }
860971bb1a5SLionel Sambuc 
861971bb1a5SLionel Sambuc char *
xcb_selinux_list_item_object_context(const xcb_selinux_list_item_t * R)862971bb1a5SLionel Sambuc xcb_selinux_list_item_object_context (const xcb_selinux_list_item_t *R  /**< */)
863971bb1a5SLionel Sambuc {
864971bb1a5SLionel Sambuc     return (char *) (R + 1);
865971bb1a5SLionel Sambuc }
866971bb1a5SLionel Sambuc 
867971bb1a5SLionel Sambuc int
xcb_selinux_list_item_object_context_length(const xcb_selinux_list_item_t * R)868971bb1a5SLionel Sambuc xcb_selinux_list_item_object_context_length (const xcb_selinux_list_item_t *R  /**< */)
869971bb1a5SLionel Sambuc {
870971bb1a5SLionel Sambuc     return R->object_context_len;
871971bb1a5SLionel Sambuc }
872971bb1a5SLionel Sambuc 
873971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_list_item_object_context_end(const xcb_selinux_list_item_t * R)874971bb1a5SLionel Sambuc xcb_selinux_list_item_object_context_end (const xcb_selinux_list_item_t *R  /**< */)
875971bb1a5SLionel Sambuc {
876971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
877971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->object_context_len);
878971bb1a5SLionel Sambuc     i.rem = 0;
879971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
880971bb1a5SLionel Sambuc     return i;
881971bb1a5SLionel Sambuc }
882971bb1a5SLionel Sambuc 
883971bb1a5SLionel Sambuc char *
xcb_selinux_list_item_data_context(const xcb_selinux_list_item_t * R)884971bb1a5SLionel Sambuc xcb_selinux_list_item_data_context (const xcb_selinux_list_item_t *R  /**< */)
885971bb1a5SLionel Sambuc {
886971bb1a5SLionel Sambuc     xcb_generic_iterator_t prev = xcb_selinux_list_item_object_context_end(R);
887971bb1a5SLionel Sambuc     return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0);
888971bb1a5SLionel Sambuc }
889971bb1a5SLionel Sambuc 
890971bb1a5SLionel Sambuc int
xcb_selinux_list_item_data_context_length(const xcb_selinux_list_item_t * R)891971bb1a5SLionel Sambuc xcb_selinux_list_item_data_context_length (const xcb_selinux_list_item_t *R  /**< */)
892971bb1a5SLionel Sambuc {
893971bb1a5SLionel Sambuc     return R->data_context_len;
894971bb1a5SLionel Sambuc }
895971bb1a5SLionel Sambuc 
896971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_list_item_data_context_end(const xcb_selinux_list_item_t * R)897971bb1a5SLionel Sambuc xcb_selinux_list_item_data_context_end (const xcb_selinux_list_item_t *R  /**< */)
898971bb1a5SLionel Sambuc {
899971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
900971bb1a5SLionel Sambuc     xcb_generic_iterator_t child = xcb_selinux_list_item_object_context_end(R);
901971bb1a5SLionel Sambuc     i.data = ((char *) child.data) + (R->data_context_len);
902971bb1a5SLionel Sambuc     i.rem = 0;
903971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
904971bb1a5SLionel Sambuc     return i;
905971bb1a5SLionel Sambuc }
906971bb1a5SLionel Sambuc 
907971bb1a5SLionel Sambuc void
xcb_selinux_list_item_next(xcb_selinux_list_item_iterator_t * i)908971bb1a5SLionel Sambuc xcb_selinux_list_item_next (xcb_selinux_list_item_iterator_t *i  /**< */)
909971bb1a5SLionel Sambuc {
910971bb1a5SLionel Sambuc     xcb_selinux_list_item_t *R = i->data;
911971bb1a5SLionel Sambuc     xcb_generic_iterator_t child;
912971bb1a5SLionel Sambuc     child.data = (xcb_selinux_list_item_t *)(((char *)R) + xcb_selinux_list_item_sizeof(R));
913971bb1a5SLionel Sambuc     i->index = (char *) child.data - (char *) i->data;
914971bb1a5SLionel Sambuc     --i->rem;
915971bb1a5SLionel Sambuc     i->data = (xcb_selinux_list_item_t *) child.data;
916971bb1a5SLionel Sambuc }
917971bb1a5SLionel Sambuc 
918971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_list_item_end(xcb_selinux_list_item_iterator_t i)919971bb1a5SLionel Sambuc xcb_selinux_list_item_end (xcb_selinux_list_item_iterator_t i  /**< */)
920971bb1a5SLionel Sambuc {
921971bb1a5SLionel Sambuc     xcb_generic_iterator_t ret;
922971bb1a5SLionel Sambuc     while(i.rem > 0)
923971bb1a5SLionel Sambuc         xcb_selinux_list_item_next(&i);
924971bb1a5SLionel Sambuc     ret.data = i.data;
925971bb1a5SLionel Sambuc     ret.rem = i.rem;
926971bb1a5SLionel Sambuc     ret.index = i.index;
927971bb1a5SLionel Sambuc     return ret;
928971bb1a5SLionel Sambuc }
929971bb1a5SLionel Sambuc 
930971bb1a5SLionel Sambuc int
xcb_selinux_set_property_create_context_sizeof(const void * _buffer)931971bb1a5SLionel Sambuc xcb_selinux_set_property_create_context_sizeof (const void  *_buffer  /**< */)
932971bb1a5SLionel Sambuc {
933971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
934971bb1a5SLionel Sambuc     const xcb_selinux_set_property_create_context_request_t *_aux = (xcb_selinux_set_property_create_context_request_t *)_buffer;
935971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
936971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
937971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
938*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
939971bb1a5SLionel Sambuc 
940971bb1a5SLionel Sambuc 
941971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_set_property_create_context_request_t);
942971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
943*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
944*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
945971bb1a5SLionel Sambuc     /* context */
946971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
947971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
948971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
949971bb1a5SLionel Sambuc     /* insert padding */
950971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
951971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
952971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
953971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
954971bb1a5SLionel Sambuc         xcb_pad = 0;
955971bb1a5SLionel Sambuc     }
956971bb1a5SLionel Sambuc     xcb_block_len = 0;
957971bb1a5SLionel Sambuc 
958971bb1a5SLionel Sambuc     return xcb_buffer_len;
959971bb1a5SLionel Sambuc }
960971bb1a5SLionel Sambuc 
961971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_property_create_context_checked(xcb_connection_t * c,uint32_t context_len,const char * context)962971bb1a5SLionel Sambuc xcb_selinux_set_property_create_context_checked (xcb_connection_t *c  /**< */,
963971bb1a5SLionel Sambuc                                                  uint32_t          context_len  /**< */,
964971bb1a5SLionel Sambuc                                                  const char       *context  /**< */)
965971bb1a5SLionel Sambuc {
966971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
967971bb1a5SLionel Sambuc         /* count */ 4,
968971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
969971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_PROPERTY_CREATE_CONTEXT,
970971bb1a5SLionel Sambuc         /* isvoid */ 1
971971bb1a5SLionel Sambuc     };
972971bb1a5SLionel Sambuc 
973971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
974971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
975971bb1a5SLionel Sambuc     xcb_selinux_set_property_create_context_request_t xcb_out;
976971bb1a5SLionel Sambuc 
977971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
978971bb1a5SLionel Sambuc 
979971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
980971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
981971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
982971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
983971bb1a5SLionel Sambuc     /* char context */
984971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
985971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
986971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
987971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
988971bb1a5SLionel Sambuc 
989971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
990971bb1a5SLionel Sambuc     return xcb_ret;
991971bb1a5SLionel Sambuc }
992971bb1a5SLionel Sambuc 
993971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_property_create_context(xcb_connection_t * c,uint32_t context_len,const char * context)994971bb1a5SLionel Sambuc xcb_selinux_set_property_create_context (xcb_connection_t *c  /**< */,
995971bb1a5SLionel Sambuc                                          uint32_t          context_len  /**< */,
996971bb1a5SLionel Sambuc                                          const char       *context  /**< */)
997971bb1a5SLionel Sambuc {
998971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
999971bb1a5SLionel Sambuc         /* count */ 4,
1000971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1001971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_PROPERTY_CREATE_CONTEXT,
1002971bb1a5SLionel Sambuc         /* isvoid */ 1
1003971bb1a5SLionel Sambuc     };
1004971bb1a5SLionel Sambuc 
1005971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
1006971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
1007971bb1a5SLionel Sambuc     xcb_selinux_set_property_create_context_request_t xcb_out;
1008971bb1a5SLionel Sambuc 
1009971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
1010971bb1a5SLionel Sambuc 
1011971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1012971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1013971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1014971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1015971bb1a5SLionel Sambuc     /* char context */
1016971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
1017971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
1018971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
1019971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1020971bb1a5SLionel Sambuc 
1021971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1022971bb1a5SLionel Sambuc     return xcb_ret;
1023971bb1a5SLionel Sambuc }
1024971bb1a5SLionel Sambuc 
1025971bb1a5SLionel Sambuc int
xcb_selinux_get_property_create_context_sizeof(const void * _buffer)1026971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_sizeof (const void  *_buffer  /**< */)
1027971bb1a5SLionel Sambuc {
1028971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1029971bb1a5SLionel Sambuc     const xcb_selinux_get_property_create_context_reply_t *_aux = (xcb_selinux_get_property_create_context_reply_t *)_buffer;
1030971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1031971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1032971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1033*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1034971bb1a5SLionel Sambuc 
1035971bb1a5SLionel Sambuc 
1036971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_property_create_context_reply_t);
1037971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1038*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1039*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1040971bb1a5SLionel Sambuc     /* context */
1041971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
1042971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1043971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
1044971bb1a5SLionel Sambuc     /* insert padding */
1045971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1046971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1047971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1048971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1049971bb1a5SLionel Sambuc         xcb_pad = 0;
1050971bb1a5SLionel Sambuc     }
1051971bb1a5SLionel Sambuc     xcb_block_len = 0;
1052971bb1a5SLionel Sambuc 
1053971bb1a5SLionel Sambuc     return xcb_buffer_len;
1054971bb1a5SLionel Sambuc }
1055971bb1a5SLionel Sambuc 
1056971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_cookie_t
xcb_selinux_get_property_create_context(xcb_connection_t * c)1057971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context (xcb_connection_t *c  /**< */)
1058971bb1a5SLionel Sambuc {
1059971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1060971bb1a5SLionel Sambuc         /* count */ 2,
1061971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1062971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_PROPERTY_CREATE_CONTEXT,
1063971bb1a5SLionel Sambuc         /* isvoid */ 0
1064971bb1a5SLionel Sambuc     };
1065971bb1a5SLionel Sambuc 
1066971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1067971bb1a5SLionel Sambuc     xcb_selinux_get_property_create_context_cookie_t xcb_ret;
1068971bb1a5SLionel Sambuc     xcb_selinux_get_property_create_context_request_t xcb_out;
1069971bb1a5SLionel Sambuc 
1070971bb1a5SLionel Sambuc 
1071971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1072971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1073971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1074971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1075971bb1a5SLionel Sambuc 
1076971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1077971bb1a5SLionel Sambuc     return xcb_ret;
1078971bb1a5SLionel Sambuc }
1079971bb1a5SLionel Sambuc 
1080971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_cookie_t
xcb_selinux_get_property_create_context_unchecked(xcb_connection_t * c)1081971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_unchecked (xcb_connection_t *c  /**< */)
1082971bb1a5SLionel Sambuc {
1083971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1084971bb1a5SLionel Sambuc         /* count */ 2,
1085971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1086971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_PROPERTY_CREATE_CONTEXT,
1087971bb1a5SLionel Sambuc         /* isvoid */ 0
1088971bb1a5SLionel Sambuc     };
1089971bb1a5SLionel Sambuc 
1090971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1091971bb1a5SLionel Sambuc     xcb_selinux_get_property_create_context_cookie_t xcb_ret;
1092971bb1a5SLionel Sambuc     xcb_selinux_get_property_create_context_request_t xcb_out;
1093971bb1a5SLionel Sambuc 
1094971bb1a5SLionel Sambuc 
1095971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1096971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1097971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1098971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1099971bb1a5SLionel Sambuc 
1100971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1101971bb1a5SLionel Sambuc     return xcb_ret;
1102971bb1a5SLionel Sambuc }
1103971bb1a5SLionel Sambuc 
1104971bb1a5SLionel Sambuc char *
xcb_selinux_get_property_create_context_context(const xcb_selinux_get_property_create_context_reply_t * R)1105971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_context (const xcb_selinux_get_property_create_context_reply_t *R  /**< */)
1106971bb1a5SLionel Sambuc {
1107971bb1a5SLionel Sambuc     return (char *) (R + 1);
1108971bb1a5SLionel Sambuc }
1109971bb1a5SLionel Sambuc 
1110971bb1a5SLionel Sambuc int
xcb_selinux_get_property_create_context_context_length(const xcb_selinux_get_property_create_context_reply_t * R)1111971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_context_length (const xcb_selinux_get_property_create_context_reply_t *R  /**< */)
1112971bb1a5SLionel Sambuc {
1113971bb1a5SLionel Sambuc     return R->context_len;
1114971bb1a5SLionel Sambuc }
1115971bb1a5SLionel Sambuc 
1116971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_property_create_context_context_end(const xcb_selinux_get_property_create_context_reply_t * R)1117971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_context_end (const xcb_selinux_get_property_create_context_reply_t *R  /**< */)
1118971bb1a5SLionel Sambuc {
1119971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
1120971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
1121971bb1a5SLionel Sambuc     i.rem = 0;
1122971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
1123971bb1a5SLionel Sambuc     return i;
1124971bb1a5SLionel Sambuc }
1125971bb1a5SLionel Sambuc 
1126971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_reply_t *
xcb_selinux_get_property_create_context_reply(xcb_connection_t * c,xcb_selinux_get_property_create_context_cookie_t cookie,xcb_generic_error_t ** e)1127971bb1a5SLionel Sambuc xcb_selinux_get_property_create_context_reply (xcb_connection_t                                  *c  /**< */,
1128971bb1a5SLionel Sambuc                                                xcb_selinux_get_property_create_context_cookie_t   cookie  /**< */,
1129971bb1a5SLionel Sambuc                                                xcb_generic_error_t                              **e  /**< */)
1130971bb1a5SLionel Sambuc {
1131971bb1a5SLionel Sambuc     return (xcb_selinux_get_property_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1132971bb1a5SLionel Sambuc }
1133971bb1a5SLionel Sambuc 
1134971bb1a5SLionel Sambuc int
xcb_selinux_set_property_use_context_sizeof(const void * _buffer)1135971bb1a5SLionel Sambuc xcb_selinux_set_property_use_context_sizeof (const void  *_buffer  /**< */)
1136971bb1a5SLionel Sambuc {
1137971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1138971bb1a5SLionel Sambuc     const xcb_selinux_set_property_use_context_request_t *_aux = (xcb_selinux_set_property_use_context_request_t *)_buffer;
1139971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1140971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1141971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1142*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1143971bb1a5SLionel Sambuc 
1144971bb1a5SLionel Sambuc 
1145971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_set_property_use_context_request_t);
1146971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1147*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1148*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1149971bb1a5SLionel Sambuc     /* context */
1150971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
1151971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1152971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
1153971bb1a5SLionel Sambuc     /* insert padding */
1154971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1155971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1156971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1157971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1158971bb1a5SLionel Sambuc         xcb_pad = 0;
1159971bb1a5SLionel Sambuc     }
1160971bb1a5SLionel Sambuc     xcb_block_len = 0;
1161971bb1a5SLionel Sambuc 
1162971bb1a5SLionel Sambuc     return xcb_buffer_len;
1163971bb1a5SLionel Sambuc }
1164971bb1a5SLionel Sambuc 
1165971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_property_use_context_checked(xcb_connection_t * c,uint32_t context_len,const char * context)1166971bb1a5SLionel Sambuc xcb_selinux_set_property_use_context_checked (xcb_connection_t *c  /**< */,
1167971bb1a5SLionel Sambuc                                               uint32_t          context_len  /**< */,
1168971bb1a5SLionel Sambuc                                               const char       *context  /**< */)
1169971bb1a5SLionel Sambuc {
1170971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1171971bb1a5SLionel Sambuc         /* count */ 4,
1172971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1173971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_PROPERTY_USE_CONTEXT,
1174971bb1a5SLionel Sambuc         /* isvoid */ 1
1175971bb1a5SLionel Sambuc     };
1176971bb1a5SLionel Sambuc 
1177971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
1178971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
1179971bb1a5SLionel Sambuc     xcb_selinux_set_property_use_context_request_t xcb_out;
1180971bb1a5SLionel Sambuc 
1181971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
1182971bb1a5SLionel Sambuc 
1183971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1184971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1185971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1186971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1187971bb1a5SLionel Sambuc     /* char context */
1188971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
1189971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
1190971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
1191971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1192971bb1a5SLionel Sambuc 
1193971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1194971bb1a5SLionel Sambuc     return xcb_ret;
1195971bb1a5SLionel Sambuc }
1196971bb1a5SLionel Sambuc 
1197971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_property_use_context(xcb_connection_t * c,uint32_t context_len,const char * context)1198971bb1a5SLionel Sambuc xcb_selinux_set_property_use_context (xcb_connection_t *c  /**< */,
1199971bb1a5SLionel Sambuc                                       uint32_t          context_len  /**< */,
1200971bb1a5SLionel Sambuc                                       const char       *context  /**< */)
1201971bb1a5SLionel Sambuc {
1202971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1203971bb1a5SLionel Sambuc         /* count */ 4,
1204971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1205971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_PROPERTY_USE_CONTEXT,
1206971bb1a5SLionel Sambuc         /* isvoid */ 1
1207971bb1a5SLionel Sambuc     };
1208971bb1a5SLionel Sambuc 
1209971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
1210971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
1211971bb1a5SLionel Sambuc     xcb_selinux_set_property_use_context_request_t xcb_out;
1212971bb1a5SLionel Sambuc 
1213971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
1214971bb1a5SLionel Sambuc 
1215971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1216971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1217971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1218971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1219971bb1a5SLionel Sambuc     /* char context */
1220971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
1221971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
1222971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
1223971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1224971bb1a5SLionel Sambuc 
1225971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1226971bb1a5SLionel Sambuc     return xcb_ret;
1227971bb1a5SLionel Sambuc }
1228971bb1a5SLionel Sambuc 
1229971bb1a5SLionel Sambuc int
xcb_selinux_get_property_use_context_sizeof(const void * _buffer)1230971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_sizeof (const void  *_buffer  /**< */)
1231971bb1a5SLionel Sambuc {
1232971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1233971bb1a5SLionel Sambuc     const xcb_selinux_get_property_use_context_reply_t *_aux = (xcb_selinux_get_property_use_context_reply_t *)_buffer;
1234971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1235971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1236971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1237*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1238971bb1a5SLionel Sambuc 
1239971bb1a5SLionel Sambuc 
1240971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_property_use_context_reply_t);
1241971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1242*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1243*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1244971bb1a5SLionel Sambuc     /* context */
1245971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
1246971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1247971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
1248971bb1a5SLionel Sambuc     /* insert padding */
1249971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1250971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1251971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1252971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1253971bb1a5SLionel Sambuc         xcb_pad = 0;
1254971bb1a5SLionel Sambuc     }
1255971bb1a5SLionel Sambuc     xcb_block_len = 0;
1256971bb1a5SLionel Sambuc 
1257971bb1a5SLionel Sambuc     return xcb_buffer_len;
1258971bb1a5SLionel Sambuc }
1259971bb1a5SLionel Sambuc 
1260971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_cookie_t
xcb_selinux_get_property_use_context(xcb_connection_t * c)1261971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context (xcb_connection_t *c  /**< */)
1262971bb1a5SLionel Sambuc {
1263971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1264971bb1a5SLionel Sambuc         /* count */ 2,
1265971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1266971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_PROPERTY_USE_CONTEXT,
1267971bb1a5SLionel Sambuc         /* isvoid */ 0
1268971bb1a5SLionel Sambuc     };
1269971bb1a5SLionel Sambuc 
1270971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1271971bb1a5SLionel Sambuc     xcb_selinux_get_property_use_context_cookie_t xcb_ret;
1272971bb1a5SLionel Sambuc     xcb_selinux_get_property_use_context_request_t xcb_out;
1273971bb1a5SLionel Sambuc 
1274971bb1a5SLionel Sambuc 
1275971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1276971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1277971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1278971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1279971bb1a5SLionel Sambuc 
1280971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1281971bb1a5SLionel Sambuc     return xcb_ret;
1282971bb1a5SLionel Sambuc }
1283971bb1a5SLionel Sambuc 
1284971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_cookie_t
xcb_selinux_get_property_use_context_unchecked(xcb_connection_t * c)1285971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_unchecked (xcb_connection_t *c  /**< */)
1286971bb1a5SLionel Sambuc {
1287971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1288971bb1a5SLionel Sambuc         /* count */ 2,
1289971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1290971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_PROPERTY_USE_CONTEXT,
1291971bb1a5SLionel Sambuc         /* isvoid */ 0
1292971bb1a5SLionel Sambuc     };
1293971bb1a5SLionel Sambuc 
1294971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1295971bb1a5SLionel Sambuc     xcb_selinux_get_property_use_context_cookie_t xcb_ret;
1296971bb1a5SLionel Sambuc     xcb_selinux_get_property_use_context_request_t xcb_out;
1297971bb1a5SLionel Sambuc 
1298971bb1a5SLionel Sambuc 
1299971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1300971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1301971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1302971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1303971bb1a5SLionel Sambuc 
1304971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1305971bb1a5SLionel Sambuc     return xcb_ret;
1306971bb1a5SLionel Sambuc }
1307971bb1a5SLionel Sambuc 
1308971bb1a5SLionel Sambuc char *
xcb_selinux_get_property_use_context_context(const xcb_selinux_get_property_use_context_reply_t * R)1309971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_context (const xcb_selinux_get_property_use_context_reply_t *R  /**< */)
1310971bb1a5SLionel Sambuc {
1311971bb1a5SLionel Sambuc     return (char *) (R + 1);
1312971bb1a5SLionel Sambuc }
1313971bb1a5SLionel Sambuc 
1314971bb1a5SLionel Sambuc int
xcb_selinux_get_property_use_context_context_length(const xcb_selinux_get_property_use_context_reply_t * R)1315971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_context_length (const xcb_selinux_get_property_use_context_reply_t *R  /**< */)
1316971bb1a5SLionel Sambuc {
1317971bb1a5SLionel Sambuc     return R->context_len;
1318971bb1a5SLionel Sambuc }
1319971bb1a5SLionel Sambuc 
1320971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_property_use_context_context_end(const xcb_selinux_get_property_use_context_reply_t * R)1321971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_context_end (const xcb_selinux_get_property_use_context_reply_t *R  /**< */)
1322971bb1a5SLionel Sambuc {
1323971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
1324971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
1325971bb1a5SLionel Sambuc     i.rem = 0;
1326971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
1327971bb1a5SLionel Sambuc     return i;
1328971bb1a5SLionel Sambuc }
1329971bb1a5SLionel Sambuc 
1330971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_reply_t *
xcb_selinux_get_property_use_context_reply(xcb_connection_t * c,xcb_selinux_get_property_use_context_cookie_t cookie,xcb_generic_error_t ** e)1331971bb1a5SLionel Sambuc xcb_selinux_get_property_use_context_reply (xcb_connection_t                               *c  /**< */,
1332971bb1a5SLionel Sambuc                                             xcb_selinux_get_property_use_context_cookie_t   cookie  /**< */,
1333971bb1a5SLionel Sambuc                                             xcb_generic_error_t                           **e  /**< */)
1334971bb1a5SLionel Sambuc {
1335971bb1a5SLionel Sambuc     return (xcb_selinux_get_property_use_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1336971bb1a5SLionel Sambuc }
1337971bb1a5SLionel Sambuc 
1338971bb1a5SLionel Sambuc int
xcb_selinux_get_property_context_sizeof(const void * _buffer)1339971bb1a5SLionel Sambuc xcb_selinux_get_property_context_sizeof (const void  *_buffer  /**< */)
1340971bb1a5SLionel Sambuc {
1341971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1342971bb1a5SLionel Sambuc     const xcb_selinux_get_property_context_reply_t *_aux = (xcb_selinux_get_property_context_reply_t *)_buffer;
1343971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1344971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1345971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1346*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1347971bb1a5SLionel Sambuc 
1348971bb1a5SLionel Sambuc 
1349971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_property_context_reply_t);
1350971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1351*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1352*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1353971bb1a5SLionel Sambuc     /* context */
1354971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
1355971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1356971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
1357971bb1a5SLionel Sambuc     /* insert padding */
1358971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1359971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1360971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1361971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1362971bb1a5SLionel Sambuc         xcb_pad = 0;
1363971bb1a5SLionel Sambuc     }
1364971bb1a5SLionel Sambuc     xcb_block_len = 0;
1365971bb1a5SLionel Sambuc 
1366971bb1a5SLionel Sambuc     return xcb_buffer_len;
1367971bb1a5SLionel Sambuc }
1368971bb1a5SLionel Sambuc 
1369971bb1a5SLionel Sambuc xcb_selinux_get_property_context_cookie_t
xcb_selinux_get_property_context(xcb_connection_t * c,xcb_window_t window,xcb_atom_t property)1370971bb1a5SLionel Sambuc xcb_selinux_get_property_context (xcb_connection_t *c  /**< */,
1371971bb1a5SLionel Sambuc                                   xcb_window_t      window  /**< */,
1372971bb1a5SLionel Sambuc                                   xcb_atom_t        property  /**< */)
1373971bb1a5SLionel Sambuc {
1374971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1375971bb1a5SLionel Sambuc         /* count */ 2,
1376971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1377971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_PROPERTY_CONTEXT,
1378971bb1a5SLionel Sambuc         /* isvoid */ 0
1379971bb1a5SLionel Sambuc     };
1380971bb1a5SLionel Sambuc 
1381971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1382971bb1a5SLionel Sambuc     xcb_selinux_get_property_context_cookie_t xcb_ret;
1383971bb1a5SLionel Sambuc     xcb_selinux_get_property_context_request_t xcb_out;
1384971bb1a5SLionel Sambuc 
1385971bb1a5SLionel Sambuc     xcb_out.window = window;
1386971bb1a5SLionel Sambuc     xcb_out.property = property;
1387971bb1a5SLionel Sambuc 
1388971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1389971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1390971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1391971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1392971bb1a5SLionel Sambuc 
1393971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1394971bb1a5SLionel Sambuc     return xcb_ret;
1395971bb1a5SLionel Sambuc }
1396971bb1a5SLionel Sambuc 
1397971bb1a5SLionel Sambuc xcb_selinux_get_property_context_cookie_t
xcb_selinux_get_property_context_unchecked(xcb_connection_t * c,xcb_window_t window,xcb_atom_t property)1398971bb1a5SLionel Sambuc xcb_selinux_get_property_context_unchecked (xcb_connection_t *c  /**< */,
1399971bb1a5SLionel Sambuc                                             xcb_window_t      window  /**< */,
1400971bb1a5SLionel Sambuc                                             xcb_atom_t        property  /**< */)
1401971bb1a5SLionel Sambuc {
1402971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1403971bb1a5SLionel Sambuc         /* count */ 2,
1404971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1405971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_PROPERTY_CONTEXT,
1406971bb1a5SLionel Sambuc         /* isvoid */ 0
1407971bb1a5SLionel Sambuc     };
1408971bb1a5SLionel Sambuc 
1409971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1410971bb1a5SLionel Sambuc     xcb_selinux_get_property_context_cookie_t xcb_ret;
1411971bb1a5SLionel Sambuc     xcb_selinux_get_property_context_request_t xcb_out;
1412971bb1a5SLionel Sambuc 
1413971bb1a5SLionel Sambuc     xcb_out.window = window;
1414971bb1a5SLionel Sambuc     xcb_out.property = property;
1415971bb1a5SLionel Sambuc 
1416971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1417971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1418971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1419971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1420971bb1a5SLionel Sambuc 
1421971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1422971bb1a5SLionel Sambuc     return xcb_ret;
1423971bb1a5SLionel Sambuc }
1424971bb1a5SLionel Sambuc 
1425971bb1a5SLionel Sambuc char *
xcb_selinux_get_property_context_context(const xcb_selinux_get_property_context_reply_t * R)1426971bb1a5SLionel Sambuc xcb_selinux_get_property_context_context (const xcb_selinux_get_property_context_reply_t *R  /**< */)
1427971bb1a5SLionel Sambuc {
1428971bb1a5SLionel Sambuc     return (char *) (R + 1);
1429971bb1a5SLionel Sambuc }
1430971bb1a5SLionel Sambuc 
1431971bb1a5SLionel Sambuc int
xcb_selinux_get_property_context_context_length(const xcb_selinux_get_property_context_reply_t * R)1432971bb1a5SLionel Sambuc xcb_selinux_get_property_context_context_length (const xcb_selinux_get_property_context_reply_t *R  /**< */)
1433971bb1a5SLionel Sambuc {
1434971bb1a5SLionel Sambuc     return R->context_len;
1435971bb1a5SLionel Sambuc }
1436971bb1a5SLionel Sambuc 
1437971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_property_context_context_end(const xcb_selinux_get_property_context_reply_t * R)1438971bb1a5SLionel Sambuc xcb_selinux_get_property_context_context_end (const xcb_selinux_get_property_context_reply_t *R  /**< */)
1439971bb1a5SLionel Sambuc {
1440971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
1441971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
1442971bb1a5SLionel Sambuc     i.rem = 0;
1443971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
1444971bb1a5SLionel Sambuc     return i;
1445971bb1a5SLionel Sambuc }
1446971bb1a5SLionel Sambuc 
1447971bb1a5SLionel Sambuc xcb_selinux_get_property_context_reply_t *
xcb_selinux_get_property_context_reply(xcb_connection_t * c,xcb_selinux_get_property_context_cookie_t cookie,xcb_generic_error_t ** e)1448971bb1a5SLionel Sambuc xcb_selinux_get_property_context_reply (xcb_connection_t                           *c  /**< */,
1449971bb1a5SLionel Sambuc                                         xcb_selinux_get_property_context_cookie_t   cookie  /**< */,
1450971bb1a5SLionel Sambuc                                         xcb_generic_error_t                       **e  /**< */)
1451971bb1a5SLionel Sambuc {
1452971bb1a5SLionel Sambuc     return (xcb_selinux_get_property_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1453971bb1a5SLionel Sambuc }
1454971bb1a5SLionel Sambuc 
1455971bb1a5SLionel Sambuc int
xcb_selinux_get_property_data_context_sizeof(const void * _buffer)1456971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_sizeof (const void  *_buffer  /**< */)
1457971bb1a5SLionel Sambuc {
1458971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1459971bb1a5SLionel Sambuc     const xcb_selinux_get_property_data_context_reply_t *_aux = (xcb_selinux_get_property_data_context_reply_t *)_buffer;
1460971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1461971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1462971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1463*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1464971bb1a5SLionel Sambuc 
1465971bb1a5SLionel Sambuc 
1466971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_property_data_context_reply_t);
1467971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1468*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1469*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1470971bb1a5SLionel Sambuc     /* context */
1471971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
1472971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1473971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
1474971bb1a5SLionel Sambuc     /* insert padding */
1475971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1476971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1477971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1478971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1479971bb1a5SLionel Sambuc         xcb_pad = 0;
1480971bb1a5SLionel Sambuc     }
1481971bb1a5SLionel Sambuc     xcb_block_len = 0;
1482971bb1a5SLionel Sambuc 
1483971bb1a5SLionel Sambuc     return xcb_buffer_len;
1484971bb1a5SLionel Sambuc }
1485971bb1a5SLionel Sambuc 
1486971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_cookie_t
xcb_selinux_get_property_data_context(xcb_connection_t * c,xcb_window_t window,xcb_atom_t property)1487971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context (xcb_connection_t *c  /**< */,
1488971bb1a5SLionel Sambuc                                        xcb_window_t      window  /**< */,
1489971bb1a5SLionel Sambuc                                        xcb_atom_t        property  /**< */)
1490971bb1a5SLionel Sambuc {
1491971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1492971bb1a5SLionel Sambuc         /* count */ 2,
1493971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1494971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_PROPERTY_DATA_CONTEXT,
1495971bb1a5SLionel Sambuc         /* isvoid */ 0
1496971bb1a5SLionel Sambuc     };
1497971bb1a5SLionel Sambuc 
1498971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1499971bb1a5SLionel Sambuc     xcb_selinux_get_property_data_context_cookie_t xcb_ret;
1500971bb1a5SLionel Sambuc     xcb_selinux_get_property_data_context_request_t xcb_out;
1501971bb1a5SLionel Sambuc 
1502971bb1a5SLionel Sambuc     xcb_out.window = window;
1503971bb1a5SLionel Sambuc     xcb_out.property = property;
1504971bb1a5SLionel Sambuc 
1505971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1506971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1507971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1508971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1509971bb1a5SLionel Sambuc 
1510971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1511971bb1a5SLionel Sambuc     return xcb_ret;
1512971bb1a5SLionel Sambuc }
1513971bb1a5SLionel Sambuc 
1514971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_cookie_t
xcb_selinux_get_property_data_context_unchecked(xcb_connection_t * c,xcb_window_t window,xcb_atom_t property)1515971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_unchecked (xcb_connection_t *c  /**< */,
1516971bb1a5SLionel Sambuc                                                  xcb_window_t      window  /**< */,
1517971bb1a5SLionel Sambuc                                                  xcb_atom_t        property  /**< */)
1518971bb1a5SLionel Sambuc {
1519971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1520971bb1a5SLionel Sambuc         /* count */ 2,
1521971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1522971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_PROPERTY_DATA_CONTEXT,
1523971bb1a5SLionel Sambuc         /* isvoid */ 0
1524971bb1a5SLionel Sambuc     };
1525971bb1a5SLionel Sambuc 
1526971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1527971bb1a5SLionel Sambuc     xcb_selinux_get_property_data_context_cookie_t xcb_ret;
1528971bb1a5SLionel Sambuc     xcb_selinux_get_property_data_context_request_t xcb_out;
1529971bb1a5SLionel Sambuc 
1530971bb1a5SLionel Sambuc     xcb_out.window = window;
1531971bb1a5SLionel Sambuc     xcb_out.property = property;
1532971bb1a5SLionel Sambuc 
1533971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1534971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1535971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1536971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1537971bb1a5SLionel Sambuc 
1538971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1539971bb1a5SLionel Sambuc     return xcb_ret;
1540971bb1a5SLionel Sambuc }
1541971bb1a5SLionel Sambuc 
1542971bb1a5SLionel Sambuc char *
xcb_selinux_get_property_data_context_context(const xcb_selinux_get_property_data_context_reply_t * R)1543971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_context (const xcb_selinux_get_property_data_context_reply_t *R  /**< */)
1544971bb1a5SLionel Sambuc {
1545971bb1a5SLionel Sambuc     return (char *) (R + 1);
1546971bb1a5SLionel Sambuc }
1547971bb1a5SLionel Sambuc 
1548971bb1a5SLionel Sambuc int
xcb_selinux_get_property_data_context_context_length(const xcb_selinux_get_property_data_context_reply_t * R)1549971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_context_length (const xcb_selinux_get_property_data_context_reply_t *R  /**< */)
1550971bb1a5SLionel Sambuc {
1551971bb1a5SLionel Sambuc     return R->context_len;
1552971bb1a5SLionel Sambuc }
1553971bb1a5SLionel Sambuc 
1554971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_property_data_context_context_end(const xcb_selinux_get_property_data_context_reply_t * R)1555971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_context_end (const xcb_selinux_get_property_data_context_reply_t *R  /**< */)
1556971bb1a5SLionel Sambuc {
1557971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
1558971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
1559971bb1a5SLionel Sambuc     i.rem = 0;
1560971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
1561971bb1a5SLionel Sambuc     return i;
1562971bb1a5SLionel Sambuc }
1563971bb1a5SLionel Sambuc 
1564971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_reply_t *
xcb_selinux_get_property_data_context_reply(xcb_connection_t * c,xcb_selinux_get_property_data_context_cookie_t cookie,xcb_generic_error_t ** e)1565971bb1a5SLionel Sambuc xcb_selinux_get_property_data_context_reply (xcb_connection_t                                *c  /**< */,
1566971bb1a5SLionel Sambuc                                              xcb_selinux_get_property_data_context_cookie_t   cookie  /**< */,
1567971bb1a5SLionel Sambuc                                              xcb_generic_error_t                            **e  /**< */)
1568971bb1a5SLionel Sambuc {
1569971bb1a5SLionel Sambuc     return (xcb_selinux_get_property_data_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1570971bb1a5SLionel Sambuc }
1571971bb1a5SLionel Sambuc 
1572971bb1a5SLionel Sambuc int
xcb_selinux_list_properties_sizeof(const void * _buffer)1573971bb1a5SLionel Sambuc xcb_selinux_list_properties_sizeof (const void  *_buffer  /**< */)
1574971bb1a5SLionel Sambuc {
1575971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1576971bb1a5SLionel Sambuc     const xcb_selinux_list_properties_reply_t *_aux = (xcb_selinux_list_properties_reply_t *)_buffer;
1577971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1578971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1579971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1580*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1581971bb1a5SLionel Sambuc 
1582971bb1a5SLionel Sambuc     unsigned int i;
1583971bb1a5SLionel Sambuc     unsigned int xcb_tmp_len;
1584971bb1a5SLionel Sambuc 
1585971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_list_properties_reply_t);
1586971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1587*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1588*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1589971bb1a5SLionel Sambuc     /* properties */
1590971bb1a5SLionel Sambuc     for(i=0; i<_aux->properties_len; i++) {
1591971bb1a5SLionel Sambuc         xcb_tmp_len = xcb_selinux_list_item_sizeof(xcb_tmp);
1592971bb1a5SLionel Sambuc         xcb_block_len += xcb_tmp_len;
1593971bb1a5SLionel Sambuc         xcb_tmp += xcb_tmp_len;
1594971bb1a5SLionel Sambuc     }
1595971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(xcb_selinux_list_item_t);
1596971bb1a5SLionel Sambuc     /* insert padding */
1597971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1598971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1599971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1600971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1601971bb1a5SLionel Sambuc         xcb_pad = 0;
1602971bb1a5SLionel Sambuc     }
1603971bb1a5SLionel Sambuc     xcb_block_len = 0;
1604971bb1a5SLionel Sambuc 
1605971bb1a5SLionel Sambuc     return xcb_buffer_len;
1606971bb1a5SLionel Sambuc }
1607971bb1a5SLionel Sambuc 
1608971bb1a5SLionel Sambuc xcb_selinux_list_properties_cookie_t
xcb_selinux_list_properties(xcb_connection_t * c,xcb_window_t window)1609971bb1a5SLionel Sambuc xcb_selinux_list_properties (xcb_connection_t *c  /**< */,
1610971bb1a5SLionel Sambuc                              xcb_window_t      window  /**< */)
1611971bb1a5SLionel Sambuc {
1612971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1613971bb1a5SLionel Sambuc         /* count */ 2,
1614971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1615971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_LIST_PROPERTIES,
1616971bb1a5SLionel Sambuc         /* isvoid */ 0
1617971bb1a5SLionel Sambuc     };
1618971bb1a5SLionel Sambuc 
1619971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1620971bb1a5SLionel Sambuc     xcb_selinux_list_properties_cookie_t xcb_ret;
1621971bb1a5SLionel Sambuc     xcb_selinux_list_properties_request_t xcb_out;
1622971bb1a5SLionel Sambuc 
1623971bb1a5SLionel Sambuc     xcb_out.window = window;
1624971bb1a5SLionel Sambuc 
1625971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1626971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1627971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1628971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1629971bb1a5SLionel Sambuc 
1630971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1631971bb1a5SLionel Sambuc     return xcb_ret;
1632971bb1a5SLionel Sambuc }
1633971bb1a5SLionel Sambuc 
1634971bb1a5SLionel Sambuc xcb_selinux_list_properties_cookie_t
xcb_selinux_list_properties_unchecked(xcb_connection_t * c,xcb_window_t window)1635971bb1a5SLionel Sambuc xcb_selinux_list_properties_unchecked (xcb_connection_t *c  /**< */,
1636971bb1a5SLionel Sambuc                                        xcb_window_t      window  /**< */)
1637971bb1a5SLionel Sambuc {
1638971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1639971bb1a5SLionel Sambuc         /* count */ 2,
1640971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1641971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_LIST_PROPERTIES,
1642971bb1a5SLionel Sambuc         /* isvoid */ 0
1643971bb1a5SLionel Sambuc     };
1644971bb1a5SLionel Sambuc 
1645971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1646971bb1a5SLionel Sambuc     xcb_selinux_list_properties_cookie_t xcb_ret;
1647971bb1a5SLionel Sambuc     xcb_selinux_list_properties_request_t xcb_out;
1648971bb1a5SLionel Sambuc 
1649971bb1a5SLionel Sambuc     xcb_out.window = window;
1650971bb1a5SLionel Sambuc 
1651971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1652971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1653971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1654971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1655971bb1a5SLionel Sambuc 
1656971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1657971bb1a5SLionel Sambuc     return xcb_ret;
1658971bb1a5SLionel Sambuc }
1659971bb1a5SLionel Sambuc 
1660971bb1a5SLionel Sambuc int
xcb_selinux_list_properties_properties_length(const xcb_selinux_list_properties_reply_t * R)1661971bb1a5SLionel Sambuc xcb_selinux_list_properties_properties_length (const xcb_selinux_list_properties_reply_t *R  /**< */)
1662971bb1a5SLionel Sambuc {
1663971bb1a5SLionel Sambuc     return R->properties_len;
1664971bb1a5SLionel Sambuc }
1665971bb1a5SLionel Sambuc 
1666971bb1a5SLionel Sambuc xcb_selinux_list_item_iterator_t
xcb_selinux_list_properties_properties_iterator(const xcb_selinux_list_properties_reply_t * R)1667971bb1a5SLionel Sambuc xcb_selinux_list_properties_properties_iterator (const xcb_selinux_list_properties_reply_t *R  /**< */)
1668971bb1a5SLionel Sambuc {
1669971bb1a5SLionel Sambuc     xcb_selinux_list_item_iterator_t i;
1670971bb1a5SLionel Sambuc     i.data = (xcb_selinux_list_item_t *) (R + 1);
1671971bb1a5SLionel Sambuc     i.rem = R->properties_len;
1672971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
1673971bb1a5SLionel Sambuc     return i;
1674971bb1a5SLionel Sambuc }
1675971bb1a5SLionel Sambuc 
1676971bb1a5SLionel Sambuc xcb_selinux_list_properties_reply_t *
xcb_selinux_list_properties_reply(xcb_connection_t * c,xcb_selinux_list_properties_cookie_t cookie,xcb_generic_error_t ** e)1677971bb1a5SLionel Sambuc xcb_selinux_list_properties_reply (xcb_connection_t                      *c  /**< */,
1678971bb1a5SLionel Sambuc                                    xcb_selinux_list_properties_cookie_t   cookie  /**< */,
1679971bb1a5SLionel Sambuc                                    xcb_generic_error_t                  **e  /**< */)
1680971bb1a5SLionel Sambuc {
1681971bb1a5SLionel Sambuc     return (xcb_selinux_list_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1682971bb1a5SLionel Sambuc }
1683971bb1a5SLionel Sambuc 
1684971bb1a5SLionel Sambuc int
xcb_selinux_set_selection_create_context_sizeof(const void * _buffer)1685971bb1a5SLionel Sambuc xcb_selinux_set_selection_create_context_sizeof (const void  *_buffer  /**< */)
1686971bb1a5SLionel Sambuc {
1687971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1688971bb1a5SLionel Sambuc     const xcb_selinux_set_selection_create_context_request_t *_aux = (xcb_selinux_set_selection_create_context_request_t *)_buffer;
1689971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1690971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1691971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1692*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1693971bb1a5SLionel Sambuc 
1694971bb1a5SLionel Sambuc 
1695971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_set_selection_create_context_request_t);
1696971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1697*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1698*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1699971bb1a5SLionel Sambuc     /* context */
1700971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
1701971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1702971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
1703971bb1a5SLionel Sambuc     /* insert padding */
1704971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1705971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1706971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1707971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1708971bb1a5SLionel Sambuc         xcb_pad = 0;
1709971bb1a5SLionel Sambuc     }
1710971bb1a5SLionel Sambuc     xcb_block_len = 0;
1711971bb1a5SLionel Sambuc 
1712971bb1a5SLionel Sambuc     return xcb_buffer_len;
1713971bb1a5SLionel Sambuc }
1714971bb1a5SLionel Sambuc 
1715971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_selection_create_context_checked(xcb_connection_t * c,uint32_t context_len,const char * context)1716971bb1a5SLionel Sambuc xcb_selinux_set_selection_create_context_checked (xcb_connection_t *c  /**< */,
1717971bb1a5SLionel Sambuc                                                   uint32_t          context_len  /**< */,
1718971bb1a5SLionel Sambuc                                                   const char       *context  /**< */)
1719971bb1a5SLionel Sambuc {
1720971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1721971bb1a5SLionel Sambuc         /* count */ 4,
1722971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1723971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_SELECTION_CREATE_CONTEXT,
1724971bb1a5SLionel Sambuc         /* isvoid */ 1
1725971bb1a5SLionel Sambuc     };
1726971bb1a5SLionel Sambuc 
1727971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
1728971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
1729971bb1a5SLionel Sambuc     xcb_selinux_set_selection_create_context_request_t xcb_out;
1730971bb1a5SLionel Sambuc 
1731971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
1732971bb1a5SLionel Sambuc 
1733971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1734971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1735971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1736971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1737971bb1a5SLionel Sambuc     /* char context */
1738971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
1739971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
1740971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
1741971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1742971bb1a5SLionel Sambuc 
1743971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1744971bb1a5SLionel Sambuc     return xcb_ret;
1745971bb1a5SLionel Sambuc }
1746971bb1a5SLionel Sambuc 
1747971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_selection_create_context(xcb_connection_t * c,uint32_t context_len,const char * context)1748971bb1a5SLionel Sambuc xcb_selinux_set_selection_create_context (xcb_connection_t *c  /**< */,
1749971bb1a5SLionel Sambuc                                           uint32_t          context_len  /**< */,
1750971bb1a5SLionel Sambuc                                           const char       *context  /**< */)
1751971bb1a5SLionel Sambuc {
1752971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1753971bb1a5SLionel Sambuc         /* count */ 4,
1754971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1755971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_SELECTION_CREATE_CONTEXT,
1756971bb1a5SLionel Sambuc         /* isvoid */ 1
1757971bb1a5SLionel Sambuc     };
1758971bb1a5SLionel Sambuc 
1759971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
1760971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
1761971bb1a5SLionel Sambuc     xcb_selinux_set_selection_create_context_request_t xcb_out;
1762971bb1a5SLionel Sambuc 
1763971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
1764971bb1a5SLionel Sambuc 
1765971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1766971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1767971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1768971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1769971bb1a5SLionel Sambuc     /* char context */
1770971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
1771971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
1772971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
1773971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1774971bb1a5SLionel Sambuc 
1775971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1776971bb1a5SLionel Sambuc     return xcb_ret;
1777971bb1a5SLionel Sambuc }
1778971bb1a5SLionel Sambuc 
1779971bb1a5SLionel Sambuc int
xcb_selinux_get_selection_create_context_sizeof(const void * _buffer)1780971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_sizeof (const void  *_buffer  /**< */)
1781971bb1a5SLionel Sambuc {
1782971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1783971bb1a5SLionel Sambuc     const xcb_selinux_get_selection_create_context_reply_t *_aux = (xcb_selinux_get_selection_create_context_reply_t *)_buffer;
1784971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1785971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1786971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1787*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1788971bb1a5SLionel Sambuc 
1789971bb1a5SLionel Sambuc 
1790971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_selection_create_context_reply_t);
1791971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1792*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1793*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1794971bb1a5SLionel Sambuc     /* context */
1795971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
1796971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1797971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
1798971bb1a5SLionel Sambuc     /* insert padding */
1799971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1800971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1801971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1802971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1803971bb1a5SLionel Sambuc         xcb_pad = 0;
1804971bb1a5SLionel Sambuc     }
1805971bb1a5SLionel Sambuc     xcb_block_len = 0;
1806971bb1a5SLionel Sambuc 
1807971bb1a5SLionel Sambuc     return xcb_buffer_len;
1808971bb1a5SLionel Sambuc }
1809971bb1a5SLionel Sambuc 
1810971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_cookie_t
xcb_selinux_get_selection_create_context(xcb_connection_t * c)1811971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context (xcb_connection_t *c  /**< */)
1812971bb1a5SLionel Sambuc {
1813971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1814971bb1a5SLionel Sambuc         /* count */ 2,
1815971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1816971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_SELECTION_CREATE_CONTEXT,
1817971bb1a5SLionel Sambuc         /* isvoid */ 0
1818971bb1a5SLionel Sambuc     };
1819971bb1a5SLionel Sambuc 
1820971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1821971bb1a5SLionel Sambuc     xcb_selinux_get_selection_create_context_cookie_t xcb_ret;
1822971bb1a5SLionel Sambuc     xcb_selinux_get_selection_create_context_request_t xcb_out;
1823971bb1a5SLionel Sambuc 
1824971bb1a5SLionel Sambuc 
1825971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1826971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1827971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1828971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1829971bb1a5SLionel Sambuc 
1830971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1831971bb1a5SLionel Sambuc     return xcb_ret;
1832971bb1a5SLionel Sambuc }
1833971bb1a5SLionel Sambuc 
1834971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_cookie_t
xcb_selinux_get_selection_create_context_unchecked(xcb_connection_t * c)1835971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_unchecked (xcb_connection_t *c  /**< */)
1836971bb1a5SLionel Sambuc {
1837971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1838971bb1a5SLionel Sambuc         /* count */ 2,
1839971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1840971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_SELECTION_CREATE_CONTEXT,
1841971bb1a5SLionel Sambuc         /* isvoid */ 0
1842971bb1a5SLionel Sambuc     };
1843971bb1a5SLionel Sambuc 
1844971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
1845971bb1a5SLionel Sambuc     xcb_selinux_get_selection_create_context_cookie_t xcb_ret;
1846971bb1a5SLionel Sambuc     xcb_selinux_get_selection_create_context_request_t xcb_out;
1847971bb1a5SLionel Sambuc 
1848971bb1a5SLionel Sambuc 
1849971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1850971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1851971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1852971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1853971bb1a5SLionel Sambuc 
1854971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1855971bb1a5SLionel Sambuc     return xcb_ret;
1856971bb1a5SLionel Sambuc }
1857971bb1a5SLionel Sambuc 
1858971bb1a5SLionel Sambuc char *
xcb_selinux_get_selection_create_context_context(const xcb_selinux_get_selection_create_context_reply_t * R)1859971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_context (const xcb_selinux_get_selection_create_context_reply_t *R  /**< */)
1860971bb1a5SLionel Sambuc {
1861971bb1a5SLionel Sambuc     return (char *) (R + 1);
1862971bb1a5SLionel Sambuc }
1863971bb1a5SLionel Sambuc 
1864971bb1a5SLionel Sambuc int
xcb_selinux_get_selection_create_context_context_length(const xcb_selinux_get_selection_create_context_reply_t * R)1865971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_context_length (const xcb_selinux_get_selection_create_context_reply_t *R  /**< */)
1866971bb1a5SLionel Sambuc {
1867971bb1a5SLionel Sambuc     return R->context_len;
1868971bb1a5SLionel Sambuc }
1869971bb1a5SLionel Sambuc 
1870971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_selection_create_context_context_end(const xcb_selinux_get_selection_create_context_reply_t * R)1871971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_context_end (const xcb_selinux_get_selection_create_context_reply_t *R  /**< */)
1872971bb1a5SLionel Sambuc {
1873971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
1874971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
1875971bb1a5SLionel Sambuc     i.rem = 0;
1876971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
1877971bb1a5SLionel Sambuc     return i;
1878971bb1a5SLionel Sambuc }
1879971bb1a5SLionel Sambuc 
1880971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_reply_t *
xcb_selinux_get_selection_create_context_reply(xcb_connection_t * c,xcb_selinux_get_selection_create_context_cookie_t cookie,xcb_generic_error_t ** e)1881971bb1a5SLionel Sambuc xcb_selinux_get_selection_create_context_reply (xcb_connection_t                                   *c  /**< */,
1882971bb1a5SLionel Sambuc                                                 xcb_selinux_get_selection_create_context_cookie_t   cookie  /**< */,
1883971bb1a5SLionel Sambuc                                                 xcb_generic_error_t                               **e  /**< */)
1884971bb1a5SLionel Sambuc {
1885971bb1a5SLionel Sambuc     return (xcb_selinux_get_selection_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1886971bb1a5SLionel Sambuc }
1887971bb1a5SLionel Sambuc 
1888971bb1a5SLionel Sambuc int
xcb_selinux_set_selection_use_context_sizeof(const void * _buffer)1889971bb1a5SLionel Sambuc xcb_selinux_set_selection_use_context_sizeof (const void  *_buffer  /**< */)
1890971bb1a5SLionel Sambuc {
1891971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1892971bb1a5SLionel Sambuc     const xcb_selinux_set_selection_use_context_request_t *_aux = (xcb_selinux_set_selection_use_context_request_t *)_buffer;
1893971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1894971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1895971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1896*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1897971bb1a5SLionel Sambuc 
1898971bb1a5SLionel Sambuc 
1899971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_set_selection_use_context_request_t);
1900971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1901*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1902*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1903971bb1a5SLionel Sambuc     /* context */
1904971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
1905971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1906971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
1907971bb1a5SLionel Sambuc     /* insert padding */
1908971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1909971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
1910971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
1911971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
1912971bb1a5SLionel Sambuc         xcb_pad = 0;
1913971bb1a5SLionel Sambuc     }
1914971bb1a5SLionel Sambuc     xcb_block_len = 0;
1915971bb1a5SLionel Sambuc 
1916971bb1a5SLionel Sambuc     return xcb_buffer_len;
1917971bb1a5SLionel Sambuc }
1918971bb1a5SLionel Sambuc 
1919971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_selection_use_context_checked(xcb_connection_t * c,uint32_t context_len,const char * context)1920971bb1a5SLionel Sambuc xcb_selinux_set_selection_use_context_checked (xcb_connection_t *c  /**< */,
1921971bb1a5SLionel Sambuc                                                uint32_t          context_len  /**< */,
1922971bb1a5SLionel Sambuc                                                const char       *context  /**< */)
1923971bb1a5SLionel Sambuc {
1924971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1925971bb1a5SLionel Sambuc         /* count */ 4,
1926971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1927971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_SELECTION_USE_CONTEXT,
1928971bb1a5SLionel Sambuc         /* isvoid */ 1
1929971bb1a5SLionel Sambuc     };
1930971bb1a5SLionel Sambuc 
1931971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
1932971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
1933971bb1a5SLionel Sambuc     xcb_selinux_set_selection_use_context_request_t xcb_out;
1934971bb1a5SLionel Sambuc 
1935971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
1936971bb1a5SLionel Sambuc 
1937971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1938971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1939971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1940971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1941971bb1a5SLionel Sambuc     /* char context */
1942971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
1943971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
1944971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
1945971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1946971bb1a5SLionel Sambuc 
1947971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1948971bb1a5SLionel Sambuc     return xcb_ret;
1949971bb1a5SLionel Sambuc }
1950971bb1a5SLionel Sambuc 
1951971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_selinux_set_selection_use_context(xcb_connection_t * c,uint32_t context_len,const char * context)1952971bb1a5SLionel Sambuc xcb_selinux_set_selection_use_context (xcb_connection_t *c  /**< */,
1953971bb1a5SLionel Sambuc                                        uint32_t          context_len  /**< */,
1954971bb1a5SLionel Sambuc                                        const char       *context  /**< */)
1955971bb1a5SLionel Sambuc {
1956971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
1957971bb1a5SLionel Sambuc         /* count */ 4,
1958971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
1959971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_SET_SELECTION_USE_CONTEXT,
1960971bb1a5SLionel Sambuc         /* isvoid */ 1
1961971bb1a5SLionel Sambuc     };
1962971bb1a5SLionel Sambuc 
1963971bb1a5SLionel Sambuc     struct iovec xcb_parts[6];
1964971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
1965971bb1a5SLionel Sambuc     xcb_selinux_set_selection_use_context_request_t xcb_out;
1966971bb1a5SLionel Sambuc 
1967971bb1a5SLionel Sambuc     xcb_out.context_len = context_len;
1968971bb1a5SLionel Sambuc 
1969971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
1970971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
1971971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
1972971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1973971bb1a5SLionel Sambuc     /* char context */
1974971bb1a5SLionel Sambuc     xcb_parts[4].iov_base = (char *) context;
1975971bb1a5SLionel Sambuc     xcb_parts[4].iov_len = context_len * sizeof(char);
1976971bb1a5SLionel Sambuc     xcb_parts[5].iov_base = 0;
1977971bb1a5SLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1978971bb1a5SLionel Sambuc 
1979971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1980971bb1a5SLionel Sambuc     return xcb_ret;
1981971bb1a5SLionel Sambuc }
1982971bb1a5SLionel Sambuc 
1983971bb1a5SLionel Sambuc int
xcb_selinux_get_selection_use_context_sizeof(const void * _buffer)1984971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_sizeof (const void  *_buffer  /**< */)
1985971bb1a5SLionel Sambuc {
1986971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
1987971bb1a5SLionel Sambuc     const xcb_selinux_get_selection_use_context_reply_t *_aux = (xcb_selinux_get_selection_use_context_reply_t *)_buffer;
1988971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
1989971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
1990971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
1991*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
1992971bb1a5SLionel Sambuc 
1993971bb1a5SLionel Sambuc 
1994971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_selection_use_context_reply_t);
1995971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
1996*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
1997*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
1998971bb1a5SLionel Sambuc     /* context */
1999971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
2000971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
2001971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
2002971bb1a5SLionel Sambuc     /* insert padding */
2003971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2004971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
2005971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
2006971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
2007971bb1a5SLionel Sambuc         xcb_pad = 0;
2008971bb1a5SLionel Sambuc     }
2009971bb1a5SLionel Sambuc     xcb_block_len = 0;
2010971bb1a5SLionel Sambuc 
2011971bb1a5SLionel Sambuc     return xcb_buffer_len;
2012971bb1a5SLionel Sambuc }
2013971bb1a5SLionel Sambuc 
2014971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_cookie_t
xcb_selinux_get_selection_use_context(xcb_connection_t * c)2015971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context (xcb_connection_t *c  /**< */)
2016971bb1a5SLionel Sambuc {
2017971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2018971bb1a5SLionel Sambuc         /* count */ 2,
2019971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2020971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_SELECTION_USE_CONTEXT,
2021971bb1a5SLionel Sambuc         /* isvoid */ 0
2022971bb1a5SLionel Sambuc     };
2023971bb1a5SLionel Sambuc 
2024971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2025971bb1a5SLionel Sambuc     xcb_selinux_get_selection_use_context_cookie_t xcb_ret;
2026971bb1a5SLionel Sambuc     xcb_selinux_get_selection_use_context_request_t xcb_out;
2027971bb1a5SLionel Sambuc 
2028971bb1a5SLionel Sambuc 
2029971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2030971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2031971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2032971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2033971bb1a5SLionel Sambuc 
2034971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2035971bb1a5SLionel Sambuc     return xcb_ret;
2036971bb1a5SLionel Sambuc }
2037971bb1a5SLionel Sambuc 
2038971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_cookie_t
xcb_selinux_get_selection_use_context_unchecked(xcb_connection_t * c)2039971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_unchecked (xcb_connection_t *c  /**< */)
2040971bb1a5SLionel Sambuc {
2041971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2042971bb1a5SLionel Sambuc         /* count */ 2,
2043971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2044971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_SELECTION_USE_CONTEXT,
2045971bb1a5SLionel Sambuc         /* isvoid */ 0
2046971bb1a5SLionel Sambuc     };
2047971bb1a5SLionel Sambuc 
2048971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2049971bb1a5SLionel Sambuc     xcb_selinux_get_selection_use_context_cookie_t xcb_ret;
2050971bb1a5SLionel Sambuc     xcb_selinux_get_selection_use_context_request_t xcb_out;
2051971bb1a5SLionel Sambuc 
2052971bb1a5SLionel Sambuc 
2053971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2054971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2055971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2056971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2057971bb1a5SLionel Sambuc 
2058971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2059971bb1a5SLionel Sambuc     return xcb_ret;
2060971bb1a5SLionel Sambuc }
2061971bb1a5SLionel Sambuc 
2062971bb1a5SLionel Sambuc char *
xcb_selinux_get_selection_use_context_context(const xcb_selinux_get_selection_use_context_reply_t * R)2063971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_context (const xcb_selinux_get_selection_use_context_reply_t *R  /**< */)
2064971bb1a5SLionel Sambuc {
2065971bb1a5SLionel Sambuc     return (char *) (R + 1);
2066971bb1a5SLionel Sambuc }
2067971bb1a5SLionel Sambuc 
2068971bb1a5SLionel Sambuc int
xcb_selinux_get_selection_use_context_context_length(const xcb_selinux_get_selection_use_context_reply_t * R)2069971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_context_length (const xcb_selinux_get_selection_use_context_reply_t *R  /**< */)
2070971bb1a5SLionel Sambuc {
2071971bb1a5SLionel Sambuc     return R->context_len;
2072971bb1a5SLionel Sambuc }
2073971bb1a5SLionel Sambuc 
2074971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_selection_use_context_context_end(const xcb_selinux_get_selection_use_context_reply_t * R)2075971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_context_end (const xcb_selinux_get_selection_use_context_reply_t *R  /**< */)
2076971bb1a5SLionel Sambuc {
2077971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
2078971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
2079971bb1a5SLionel Sambuc     i.rem = 0;
2080971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
2081971bb1a5SLionel Sambuc     return i;
2082971bb1a5SLionel Sambuc }
2083971bb1a5SLionel Sambuc 
2084971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_reply_t *
xcb_selinux_get_selection_use_context_reply(xcb_connection_t * c,xcb_selinux_get_selection_use_context_cookie_t cookie,xcb_generic_error_t ** e)2085971bb1a5SLionel Sambuc xcb_selinux_get_selection_use_context_reply (xcb_connection_t                                *c  /**< */,
2086971bb1a5SLionel Sambuc                                              xcb_selinux_get_selection_use_context_cookie_t   cookie  /**< */,
2087971bb1a5SLionel Sambuc                                              xcb_generic_error_t                            **e  /**< */)
2088971bb1a5SLionel Sambuc {
2089971bb1a5SLionel Sambuc     return (xcb_selinux_get_selection_use_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2090971bb1a5SLionel Sambuc }
2091971bb1a5SLionel Sambuc 
2092971bb1a5SLionel Sambuc int
xcb_selinux_get_selection_context_sizeof(const void * _buffer)2093971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_sizeof (const void  *_buffer  /**< */)
2094971bb1a5SLionel Sambuc {
2095971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
2096971bb1a5SLionel Sambuc     const xcb_selinux_get_selection_context_reply_t *_aux = (xcb_selinux_get_selection_context_reply_t *)_buffer;
2097971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
2098971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
2099971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
2100*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
2101971bb1a5SLionel Sambuc 
2102971bb1a5SLionel Sambuc 
2103971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_selection_context_reply_t);
2104971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
2105*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
2106*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
2107971bb1a5SLionel Sambuc     /* context */
2108971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
2109971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
2110971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
2111971bb1a5SLionel Sambuc     /* insert padding */
2112971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2113971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
2114971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
2115971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
2116971bb1a5SLionel Sambuc         xcb_pad = 0;
2117971bb1a5SLionel Sambuc     }
2118971bb1a5SLionel Sambuc     xcb_block_len = 0;
2119971bb1a5SLionel Sambuc 
2120971bb1a5SLionel Sambuc     return xcb_buffer_len;
2121971bb1a5SLionel Sambuc }
2122971bb1a5SLionel Sambuc 
2123971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_cookie_t
xcb_selinux_get_selection_context(xcb_connection_t * c,xcb_atom_t selection)2124971bb1a5SLionel Sambuc xcb_selinux_get_selection_context (xcb_connection_t *c  /**< */,
2125971bb1a5SLionel Sambuc                                    xcb_atom_t        selection  /**< */)
2126971bb1a5SLionel Sambuc {
2127971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2128971bb1a5SLionel Sambuc         /* count */ 2,
2129971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2130971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_SELECTION_CONTEXT,
2131971bb1a5SLionel Sambuc         /* isvoid */ 0
2132971bb1a5SLionel Sambuc     };
2133971bb1a5SLionel Sambuc 
2134971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2135971bb1a5SLionel Sambuc     xcb_selinux_get_selection_context_cookie_t xcb_ret;
2136971bb1a5SLionel Sambuc     xcb_selinux_get_selection_context_request_t xcb_out;
2137971bb1a5SLionel Sambuc 
2138971bb1a5SLionel Sambuc     xcb_out.selection = selection;
2139971bb1a5SLionel Sambuc 
2140971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2141971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2142971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2143971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2144971bb1a5SLionel Sambuc 
2145971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2146971bb1a5SLionel Sambuc     return xcb_ret;
2147971bb1a5SLionel Sambuc }
2148971bb1a5SLionel Sambuc 
2149971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_cookie_t
xcb_selinux_get_selection_context_unchecked(xcb_connection_t * c,xcb_atom_t selection)2150971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_unchecked (xcb_connection_t *c  /**< */,
2151971bb1a5SLionel Sambuc                                              xcb_atom_t        selection  /**< */)
2152971bb1a5SLionel Sambuc {
2153971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2154971bb1a5SLionel Sambuc         /* count */ 2,
2155971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2156971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_SELECTION_CONTEXT,
2157971bb1a5SLionel Sambuc         /* isvoid */ 0
2158971bb1a5SLionel Sambuc     };
2159971bb1a5SLionel Sambuc 
2160971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2161971bb1a5SLionel Sambuc     xcb_selinux_get_selection_context_cookie_t xcb_ret;
2162971bb1a5SLionel Sambuc     xcb_selinux_get_selection_context_request_t xcb_out;
2163971bb1a5SLionel Sambuc 
2164971bb1a5SLionel Sambuc     xcb_out.selection = selection;
2165971bb1a5SLionel Sambuc 
2166971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2167971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2168971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2169971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2170971bb1a5SLionel Sambuc 
2171971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2172971bb1a5SLionel Sambuc     return xcb_ret;
2173971bb1a5SLionel Sambuc }
2174971bb1a5SLionel Sambuc 
2175971bb1a5SLionel Sambuc char *
xcb_selinux_get_selection_context_context(const xcb_selinux_get_selection_context_reply_t * R)2176971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_context (const xcb_selinux_get_selection_context_reply_t *R  /**< */)
2177971bb1a5SLionel Sambuc {
2178971bb1a5SLionel Sambuc     return (char *) (R + 1);
2179971bb1a5SLionel Sambuc }
2180971bb1a5SLionel Sambuc 
2181971bb1a5SLionel Sambuc int
xcb_selinux_get_selection_context_context_length(const xcb_selinux_get_selection_context_reply_t * R)2182971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_context_length (const xcb_selinux_get_selection_context_reply_t *R  /**< */)
2183971bb1a5SLionel Sambuc {
2184971bb1a5SLionel Sambuc     return R->context_len;
2185971bb1a5SLionel Sambuc }
2186971bb1a5SLionel Sambuc 
2187971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_selection_context_context_end(const xcb_selinux_get_selection_context_reply_t * R)2188971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_context_end (const xcb_selinux_get_selection_context_reply_t *R  /**< */)
2189971bb1a5SLionel Sambuc {
2190971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
2191971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
2192971bb1a5SLionel Sambuc     i.rem = 0;
2193971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
2194971bb1a5SLionel Sambuc     return i;
2195971bb1a5SLionel Sambuc }
2196971bb1a5SLionel Sambuc 
2197971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_reply_t *
xcb_selinux_get_selection_context_reply(xcb_connection_t * c,xcb_selinux_get_selection_context_cookie_t cookie,xcb_generic_error_t ** e)2198971bb1a5SLionel Sambuc xcb_selinux_get_selection_context_reply (xcb_connection_t                            *c  /**< */,
2199971bb1a5SLionel Sambuc                                          xcb_selinux_get_selection_context_cookie_t   cookie  /**< */,
2200971bb1a5SLionel Sambuc                                          xcb_generic_error_t                        **e  /**< */)
2201971bb1a5SLionel Sambuc {
2202971bb1a5SLionel Sambuc     return (xcb_selinux_get_selection_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2203971bb1a5SLionel Sambuc }
2204971bb1a5SLionel Sambuc 
2205971bb1a5SLionel Sambuc int
xcb_selinux_get_selection_data_context_sizeof(const void * _buffer)2206971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_sizeof (const void  *_buffer  /**< */)
2207971bb1a5SLionel Sambuc {
2208971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
2209971bb1a5SLionel Sambuc     const xcb_selinux_get_selection_data_context_reply_t *_aux = (xcb_selinux_get_selection_data_context_reply_t *)_buffer;
2210971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
2211971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
2212971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
2213*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
2214971bb1a5SLionel Sambuc 
2215971bb1a5SLionel Sambuc 
2216971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_selection_data_context_reply_t);
2217971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
2218*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
2219*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
2220971bb1a5SLionel Sambuc     /* context */
2221971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
2222971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
2223971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
2224971bb1a5SLionel Sambuc     /* insert padding */
2225971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2226971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
2227971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
2228971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
2229971bb1a5SLionel Sambuc         xcb_pad = 0;
2230971bb1a5SLionel Sambuc     }
2231971bb1a5SLionel Sambuc     xcb_block_len = 0;
2232971bb1a5SLionel Sambuc 
2233971bb1a5SLionel Sambuc     return xcb_buffer_len;
2234971bb1a5SLionel Sambuc }
2235971bb1a5SLionel Sambuc 
2236971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_cookie_t
xcb_selinux_get_selection_data_context(xcb_connection_t * c,xcb_atom_t selection)2237971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context (xcb_connection_t *c  /**< */,
2238971bb1a5SLionel Sambuc                                         xcb_atom_t        selection  /**< */)
2239971bb1a5SLionel Sambuc {
2240971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2241971bb1a5SLionel Sambuc         /* count */ 2,
2242971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2243971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_SELECTION_DATA_CONTEXT,
2244971bb1a5SLionel Sambuc         /* isvoid */ 0
2245971bb1a5SLionel Sambuc     };
2246971bb1a5SLionel Sambuc 
2247971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2248971bb1a5SLionel Sambuc     xcb_selinux_get_selection_data_context_cookie_t xcb_ret;
2249971bb1a5SLionel Sambuc     xcb_selinux_get_selection_data_context_request_t xcb_out;
2250971bb1a5SLionel Sambuc 
2251971bb1a5SLionel Sambuc     xcb_out.selection = selection;
2252971bb1a5SLionel Sambuc 
2253971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2254971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2255971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2256971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2257971bb1a5SLionel Sambuc 
2258971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2259971bb1a5SLionel Sambuc     return xcb_ret;
2260971bb1a5SLionel Sambuc }
2261971bb1a5SLionel Sambuc 
2262971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_cookie_t
xcb_selinux_get_selection_data_context_unchecked(xcb_connection_t * c,xcb_atom_t selection)2263971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_unchecked (xcb_connection_t *c  /**< */,
2264971bb1a5SLionel Sambuc                                                   xcb_atom_t        selection  /**< */)
2265971bb1a5SLionel Sambuc {
2266971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2267971bb1a5SLionel Sambuc         /* count */ 2,
2268971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2269971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_SELECTION_DATA_CONTEXT,
2270971bb1a5SLionel Sambuc         /* isvoid */ 0
2271971bb1a5SLionel Sambuc     };
2272971bb1a5SLionel Sambuc 
2273971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2274971bb1a5SLionel Sambuc     xcb_selinux_get_selection_data_context_cookie_t xcb_ret;
2275971bb1a5SLionel Sambuc     xcb_selinux_get_selection_data_context_request_t xcb_out;
2276971bb1a5SLionel Sambuc 
2277971bb1a5SLionel Sambuc     xcb_out.selection = selection;
2278971bb1a5SLionel Sambuc 
2279971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2280971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2281971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2282971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2283971bb1a5SLionel Sambuc 
2284971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2285971bb1a5SLionel Sambuc     return xcb_ret;
2286971bb1a5SLionel Sambuc }
2287971bb1a5SLionel Sambuc 
2288971bb1a5SLionel Sambuc char *
xcb_selinux_get_selection_data_context_context(const xcb_selinux_get_selection_data_context_reply_t * R)2289971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_context (const xcb_selinux_get_selection_data_context_reply_t *R  /**< */)
2290971bb1a5SLionel Sambuc {
2291971bb1a5SLionel Sambuc     return (char *) (R + 1);
2292971bb1a5SLionel Sambuc }
2293971bb1a5SLionel Sambuc 
2294971bb1a5SLionel Sambuc int
xcb_selinux_get_selection_data_context_context_length(const xcb_selinux_get_selection_data_context_reply_t * R)2295971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_context_length (const xcb_selinux_get_selection_data_context_reply_t *R  /**< */)
2296971bb1a5SLionel Sambuc {
2297971bb1a5SLionel Sambuc     return R->context_len;
2298971bb1a5SLionel Sambuc }
2299971bb1a5SLionel Sambuc 
2300971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_selection_data_context_context_end(const xcb_selinux_get_selection_data_context_reply_t * R)2301971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_context_end (const xcb_selinux_get_selection_data_context_reply_t *R  /**< */)
2302971bb1a5SLionel Sambuc {
2303971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
2304971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
2305971bb1a5SLionel Sambuc     i.rem = 0;
2306971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
2307971bb1a5SLionel Sambuc     return i;
2308971bb1a5SLionel Sambuc }
2309971bb1a5SLionel Sambuc 
2310971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_reply_t *
xcb_selinux_get_selection_data_context_reply(xcb_connection_t * c,xcb_selinux_get_selection_data_context_cookie_t cookie,xcb_generic_error_t ** e)2311971bb1a5SLionel Sambuc xcb_selinux_get_selection_data_context_reply (xcb_connection_t                                 *c  /**< */,
2312971bb1a5SLionel Sambuc                                               xcb_selinux_get_selection_data_context_cookie_t   cookie  /**< */,
2313971bb1a5SLionel Sambuc                                               xcb_generic_error_t                             **e  /**< */)
2314971bb1a5SLionel Sambuc {
2315971bb1a5SLionel Sambuc     return (xcb_selinux_get_selection_data_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2316971bb1a5SLionel Sambuc }
2317971bb1a5SLionel Sambuc 
2318971bb1a5SLionel Sambuc int
xcb_selinux_list_selections_sizeof(const void * _buffer)2319971bb1a5SLionel Sambuc xcb_selinux_list_selections_sizeof (const void  *_buffer  /**< */)
2320971bb1a5SLionel Sambuc {
2321971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
2322971bb1a5SLionel Sambuc     const xcb_selinux_list_selections_reply_t *_aux = (xcb_selinux_list_selections_reply_t *)_buffer;
2323971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
2324971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
2325971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
2326*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
2327971bb1a5SLionel Sambuc 
2328971bb1a5SLionel Sambuc     unsigned int i;
2329971bb1a5SLionel Sambuc     unsigned int xcb_tmp_len;
2330971bb1a5SLionel Sambuc 
2331971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_list_selections_reply_t);
2332971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
2333*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
2334*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
2335971bb1a5SLionel Sambuc     /* selections */
2336971bb1a5SLionel Sambuc     for(i=0; i<_aux->selections_len; i++) {
2337971bb1a5SLionel Sambuc         xcb_tmp_len = xcb_selinux_list_item_sizeof(xcb_tmp);
2338971bb1a5SLionel Sambuc         xcb_block_len += xcb_tmp_len;
2339971bb1a5SLionel Sambuc         xcb_tmp += xcb_tmp_len;
2340971bb1a5SLionel Sambuc     }
2341971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(xcb_selinux_list_item_t);
2342971bb1a5SLionel Sambuc     /* insert padding */
2343971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2344971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
2345971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
2346971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
2347971bb1a5SLionel Sambuc         xcb_pad = 0;
2348971bb1a5SLionel Sambuc     }
2349971bb1a5SLionel Sambuc     xcb_block_len = 0;
2350971bb1a5SLionel Sambuc 
2351971bb1a5SLionel Sambuc     return xcb_buffer_len;
2352971bb1a5SLionel Sambuc }
2353971bb1a5SLionel Sambuc 
2354971bb1a5SLionel Sambuc xcb_selinux_list_selections_cookie_t
xcb_selinux_list_selections(xcb_connection_t * c)2355971bb1a5SLionel Sambuc xcb_selinux_list_selections (xcb_connection_t *c  /**< */)
2356971bb1a5SLionel Sambuc {
2357971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2358971bb1a5SLionel Sambuc         /* count */ 2,
2359971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2360971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_LIST_SELECTIONS,
2361971bb1a5SLionel Sambuc         /* isvoid */ 0
2362971bb1a5SLionel Sambuc     };
2363971bb1a5SLionel Sambuc 
2364971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2365971bb1a5SLionel Sambuc     xcb_selinux_list_selections_cookie_t xcb_ret;
2366971bb1a5SLionel Sambuc     xcb_selinux_list_selections_request_t xcb_out;
2367971bb1a5SLionel Sambuc 
2368971bb1a5SLionel Sambuc 
2369971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2370971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2371971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2372971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2373971bb1a5SLionel Sambuc 
2374971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2375971bb1a5SLionel Sambuc     return xcb_ret;
2376971bb1a5SLionel Sambuc }
2377971bb1a5SLionel Sambuc 
2378971bb1a5SLionel Sambuc xcb_selinux_list_selections_cookie_t
xcb_selinux_list_selections_unchecked(xcb_connection_t * c)2379971bb1a5SLionel Sambuc xcb_selinux_list_selections_unchecked (xcb_connection_t *c  /**< */)
2380971bb1a5SLionel Sambuc {
2381971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2382971bb1a5SLionel Sambuc         /* count */ 2,
2383971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2384971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_LIST_SELECTIONS,
2385971bb1a5SLionel Sambuc         /* isvoid */ 0
2386971bb1a5SLionel Sambuc     };
2387971bb1a5SLionel Sambuc 
2388971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2389971bb1a5SLionel Sambuc     xcb_selinux_list_selections_cookie_t xcb_ret;
2390971bb1a5SLionel Sambuc     xcb_selinux_list_selections_request_t xcb_out;
2391971bb1a5SLionel Sambuc 
2392971bb1a5SLionel Sambuc 
2393971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2394971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2395971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2396971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2397971bb1a5SLionel Sambuc 
2398971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2399971bb1a5SLionel Sambuc     return xcb_ret;
2400971bb1a5SLionel Sambuc }
2401971bb1a5SLionel Sambuc 
2402971bb1a5SLionel Sambuc int
xcb_selinux_list_selections_selections_length(const xcb_selinux_list_selections_reply_t * R)2403971bb1a5SLionel Sambuc xcb_selinux_list_selections_selections_length (const xcb_selinux_list_selections_reply_t *R  /**< */)
2404971bb1a5SLionel Sambuc {
2405971bb1a5SLionel Sambuc     return R->selections_len;
2406971bb1a5SLionel Sambuc }
2407971bb1a5SLionel Sambuc 
2408971bb1a5SLionel Sambuc xcb_selinux_list_item_iterator_t
xcb_selinux_list_selections_selections_iterator(const xcb_selinux_list_selections_reply_t * R)2409971bb1a5SLionel Sambuc xcb_selinux_list_selections_selections_iterator (const xcb_selinux_list_selections_reply_t *R  /**< */)
2410971bb1a5SLionel Sambuc {
2411971bb1a5SLionel Sambuc     xcb_selinux_list_item_iterator_t i;
2412971bb1a5SLionel Sambuc     i.data = (xcb_selinux_list_item_t *) (R + 1);
2413971bb1a5SLionel Sambuc     i.rem = R->selections_len;
2414971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
2415971bb1a5SLionel Sambuc     return i;
2416971bb1a5SLionel Sambuc }
2417971bb1a5SLionel Sambuc 
2418971bb1a5SLionel Sambuc xcb_selinux_list_selections_reply_t *
xcb_selinux_list_selections_reply(xcb_connection_t * c,xcb_selinux_list_selections_cookie_t cookie,xcb_generic_error_t ** e)2419971bb1a5SLionel Sambuc xcb_selinux_list_selections_reply (xcb_connection_t                      *c  /**< */,
2420971bb1a5SLionel Sambuc                                    xcb_selinux_list_selections_cookie_t   cookie  /**< */,
2421971bb1a5SLionel Sambuc                                    xcb_generic_error_t                  **e  /**< */)
2422971bb1a5SLionel Sambuc {
2423971bb1a5SLionel Sambuc     return (xcb_selinux_list_selections_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2424971bb1a5SLionel Sambuc }
2425971bb1a5SLionel Sambuc 
2426971bb1a5SLionel Sambuc int
xcb_selinux_get_client_context_sizeof(const void * _buffer)2427971bb1a5SLionel Sambuc xcb_selinux_get_client_context_sizeof (const void  *_buffer  /**< */)
2428971bb1a5SLionel Sambuc {
2429971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
2430971bb1a5SLionel Sambuc     const xcb_selinux_get_client_context_reply_t *_aux = (xcb_selinux_get_client_context_reply_t *)_buffer;
2431971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
2432971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
2433971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
2434*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
2435971bb1a5SLionel Sambuc 
2436971bb1a5SLionel Sambuc 
2437971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_selinux_get_client_context_reply_t);
2438971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
2439*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
2440*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
2441971bb1a5SLionel Sambuc     /* context */
2442971bb1a5SLionel Sambuc     xcb_block_len += _aux->context_len * sizeof(char);
2443971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
2444971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(char);
2445971bb1a5SLionel Sambuc     /* insert padding */
2446971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2447971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
2448971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
2449971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
2450971bb1a5SLionel Sambuc         xcb_pad = 0;
2451971bb1a5SLionel Sambuc     }
2452971bb1a5SLionel Sambuc     xcb_block_len = 0;
2453971bb1a5SLionel Sambuc 
2454971bb1a5SLionel Sambuc     return xcb_buffer_len;
2455971bb1a5SLionel Sambuc }
2456971bb1a5SLionel Sambuc 
2457971bb1a5SLionel Sambuc xcb_selinux_get_client_context_cookie_t
xcb_selinux_get_client_context(xcb_connection_t * c,uint32_t resource)2458971bb1a5SLionel Sambuc xcb_selinux_get_client_context (xcb_connection_t *c  /**< */,
2459971bb1a5SLionel Sambuc                                 uint32_t          resource  /**< */)
2460971bb1a5SLionel Sambuc {
2461971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2462971bb1a5SLionel Sambuc         /* count */ 2,
2463971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2464971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_CLIENT_CONTEXT,
2465971bb1a5SLionel Sambuc         /* isvoid */ 0
2466971bb1a5SLionel Sambuc     };
2467971bb1a5SLionel Sambuc 
2468971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2469971bb1a5SLionel Sambuc     xcb_selinux_get_client_context_cookie_t xcb_ret;
2470971bb1a5SLionel Sambuc     xcb_selinux_get_client_context_request_t xcb_out;
2471971bb1a5SLionel Sambuc 
2472971bb1a5SLionel Sambuc     xcb_out.resource = resource;
2473971bb1a5SLionel Sambuc 
2474971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2475971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2476971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2477971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2478971bb1a5SLionel Sambuc 
2479971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2480971bb1a5SLionel Sambuc     return xcb_ret;
2481971bb1a5SLionel Sambuc }
2482971bb1a5SLionel Sambuc 
2483971bb1a5SLionel Sambuc xcb_selinux_get_client_context_cookie_t
xcb_selinux_get_client_context_unchecked(xcb_connection_t * c,uint32_t resource)2484971bb1a5SLionel Sambuc xcb_selinux_get_client_context_unchecked (xcb_connection_t *c  /**< */,
2485971bb1a5SLionel Sambuc                                           uint32_t          resource  /**< */)
2486971bb1a5SLionel Sambuc {
2487971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
2488971bb1a5SLionel Sambuc         /* count */ 2,
2489971bb1a5SLionel Sambuc         /* ext */ &xcb_selinux_id,
2490971bb1a5SLionel Sambuc         /* opcode */ XCB_SELINUX_GET_CLIENT_CONTEXT,
2491971bb1a5SLionel Sambuc         /* isvoid */ 0
2492971bb1a5SLionel Sambuc     };
2493971bb1a5SLionel Sambuc 
2494971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
2495971bb1a5SLionel Sambuc     xcb_selinux_get_client_context_cookie_t xcb_ret;
2496971bb1a5SLionel Sambuc     xcb_selinux_get_client_context_request_t xcb_out;
2497971bb1a5SLionel Sambuc 
2498971bb1a5SLionel Sambuc     xcb_out.resource = resource;
2499971bb1a5SLionel Sambuc 
2500971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
2501971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
2502971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
2503971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2504971bb1a5SLionel Sambuc 
2505971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2506971bb1a5SLionel Sambuc     return xcb_ret;
2507971bb1a5SLionel Sambuc }
2508971bb1a5SLionel Sambuc 
2509971bb1a5SLionel Sambuc char *
xcb_selinux_get_client_context_context(const xcb_selinux_get_client_context_reply_t * R)2510971bb1a5SLionel Sambuc xcb_selinux_get_client_context_context (const xcb_selinux_get_client_context_reply_t *R  /**< */)
2511971bb1a5SLionel Sambuc {
2512971bb1a5SLionel Sambuc     return (char *) (R + 1);
2513971bb1a5SLionel Sambuc }
2514971bb1a5SLionel Sambuc 
2515971bb1a5SLionel Sambuc int
xcb_selinux_get_client_context_context_length(const xcb_selinux_get_client_context_reply_t * R)2516971bb1a5SLionel Sambuc xcb_selinux_get_client_context_context_length (const xcb_selinux_get_client_context_reply_t *R  /**< */)
2517971bb1a5SLionel Sambuc {
2518971bb1a5SLionel Sambuc     return R->context_len;
2519971bb1a5SLionel Sambuc }
2520971bb1a5SLionel Sambuc 
2521971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_selinux_get_client_context_context_end(const xcb_selinux_get_client_context_reply_t * R)2522971bb1a5SLionel Sambuc xcb_selinux_get_client_context_context_end (const xcb_selinux_get_client_context_reply_t *R  /**< */)
2523971bb1a5SLionel Sambuc {
2524971bb1a5SLionel Sambuc     xcb_generic_iterator_t i;
2525971bb1a5SLionel Sambuc     i.data = ((char *) (R + 1)) + (R->context_len);
2526971bb1a5SLionel Sambuc     i.rem = 0;
2527971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
2528971bb1a5SLionel Sambuc     return i;
2529971bb1a5SLionel Sambuc }
2530971bb1a5SLionel Sambuc 
2531971bb1a5SLionel Sambuc xcb_selinux_get_client_context_reply_t *
xcb_selinux_get_client_context_reply(xcb_connection_t * c,xcb_selinux_get_client_context_cookie_t cookie,xcb_generic_error_t ** e)2532971bb1a5SLionel Sambuc xcb_selinux_get_client_context_reply (xcb_connection_t                         *c  /**< */,
2533971bb1a5SLionel Sambuc                                       xcb_selinux_get_client_context_cookie_t   cookie  /**< */,
2534971bb1a5SLionel Sambuc                                       xcb_generic_error_t                     **e  /**< */)
2535971bb1a5SLionel Sambuc {
2536971bb1a5SLionel Sambuc     return (xcb_selinux_get_client_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2537971bb1a5SLionel Sambuc }
2538971bb1a5SLionel Sambuc 
2539