|
| 1 | +use crate::prelude::*; |
| 2 | +use crate::{ |
| 3 | + __s32, |
| 4 | + __u16, |
| 5 | + __u32, |
| 6 | +}; |
| 7 | + |
| 8 | +pub type sctp_assoc_t = __s32; |
| 9 | + |
| 10 | +pub const SCTP_FUTURE_ASSOC: c_int = 0; |
| 11 | +pub const SCTP_CURRENT_ASSOC: c_int = 1; |
| 12 | +pub const SCTP_ALL_ASSOC: c_int = 2; |
| 13 | + |
| 14 | +pub const SCTP_RTOINFO: c_int = 0; |
| 15 | +pub const SCTP_ASSOCINFO: c_int = 1; |
| 16 | +pub const SCTP_INITMSG: c_int = 2; |
| 17 | +pub const SCTP_NODELAY: c_int = 3; |
| 18 | +pub const SCTP_AUTOCLOSE: c_int = 4; |
| 19 | +pub const SCTP_SET_PEER_PRIMARY_ADDR: c_int = 5; |
| 20 | +pub const SCTP_PRIMARY_ADDR: c_int = 6; |
| 21 | +pub const SCTP_ADAPTATION_LAYER: c_int = 7; |
| 22 | +pub const SCTP_DISABLE_FRAGMENTS: c_int = 8; |
| 23 | +pub const SCTP_PEER_ADDR_PARAMS: c_int = 9; |
| 24 | +pub const SCTP_DEFAULT_SEND_PARAM: c_int = 10; |
| 25 | +pub const SCTP_EVENTS: c_int = 11; |
| 26 | +pub const SCTP_I_WANT_MAPPED_V4_ADDR: c_int = 12; |
| 27 | +pub const SCTP_MAXSEG: c_int = 13; |
| 28 | +pub const SCTP_STATUS: c_int = 14; |
| 29 | +pub const SCTP_GET_PEER_ADDR_INFO: c_int = 15; |
| 30 | +pub const SCTP_DELAYED_ACK_TIME: c_int = 16; |
| 31 | +pub const SCTP_DELAYED_ACK: c_int = SCTP_DELAYED_ACK_TIME; |
| 32 | +pub const SCTP_DELAYED_SACK: c_int = SCTP_DELAYED_ACK_TIME; |
| 33 | +pub const SCTP_CONTEXT: c_int = 17; |
| 34 | +pub const SCTP_FRAGMENT_INTERLEAVE: c_int = 18; |
| 35 | +pub const SCTP_PARTIAL_DELIVERY_POINT: c_int = 19; |
| 36 | +pub const SCTP_MAX_BURST: c_int = 20; |
| 37 | +pub const SCTP_AUTH_CHUNK: c_int = 21; |
| 38 | +pub const SCTP_HMAC_IDENT: c_int = 22; |
| 39 | +pub const SCTP_AUTH_KEY: c_int = 23; |
| 40 | +pub const SCTP_AUTH_ACTIVE_KEY: c_int = 24; |
| 41 | +pub const SCTP_AUTH_DELETE_KEY: c_int = 25; |
| 42 | +pub const SCTP_PEER_AUTH_CHUNKS: c_int = 26; |
| 43 | +pub const SCTP_LOCAL_AUTH_CHUNKS: c_int = 27; |
| 44 | +pub const SCTP_GET_ASSOC_NUMBER: c_int = 28; |
| 45 | +pub const SCTP_GET_ASSOC_ID_LIST: c_int = 29; |
| 46 | +pub const SCTP_AUTO_ASCONF: c_int = 30; |
| 47 | +pub const SCTP_PEER_ADDR_THLDS: c_int = 31; |
| 48 | +pub const SCTP_RECVRCVINFO: c_int = 32; |
| 49 | +pub const SCTP_RECVNXTINFO: c_int = 33; |
| 50 | +pub const SCTP_DEFAULT_SNDINFO: c_int = 34; |
| 51 | +pub const SCTP_AUTH_DEACTIVATE_KEY: c_int = 35; |
| 52 | +pub const SCTP_REUSE_PORT: c_int = 36; |
| 53 | +pub const SCTP_PEER_ADDR_THLDS_V2: c_int = 37; |
| 54 | + |
| 55 | +pub const SCTP_PR_SCTP_NONE: c_int = 0x0000; |
| 56 | +pub const SCTP_PR_SCTP_TTL: c_int = 0x0010; |
| 57 | +pub const SCTP_PR_SCTP_RTX: c_int = 0x0020; |
| 58 | +pub const SCTP_PR_SCTP_PRIO: c_int = 0x0030; |
| 59 | +/// This symbol is prone to change across releases upstream. |
| 60 | +/// See the [usage guidelines](crate#usage-guidelines) for details. |
| 61 | +pub const SCTP_PR_SCTP_MAX: c_int = SCTP_PR_SCTP_PRIO; |
| 62 | +pub const SCTP_PR_SCTP_MASK: c_int = 0x0030; |
| 63 | + |
| 64 | +f! { |
| 65 | + pub fn SCTP_PR_INDEX(policy: c_int) -> c_int { |
| 66 | + policy >> (4 - 1) |
| 67 | + } |
| 68 | + |
| 69 | + pub fn SCTP_PR_POLICY(policy: c_int) -> c_int { |
| 70 | + policy & SCTP_PR_SCTP_MASK |
| 71 | + } |
| 72 | + |
| 73 | + pub 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 | +safe_f! { |
| 80 | + pub const fn SCTP_PR_TTL_ENABLED(policy: c_int) -> bool { |
| 81 | + policy == SCTP_PR_SCTP_TTL |
| 82 | + } |
| 83 | + |
| 84 | + pub const fn SCTP_PR_RTX_ENABLED(policy: c_int) -> bool { |
| 85 | + policy == SCTP_PR_SCTP_RTX |
| 86 | + } |
| 87 | + |
| 88 | + pub const fn SCTP_PR_PRIO_ENABLED(policy: c_int) -> bool { |
| 89 | + policy == SCTP_PR_SCTP_PRIO |
| 90 | + } |
| 91 | +} |
| 92 | + |
| 93 | +pub const SCTP_ENABLE_RESET_STREAM_REQ: c_int = 0x01; |
| 94 | +pub const SCTP_ENABLE_RESET_ASSOC_REQ: c_int = 0x02; |
| 95 | +pub const SCTP_ENABLE_CHANGE_ASSOC_REQ: c_int = 0x04; |
| 96 | +pub const SCTP_ENABLE_STRRESET_MASK: c_int = 0x07; |
| 97 | + |
| 98 | +pub const SCTP_STREAM_RESET_INCOMING: c_int = 0x01; |
| 99 | +pub const SCTP_STREAM_RESET_OUTGOING: c_int = 0x02; |
| 100 | + |
| 101 | +pub const MSG_NOTIFICATION: c_int = 0x8000; |
| 102 | + |
| 103 | +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 | + |
| 160 | +pub const SCTP_UNORDERED: c_int = 1 << 0; |
| 161 | +pub const SCTP_ADDR_OVER: c_int = 1 << 1; |
| 162 | +pub const SCTP_ABORT: c_int = 1 << 2; |
| 163 | +pub const SCTP_SACK_IMMEDIATELY: c_int = 1 << 3; |
| 164 | +pub const SCTP_SENDALL: c_int = 1 << 6; |
| 165 | +pub const SCTP_PR_SCTP_ALL: c_int = 1 << 7; |
| 166 | +pub const SCTP_NOTIFICATION: c_int = MSG_NOTIFICATION; |
| 167 | +pub const SCTP_EOF: c_int = crate::MSG_FIN; |
| 168 | + |
| 169 | +pub const SCTP_INIT: c_int = 0; |
| 170 | +pub const SCTP_SNDRCV: c_int = 1; |
| 171 | +pub const SCTP_SNDINFO: c_int = 2; |
| 172 | +pub const SCTP_RCVINFO: c_int = 3; |
| 173 | +pub const SCTP_NXTINFO: c_int = 4; |
| 174 | +pub const SCTP_PRINFO: c_int = 5; |
| 175 | +pub const SCTP_AUTHINFO: c_int = 6; |
| 176 | +pub const SCTP_DSTADDRV4: c_int = 7; |
| 177 | +pub const SCTP_DSTADDRV6: c_int = 8; |
0 commit comments