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         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_EOT`
20         const EOT = 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 
33 bitflags! {
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