summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/backend/libc/net/send_recv.rs
blob: 26543a1fdbfd7e35947455959712a7d8b5a61730 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use crate::backend::c;
use bitflags::bitflags;

bitflags! {
    /// `MSG_* flags for use with [`send`], [`send_to`], and related functions.
    ///
    /// [`send`]: crate::net::send
    /// [`sendto`]: crate::net::sendto
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
    pub struct SendFlags: u32 {
        /// `MSG_CONFIRM`
        #[cfg(not(any(
            bsd,
            solarish,
            windows,
            target_os = "espidf",
            target_os = "nto",
            target_os = "haiku",
        )))]
        const CONFIRM = bitcast!(c::MSG_CONFIRM);
        /// `MSG_DONTROUTE`
        const DONTROUTE = bitcast!(c::MSG_DONTROUTE);
        /// `MSG_DONTWAIT`
        #[cfg(not(windows))]
        const DONTWAIT = bitcast!(c::MSG_DONTWAIT);
        /// `MSG_EOR`
        #[cfg(not(windows))]
        const EOT = bitcast!(c::MSG_EOR);
        /// `MSG_MORE`
        #[cfg(not(any(
            bsd,
            solarish,
            windows,
            target_os = "haiku",
            target_os = "nto",
        )))]
        const MORE = bitcast!(c::MSG_MORE);
        #[cfg(not(any(apple, windows)))]
        /// `MSG_NOSIGNAL`
        const NOSIGNAL = bitcast!(c::MSG_NOSIGNAL);
        /// `MSG_OOB`
        const OOB = bitcast!(c::MSG_OOB);
    }
}

bitflags! {
    /// `MSG_* flags for use with [`recv`], [`recvfrom`], and related functions.
    ///
    /// [`recv`]: crate::net::recv
    /// [`recvfrom`]: crate::net::recvfrom
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
    pub struct RecvFlags: u32 {
        #[cfg(not(any(apple, solarish, windows, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
        /// `MSG_CMSG_CLOEXEC`
        const CMSG_CLOEXEC = bitcast!(c::MSG_CMSG_CLOEXEC);
        /// `MSG_DONTWAIT`
        #[cfg(not(windows))]
        const DONTWAIT = bitcast!(c::MSG_DONTWAIT);
        /// `MSG_ERRQUEUE`
        #[cfg(not(any(
            bsd,
            solarish,
            windows,
            target_os = "espidf",
            target_os = "haiku",
            target_os = "nto",
        )))]
        const ERRQUEUE = bitcast!(c::MSG_ERRQUEUE);
        /// `MSG_OOB`
        const OOB = bitcast!(c::MSG_OOB);
        /// `MSG_PEEK`
        const PEEK = bitcast!(c::MSG_PEEK);
        /// `MSG_TRUNC`
        const TRUNC = bitcast!(c::MSG_TRUNC);
        /// `MSG_WAITALL`
        const WAITALL = bitcast!(c::MSG_WAITALL);
    }
}