x11rb_async/protocol/
xselinux.rs

1// This file contains generated code. Do not edit directly.
2// To regenerate this, run 'make'.
3
4//! Bindings to the `SELinux` X11 extension.
5
6#![allow(clippy::too_many_arguments)]
7
8#[allow(unused_imports)]
9use std::borrow::Cow;
10#[allow(unused_imports)]
11use std::convert::TryInto;
12#[allow(unused_imports)]
13use crate::utils::RawFdContainer;
14#[allow(unused_imports)]
15use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
16use std::io::IoSlice;
17use crate::connection::RequestConnection;
18#[allow(unused_imports)]
19use crate::connection::Connection as X11Connection;
20#[allow(unused_imports)]
21use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
22use crate::errors::ConnectionError;
23#[allow(unused_imports)]
24use crate::errors::ReplyOrIdError;
25use std::future::Future;
26use std::pin::Pin;
27#[allow(unused_imports)]
28use super::xproto;
29
30pub use x11rb_protocol::protocol::xselinux::*;
31
32/// Get the major opcode of this extension
33async fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
34    let info = conn.extension_information(X11_EXTENSION_NAME).await?;
35    let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
36    Ok(info.major_opcode)
37}
38
39pub async fn query_version<Conn>(conn: &Conn, client_major: u8, client_minor: u8) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
40where
41    Conn: RequestConnection + ?Sized,
42{
43    let request0 = QueryVersionRequest {
44        client_major,
45        client_minor,
46    };
47    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
48    let slices = [IoSlice::new(&bytes[0])];
49    assert_eq!(slices.len(), bytes.len());
50    conn.send_request_with_reply(&slices, fds).await
51}
52pub async fn set_device_create_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
53where
54    Conn: RequestConnection + ?Sized,
55{
56    let request0 = SetDeviceCreateContextRequest {
57        context: Cow::Borrowed(context),
58    };
59    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
60    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
61    assert_eq!(slices.len(), bytes.len());
62    conn.send_request_without_reply(&slices, fds).await
63}
64pub async fn get_device_create_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetDeviceCreateContextReply>, ConnectionError>
65where
66    Conn: RequestConnection + ?Sized,
67{
68    let request0 = GetDeviceCreateContextRequest;
69    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
70    let slices = [IoSlice::new(&bytes[0])];
71    assert_eq!(slices.len(), bytes.len());
72    conn.send_request_with_reply(&slices, fds).await
73}
74pub async fn set_device_context<'c, 'input, Conn>(conn: &'c Conn, device: u32, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
75where
76    Conn: RequestConnection + ?Sized,
77{
78    let request0 = SetDeviceContextRequest {
79        device,
80        context: Cow::Borrowed(context),
81    };
82    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
83    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
84    assert_eq!(slices.len(), bytes.len());
85    conn.send_request_without_reply(&slices, fds).await
86}
87pub async fn get_device_context<Conn>(conn: &Conn, device: u32) -> Result<Cookie<'_, Conn, GetDeviceContextReply>, ConnectionError>
88where
89    Conn: RequestConnection + ?Sized,
90{
91    let request0 = GetDeviceContextRequest {
92        device,
93    };
94    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
95    let slices = [IoSlice::new(&bytes[0])];
96    assert_eq!(slices.len(), bytes.len());
97    conn.send_request_with_reply(&slices, fds).await
98}
99pub async fn set_window_create_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
100where
101    Conn: RequestConnection + ?Sized,
102{
103    let request0 = SetWindowCreateContextRequest {
104        context: Cow::Borrowed(context),
105    };
106    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
107    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
108    assert_eq!(slices.len(), bytes.len());
109    conn.send_request_without_reply(&slices, fds).await
110}
111pub async fn get_window_create_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetWindowCreateContextReply>, ConnectionError>
112where
113    Conn: RequestConnection + ?Sized,
114{
115    let request0 = GetWindowCreateContextRequest;
116    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
117    let slices = [IoSlice::new(&bytes[0])];
118    assert_eq!(slices.len(), bytes.len());
119    conn.send_request_with_reply(&slices, fds).await
120}
121pub async fn get_window_context<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetWindowContextReply>, ConnectionError>
122where
123    Conn: RequestConnection + ?Sized,
124{
125    let request0 = GetWindowContextRequest {
126        window,
127    };
128    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
129    let slices = [IoSlice::new(&bytes[0])];
130    assert_eq!(slices.len(), bytes.len());
131    conn.send_request_with_reply(&slices, fds).await
132}
133pub async fn set_property_create_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
134where
135    Conn: RequestConnection + ?Sized,
136{
137    let request0 = SetPropertyCreateContextRequest {
138        context: Cow::Borrowed(context),
139    };
140    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
141    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
142    assert_eq!(slices.len(), bytes.len());
143    conn.send_request_without_reply(&slices, fds).await
144}
145pub async fn get_property_create_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetPropertyCreateContextReply>, ConnectionError>
146where
147    Conn: RequestConnection + ?Sized,
148{
149    let request0 = GetPropertyCreateContextRequest;
150    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
151    let slices = [IoSlice::new(&bytes[0])];
152    assert_eq!(slices.len(), bytes.len());
153    conn.send_request_with_reply(&slices, fds).await
154}
155pub async fn set_property_use_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
156where
157    Conn: RequestConnection + ?Sized,
158{
159    let request0 = SetPropertyUseContextRequest {
160        context: Cow::Borrowed(context),
161    };
162    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
163    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
164    assert_eq!(slices.len(), bytes.len());
165    conn.send_request_without_reply(&slices, fds).await
166}
167pub async fn get_property_use_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetPropertyUseContextReply>, ConnectionError>
168where
169    Conn: RequestConnection + ?Sized,
170{
171    let request0 = GetPropertyUseContextRequest;
172    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
173    let slices = [IoSlice::new(&bytes[0])];
174    assert_eq!(slices.len(), bytes.len());
175    conn.send_request_with_reply(&slices, fds).await
176}
177pub async fn get_property_context<Conn>(conn: &Conn, window: xproto::Window, property: xproto::Atom) -> Result<Cookie<'_, Conn, GetPropertyContextReply>, ConnectionError>
178where
179    Conn: RequestConnection + ?Sized,
180{
181    let request0 = GetPropertyContextRequest {
182        window,
183        property,
184    };
185    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
186    let slices = [IoSlice::new(&bytes[0])];
187    assert_eq!(slices.len(), bytes.len());
188    conn.send_request_with_reply(&slices, fds).await
189}
190pub async fn get_property_data_context<Conn>(conn: &Conn, window: xproto::Window, property: xproto::Atom) -> Result<Cookie<'_, Conn, GetPropertyDataContextReply>, ConnectionError>
191where
192    Conn: RequestConnection + ?Sized,
193{
194    let request0 = GetPropertyDataContextRequest {
195        window,
196        property,
197    };
198    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
199    let slices = [IoSlice::new(&bytes[0])];
200    assert_eq!(slices.len(), bytes.len());
201    conn.send_request_with_reply(&slices, fds).await
202}
203pub async fn list_properties<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, ListPropertiesReply>, ConnectionError>
204where
205    Conn: RequestConnection + ?Sized,
206{
207    let request0 = ListPropertiesRequest {
208        window,
209    };
210    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
211    let slices = [IoSlice::new(&bytes[0])];
212    assert_eq!(slices.len(), bytes.len());
213    conn.send_request_with_reply(&slices, fds).await
214}
215pub async fn set_selection_create_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
216where
217    Conn: RequestConnection + ?Sized,
218{
219    let request0 = SetSelectionCreateContextRequest {
220        context: Cow::Borrowed(context),
221    };
222    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
223    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
224    assert_eq!(slices.len(), bytes.len());
225    conn.send_request_without_reply(&slices, fds).await
226}
227pub async fn get_selection_create_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetSelectionCreateContextReply>, ConnectionError>
228where
229    Conn: RequestConnection + ?Sized,
230{
231    let request0 = GetSelectionCreateContextRequest;
232    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
233    let slices = [IoSlice::new(&bytes[0])];
234    assert_eq!(slices.len(), bytes.len());
235    conn.send_request_with_reply(&slices, fds).await
236}
237pub async fn set_selection_use_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
238where
239    Conn: RequestConnection + ?Sized,
240{
241    let request0 = SetSelectionUseContextRequest {
242        context: Cow::Borrowed(context),
243    };
244    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
245    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
246    assert_eq!(slices.len(), bytes.len());
247    conn.send_request_without_reply(&slices, fds).await
248}
249pub async fn get_selection_use_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetSelectionUseContextReply>, ConnectionError>
250where
251    Conn: RequestConnection + ?Sized,
252{
253    let request0 = GetSelectionUseContextRequest;
254    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
255    let slices = [IoSlice::new(&bytes[0])];
256    assert_eq!(slices.len(), bytes.len());
257    conn.send_request_with_reply(&slices, fds).await
258}
259pub async fn get_selection_context<Conn>(conn: &Conn, selection: xproto::Atom) -> Result<Cookie<'_, Conn, GetSelectionContextReply>, ConnectionError>
260where
261    Conn: RequestConnection + ?Sized,
262{
263    let request0 = GetSelectionContextRequest {
264        selection,
265    };
266    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
267    let slices = [IoSlice::new(&bytes[0])];
268    assert_eq!(slices.len(), bytes.len());
269    conn.send_request_with_reply(&slices, fds).await
270}
271pub async fn get_selection_data_context<Conn>(conn: &Conn, selection: xproto::Atom) -> Result<Cookie<'_, Conn, GetSelectionDataContextReply>, ConnectionError>
272where
273    Conn: RequestConnection + ?Sized,
274{
275    let request0 = GetSelectionDataContextRequest {
276        selection,
277    };
278    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
279    let slices = [IoSlice::new(&bytes[0])];
280    assert_eq!(slices.len(), bytes.len());
281    conn.send_request_with_reply(&slices, fds).await
282}
283pub async fn list_selections<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, ListSelectionsReply>, ConnectionError>
284where
285    Conn: RequestConnection + ?Sized,
286{
287    let request0 = ListSelectionsRequest;
288    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
289    let slices = [IoSlice::new(&bytes[0])];
290    assert_eq!(slices.len(), bytes.len());
291    conn.send_request_with_reply(&slices, fds).await
292}
293pub async fn get_client_context<Conn>(conn: &Conn, resource: u32) -> Result<Cookie<'_, Conn, GetClientContextReply>, ConnectionError>
294where
295    Conn: RequestConnection + ?Sized,
296{
297    let request0 = GetClientContextRequest {
298        resource,
299    };
300    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
301    let slices = [IoSlice::new(&bytes[0])];
302    assert_eq!(slices.len(), bytes.len());
303    conn.send_request_with_reply(&slices, fds).await
304}
305/// Extension trait defining the requests of this extension.
306pub trait ConnectionExt: RequestConnection {
307    fn xselinux_query_version(&self, client_major: u8, client_minor: u8) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>> + Send + '_>>
308    {
309        Box::pin(query_version(self, client_major, client_minor))
310    }
311    fn xselinux_set_device_create_context<'c, 'input, 'future>(&'c self, context: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
312    where
313        'c: 'future,
314        'input: 'future,
315    {
316        Box::pin(set_device_create_context(self, context))
317    }
318    fn xselinux_get_device_create_context(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetDeviceCreateContextReply>, ConnectionError>> + Send + '_>>
319    {
320        Box::pin(get_device_create_context(self))
321    }
322    fn xselinux_set_device_context<'c, 'input, 'future>(&'c self, device: u32, context: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
323    where
324        'c: 'future,
325        'input: 'future,
326    {
327        Box::pin(set_device_context(self, device, context))
328    }
329    fn xselinux_get_device_context(&self, device: u32) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetDeviceContextReply>, ConnectionError>> + Send + '_>>
330    {
331        Box::pin(get_device_context(self, device))
332    }
333    fn xselinux_set_window_create_context<'c, 'input, 'future>(&'c self, context: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
334    where
335        'c: 'future,
336        'input: 'future,
337    {
338        Box::pin(set_window_create_context(self, context))
339    }
340    fn xselinux_get_window_create_context(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetWindowCreateContextReply>, ConnectionError>> + Send + '_>>
341    {
342        Box::pin(get_window_create_context(self))
343    }
344    fn xselinux_get_window_context(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetWindowContextReply>, ConnectionError>> + Send + '_>>
345    {
346        Box::pin(get_window_context(self, window))
347    }
348    fn xselinux_set_property_create_context<'c, 'input, 'future>(&'c self, context: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
349    where
350        'c: 'future,
351        'input: 'future,
352    {
353        Box::pin(set_property_create_context(self, context))
354    }
355    fn xselinux_get_property_create_context(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetPropertyCreateContextReply>, ConnectionError>> + Send + '_>>
356    {
357        Box::pin(get_property_create_context(self))
358    }
359    fn xselinux_set_property_use_context<'c, 'input, 'future>(&'c self, context: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
360    where
361        'c: 'future,
362        'input: 'future,
363    {
364        Box::pin(set_property_use_context(self, context))
365    }
366    fn xselinux_get_property_use_context(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetPropertyUseContextReply>, ConnectionError>> + Send + '_>>
367    {
368        Box::pin(get_property_use_context(self))
369    }
370    fn xselinux_get_property_context(&self, window: xproto::Window, property: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetPropertyContextReply>, ConnectionError>> + Send + '_>>
371    {
372        Box::pin(get_property_context(self, window, property))
373    }
374    fn xselinux_get_property_data_context(&self, window: xproto::Window, property: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetPropertyDataContextReply>, ConnectionError>> + Send + '_>>
375    {
376        Box::pin(get_property_data_context(self, window, property))
377    }
378    fn xselinux_list_properties(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, ListPropertiesReply>, ConnectionError>> + Send + '_>>
379    {
380        Box::pin(list_properties(self, window))
381    }
382    fn xselinux_set_selection_create_context<'c, 'input, 'future>(&'c self, context: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
383    where
384        'c: 'future,
385        'input: 'future,
386    {
387        Box::pin(set_selection_create_context(self, context))
388    }
389    fn xselinux_get_selection_create_context(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetSelectionCreateContextReply>, ConnectionError>> + Send + '_>>
390    {
391        Box::pin(get_selection_create_context(self))
392    }
393    fn xselinux_set_selection_use_context<'c, 'input, 'future>(&'c self, context: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
394    where
395        'c: 'future,
396        'input: 'future,
397    {
398        Box::pin(set_selection_use_context(self, context))
399    }
400    fn xselinux_get_selection_use_context(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetSelectionUseContextReply>, ConnectionError>> + Send + '_>>
401    {
402        Box::pin(get_selection_use_context(self))
403    }
404    fn xselinux_get_selection_context(&self, selection: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetSelectionContextReply>, ConnectionError>> + Send + '_>>
405    {
406        Box::pin(get_selection_context(self, selection))
407    }
408    fn xselinux_get_selection_data_context(&self, selection: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetSelectionDataContextReply>, ConnectionError>> + Send + '_>>
409    {
410        Box::pin(get_selection_data_context(self, selection))
411    }
412    fn xselinux_list_selections(&self) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, ListSelectionsReply>, ConnectionError>> + Send + '_>>
413    {
414        Box::pin(list_selections(self))
415    }
416    fn xselinux_get_client_context(&self, resource: u32) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetClientContextReply>, ConnectionError>> + Send + '_>>
417    {
418        Box::pin(get_client_context(self, resource))
419    }
420}
421
422impl<C: RequestConnection + ?Sized> ConnectionExt for C {}