sctp.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. /* SCTP kernel reference Implementation
  2. * (C) Copyright IBM Corp. 2001, 2004
  3. * Copyright (c) 1999-2000 Cisco, Inc.
  4. * Copyright (c) 1999-2001 Motorola, Inc.
  5. * Copyright (c) 2001 Intel Corp.
  6. * Copyright (c) 2001 Nokia, Inc.
  7. * Copyright (c) 2001 La Monte H.P. Yarroll
  8. *
  9. * This file is part of the SCTP kernel reference Implementation
  10. *
  11. * Various protocol defined structures.
  12. *
  13. * The SCTP reference 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. * The SCTP reference 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, write to
  27. * the Free Software Foundation, 59 Temple Place - Suite 330,
  28. * Boston, MA 02111-1307, USA.
  29. *
  30. * Please send any bug reports or fixes you make to the
  31. * email address(es):
  32. * lksctp developers <lksctp-developerst@lists.sourceforge.net>
  33. *
  34. * Or submit a bug report through the following website:
  35. * http://www.sf.net/projects/lksctp
  36. *
  37. * Written or modified by:
  38. * La Monte H.P. Yarroll <piggy@acm.org>
  39. * Karl Knutson <karl@athena.chicago.il.us>
  40. * Jon Grimm <jgrimm@us.ibm.com>
  41. * Xingang Guo <xingang.guo@intel.com>
  42. * randall@sctp.chicago.il.us
  43. * kmorneau@cisco.com
  44. * qxie1@email.mot.com
  45. * Sridhar Samudrala <sri@us.ibm.com>
  46. * Kevin Gao <kevin.gao@intel.com>
  47. *
  48. * Any bugs reported given to us we will try to fix... any fixes shared will
  49. * be incorporated into the next SCTP release.
  50. */
  51. #ifndef __LINUX_SCTP_H__
  52. #define __LINUX_SCTP_H__
  53. #include <linux/in.h> /* We need in_addr. */
  54. #include <linux/in6.h> /* We need in6_addr. */
  55. /* Section 3.1. SCTP Common Header Format */
  56. typedef struct sctphdr {
  57. __be16 source;
  58. __be16 dest;
  59. __be32 vtag;
  60. __be32 checksum;
  61. } __attribute__((packed)) sctp_sctphdr_t;
  62. #ifdef __KERNEL__
  63. #include <linux/skbuff.h>
  64. static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
  65. {
  66. return (struct sctphdr *)skb_transport_header(skb);
  67. }
  68. #endif
  69. /* Section 3.2. Chunk Field Descriptions. */
  70. typedef struct sctp_chunkhdr {
  71. __u8 type;
  72. __u8 flags;
  73. __be16 length;
  74. } __attribute__((packed)) sctp_chunkhdr_t;
  75. /* Section 3.2. Chunk Type Values.
  76. * [Chunk Type] identifies the type of information contained in the Chunk
  77. * Value field. It takes a value from 0 to 254. The value of 255 is
  78. * reserved for future use as an extension field.
  79. */
  80. typedef enum {
  81. SCTP_CID_DATA = 0,
  82. SCTP_CID_INIT = 1,
  83. SCTP_CID_INIT_ACK = 2,
  84. SCTP_CID_SACK = 3,
  85. SCTP_CID_HEARTBEAT = 4,
  86. SCTP_CID_HEARTBEAT_ACK = 5,
  87. SCTP_CID_ABORT = 6,
  88. SCTP_CID_SHUTDOWN = 7,
  89. SCTP_CID_SHUTDOWN_ACK = 8,
  90. SCTP_CID_ERROR = 9,
  91. SCTP_CID_COOKIE_ECHO = 10,
  92. SCTP_CID_COOKIE_ACK = 11,
  93. SCTP_CID_ECN_ECNE = 12,
  94. SCTP_CID_ECN_CWR = 13,
  95. SCTP_CID_SHUTDOWN_COMPLETE = 14,
  96. /* PR-SCTP Sec 3.2 */
  97. SCTP_CID_FWD_TSN = 0xC0,
  98. /* Use hex, as defined in ADDIP sec. 3.1 */
  99. SCTP_CID_ASCONF = 0xC1,
  100. SCTP_CID_ASCONF_ACK = 0x80,
  101. } sctp_cid_t; /* enum */
  102. /* Section 3.2
  103. * Chunk Types are encoded such that the highest-order two bits specify
  104. * the action that must be taken if the processing endpoint does not
  105. * recognize the Chunk Type.
  106. */
  107. typedef enum {
  108. SCTP_CID_ACTION_DISCARD = 0x00,
  109. SCTP_CID_ACTION_DISCARD_ERR = 0x40,
  110. SCTP_CID_ACTION_SKIP = 0x80,
  111. SCTP_CID_ACTION_SKIP_ERR = 0xc0,
  112. } sctp_cid_action_t;
  113. enum { SCTP_CID_ACTION_MASK = 0xc0, };
  114. /* This flag is used in Chunk Flags for ABORT and SHUTDOWN COMPLETE.
  115. *
  116. * 3.3.7 Abort Association (ABORT) (6):
  117. * The T bit is set to 0 if the sender had a TCB that it destroyed.
  118. * If the sender did not have a TCB it should set this bit to 1.
  119. */
  120. enum { SCTP_CHUNK_FLAG_T = 0x01 };
  121. /*
  122. * Set the T bit
  123. *
  124. * 0 1 2 3
  125. * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  126. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  127. * | Type = 14 |Reserved |T| Length = 4 |
  128. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  129. *
  130. * Chunk Flags: 8 bits
  131. *
  132. * Reserved: 7 bits
  133. * Set to 0 on transmit and ignored on receipt.
  134. *
  135. * T bit: 1 bit
  136. * The T bit is set to 0 if the sender had a TCB that it destroyed. If
  137. * the sender did NOT have a TCB it should set this bit to 1.
  138. *
  139. * Note: Special rules apply to this chunk for verification, please
  140. * see Section 8.5.1 for details.
  141. */
  142. #define sctp_test_T_bit(c) ((c)->chunk_hdr->flags & SCTP_CHUNK_FLAG_T)
  143. /* RFC 2960
  144. * Section 3.2.1 Optional/Variable-length Parmaeter Format.
  145. */
  146. typedef struct sctp_paramhdr {
  147. __be16 type;
  148. __be16 length;
  149. } __attribute__((packed)) sctp_paramhdr_t;
  150. typedef enum {
  151. /* RFC 2960 Section 3.3.5 */
  152. SCTP_PARAM_HEARTBEAT_INFO = __constant_htons(1),
  153. /* RFC 2960 Section 3.3.2.1 */
  154. SCTP_PARAM_IPV4_ADDRESS = __constant_htons(5),
  155. SCTP_PARAM_IPV6_ADDRESS = __constant_htons(6),
  156. SCTP_PARAM_STATE_COOKIE = __constant_htons(7),
  157. SCTP_PARAM_UNRECOGNIZED_PARAMETERS = __constant_htons(8),
  158. SCTP_PARAM_COOKIE_PRESERVATIVE = __constant_htons(9),
  159. SCTP_PARAM_HOST_NAME_ADDRESS = __constant_htons(11),
  160. SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = __constant_htons(12),
  161. SCTP_PARAM_ECN_CAPABLE = __constant_htons(0x8000),
  162. /* Add-IP: Supported Extensions, Section 4.2 */
  163. SCTP_PARAM_SUPPORTED_EXT = __constant_htons(0x8008),
  164. /* PR-SCTP Sec 3.1 */
  165. SCTP_PARAM_FWD_TSN_SUPPORT = __constant_htons(0xc000),
  166. /* Add-IP Extension. Section 3.2 */
  167. SCTP_PARAM_ADD_IP = __constant_htons(0xc001),
  168. SCTP_PARAM_DEL_IP = __constant_htons(0xc002),
  169. SCTP_PARAM_ERR_CAUSE = __constant_htons(0xc003),
  170. SCTP_PARAM_SET_PRIMARY = __constant_htons(0xc004),
  171. SCTP_PARAM_SUCCESS_REPORT = __constant_htons(0xc005),
  172. SCTP_PARAM_ADAPTATION_LAYER_IND = __constant_htons(0xc006),
  173. } sctp_param_t; /* enum */
  174. /* RFC 2960 Section 3.2.1
  175. * The Parameter Types are encoded such that the highest-order two bits
  176. * specify the action that must be taken if the processing endpoint does
  177. * not recognize the Parameter Type.
  178. *
  179. */
  180. typedef enum {
  181. SCTP_PARAM_ACTION_DISCARD = __constant_htons(0x0000),
  182. SCTP_PARAM_ACTION_DISCARD_ERR = __constant_htons(0x4000),
  183. SCTP_PARAM_ACTION_SKIP = __constant_htons(0x8000),
  184. SCTP_PARAM_ACTION_SKIP_ERR = __constant_htons(0xc000),
  185. } sctp_param_action_t;
  186. enum { SCTP_PARAM_ACTION_MASK = __constant_htons(0xc000), };
  187. /* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
  188. typedef struct sctp_datahdr {
  189. __be32 tsn;
  190. __be16 stream;
  191. __be16 ssn;
  192. __be32 ppid;
  193. __u8 payload[0];
  194. } __attribute__((packed)) sctp_datahdr_t;
  195. typedef struct sctp_data_chunk {
  196. sctp_chunkhdr_t chunk_hdr;
  197. sctp_datahdr_t data_hdr;
  198. } __attribute__((packed)) sctp_data_chunk_t;
  199. /* DATA Chuck Specific Flags */
  200. enum {
  201. SCTP_DATA_MIDDLE_FRAG = 0x00,
  202. SCTP_DATA_LAST_FRAG = 0x01,
  203. SCTP_DATA_FIRST_FRAG = 0x02,
  204. SCTP_DATA_NOT_FRAG = 0x03,
  205. SCTP_DATA_UNORDERED = 0x04,
  206. };
  207. enum { SCTP_DATA_FRAG_MASK = 0x03, };
  208. /* RFC 2960 Section 3.3.2 Initiation (INIT) (1)
  209. *
  210. * This chunk is used to initiate a SCTP association between two
  211. * endpoints.
  212. */
  213. typedef struct sctp_inithdr {
  214. __be32 init_tag;
  215. __be32 a_rwnd;
  216. __be16 num_outbound_streams;
  217. __be16 num_inbound_streams;
  218. __be32 initial_tsn;
  219. __u8 params[0];
  220. } __attribute__((packed)) sctp_inithdr_t;
  221. typedef struct sctp_init_chunk {
  222. sctp_chunkhdr_t chunk_hdr;
  223. sctp_inithdr_t init_hdr;
  224. } __attribute__((packed)) sctp_init_chunk_t;
  225. /* Section 3.3.2.1. IPv4 Address Parameter (5) */
  226. typedef struct sctp_ipv4addr_param {
  227. sctp_paramhdr_t param_hdr;
  228. struct in_addr addr;
  229. } __attribute__((packed)) sctp_ipv4addr_param_t;
  230. /* Section 3.3.2.1. IPv6 Address Parameter (6) */
  231. typedef struct sctp_ipv6addr_param {
  232. sctp_paramhdr_t param_hdr;
  233. struct in6_addr addr;
  234. } __attribute__((packed)) sctp_ipv6addr_param_t;
  235. /* Section 3.3.2.1 Cookie Preservative (9) */
  236. typedef struct sctp_cookie_preserve_param {
  237. sctp_paramhdr_t param_hdr;
  238. __be32 lifespan_increment;
  239. } __attribute__((packed)) sctp_cookie_preserve_param_t;
  240. /* Section 3.3.2.1 Host Name Address (11) */
  241. typedef struct sctp_hostname_param {
  242. sctp_paramhdr_t param_hdr;
  243. uint8_t hostname[0];
  244. } __attribute__((packed)) sctp_hostname_param_t;
  245. /* Section 3.3.2.1 Supported Address Types (12) */
  246. typedef struct sctp_supported_addrs_param {
  247. sctp_paramhdr_t param_hdr;
  248. __be16 types[0];
  249. } __attribute__((packed)) sctp_supported_addrs_param_t;
  250. /* Appendix A. ECN Capable (32768) */
  251. typedef struct sctp_ecn_capable_param {
  252. sctp_paramhdr_t param_hdr;
  253. } __attribute__((packed)) sctp_ecn_capable_param_t;
  254. /* ADDIP Section 3.2.6 Adaptation Layer Indication */
  255. typedef struct sctp_adaptation_ind_param {
  256. struct sctp_paramhdr param_hdr;
  257. __be32 adaptation_ind;
  258. } __attribute__((packed)) sctp_adaptation_ind_param_t;
  259. /* ADDIP Section 4.2.7 Supported Extensions Parameter */
  260. typedef struct sctp_supported_ext_param {
  261. struct sctp_paramhdr param_hdr;
  262. __u8 chunks[0];
  263. } __attribute__((packed)) sctp_supported_ext_param_t;
  264. /* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
  265. * The INIT ACK chunk is used to acknowledge the initiation of an SCTP
  266. * association.
  267. */
  268. typedef sctp_init_chunk_t sctp_initack_chunk_t;
  269. /* Section 3.3.3.1 State Cookie (7) */
  270. typedef struct sctp_cookie_param {
  271. sctp_paramhdr_t p;
  272. __u8 body[0];
  273. } __attribute__((packed)) sctp_cookie_param_t;
  274. /* Section 3.3.3.1 Unrecognized Parameters (8) */
  275. typedef struct sctp_unrecognized_param {
  276. sctp_paramhdr_t param_hdr;
  277. sctp_paramhdr_t unrecognized;
  278. } __attribute__((packed)) sctp_unrecognized_param_t;
  279. /*
  280. * 3.3.4 Selective Acknowledgement (SACK) (3):
  281. *
  282. * This chunk is sent to the peer endpoint to acknowledge received DATA
  283. * chunks and to inform the peer endpoint of gaps in the received
  284. * subsequences of DATA chunks as represented by their TSNs.
  285. */
  286. typedef struct sctp_gap_ack_block {
  287. __be16 start;
  288. __be16 end;
  289. } __attribute__((packed)) sctp_gap_ack_block_t;
  290. typedef __be32 sctp_dup_tsn_t;
  291. typedef union {
  292. sctp_gap_ack_block_t gab;
  293. sctp_dup_tsn_t dup;
  294. } sctp_sack_variable_t;
  295. typedef struct sctp_sackhdr {
  296. __be32 cum_tsn_ack;
  297. __be32 a_rwnd;
  298. __be16 num_gap_ack_blocks;
  299. __be16 num_dup_tsns;
  300. sctp_sack_variable_t variable[0];
  301. } __attribute__((packed)) sctp_sackhdr_t;
  302. typedef struct sctp_sack_chunk {
  303. sctp_chunkhdr_t chunk_hdr;
  304. sctp_sackhdr_t sack_hdr;
  305. } __attribute__((packed)) sctp_sack_chunk_t;
  306. /* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
  307. *
  308. * An endpoint should send this chunk to its peer endpoint to probe the
  309. * reachability of a particular destination transport address defined in
  310. * the present association.
  311. */
  312. typedef struct sctp_heartbeathdr {
  313. sctp_paramhdr_t info;
  314. } __attribute__((packed)) sctp_heartbeathdr_t;
  315. typedef struct sctp_heartbeat_chunk {
  316. sctp_chunkhdr_t chunk_hdr;
  317. sctp_heartbeathdr_t hb_hdr;
  318. } __attribute__((packed)) sctp_heartbeat_chunk_t;
  319. /* For the abort and shutdown ACK we must carry the init tag in the
  320. * common header. Just the common header is all that is needed with a
  321. * chunk descriptor.
  322. */
  323. typedef struct sctp_abort_chunk {
  324. sctp_chunkhdr_t uh;
  325. } __attribute__((packed)) sctp_abort_chunk_t;
  326. /* For the graceful shutdown we must carry the tag (in common header)
  327. * and the highest consecutive acking value.
  328. */
  329. typedef struct sctp_shutdownhdr {
  330. __be32 cum_tsn_ack;
  331. } __attribute__((packed)) sctp_shutdownhdr_t;
  332. struct sctp_shutdown_chunk_t {
  333. sctp_chunkhdr_t chunk_hdr;
  334. sctp_shutdownhdr_t shutdown_hdr;
  335. } __attribute__ ((packed));
  336. /* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
  337. typedef struct sctp_errhdr {
  338. __be16 cause;
  339. __be16 length;
  340. __u8 variable[0];
  341. } __attribute__((packed)) sctp_errhdr_t;
  342. typedef struct sctp_operr_chunk {
  343. sctp_chunkhdr_t chunk_hdr;
  344. sctp_errhdr_t err_hdr;
  345. } __attribute__((packed)) sctp_operr_chunk_t;
  346. /* RFC 2960 3.3.10 - Operation Error
  347. *
  348. * Cause Code: 16 bits (unsigned integer)
  349. *
  350. * Defines the type of error conditions being reported.
  351. * Cause Code
  352. * Value Cause Code
  353. * --------- ----------------
  354. * 1 Invalid Stream Identifier
  355. * 2 Missing Mandatory Parameter
  356. * 3 Stale Cookie Error
  357. * 4 Out of Resource
  358. * 5 Unresolvable Address
  359. * 6 Unrecognized Chunk Type
  360. * 7 Invalid Mandatory Parameter
  361. * 8 Unrecognized Parameters
  362. * 9 No User Data
  363. * 10 Cookie Received While Shutting Down
  364. */
  365. typedef enum {
  366. SCTP_ERROR_NO_ERROR = __constant_htons(0x00),
  367. SCTP_ERROR_INV_STRM = __constant_htons(0x01),
  368. SCTP_ERROR_MISS_PARAM = __constant_htons(0x02),
  369. SCTP_ERROR_STALE_COOKIE = __constant_htons(0x03),
  370. SCTP_ERROR_NO_RESOURCE = __constant_htons(0x04),
  371. SCTP_ERROR_DNS_FAILED = __constant_htons(0x05),
  372. SCTP_ERROR_UNKNOWN_CHUNK = __constant_htons(0x06),
  373. SCTP_ERROR_INV_PARAM = __constant_htons(0x07),
  374. SCTP_ERROR_UNKNOWN_PARAM = __constant_htons(0x08),
  375. SCTP_ERROR_NO_DATA = __constant_htons(0x09),
  376. SCTP_ERROR_COOKIE_IN_SHUTDOWN = __constant_htons(0x0a),
  377. /* SCTP Implementation Guide:
  378. * 11 Restart of an association with new addresses
  379. * 12 User Initiated Abort
  380. * 13 Protocol Violation
  381. */
  382. SCTP_ERROR_RESTART = __constant_htons(0x0b),
  383. SCTP_ERROR_USER_ABORT = __constant_htons(0x0c),
  384. SCTP_ERROR_PROTO_VIOLATION = __constant_htons(0x0d),
  385. /* ADDIP Section 3.3 New Error Causes
  386. *
  387. * Four new Error Causes are added to the SCTP Operational Errors,
  388. * primarily for use in the ASCONF-ACK chunk.
  389. *
  390. * Value Cause Code
  391. * --------- ----------------
  392. * 0x0100 Request to Delete Last Remaining IP Address.
  393. * 0x0101 Operation Refused Due to Resource Shortage.
  394. * 0x0102 Request to Delete Source IP Address.
  395. * 0x0103 Association Aborted due to illegal ASCONF-ACK
  396. * 0x0104 Request refused - no authorization.
  397. */
  398. SCTP_ERROR_DEL_LAST_IP = __constant_htons(0x0100),
  399. SCTP_ERROR_RSRC_LOW = __constant_htons(0x0101),
  400. SCTP_ERROR_DEL_SRC_IP = __constant_htons(0x0102),
  401. SCTP_ERROR_ASCONF_ACK = __constant_htons(0x0103),
  402. SCTP_ERROR_REQ_REFUSED = __constant_htons(0x0104)
  403. } sctp_error_t;
  404. /* RFC 2960. Appendix A. Explicit Congestion Notification.
  405. * Explicit Congestion Notification Echo (ECNE) (12)
  406. */
  407. typedef struct sctp_ecnehdr {
  408. __be32 lowest_tsn;
  409. } sctp_ecnehdr_t;
  410. typedef struct sctp_ecne_chunk {
  411. sctp_chunkhdr_t chunk_hdr;
  412. sctp_ecnehdr_t ence_hdr;
  413. } __attribute__((packed)) sctp_ecne_chunk_t;
  414. /* RFC 2960. Appendix A. Explicit Congestion Notification.
  415. * Congestion Window Reduced (CWR) (13)
  416. */
  417. typedef struct sctp_cwrhdr {
  418. __be32 lowest_tsn;
  419. } sctp_cwrhdr_t;
  420. typedef struct sctp_cwr_chunk {
  421. sctp_chunkhdr_t chunk_hdr;
  422. sctp_cwrhdr_t cwr_hdr;
  423. } __attribute__((packed)) sctp_cwr_chunk_t;
  424. /* PR-SCTP
  425. * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
  426. *
  427. * Forward Cumulative TSN chunk has the following format:
  428. *
  429. * 0 1 2 3
  430. * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  431. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  432. * | Type = 192 | Flags = 0x00 | Length = Variable |
  433. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  434. * | New Cumulative TSN |
  435. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  436. * | Stream-1 | Stream Sequence-1 |
  437. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  438. * \ /
  439. * / \
  440. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  441. * | Stream-N | Stream Sequence-N |
  442. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  443. *
  444. * Chunk Flags:
  445. *
  446. * Set to all zeros on transmit and ignored on receipt.
  447. *
  448. * New Cumulative TSN: 32 bit u_int
  449. *
  450. * This indicates the new cumulative TSN to the data receiver. Upon
  451. * the reception of this value, the data receiver MUST consider
  452. * any missing TSNs earlier than or equal to this value as received
  453. * and stop reporting them as gaps in any subsequent SACKs.
  454. *
  455. * Stream-N: 16 bit u_int
  456. *
  457. * This field holds a stream number that was skipped by this
  458. * FWD-TSN.
  459. *
  460. * Stream Sequence-N: 16 bit u_int
  461. * This field holds the sequence number associated with the stream
  462. * that was skipped. The stream sequence field holds the largest stream
  463. * sequence number in this stream being skipped. The receiver of
  464. * the FWD-TSN's can use the Stream-N and Stream Sequence-N fields
  465. * to enable delivery of any stranded TSN's that remain on the stream
  466. * re-ordering queues. This field MUST NOT report TSN's corresponding
  467. * to DATA chunk that are marked as unordered. For ordered DATA
  468. * chunks this field MUST be filled in.
  469. */
  470. struct sctp_fwdtsn_skip {
  471. __be16 stream;
  472. __be16 ssn;
  473. } __attribute__((packed));
  474. struct sctp_fwdtsn_hdr {
  475. __be32 new_cum_tsn;
  476. struct sctp_fwdtsn_skip skip[0];
  477. } __attribute((packed));
  478. struct sctp_fwdtsn_chunk {
  479. struct sctp_chunkhdr chunk_hdr;
  480. struct sctp_fwdtsn_hdr fwdtsn_hdr;
  481. } __attribute((packed));
  482. /* ADDIP
  483. * Section 3.1.1 Address Configuration Change Chunk (ASCONF)
  484. *
  485. * Serial Number: 32 bits (unsigned integer)
  486. * This value represents a Serial Number for the ASCONF Chunk. The
  487. * valid range of Serial Number is from 0 to 2^32-1.
  488. * Serial Numbers wrap back to 0 after reaching 2^32 -1.
  489. *
  490. * Address Parameter: 8 or 20 bytes (depending on type)
  491. * The address is an address of the sender of the ASCONF chunk,
  492. * the address MUST be considered part of the association by the
  493. * peer endpoint. This field may be used by the receiver of the
  494. * ASCONF to help in finding the association. This parameter MUST
  495. * be present in every ASCONF message i.e. it is a mandatory TLV
  496. * parameter.
  497. *
  498. * ASCONF Parameter: TLV format
  499. * Each Address configuration change is represented by a TLV
  500. * parameter as defined in Section 3.2. One or more requests may
  501. * be present in an ASCONF Chunk.
  502. *
  503. * Section 3.1.2 Address Configuration Acknowledgement Chunk (ASCONF-ACK)
  504. *
  505. * Serial Number: 32 bits (unsigned integer)
  506. * This value represents the Serial Number for the received ASCONF
  507. * Chunk that is acknowledged by this chunk. This value is copied
  508. * from the received ASCONF Chunk.
  509. *
  510. * ASCONF Parameter Response: TLV format
  511. * The ASCONF Parameter Response is used in the ASCONF-ACK to
  512. * report status of ASCONF processing.
  513. */
  514. typedef struct sctp_addip_param {
  515. sctp_paramhdr_t param_hdr;
  516. __be32 crr_id;
  517. } __attribute__((packed)) sctp_addip_param_t;
  518. typedef struct sctp_addiphdr {
  519. __be32 serial;
  520. __u8 params[0];
  521. } __attribute__((packed)) sctp_addiphdr_t;
  522. typedef struct sctp_addip_chunk {
  523. sctp_chunkhdr_t chunk_hdr;
  524. sctp_addiphdr_t addip_hdr;
  525. } __attribute__((packed)) sctp_addip_chunk_t;
  526. #endif /* __LINUX_SCTP_H__ */