rustix/backend/linux_raw/net/
send_recv.rs

1use crate::backend::c;
2use bitflags::bitflags;
3
4bitflags! {
5    /// `MSG_*` flags for use with [`send`], [`sendto`], and related
6    /// functions.
7    ///
8    /// [`send`]: crate::net::send
9    /// [`sendto`]: crate::net::sendto
10    #[repr(transparent)]
11    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
12    pub struct SendFlags: u32 {
13        /// `MSG_CONFIRM`
14        const CONFIRM = c::MSG_CONFIRM;
15        /// `MSG_DONTROUTE`
16        const DONTROUTE = c::MSG_DONTROUTE;
17        /// `MSG_DONTWAIT`
18        const DONTWAIT = c::MSG_DONTWAIT;
19        /// `MSG_EOR`
20        const EOR = c::MSG_EOR;
21        /// `MSG_MORE`
22        const MORE = c::MSG_MORE;
23        /// `MSG_NOSIGNAL`
24        const NOSIGNAL = c::MSG_NOSIGNAL;
25        /// `MSG_OOB`
26        const OOB = c::MSG_OOB;
27
28        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
29        const _ = !0;
30    }
31}
32
33bitflags! {
34    /// `MSG_*` flags for use with [`recv`], [`recvfrom`], and related
35    /// functions.
36    ///
37    /// [`recv`]: crate::net::recv
38    /// [`recvfrom`]: crate::net::recvfrom
39    #[repr(transparent)]
40    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
41    pub struct RecvFlags: u32 {
42        /// `MSG_CMSG_CLOEXEC`
43        const CMSG_CLOEXEC = c::MSG_CMSG_CLOEXEC;
44        /// `MSG_DONTWAIT`
45        const DONTWAIT = c::MSG_DONTWAIT;
46        /// `MSG_ERRQUEUE`
47        const ERRQUEUE = c::MSG_ERRQUEUE;
48        /// `MSG_OOB`
49        const OOB = c::MSG_OOB;
50        /// `MSG_PEEK`
51        const PEEK = c::MSG_PEEK;
52        /// `MSG_TRUNC`
53        const TRUNC = c::MSG_TRUNC;
54        /// `MSG_WAITALL`
55        const WAITALL = c::MSG_WAITALL;
56
57        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
58        const _ = !0;
59    }
60}
61
62bitflags! {
63    /// `MSG_*` flags returned from [`recvmsg`], in the `flags` field of
64    /// [`RecvMsg`]
65    ///
66    /// [`recvmsg`]: crate::net::recvmsg
67    /// [`RecvMsg`]: crate::net::RecvMsg
68    #[repr(transparent)]
69    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
70    pub struct ReturnFlags: u32 {
71        /// `MSG_OOB`
72        const OOB = c::MSG_OOB;
73        /// `MSG_EOR`
74        const EOR = c::MSG_EOR;
75        /// `MSG_TRUNC`
76        const TRUNC = c::MSG_TRUNC;
77        /// `MSG_CTRUNC`
78        const CTRUNC = c::MSG_CTRUNC;
79        /// `MSG_ERRQUEUE`
80        const ERRQUEUE = c::MSG_ERRQUEUE;
81        /// `MSG_CMSG_CLOEXEC`
82        const CMSG_CLOEXEC = c::MSG_CMSG_CLOEXEC;
83
84        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
85        const _ = !0;
86    }
87}