1 use crate::backend::c;
2 use bitflags::bitflags;
3 
4 bitflags! {
5     /// `MSG_*` flags for use with [`send`], [`send_to`], 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         #[cfg(not(any(
15             bsd,
16             solarish,
17             windows,
18             target_os = "aix",
19             target_os = "espidf",
20             target_os = "nto",
21             target_os = "haiku",
22             target_os = "vita",
23         )))]
24         const CONFIRM = bitcast!(c::MSG_CONFIRM);
25         /// `MSG_DONTROUTE`
26         const DONTROUTE = bitcast!(c::MSG_DONTROUTE);
27         /// `MSG_DONTWAIT`
28         #[cfg(not(windows))]
29         const DONTWAIT = bitcast!(c::MSG_DONTWAIT);
30         /// `MSG_EOR`
31         #[cfg(not(windows))]
32         const EOT = bitcast!(c::MSG_EOR);
33         /// `MSG_MORE`
34         #[cfg(not(any(
35             bsd,
36             solarish,
37             windows,
38             target_os = "aix",
39             target_os = "haiku",
40             target_os = "nto",
41             target_os = "vita",
42         )))]
43         const MORE = bitcast!(c::MSG_MORE);
44         #[cfg(not(any(apple, windows, target_os = "vita")))]
45         /// `MSG_NOSIGNAL`
46         const NOSIGNAL = bitcast!(c::MSG_NOSIGNAL);
47         /// `MSG_OOB`
48         const OOB = bitcast!(c::MSG_OOB);
49 
50         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
51         const _ = !0;
52     }
53 }
54 
55 bitflags! {
56     /// `MSG_*` flags for use with [`recv`], [`recvfrom`], and related
57     /// functions.
58     ///
59     /// [`recv`]: crate::net::recv
60     /// [`recvfrom`]: crate::net::recvfrom
61     #[repr(transparent)]
62     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
63     pub struct RecvFlags: u32 {
64         #[cfg(not(any(
65             apple,
66             solarish,
67             windows,
68             target_os = "aix",
69             target_os = "espidf",
70             target_os = "haiku",
71             target_os = "nto",
72             target_os = "vita",
73         )))]
74         /// `MSG_CMSG_CLOEXEC`
75         const CMSG_CLOEXEC = bitcast!(c::MSG_CMSG_CLOEXEC);
76         /// `MSG_DONTWAIT`
77         #[cfg(not(windows))]
78         const DONTWAIT = bitcast!(c::MSG_DONTWAIT);
79         /// `MSG_ERRQUEUE`
80         #[cfg(not(any(
81             bsd,
82             solarish,
83             windows,
84             target_os = "aix",
85             target_os = "espidf",
86             target_os = "haiku",
87             target_os = "nto",
88             target_os = "vita",
89         )))]
90         const ERRQUEUE = bitcast!(c::MSG_ERRQUEUE);
91         /// `MSG_OOB`
92         const OOB = bitcast!(c::MSG_OOB);
93         /// `MSG_PEEK`
94         const PEEK = bitcast!(c::MSG_PEEK);
95         /// `MSG_TRUNC`
96         const TRUNC = bitcast!(c::MSG_TRUNC);
97         /// `MSG_WAITALL`
98         const WAITALL = bitcast!(c::MSG_WAITALL);
99 
100         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
101         const _ = !0;
102     }
103 }
104