Skip to main content

libc/new/linux_uapi/linux/
sctp.rs

1use crate::prelude::*;
2use crate::{
3    __s32,
4    __u16,
5    __u32,
6};
7
8pub type sctp_assoc_t = __s32;
9
10pub const SCTP_FUTURE_ASSOC: c_int = 0;
11pub const SCTP_CURRENT_ASSOC: c_int = 1;
12pub const SCTP_ALL_ASSOC: c_int = 2;
13
14pub const SCTP_RTOINFO: c_int = 0;
15pub const SCTP_ASSOCINFO: c_int = 1;
16pub const SCTP_INITMSG: c_int = 2;
17pub const SCTP_NODELAY: c_int = 3;
18pub const SCTP_AUTOCLOSE: c_int = 4;
19pub const SCTP_SET_PEER_PRIMARY_ADDR: c_int = 5;
20pub const SCTP_PRIMARY_ADDR: c_int = 6;
21pub const SCTP_ADAPTATION_LAYER: c_int = 7;
22pub const SCTP_DISABLE_FRAGMENTS: c_int = 8;
23pub const SCTP_PEER_ADDR_PARAMS: c_int = 9;
24pub const SCTP_DEFAULT_SEND_PARAM: c_int = 10;
25pub const SCTP_EVENTS: c_int = 11;
26pub const SCTP_I_WANT_MAPPED_V4_ADDR: c_int = 12;
27pub const SCTP_MAXSEG: c_int = 13;
28pub const SCTP_STATUS: c_int = 14;
29pub const SCTP_GET_PEER_ADDR_INFO: c_int = 15;
30pub const SCTP_DELAYED_ACK_TIME: c_int = 16;
31pub const SCTP_DELAYED_ACK: c_int = SCTP_DELAYED_ACK_TIME;
32pub const SCTP_DELAYED_SACK: c_int = SCTP_DELAYED_ACK_TIME;
33pub const SCTP_CONTEXT: c_int = 17;
34pub const SCTP_FRAGMENT_INTERLEAVE: c_int = 18;
35pub const SCTP_PARTIAL_DELIVERY_POINT: c_int = 19;
36pub const SCTP_MAX_BURST: c_int = 20;
37pub const SCTP_AUTH_CHUNK: c_int = 21;
38pub const SCTP_HMAC_IDENT: c_int = 22;
39pub const SCTP_AUTH_KEY: c_int = 23;
40pub const SCTP_AUTH_ACTIVE_KEY: c_int = 24;
41pub const SCTP_AUTH_DELETE_KEY: c_int = 25;
42pub const SCTP_PEER_AUTH_CHUNKS: c_int = 26;
43pub const SCTP_LOCAL_AUTH_CHUNKS: c_int = 27;
44pub const SCTP_GET_ASSOC_NUMBER: c_int = 28;
45pub const SCTP_GET_ASSOC_ID_LIST: c_int = 29;
46pub const SCTP_AUTO_ASCONF: c_int = 30;
47pub const SCTP_PEER_ADDR_THLDS: c_int = 31;
48pub const SCTP_RECVRCVINFO: c_int = 32;
49pub const SCTP_RECVNXTINFO: c_int = 33;
50pub const SCTP_DEFAULT_SNDINFO: c_int = 34;
51pub const SCTP_AUTH_DEACTIVATE_KEY: c_int = 35;
52pub const SCTP_REUSE_PORT: c_int = 36;
53pub const SCTP_PEER_ADDR_THLDS_V2: c_int = 37;
54
55pub const SCTP_PR_SCTP_NONE: c_int = 0x0000;
56pub const SCTP_PR_SCTP_TTL: c_int = 0x0010;
57pub const SCTP_PR_SCTP_RTX: c_int = 0x0020;
58pub const SCTP_PR_SCTP_PRIO: c_int = 0x0030;
59/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
60/// for details.
61pub const SCTP_PR_SCTP_MAX: c_int = SCTP_PR_SCTP_PRIO;
62pub const SCTP_PR_SCTP_MASK: c_int = 0x0030;
63
64#[inline]
pub unsafe extern "C" fn SCTP_PR_SET_POLICY(flags: &mut c_int, policy: c_int)
    -> () {
    *flags &= !SCTP_PR_SCTP_MASK;
    *flags |= policy;
}f! {
65    pub unsafe fn SCTP_PR_INDEX(policy: c_int) -> c_int {
66        policy >> (4 - 1)
67    }
68
69    pub unsafe fn SCTP_PR_POLICY(policy: c_int) -> c_int {
70        policy & SCTP_PR_SCTP_MASK
71    }
72
73    pub unsafe fn SCTP_PR_SET_POLICY(flags: &mut c_int, policy: c_int) -> () {
74        *flags &= !SCTP_PR_SCTP_MASK;
75        *flags |= policy;
76    }
77}
78
79#[inline]
pub const extern "C" fn SCTP_PR_PRIO_ENABLED(policy: c_int) -> bool {
    policy == SCTP_PR_SCTP_PRIO
}safe_f! {
80    pub const safe fn SCTP_PR_TTL_ENABLED(policy: c_int) -> bool {
81        policy == SCTP_PR_SCTP_TTL
82    }
83
84    pub const safe fn SCTP_PR_RTX_ENABLED(policy: c_int) -> bool {
85        policy == SCTP_PR_SCTP_RTX
86    }
87
88    pub const safe fn SCTP_PR_PRIO_ENABLED(policy: c_int) -> bool {
89        policy == SCTP_PR_SCTP_PRIO
90    }
91}
92
93pub const SCTP_ENABLE_RESET_STREAM_REQ: c_int = 0x01;
94pub const SCTP_ENABLE_RESET_ASSOC_REQ: c_int = 0x02;
95pub const SCTP_ENABLE_CHANGE_ASSOC_REQ: c_int = 0x04;
96pub const SCTP_ENABLE_STRRESET_MASK: c_int = 0x07;
97
98pub const SCTP_STREAM_RESET_INCOMING: c_int = 0x01;
99pub const SCTP_STREAM_RESET_OUTGOING: c_int = 0x02;
100
101pub const MSG_NOTIFICATION: c_int = 0x8000;
102
103#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sctp_authinfo {
    #[inline]
    fn clone(&self) -> sctp_authinfo {
        let _: ::core::clone::AssertParamIsClone<__u16>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sctp_authinfo { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sctp_authinfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "sctp_authinfo",
            "auth_keynumber", &&self.auth_keynumber)
    }
}s! {
104    pub struct sctp_initmsg {
105        pub sinit_num_ostreams: __u16,
106        pub sinit_max_instreams: __u16,
107        pub sinit_max_attempts: __u16,
108        pub sinit_max_init_timeo: __u16,
109    }
110
111    pub struct sctp_sndrcvinfo {
112        pub sinfo_stream: __u16,
113        pub sinfo_ssn: __u16,
114        pub sinfo_flags: __u16,
115        pub sinfo_ppid: __u32,
116        pub sinfo_context: __u32,
117        pub sinfo_timetolive: __u32,
118        pub sinfo_tsn: __u32,
119        pub sinfo_cumtsn: __u32,
120        pub sinfo_assoc_id: crate::sctp_assoc_t,
121    }
122
123    pub struct sctp_sndinfo {
124        pub snd_sid: __u16,
125        pub snd_flags: __u16,
126        pub snd_ppid: __u32,
127        pub snd_context: __u32,
128        pub snd_assoc_id: crate::sctp_assoc_t,
129    }
130
131    pub struct sctp_rcvinfo {
132        pub rcv_sid: __u16,
133        pub rcv_ssn: __u16,
134        pub rcv_flags: __u16,
135        pub rcv_ppid: __u32,
136        pub rcv_tsn: __u32,
137        pub rcv_cumtsn: __u32,
138        pub rcv_context: __u32,
139        pub rcv_assoc_id: crate::sctp_assoc_t,
140    }
141
142    pub struct sctp_nxtinfo {
143        pub nxt_sid: __u16,
144        pub nxt_flags: __u16,
145        pub nxt_ppid: __u32,
146        pub nxt_length: __u32,
147        pub nxt_assoc_id: crate::sctp_assoc_t,
148    }
149
150    pub struct sctp_prinfo {
151        pub pr_policy: __u16,
152        pub pr_value: __u32,
153    }
154
155    pub struct sctp_authinfo {
156        pub auth_keynumber: __u16,
157    }
158}
159
160pub const SCTP_UNORDERED: c_int = 1 << 0;
161pub const SCTP_ADDR_OVER: c_int = 1 << 1;
162pub const SCTP_ABORT: c_int = 1 << 2;
163pub const SCTP_SACK_IMMEDIATELY: c_int = 1 << 3;
164pub const SCTP_SENDALL: c_int = 1 << 6;
165pub const SCTP_PR_SCTP_ALL: c_int = 1 << 7;
166pub const SCTP_NOTIFICATION: c_int = MSG_NOTIFICATION;
167pub const SCTP_EOF: c_int = crate::MSG_FIN;
168
169pub const SCTP_INIT: c_int = 0;
170pub const SCTP_SNDRCV: c_int = 1;
171pub const SCTP_SNDINFO: c_int = 2;
172pub const SCTP_RCVINFO: c_int = 3;
173pub const SCTP_NXTINFO: c_int = 4;
174pub const SCTP_PRINFO: c_int = 5;
175pub const SCTP_AUTHINFO: c_int = 6;
176pub const SCTP_DSTADDRV4: c_int = 7;
177pub const SCTP_DSTADDRV6: c_int = 8;