sctp.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /* SCTP kernel implementation
  3. * (C) Copyright IBM Corp. 2001, 2004
  4. * Copyright (c) 1999-2000 Cisco, Inc.
  5. * Copyright (c) 1999-2001 Motorola, Inc.
  6. * Copyright (c) 2002 Intel Corp.
  7. *
  8. * This file is part of the SCTP kernel implementation
  9. *
  10. * This header represents the structures and constants needed to support
  11. * the SCTP Extension to the Sockets API.
  12. *
  13. * This SCTP implementation is free software;
  14. * you can redistribute it and/or modify it under the terms of
  15. * the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2, or (at your option)
  17. * any later version.
  18. *
  19. * This SCTP implementation is distributed in the hope that it
  20. * will be useful, but WITHOUT ANY WARRANTY; without even the implied
  21. * ************************
  22. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  23. * See the GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with GNU CC; see the file COPYING. If not, see
  27. * <http://www.gnu.org/licenses/>.
  28. *
  29. * Please send any bug reports or fixes you make to the
  30. * email address(es):
  31. * lksctp developers <linux-sctp@vger.kernel.org>
  32. *
  33. * Or submit a bug report through the following website:
  34. * http://www.sf.net/projects/lksctp
  35. *
  36. * Written or modified by:
  37. * La Monte H.P. Yarroll <piggy@acm.org>
  38. * R. Stewart <randall@sctp.chicago.il.us>
  39. * K. Morneau <kmorneau@cisco.com>
  40. * Q. Xie <qxie1@email.mot.com>
  41. * Karl Knutson <karl@athena.chicago.il.us>
  42. * Jon Grimm <jgrimm@us.ibm.com>
  43. * Daisy Chang <daisyc@us.ibm.com>
  44. * Ryan Layer <rmlayer@us.ibm.com>
  45. * Ardelle Fan <ardelle.fan@intel.com>
  46. * Sridhar Samudrala <sri@us.ibm.com>
  47. * Inaky Perez-Gonzalez <inaky.gonzalez@intel.com>
  48. * Vlad Yasevich <vladislav.yasevich@hp.com>
  49. *
  50. * Any bugs reported given to us we will try to fix... any fixes shared will
  51. * be incorporated into the next SCTP release.
  52. */
  53. #ifndef _UAPI_SCTP_H
  54. #define _UAPI_SCTP_H
  55. #include <linux/types.h>
  56. #include <linux/socket.h>
  57. typedef __s32 sctp_assoc_t;
  58. /* The following symbols come from the Sockets API Extensions for
  59. * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
  60. */
  61. #define SCTP_RTOINFO 0
  62. #define SCTP_ASSOCINFO 1
  63. #define SCTP_INITMSG 2
  64. #define SCTP_NODELAY 3 /* Get/set nodelay option. */
  65. #define SCTP_AUTOCLOSE 4
  66. #define SCTP_SET_PEER_PRIMARY_ADDR 5
  67. #define SCTP_PRIMARY_ADDR 6
  68. #define SCTP_ADAPTATION_LAYER 7
  69. #define SCTP_DISABLE_FRAGMENTS 8
  70. #define SCTP_PEER_ADDR_PARAMS 9
  71. #define SCTP_DEFAULT_SEND_PARAM 10
  72. #define SCTP_EVENTS 11
  73. #define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */
  74. #define SCTP_MAXSEG 13 /* Get/set maximum fragment. */
  75. #define SCTP_STATUS 14
  76. #define SCTP_GET_PEER_ADDR_INFO 15
  77. #define SCTP_DELAYED_ACK_TIME 16
  78. #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
  79. #define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
  80. #define SCTP_CONTEXT 17
  81. #define SCTP_FRAGMENT_INTERLEAVE 18
  82. #define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */
  83. #define SCTP_MAX_BURST 20 /* Set/Get max burst */
  84. #define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */
  85. #define SCTP_HMAC_IDENT 22
  86. #define SCTP_AUTH_KEY 23
  87. #define SCTP_AUTH_ACTIVE_KEY 24
  88. #define SCTP_AUTH_DELETE_KEY 25
  89. #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */
  90. #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */
  91. #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */
  92. #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */
  93. #define SCTP_AUTO_ASCONF 30
  94. #define SCTP_PEER_ADDR_THLDS 31
  95. #define SCTP_RECVRCVINFO 32
  96. #define SCTP_RECVNXTINFO 33
  97. #define SCTP_DEFAULT_SNDINFO 34
  98. #define SCTP_AUTH_DEACTIVATE_KEY 35
  99. #define SCTP_REUSE_PORT 36
  100. /* Internal Socket Options. Some of the sctp library functions are
  101. * implemented using these socket options.
  102. */
  103. #define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */
  104. #define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */
  105. #define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */
  106. /* Options 104-106 are deprecated and removed. Do not use this space */
  107. #define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */
  108. #define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */
  109. #define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */
  110. #define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
  111. #define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
  112. #define SCTP_GET_ASSOC_STATS 112 /* Read only */
  113. #define SCTP_PR_SUPPORTED 113
  114. #define SCTP_DEFAULT_PRINFO 114
  115. #define SCTP_PR_ASSOC_STATUS 115
  116. #define SCTP_PR_STREAM_STATUS 116
  117. #define SCTP_RECONFIG_SUPPORTED 117
  118. #define SCTP_ENABLE_STREAM_RESET 118
  119. #define SCTP_RESET_STREAMS 119
  120. #define SCTP_RESET_ASSOC 120
  121. #define SCTP_ADD_STREAMS 121
  122. #define SCTP_SOCKOPT_PEELOFF_FLAGS 122
  123. #define SCTP_STREAM_SCHEDULER 123
  124. #define SCTP_STREAM_SCHEDULER_VALUE 124
  125. #define SCTP_INTERLEAVING_SUPPORTED 125
  126. #define SCTP_SENDMSG_CONNECT 126
  127. /* PR-SCTP policies */
  128. #define SCTP_PR_SCTP_NONE 0x0000
  129. #define SCTP_PR_SCTP_TTL 0x0010
  130. #define SCTP_PR_SCTP_RTX 0x0020
  131. #define SCTP_PR_SCTP_PRIO 0x0030
  132. #define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_PRIO
  133. #define SCTP_PR_SCTP_MASK 0x0030
  134. #define __SCTP_PR_INDEX(x) ((x >> 4) - 1)
  135. #define SCTP_PR_INDEX(x) __SCTP_PR_INDEX(SCTP_PR_SCTP_ ## x)
  136. #define SCTP_PR_POLICY(x) ((x) & SCTP_PR_SCTP_MASK)
  137. #define SCTP_PR_SET_POLICY(flags, x) \
  138. do { \
  139. flags &= ~SCTP_PR_SCTP_MASK; \
  140. flags |= x; \
  141. } while (0)
  142. #define SCTP_PR_TTL_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL)
  143. #define SCTP_PR_RTX_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX)
  144. #define SCTP_PR_PRIO_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO)
  145. /* For enable stream reset */
  146. #define SCTP_ENABLE_RESET_STREAM_REQ 0x01
  147. #define SCTP_ENABLE_RESET_ASSOC_REQ 0x02
  148. #define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x04
  149. #define SCTP_ENABLE_STRRESET_MASK 0x07
  150. #define SCTP_STREAM_RESET_INCOMING 0x01
  151. #define SCTP_STREAM_RESET_OUTGOING 0x02
  152. /* These are bit fields for msghdr->msg_flags. See section 5.1. */
  153. /* On user space Linux, these live in <bits/socket.h> as an enum. */
  154. enum sctp_msg_flags {
  155. MSG_NOTIFICATION = 0x8000,
  156. #define MSG_NOTIFICATION MSG_NOTIFICATION
  157. };
  158. /* 5.3.1 SCTP Initiation Structure (SCTP_INIT)
  159. *
  160. * This cmsghdr structure provides information for initializing new
  161. * SCTP associations with sendmsg(). The SCTP_INITMSG socket option
  162. * uses this same data structure. This structure is not used for
  163. * recvmsg().
  164. *
  165. * cmsg_level cmsg_type cmsg_data[]
  166. * ------------ ------------ ----------------------
  167. * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg
  168. */
  169. struct sctp_initmsg {
  170. __u16 sinit_num_ostreams;
  171. __u16 sinit_max_instreams;
  172. __u16 sinit_max_attempts;
  173. __u16 sinit_max_init_timeo;
  174. };
  175. /* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV)
  176. *
  177. * This cmsghdr structure specifies SCTP options for sendmsg() and
  178. * describes SCTP header information about a received message through
  179. * recvmsg().
  180. *
  181. * cmsg_level cmsg_type cmsg_data[]
  182. * ------------ ------------ ----------------------
  183. * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo
  184. */
  185. struct sctp_sndrcvinfo {
  186. __u16 sinfo_stream;
  187. __u16 sinfo_ssn;
  188. __u16 sinfo_flags;
  189. __u32 sinfo_ppid;
  190. __u32 sinfo_context;
  191. __u32 sinfo_timetolive;
  192. __u32 sinfo_tsn;
  193. __u32 sinfo_cumtsn;
  194. sctp_assoc_t sinfo_assoc_id;
  195. };
  196. /* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO)
  197. *
  198. * This cmsghdr structure specifies SCTP options for sendmsg().
  199. *
  200. * cmsg_level cmsg_type cmsg_data[]
  201. * ------------ ------------ -------------------
  202. * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo
  203. */
  204. struct sctp_sndinfo {
  205. __u16 snd_sid;
  206. __u16 snd_flags;
  207. __u32 snd_ppid;
  208. __u32 snd_context;
  209. sctp_assoc_t snd_assoc_id;
  210. };
  211. /* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO)
  212. *
  213. * This cmsghdr structure describes SCTP receive information
  214. * about a received message through recvmsg().
  215. *
  216. * cmsg_level cmsg_type cmsg_data[]
  217. * ------------ ------------ -------------------
  218. * IPPROTO_SCTP SCTP_RCVINFO struct sctp_rcvinfo
  219. */
  220. struct sctp_rcvinfo {
  221. __u16 rcv_sid;
  222. __u16 rcv_ssn;
  223. __u16 rcv_flags;
  224. __u32 rcv_ppid;
  225. __u32 rcv_tsn;
  226. __u32 rcv_cumtsn;
  227. __u32 rcv_context;
  228. sctp_assoc_t rcv_assoc_id;
  229. };
  230. /* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO)
  231. *
  232. * This cmsghdr structure describes SCTP receive information
  233. * of the next message that will be delivered through recvmsg()
  234. * if this information is already available when delivering
  235. * the current message.
  236. *
  237. * cmsg_level cmsg_type cmsg_data[]
  238. * ------------ ------------ -------------------
  239. * IPPROTO_SCTP SCTP_NXTINFO struct sctp_nxtinfo
  240. */
  241. struct sctp_nxtinfo {
  242. __u16 nxt_sid;
  243. __u16 nxt_flags;
  244. __u32 nxt_ppid;
  245. __u32 nxt_length;
  246. sctp_assoc_t nxt_assoc_id;
  247. };
  248. /* 5.3.7 SCTP PR-SCTP Information Structure (SCTP_PRINFO)
  249. *
  250. * This cmsghdr structure specifies SCTP options for sendmsg().
  251. *
  252. * cmsg_level cmsg_type cmsg_data[]
  253. * ------------ ------------ -------------------
  254. * IPPROTO_SCTP SCTP_PRINFO struct sctp_prinfo
  255. */
  256. struct sctp_prinfo {
  257. __u16 pr_policy;
  258. __u32 pr_value;
  259. };
  260. /* 5.3.8 SCTP AUTH Information Structure (SCTP_AUTHINFO)
  261. *
  262. * This cmsghdr structure specifies SCTP options for sendmsg().
  263. *
  264. * cmsg_level cmsg_type cmsg_data[]
  265. * ------------ ------------ -------------------
  266. * IPPROTO_SCTP SCTP_AUTHINFO struct sctp_authinfo
  267. */
  268. struct sctp_authinfo {
  269. __u16 auth_keynumber;
  270. };
  271. /*
  272. * sinfo_flags: 16 bits (unsigned integer)
  273. *
  274. * This field may contain any of the following flags and is composed of
  275. * a bitwise OR of these values.
  276. */
  277. enum sctp_sinfo_flags {
  278. SCTP_UNORDERED = (1 << 0), /* Send/receive message unordered. */
  279. SCTP_ADDR_OVER = (1 << 1), /* Override the primary destination. */
  280. SCTP_ABORT = (1 << 2), /* Send an ABORT message to the peer. */
  281. SCTP_SACK_IMMEDIATELY = (1 << 3), /* SACK should be sent without delay. */
  282. /* 2 bits here have been used by SCTP_PR_SCTP_MASK */
  283. SCTP_SENDALL = (1 << 6),
  284. SCTP_PR_SCTP_ALL = (1 << 7),
  285. SCTP_NOTIFICATION = MSG_NOTIFICATION, /* Next message is not user msg but notification. */
  286. SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */
  287. };
  288. typedef union {
  289. __u8 raw;
  290. struct sctp_initmsg init;
  291. struct sctp_sndrcvinfo sndrcv;
  292. } sctp_cmsg_data_t;
  293. /* These are cmsg_types. */
  294. typedef enum sctp_cmsg_type {
  295. SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
  296. #define SCTP_INIT SCTP_INIT
  297. SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */
  298. #define SCTP_SNDRCV SCTP_SNDRCV
  299. SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */
  300. #define SCTP_SNDINFO SCTP_SNDINFO
  301. SCTP_RCVINFO, /* 5.3.5 SCTP Receive Information Structure */
  302. #define SCTP_RCVINFO SCTP_RCVINFO
  303. SCTP_NXTINFO, /* 5.3.6 SCTP Next Receive Information Structure */
  304. #define SCTP_NXTINFO SCTP_NXTINFO
  305. SCTP_PRINFO, /* 5.3.7 SCTP PR-SCTP Information Structure */
  306. #define SCTP_PRINFO SCTP_PRINFO
  307. SCTP_AUTHINFO, /* 5.3.8 SCTP AUTH Information Structure */
  308. #define SCTP_AUTHINFO SCTP_AUTHINFO
  309. SCTP_DSTADDRV4, /* 5.3.9 SCTP Destination IPv4 Address Structure */
  310. #define SCTP_DSTADDRV4 SCTP_DSTADDRV4
  311. SCTP_DSTADDRV6, /* 5.3.10 SCTP Destination IPv6 Address Structure */
  312. #define SCTP_DSTADDRV6 SCTP_DSTADDRV6
  313. } sctp_cmsg_t;
  314. /*
  315. * 5.3.1.1 SCTP_ASSOC_CHANGE
  316. *
  317. * Communication notifications inform the ULP that an SCTP association
  318. * has either begun or ended. The identifier for a new association is
  319. * provided by this notificaion. The notification information has the
  320. * following format:
  321. *
  322. */
  323. struct sctp_assoc_change {
  324. __u16 sac_type;
  325. __u16 sac_flags;
  326. __u32 sac_length;
  327. __u16 sac_state;
  328. __u16 sac_error;
  329. __u16 sac_outbound_streams;
  330. __u16 sac_inbound_streams;
  331. sctp_assoc_t sac_assoc_id;
  332. __u8 sac_info[0];
  333. };
  334. /*
  335. * sac_state: 32 bits (signed integer)
  336. *
  337. * This field holds one of a number of values that communicate the
  338. * event that happened to the association. They include:
  339. *
  340. * Note: The following state names deviate from the API draft as
  341. * the names clash too easily with other kernel symbols.
  342. */
  343. enum sctp_sac_state {
  344. SCTP_COMM_UP,
  345. SCTP_COMM_LOST,
  346. SCTP_RESTART,
  347. SCTP_SHUTDOWN_COMP,
  348. SCTP_CANT_STR_ASSOC,
  349. };
  350. /*
  351. * 5.3.1.2 SCTP_PEER_ADDR_CHANGE
  352. *
  353. * When a destination address on a multi-homed peer encounters a change
  354. * an interface details event is sent. The information has the
  355. * following structure:
  356. */
  357. struct sctp_paddr_change {
  358. __u16 spc_type;
  359. __u16 spc_flags;
  360. __u32 spc_length;
  361. struct sockaddr_storage spc_aaddr;
  362. int spc_state;
  363. int spc_error;
  364. sctp_assoc_t spc_assoc_id;
  365. } __attribute__((packed, aligned(4)));
  366. /*
  367. * spc_state: 32 bits (signed integer)
  368. *
  369. * This field holds one of a number of values that communicate the
  370. * event that happened to the address. They include:
  371. */
  372. enum sctp_spc_state {
  373. SCTP_ADDR_AVAILABLE,
  374. SCTP_ADDR_UNREACHABLE,
  375. SCTP_ADDR_REMOVED,
  376. SCTP_ADDR_ADDED,
  377. SCTP_ADDR_MADE_PRIM,
  378. SCTP_ADDR_CONFIRMED,
  379. };
  380. /*
  381. * 5.3.1.3 SCTP_REMOTE_ERROR
  382. *
  383. * A remote peer may send an Operational Error message to its peer.
  384. * This message indicates a variety of error conditions on an
  385. * association. The entire error TLV as it appears on the wire is
  386. * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
  387. * specification [SCTP] and any extensions for a list of possible
  388. * error formats. SCTP error TLVs have the format:
  389. */
  390. struct sctp_remote_error {
  391. __u16 sre_type;
  392. __u16 sre_flags;
  393. __u32 sre_length;
  394. __be16 sre_error;
  395. sctp_assoc_t sre_assoc_id;
  396. __u8 sre_data[0];
  397. };
  398. /*
  399. * 5.3.1.4 SCTP_SEND_FAILED
  400. *
  401. * If SCTP cannot deliver a message it may return the message as a
  402. * notification.
  403. */
  404. struct sctp_send_failed {
  405. __u16 ssf_type;
  406. __u16 ssf_flags;
  407. __u32 ssf_length;
  408. __u32 ssf_error;
  409. struct sctp_sndrcvinfo ssf_info;
  410. sctp_assoc_t ssf_assoc_id;
  411. __u8 ssf_data[0];
  412. };
  413. /*
  414. * ssf_flags: 16 bits (unsigned integer)
  415. *
  416. * The flag value will take one of the following values
  417. *
  418. * SCTP_DATA_UNSENT - Indicates that the data was never put on
  419. * the wire.
  420. *
  421. * SCTP_DATA_SENT - Indicates that the data was put on the wire.
  422. * Note that this does not necessarily mean that the
  423. * data was (or was not) successfully delivered.
  424. */
  425. enum sctp_ssf_flags {
  426. SCTP_DATA_UNSENT,
  427. SCTP_DATA_SENT,
  428. };
  429. /*
  430. * 5.3.1.5 SCTP_SHUTDOWN_EVENT
  431. *
  432. * When a peer sends a SHUTDOWN, SCTP delivers this notification to
  433. * inform the application that it should cease sending data.
  434. */
  435. struct sctp_shutdown_event {
  436. __u16 sse_type;
  437. __u16 sse_flags;
  438. __u32 sse_length;
  439. sctp_assoc_t sse_assoc_id;
  440. };
  441. /*
  442. * 5.3.1.6 SCTP_ADAPTATION_INDICATION
  443. *
  444. * When a peer sends a Adaptation Layer Indication parameter , SCTP
  445. * delivers this notification to inform the application
  446. * that of the peers requested adaptation layer.
  447. */
  448. struct sctp_adaptation_event {
  449. __u16 sai_type;
  450. __u16 sai_flags;
  451. __u32 sai_length;
  452. __u32 sai_adaptation_ind;
  453. sctp_assoc_t sai_assoc_id;
  454. };
  455. /*
  456. * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
  457. *
  458. * When a receiver is engaged in a partial delivery of a
  459. * message this notification will be used to indicate
  460. * various events.
  461. */
  462. struct sctp_pdapi_event {
  463. __u16 pdapi_type;
  464. __u16 pdapi_flags;
  465. __u32 pdapi_length;
  466. __u32 pdapi_indication;
  467. sctp_assoc_t pdapi_assoc_id;
  468. __u32 pdapi_stream;
  469. __u32 pdapi_seq;
  470. };
  471. enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
  472. /*
  473. * 5.3.1.8. SCTP_AUTHENTICATION_EVENT
  474. *
  475. * When a receiver is using authentication this message will provide
  476. * notifications regarding new keys being made active as well as errors.
  477. */
  478. struct sctp_authkey_event {
  479. __u16 auth_type;
  480. __u16 auth_flags;
  481. __u32 auth_length;
  482. __u16 auth_keynumber;
  483. __u16 auth_altkeynumber;
  484. __u32 auth_indication;
  485. sctp_assoc_t auth_assoc_id;
  486. };
  487. enum {
  488. SCTP_AUTH_NEW_KEY,
  489. #define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY /* compatible with before */
  490. SCTP_AUTH_FREE_KEY,
  491. SCTP_AUTH_NO_AUTH,
  492. };
  493. /*
  494. * 6.1.9. SCTP_SENDER_DRY_EVENT
  495. *
  496. * When the SCTP stack has no more user data to send or retransmit, this
  497. * notification is given to the user. Also, at the time when a user app
  498. * subscribes to this event, if there is no data to be sent or
  499. * retransmit, the stack will immediately send up this notification.
  500. */
  501. struct sctp_sender_dry_event {
  502. __u16 sender_dry_type;
  503. __u16 sender_dry_flags;
  504. __u32 sender_dry_length;
  505. sctp_assoc_t sender_dry_assoc_id;
  506. };
  507. #define SCTP_STREAM_RESET_INCOMING_SSN 0x0001
  508. #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002
  509. #define SCTP_STREAM_RESET_DENIED 0x0004
  510. #define SCTP_STREAM_RESET_FAILED 0x0008
  511. struct sctp_stream_reset_event {
  512. __u16 strreset_type;
  513. __u16 strreset_flags;
  514. __u32 strreset_length;
  515. sctp_assoc_t strreset_assoc_id;
  516. __u16 strreset_stream_list[];
  517. };
  518. #define SCTP_ASSOC_RESET_DENIED 0x0004
  519. #define SCTP_ASSOC_RESET_FAILED 0x0008
  520. struct sctp_assoc_reset_event {
  521. __u16 assocreset_type;
  522. __u16 assocreset_flags;
  523. __u32 assocreset_length;
  524. sctp_assoc_t assocreset_assoc_id;
  525. __u32 assocreset_local_tsn;
  526. __u32 assocreset_remote_tsn;
  527. };
  528. #define SCTP_ASSOC_CHANGE_DENIED 0x0004
  529. #define SCTP_ASSOC_CHANGE_FAILED 0x0008
  530. #define SCTP_STREAM_CHANGE_DENIED SCTP_ASSOC_CHANGE_DENIED
  531. #define SCTP_STREAM_CHANGE_FAILED SCTP_ASSOC_CHANGE_FAILED
  532. struct sctp_stream_change_event {
  533. __u16 strchange_type;
  534. __u16 strchange_flags;
  535. __u32 strchange_length;
  536. sctp_assoc_t strchange_assoc_id;
  537. __u16 strchange_instrms;
  538. __u16 strchange_outstrms;
  539. };
  540. /*
  541. * Described in Section 7.3
  542. * Ancillary Data and Notification Interest Options
  543. */
  544. struct sctp_event_subscribe {
  545. __u8 sctp_data_io_event;
  546. __u8 sctp_association_event;
  547. __u8 sctp_address_event;
  548. __u8 sctp_send_failure_event;
  549. __u8 sctp_peer_error_event;
  550. __u8 sctp_shutdown_event;
  551. __u8 sctp_partial_delivery_event;
  552. __u8 sctp_adaptation_layer_event;
  553. __u8 sctp_authentication_event;
  554. __u8 sctp_sender_dry_event;
  555. __u8 sctp_stream_reset_event;
  556. __u8 sctp_assoc_reset_event;
  557. __u8 sctp_stream_change_event;
  558. };
  559. /*
  560. * 5.3.1 SCTP Notification Structure
  561. *
  562. * The notification structure is defined as the union of all
  563. * notification types.
  564. *
  565. */
  566. union sctp_notification {
  567. struct {
  568. __u16 sn_type; /* Notification type. */
  569. __u16 sn_flags;
  570. __u32 sn_length;
  571. } sn_header;
  572. struct sctp_assoc_change sn_assoc_change;
  573. struct sctp_paddr_change sn_paddr_change;
  574. struct sctp_remote_error sn_remote_error;
  575. struct sctp_send_failed sn_send_failed;
  576. struct sctp_shutdown_event sn_shutdown_event;
  577. struct sctp_adaptation_event sn_adaptation_event;
  578. struct sctp_pdapi_event sn_pdapi_event;
  579. struct sctp_authkey_event sn_authkey_event;
  580. struct sctp_sender_dry_event sn_sender_dry_event;
  581. struct sctp_stream_reset_event sn_strreset_event;
  582. struct sctp_assoc_reset_event sn_assocreset_event;
  583. struct sctp_stream_change_event sn_strchange_event;
  584. };
  585. /* Section 5.3.1
  586. * All standard values for sn_type flags are greater than 2^15.
  587. * Values from 2^15 and down are reserved.
  588. */
  589. enum sctp_sn_type {
  590. SCTP_SN_TYPE_BASE = (1<<15),
  591. SCTP_ASSOC_CHANGE,
  592. #define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE
  593. SCTP_PEER_ADDR_CHANGE,
  594. #define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE
  595. SCTP_SEND_FAILED,
  596. #define SCTP_SEND_FAILED SCTP_SEND_FAILED
  597. SCTP_REMOTE_ERROR,
  598. #define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR
  599. SCTP_SHUTDOWN_EVENT,
  600. #define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT
  601. SCTP_PARTIAL_DELIVERY_EVENT,
  602. #define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT
  603. SCTP_ADAPTATION_INDICATION,
  604. #define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION
  605. SCTP_AUTHENTICATION_EVENT,
  606. #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT
  607. SCTP_SENDER_DRY_EVENT,
  608. #define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT
  609. SCTP_STREAM_RESET_EVENT,
  610. #define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT
  611. SCTP_ASSOC_RESET_EVENT,
  612. #define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT
  613. SCTP_STREAM_CHANGE_EVENT,
  614. #define SCTP_STREAM_CHANGE_EVENT SCTP_STREAM_CHANGE_EVENT
  615. };
  616. /* Notification error codes used to fill up the error fields in some
  617. * notifications.
  618. * SCTP_PEER_ADDRESS_CHAGE : spc_error
  619. * SCTP_ASSOC_CHANGE : sac_error
  620. * These names should be potentially included in the draft 04 of the SCTP
  621. * sockets API specification.
  622. */
  623. typedef enum sctp_sn_error {
  624. SCTP_FAILED_THRESHOLD,
  625. SCTP_RECEIVED_SACK,
  626. SCTP_HEARTBEAT_SUCCESS,
  627. SCTP_RESPONSE_TO_USER_REQ,
  628. SCTP_INTERNAL_ERROR,
  629. SCTP_SHUTDOWN_GUARD_EXPIRES,
  630. SCTP_PEER_FAULTY,
  631. } sctp_sn_error_t;
  632. /*
  633. * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
  634. *
  635. * The protocol parameters used to initialize and bound retransmission
  636. * timeout (RTO) are tunable. See [SCTP] for more information on how
  637. * these parameters are used in RTO calculation.
  638. */
  639. struct sctp_rtoinfo {
  640. sctp_assoc_t srto_assoc_id;
  641. __u32 srto_initial;
  642. __u32 srto_max;
  643. __u32 srto_min;
  644. };
  645. /*
  646. * 7.1.2 Association Parameters (SCTP_ASSOCINFO)
  647. *
  648. * This option is used to both examine and set various association and
  649. * endpoint parameters.
  650. */
  651. struct sctp_assocparams {
  652. sctp_assoc_t sasoc_assoc_id;
  653. __u16 sasoc_asocmaxrxt;
  654. __u16 sasoc_number_peer_destinations;
  655. __u32 sasoc_peer_rwnd;
  656. __u32 sasoc_local_rwnd;
  657. __u32 sasoc_cookie_life;
  658. };
  659. /*
  660. * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
  661. *
  662. * Requests that the peer mark the enclosed address as the association
  663. * primary. The enclosed address must be one of the association's
  664. * locally bound addresses. The following structure is used to make a
  665. * set primary request:
  666. */
  667. struct sctp_setpeerprim {
  668. sctp_assoc_t sspp_assoc_id;
  669. struct sockaddr_storage sspp_addr;
  670. } __attribute__((packed, aligned(4)));
  671. /*
  672. * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
  673. *
  674. * Requests that the local SCTP stack use the enclosed peer address as
  675. * the association primary. The enclosed address must be one of the
  676. * association peer's addresses. The following structure is used to
  677. * make a set peer primary request:
  678. */
  679. struct sctp_prim {
  680. sctp_assoc_t ssp_assoc_id;
  681. struct sockaddr_storage ssp_addr;
  682. } __attribute__((packed, aligned(4)));
  683. /* For backward compatibility use, define the old name too */
  684. #define sctp_setprim sctp_prim
  685. /*
  686. * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
  687. *
  688. * Requests that the local endpoint set the specified Adaptation Layer
  689. * Indication parameter for all future INIT and INIT-ACK exchanges.
  690. */
  691. struct sctp_setadaptation {
  692. __u32 ssb_adaptation_ind;
  693. };
  694. /*
  695. * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS)
  696. *
  697. * Applications can enable or disable heartbeats for any peer address
  698. * of an association, modify an address's heartbeat interval, force a
  699. * heartbeat to be sent immediately, and adjust the address's maximum
  700. * number of retransmissions sent before an address is considered
  701. * unreachable. The following structure is used to access and modify an
  702. * address's parameters:
  703. */
  704. enum sctp_spp_flags {
  705. SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/
  706. SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/
  707. SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
  708. SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/
  709. SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/
  710. SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/
  711. SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
  712. SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/
  713. SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/
  714. SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
  715. SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */
  716. SPP_IPV6_FLOWLABEL = 1<<8,
  717. SPP_DSCP = 1<<9,
  718. };
  719. struct sctp_paddrparams {
  720. sctp_assoc_t spp_assoc_id;
  721. struct sockaddr_storage spp_address;
  722. __u32 spp_hbinterval;
  723. __u16 spp_pathmaxrxt;
  724. __u32 spp_pathmtu;
  725. __u32 spp_sackdelay;
  726. __u32 spp_flags;
  727. __u32 spp_ipv6_flowlabel;
  728. __u8 spp_dscp;
  729. } __attribute__((packed, aligned(4)));
  730. /*
  731. * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
  732. *
  733. * This set option adds a chunk type that the user is requesting to be
  734. * received only in an authenticated way. Changes to the list of chunks
  735. * will only effect future associations on the socket.
  736. */
  737. struct sctp_authchunk {
  738. __u8 sauth_chunk;
  739. };
  740. /*
  741. * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
  742. *
  743. * This option gets or sets the list of HMAC algorithms that the local
  744. * endpoint requires the peer to use.
  745. */
  746. #ifndef __KERNEL__
  747. /* This here is only used by user space as is. It might not be a good idea
  748. * to export/reveal the whole structure with reserved fields etc.
  749. */
  750. enum {
  751. SCTP_AUTH_HMAC_ID_SHA1 = 1,
  752. SCTP_AUTH_HMAC_ID_SHA256 = 3,
  753. };
  754. #endif
  755. struct sctp_hmacalgo {
  756. __u32 shmac_num_idents;
  757. __u16 shmac_idents[];
  758. };
  759. /* Sadly, user and kernel space have different names for
  760. * this structure member, so this is to not break anything.
  761. */
  762. #define shmac_number_of_idents shmac_num_idents
  763. /*
  764. * 7.1.20. Set a shared key (SCTP_AUTH_KEY)
  765. *
  766. * This option will set a shared secret key which is used to build an
  767. * association shared key.
  768. */
  769. struct sctp_authkey {
  770. sctp_assoc_t sca_assoc_id;
  771. __u16 sca_keynumber;
  772. __u16 sca_keylength;
  773. __u8 sca_key[];
  774. };
  775. /*
  776. * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
  777. *
  778. * This option will get or set the active shared key to be used to build
  779. * the association shared key.
  780. */
  781. struct sctp_authkeyid {
  782. sctp_assoc_t scact_assoc_id;
  783. __u16 scact_keynumber;
  784. };
  785. /*
  786. * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK)
  787. *
  788. * This option will effect the way delayed acks are performed. This
  789. * option allows you to get or set the delayed ack time, in
  790. * milliseconds. It also allows changing the delayed ack frequency.
  791. * Changing the frequency to 1 disables the delayed sack algorithm. If
  792. * the assoc_id is 0, then this sets or gets the endpoints default
  793. * values. If the assoc_id field is non-zero, then the set or get
  794. * effects the specified association for the one to many model (the
  795. * assoc_id field is ignored by the one to one model). Note that if
  796. * sack_delay or sack_freq are 0 when setting this option, then the
  797. * current values will remain unchanged.
  798. */
  799. struct sctp_sack_info {
  800. sctp_assoc_t sack_assoc_id;
  801. uint32_t sack_delay;
  802. uint32_t sack_freq;
  803. };
  804. struct sctp_assoc_value {
  805. sctp_assoc_t assoc_id;
  806. uint32_t assoc_value;
  807. };
  808. struct sctp_stream_value {
  809. sctp_assoc_t assoc_id;
  810. uint16_t stream_id;
  811. uint16_t stream_value;
  812. };
  813. /*
  814. * 7.2.2 Peer Address Information
  815. *
  816. * Applications can retrieve information about a specific peer address
  817. * of an association, including its reachability state, congestion
  818. * window, and retransmission timer values. This information is
  819. * read-only. The following structure is used to access this
  820. * information:
  821. */
  822. struct sctp_paddrinfo {
  823. sctp_assoc_t spinfo_assoc_id;
  824. struct sockaddr_storage spinfo_address;
  825. __s32 spinfo_state;
  826. __u32 spinfo_cwnd;
  827. __u32 spinfo_srtt;
  828. __u32 spinfo_rto;
  829. __u32 spinfo_mtu;
  830. } __attribute__((packed, aligned(4)));
  831. /* Peer addresses's state. */
  832. /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
  833. * calls.
  834. * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
  835. * Not yet confirmed by a heartbeat and not available for data
  836. * transfers.
  837. * ACTIVE : Peer address confirmed, active and available for data transfers.
  838. * INACTIVE: Peer address inactive and not available for data transfers.
  839. */
  840. enum sctp_spinfo_state {
  841. SCTP_INACTIVE,
  842. SCTP_PF,
  843. SCTP_ACTIVE,
  844. SCTP_UNCONFIRMED,
  845. SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */
  846. };
  847. /*
  848. * 7.2.1 Association Status (SCTP_STATUS)
  849. *
  850. * Applications can retrieve current status information about an
  851. * association, including association state, peer receiver window size,
  852. * number of unacked data chunks, and number of data chunks pending
  853. * receipt. This information is read-only. The following structure is
  854. * used to access this information:
  855. */
  856. struct sctp_status {
  857. sctp_assoc_t sstat_assoc_id;
  858. __s32 sstat_state;
  859. __u32 sstat_rwnd;
  860. __u16 sstat_unackdata;
  861. __u16 sstat_penddata;
  862. __u16 sstat_instrms;
  863. __u16 sstat_outstrms;
  864. __u32 sstat_fragmentation_point;
  865. struct sctp_paddrinfo sstat_primary;
  866. };
  867. /*
  868. * 7.2.3. Get the list of chunks the peer requires to be authenticated
  869. * (SCTP_PEER_AUTH_CHUNKS)
  870. *
  871. * This option gets a list of chunks for a specified association that
  872. * the peer requires to be received authenticated only.
  873. */
  874. struct sctp_authchunks {
  875. sctp_assoc_t gauth_assoc_id;
  876. __u32 gauth_number_of_chunks;
  877. uint8_t gauth_chunks[];
  878. };
  879. /* The broken spelling has been released already in lksctp-tools header,
  880. * so don't break anyone, now that it's fixed.
  881. */
  882. #define guth_number_of_chunks gauth_number_of_chunks
  883. /* Association states. */
  884. enum sctp_sstat_state {
  885. SCTP_EMPTY = 0,
  886. SCTP_CLOSED = 1,
  887. SCTP_COOKIE_WAIT = 2,
  888. SCTP_COOKIE_ECHOED = 3,
  889. SCTP_ESTABLISHED = 4,
  890. SCTP_SHUTDOWN_PENDING = 5,
  891. SCTP_SHUTDOWN_SENT = 6,
  892. SCTP_SHUTDOWN_RECEIVED = 7,
  893. SCTP_SHUTDOWN_ACK_SENT = 8,
  894. };
  895. /*
  896. * 8.2.6. Get the Current Identifiers of Associations
  897. * (SCTP_GET_ASSOC_ID_LIST)
  898. *
  899. * This option gets the current list of SCTP association identifiers of
  900. * the SCTP associations handled by a one-to-many style socket.
  901. */
  902. struct sctp_assoc_ids {
  903. __u32 gaids_number_of_ids;
  904. sctp_assoc_t gaids_assoc_id[];
  905. };
  906. /*
  907. * 8.3, 8.5 get all peer/local addresses in an association.
  908. * This parameter struct is used by SCTP_GET_PEER_ADDRS and
  909. * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
  910. * sctp_getpaddrs() and sctp_getladdrs() API.
  911. */
  912. struct sctp_getaddrs_old {
  913. sctp_assoc_t assoc_id;
  914. int addr_num;
  915. #ifdef __KERNEL__
  916. struct sockaddr __user *addrs;
  917. #else
  918. struct sockaddr *addrs;
  919. #endif
  920. };
  921. struct sctp_getaddrs {
  922. sctp_assoc_t assoc_id; /*input*/
  923. __u32 addr_num; /*output*/
  924. __u8 addrs[0]; /*output, variable size*/
  925. };
  926. /* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
  927. * association stats. All stats are counts except sas_maxrto and
  928. * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
  929. * the last call. Will return 0 when RTO was not update since last call
  930. */
  931. struct sctp_assoc_stats {
  932. sctp_assoc_t sas_assoc_id; /* Input */
  933. /* Transport of observed max RTO */
  934. struct sockaddr_storage sas_obs_rto_ipaddr;
  935. __u64 sas_maxrto; /* Maximum Observed RTO for period */
  936. __u64 sas_isacks; /* SACKs received */
  937. __u64 sas_osacks; /* SACKs sent */
  938. __u64 sas_opackets; /* Packets sent */
  939. __u64 sas_ipackets; /* Packets received */
  940. __u64 sas_rtxchunks; /* Retransmitted Chunks */
  941. __u64 sas_outofseqtsns;/* TSN received > next expected */
  942. __u64 sas_idupchunks; /* Dups received (ordered+unordered) */
  943. __u64 sas_gapcnt; /* Gap Acknowledgements Received */
  944. __u64 sas_ouodchunks; /* Unordered data chunks sent */
  945. __u64 sas_iuodchunks; /* Unordered data chunks received */
  946. __u64 sas_oodchunks; /* Ordered data chunks sent */
  947. __u64 sas_iodchunks; /* Ordered data chunks received */
  948. __u64 sas_octrlchunks; /* Control chunks sent */
  949. __u64 sas_ictrlchunks; /* Control chunks received */
  950. };
  951. /*
  952. * 8.1 sctp_bindx()
  953. *
  954. * The flags parameter is formed from the bitwise OR of zero or more of the
  955. * following currently defined flags:
  956. */
  957. #define SCTP_BINDX_ADD_ADDR 0x01
  958. #define SCTP_BINDX_REM_ADDR 0x02
  959. /* This is the structure that is passed as an argument(optval) to
  960. * getsockopt(SCTP_SOCKOPT_PEELOFF).
  961. */
  962. typedef struct {
  963. sctp_assoc_t associd;
  964. int sd;
  965. } sctp_peeloff_arg_t;
  966. typedef struct {
  967. sctp_peeloff_arg_t p_arg;
  968. unsigned flags;
  969. } sctp_peeloff_flags_arg_t;
  970. /*
  971. * Peer Address Thresholds socket option
  972. */
  973. struct sctp_paddrthlds {
  974. sctp_assoc_t spt_assoc_id;
  975. struct sockaddr_storage spt_address;
  976. __u16 spt_pathmaxrxt;
  977. __u16 spt_pathpfthld;
  978. };
  979. /*
  980. * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status
  981. */
  982. struct sctp_prstatus {
  983. sctp_assoc_t sprstat_assoc_id;
  984. __u16 sprstat_sid;
  985. __u16 sprstat_policy;
  986. __u64 sprstat_abandoned_unsent;
  987. __u64 sprstat_abandoned_sent;
  988. };
  989. struct sctp_default_prinfo {
  990. sctp_assoc_t pr_assoc_id;
  991. __u32 pr_value;
  992. __u16 pr_policy;
  993. };
  994. struct sctp_info {
  995. __u32 sctpi_tag;
  996. __u32 sctpi_state;
  997. __u32 sctpi_rwnd;
  998. __u16 sctpi_unackdata;
  999. __u16 sctpi_penddata;
  1000. __u16 sctpi_instrms;
  1001. __u16 sctpi_outstrms;
  1002. __u32 sctpi_fragmentation_point;
  1003. __u32 sctpi_inqueue;
  1004. __u32 sctpi_outqueue;
  1005. __u32 sctpi_overall_error;
  1006. __u32 sctpi_max_burst;
  1007. __u32 sctpi_maxseg;
  1008. __u32 sctpi_peer_rwnd;
  1009. __u32 sctpi_peer_tag;
  1010. __u8 sctpi_peer_capable;
  1011. __u8 sctpi_peer_sack;
  1012. __u16 __reserved1;
  1013. /* assoc status info */
  1014. __u64 sctpi_isacks;
  1015. __u64 sctpi_osacks;
  1016. __u64 sctpi_opackets;
  1017. __u64 sctpi_ipackets;
  1018. __u64 sctpi_rtxchunks;
  1019. __u64 sctpi_outofseqtsns;
  1020. __u64 sctpi_idupchunks;
  1021. __u64 sctpi_gapcnt;
  1022. __u64 sctpi_ouodchunks;
  1023. __u64 sctpi_iuodchunks;
  1024. __u64 sctpi_oodchunks;
  1025. __u64 sctpi_iodchunks;
  1026. __u64 sctpi_octrlchunks;
  1027. __u64 sctpi_ictrlchunks;
  1028. /* primary transport info */
  1029. struct sockaddr_storage sctpi_p_address;
  1030. __s32 sctpi_p_state;
  1031. __u32 sctpi_p_cwnd;
  1032. __u32 sctpi_p_srtt;
  1033. __u32 sctpi_p_rto;
  1034. __u32 sctpi_p_hbinterval;
  1035. __u32 sctpi_p_pathmaxrxt;
  1036. __u32 sctpi_p_sackdelay;
  1037. __u32 sctpi_p_sackfreq;
  1038. __u32 sctpi_p_ssthresh;
  1039. __u32 sctpi_p_partial_bytes_acked;
  1040. __u32 sctpi_p_flight_size;
  1041. __u16 sctpi_p_error;
  1042. __u16 __reserved2;
  1043. /* sctp sock info */
  1044. __u32 sctpi_s_autoclose;
  1045. __u32 sctpi_s_adaptation_ind;
  1046. __u32 sctpi_s_pd_point;
  1047. __u8 sctpi_s_nodelay;
  1048. __u8 sctpi_s_disable_fragments;
  1049. __u8 sctpi_s_v4mapped;
  1050. __u8 sctpi_s_frag_interleave;
  1051. __u32 sctpi_s_type;
  1052. __u32 __reserved3;
  1053. };
  1054. struct sctp_reset_streams {
  1055. sctp_assoc_t srs_assoc_id;
  1056. uint16_t srs_flags;
  1057. uint16_t srs_number_streams; /* 0 == ALL */
  1058. uint16_t srs_stream_list[]; /* list if srs_num_streams is not 0 */
  1059. };
  1060. struct sctp_add_streams {
  1061. sctp_assoc_t sas_assoc_id;
  1062. uint16_t sas_instrms;
  1063. uint16_t sas_outstrms;
  1064. };
  1065. /* SCTP Stream schedulers */
  1066. enum sctp_sched_type {
  1067. SCTP_SS_FCFS,
  1068. SCTP_SS_DEFAULT = SCTP_SS_FCFS,
  1069. SCTP_SS_PRIO,
  1070. SCTP_SS_RR,
  1071. SCTP_SS_MAX = SCTP_SS_RR
  1072. };
  1073. #endif /* _UAPI_SCTP_H */