sctp_header.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. /*-
  2. * SPDX-License-Identifier: BSD-3-Clause
  3. *
  4. * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
  5. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
  6. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions are met:
  10. *
  11. * a) Redistributions of source code must retain the above copyright notice,
  12. * this list of conditions and the following disclaimer.
  13. *
  14. * b) Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in
  16. * the documentation and/or other materials provided with the distribution.
  17. *
  18. * c) Neither the name of Cisco Systems, Inc. nor the names of its
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  24. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  26. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  27. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  28. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  29. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  30. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  31. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  32. * THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #if defined(__FreeBSD__) && !defined(__Userspace__)
  35. #include <sys/cdefs.h>
  36. __FBSDID("$FreeBSD$");
  37. #endif
  38. #ifndef _NETINET_SCTP_HEADER_H_
  39. #define _NETINET_SCTP_HEADER_H_
  40. #if defined(_WIN32) && !defined(__Userspace__)
  41. #include <packon.h>
  42. #endif
  43. #if !defined(_WIN32)
  44. #include <sys/time.h>
  45. #endif
  46. #include <netinet/sctp.h>
  47. #include <netinet/sctp_constants.h>
  48. #if !defined(_WIN32)
  49. #define SCTP_PACKED __attribute__((packed))
  50. #else
  51. #pragma pack (push, 1)
  52. #define SCTP_PACKED
  53. #endif
  54. /*
  55. * Parameter structures
  56. */
  57. struct sctp_ipv4addr_param {
  58. struct sctp_paramhdr ph;/* type=SCTP_IPV4_PARAM_TYPE, len=8 */
  59. uint32_t addr; /* IPV4 address */
  60. } SCTP_PACKED;
  61. #define SCTP_V6_ADDR_BYTES 16
  62. struct sctp_ipv6addr_param {
  63. struct sctp_paramhdr ph;/* type=SCTP_IPV6_PARAM_TYPE, len=20 */
  64. uint8_t addr[SCTP_V6_ADDR_BYTES]; /* IPV6 address */
  65. } SCTP_PACKED;
  66. /* Cookie Preservative */
  67. struct sctp_cookie_perserve_param {
  68. struct sctp_paramhdr ph;/* type=SCTP_COOKIE_PRESERVE, len=8 */
  69. uint32_t time; /* time in ms to extend cookie */
  70. } SCTP_PACKED;
  71. #define SCTP_ARRAY_MIN_LEN 1
  72. /* Host Name Address */
  73. struct sctp_host_name_param {
  74. struct sctp_paramhdr ph;/* type=SCTP_HOSTNAME_ADDRESS */
  75. char name[SCTP_ARRAY_MIN_LEN]; /* host name */
  76. } SCTP_PACKED;
  77. /*
  78. * This is the maximum padded size of a s-a-p
  79. * so paramheadr + 3 address types (6 bytes) + 2 byte pad = 12
  80. */
  81. #define SCTP_MAX_ADDR_PARAMS_SIZE 12
  82. /* supported address type */
  83. struct sctp_supported_addr_param {
  84. struct sctp_paramhdr ph;/* type=SCTP_SUPPORTED_ADDRTYPE */
  85. uint16_t addr_type[2]; /* array of supported address types */
  86. } SCTP_PACKED;
  87. /* heartbeat info parameter */
  88. struct sctp_heartbeat_info_param {
  89. struct sctp_paramhdr ph;
  90. uint32_t time_value_1;
  91. uint32_t time_value_2;
  92. uint32_t random_value1;
  93. uint32_t random_value2;
  94. uint8_t addr_family;
  95. uint8_t addr_len;
  96. /* make sure that this structure is 4 byte aligned */
  97. uint8_t padding[2];
  98. char address[SCTP_ADDRMAX];
  99. } SCTP_PACKED;
  100. /* draft-ietf-tsvwg-prsctp */
  101. /* PR-SCTP supported parameter */
  102. struct sctp_prsctp_supported_param {
  103. struct sctp_paramhdr ph;
  104. } SCTP_PACKED;
  105. /* draft-ietf-tsvwg-addip-sctp */
  106. struct sctp_asconf_paramhdr { /* an ASCONF "parameter" */
  107. struct sctp_paramhdr ph;/* a SCTP parameter header */
  108. uint32_t correlation_id;/* correlation id for this param */
  109. } SCTP_PACKED;
  110. struct sctp_asconf_addr_param { /* an ASCONF address parameter */
  111. struct sctp_asconf_paramhdr aph; /* asconf "parameter" */
  112. struct sctp_ipv6addr_param addrp; /* max storage size */
  113. } SCTP_PACKED;
  114. struct sctp_asconf_tag_param { /* an ASCONF NAT-Vtag parameter */
  115. struct sctp_asconf_paramhdr aph; /* asconf "parameter" */
  116. uint32_t local_vtag;
  117. uint32_t remote_vtag;
  118. } SCTP_PACKED;
  119. struct sctp_asconf_addrv4_param { /* an ASCONF address (v4) parameter */
  120. struct sctp_asconf_paramhdr aph; /* asconf "parameter" */
  121. struct sctp_ipv4addr_param addrp; /* max storage size */
  122. } SCTP_PACKED;
  123. #define SCTP_MAX_SUPPORTED_EXT 256
  124. struct sctp_supported_chunk_types_param {
  125. struct sctp_paramhdr ph;/* type = 0x8008 len = x */
  126. uint8_t chunk_types[];
  127. } SCTP_PACKED;
  128. /*
  129. * Structures for DATA chunks
  130. */
  131. struct sctp_data {
  132. uint32_t tsn;
  133. uint16_t sid;
  134. uint16_t ssn;
  135. uint32_t ppid;
  136. /* user data follows */
  137. } SCTP_PACKED;
  138. struct sctp_data_chunk {
  139. struct sctp_chunkhdr ch;
  140. struct sctp_data dp;
  141. } SCTP_PACKED;
  142. struct sctp_idata {
  143. uint32_t tsn;
  144. uint16_t sid;
  145. uint16_t reserved; /* Where does the SSN go? */
  146. uint32_t mid;
  147. union {
  148. uint32_t ppid;
  149. uint32_t fsn; /* Fragment Sequence Number */
  150. } ppid_fsn;
  151. /* user data follows */
  152. } SCTP_PACKED;
  153. struct sctp_idata_chunk {
  154. struct sctp_chunkhdr ch;
  155. struct sctp_idata dp;
  156. } SCTP_PACKED;
  157. /*
  158. * Structures for the control chunks
  159. */
  160. /* Initiate (INIT)/Initiate Ack (INIT ACK) */
  161. struct sctp_init {
  162. uint32_t initiate_tag; /* initiate tag */
  163. uint32_t a_rwnd; /* a_rwnd */
  164. uint16_t num_outbound_streams; /* OS */
  165. uint16_t num_inbound_streams; /* MIS */
  166. uint32_t initial_tsn; /* I-TSN */
  167. /* optional param's follow */
  168. } SCTP_PACKED;
  169. #define SCTP_IDENTIFICATION_SIZE 16
  170. #define SCTP_ADDRESS_SIZE 4
  171. #if defined(__Userspace__)
  172. #define SCTP_RESERVE_SPACE 5
  173. #else
  174. #define SCTP_RESERVE_SPACE 6
  175. #endif
  176. /* state cookie header */
  177. struct sctp_state_cookie { /* this is our definition... */
  178. uint8_t identification[SCTP_IDENTIFICATION_SIZE];/* id of who we are */
  179. struct timeval time_entered; /* the time I built cookie */
  180. uint32_t cookie_life; /* life I will award this cookie */
  181. uint32_t tie_tag_my_vtag; /* my tag in old association */
  182. uint32_t tie_tag_peer_vtag; /* peers tag in old association */
  183. uint32_t peers_vtag; /* peers tag in INIT (for quick ref) */
  184. uint32_t my_vtag; /* my tag in INIT-ACK (for quick ref) */
  185. uint32_t address[SCTP_ADDRESS_SIZE]; /* 4 ints/128 bits */
  186. uint32_t addr_type; /* address type */
  187. uint32_t laddress[SCTP_ADDRESS_SIZE]; /* my local from address */
  188. uint32_t laddr_type; /* my local from address type */
  189. uint32_t scope_id; /* v6 scope id for link-locals */
  190. uint16_t peerport; /* port address of the peer in the INIT */
  191. uint16_t myport; /* my port address used in the INIT */
  192. uint8_t ipv4_addr_legal;/* Are V4 addr legal? */
  193. uint8_t ipv6_addr_legal;/* Are V6 addr legal? */
  194. #if defined(__Userspace__)
  195. uint8_t conn_addr_legal;
  196. #endif
  197. uint8_t local_scope; /* IPv6 local scope flag */
  198. uint8_t site_scope; /* IPv6 site scope flag */
  199. uint8_t ipv4_scope; /* IPv4 private addr scope */
  200. uint8_t loopback_scope; /* loopback scope information */
  201. uint8_t reserved[SCTP_RESERVE_SPACE]; /* Align to 64 bits */
  202. /*
  203. * at the end is tacked on the INIT chunk and the INIT-ACK chunk
  204. * (minus the cookie).
  205. */
  206. } SCTP_PACKED;
  207. /* state cookie parameter */
  208. struct sctp_state_cookie_param {
  209. struct sctp_paramhdr ph;
  210. struct sctp_state_cookie cookie;
  211. } SCTP_PACKED;
  212. struct sctp_init_chunk {
  213. struct sctp_chunkhdr ch;
  214. struct sctp_init init;
  215. } SCTP_PACKED;
  216. struct sctp_init_msg {
  217. struct sctphdr sh;
  218. struct sctp_init_chunk msg;
  219. } SCTP_PACKED;
  220. /* ... used for both INIT and INIT ACK */
  221. #define sctp_init_ack sctp_init
  222. #define sctp_init_ack_chunk sctp_init_chunk
  223. #define sctp_init_ack_msg sctp_init_msg
  224. /* Selective Ack (SACK) */
  225. struct sctp_gap_ack_block {
  226. uint16_t start; /* Gap Ack block start */
  227. uint16_t end; /* Gap Ack block end */
  228. } SCTP_PACKED;
  229. struct sctp_sack {
  230. uint32_t cum_tsn_ack; /* cumulative TSN Ack */
  231. uint32_t a_rwnd; /* updated a_rwnd of sender */
  232. uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */
  233. uint16_t num_dup_tsns; /* number of duplicate TSNs */
  234. /* struct sctp_gap_ack_block's follow */
  235. /* uint32_t duplicate_tsn's follow */
  236. } SCTP_PACKED;
  237. struct sctp_sack_chunk {
  238. struct sctp_chunkhdr ch;
  239. struct sctp_sack sack;
  240. } SCTP_PACKED;
  241. struct sctp_nr_sack {
  242. uint32_t cum_tsn_ack; /* cumulative TSN Ack */
  243. uint32_t a_rwnd; /* updated a_rwnd of sender */
  244. uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */
  245. uint16_t num_nr_gap_ack_blks; /* number of NR Gap Ack blocks */
  246. uint16_t num_dup_tsns; /* number of duplicate TSNs */
  247. uint16_t reserved; /* not currently used*/
  248. /* struct sctp_gap_ack_block's follow */
  249. /* uint32_t duplicate_tsn's follow */
  250. } SCTP_PACKED;
  251. struct sctp_nr_sack_chunk {
  252. struct sctp_chunkhdr ch;
  253. struct sctp_nr_sack nr_sack;
  254. } SCTP_PACKED;
  255. /* Heartbeat Request (HEARTBEAT) */
  256. struct sctp_heartbeat {
  257. struct sctp_heartbeat_info_param hb_info;
  258. } SCTP_PACKED;
  259. struct sctp_heartbeat_chunk {
  260. struct sctp_chunkhdr ch;
  261. struct sctp_heartbeat heartbeat;
  262. } SCTP_PACKED;
  263. /* ... used for Heartbeat Ack (HEARTBEAT ACK) */
  264. #define sctp_heartbeat_ack sctp_heartbeat
  265. #define sctp_heartbeat_ack_chunk sctp_heartbeat_chunk
  266. /* Abort Asssociation (ABORT) */
  267. struct sctp_abort_chunk {
  268. struct sctp_chunkhdr ch;
  269. /* optional error cause may follow */
  270. } SCTP_PACKED;
  271. struct sctp_abort_msg {
  272. struct sctphdr sh;
  273. struct sctp_abort_chunk msg;
  274. } SCTP_PACKED;
  275. /* Shutdown Association (SHUTDOWN) */
  276. struct sctp_shutdown_chunk {
  277. struct sctp_chunkhdr ch;
  278. uint32_t cumulative_tsn_ack;
  279. } SCTP_PACKED;
  280. /* Shutdown Acknowledgment (SHUTDOWN ACK) */
  281. struct sctp_shutdown_ack_chunk {
  282. struct sctp_chunkhdr ch;
  283. } SCTP_PACKED;
  284. /* Operation Error (ERROR) */
  285. struct sctp_error_chunk {
  286. struct sctp_chunkhdr ch;
  287. /* optional error causes follow */
  288. } SCTP_PACKED;
  289. /* Cookie Echo (COOKIE ECHO) */
  290. struct sctp_cookie_echo_chunk {
  291. struct sctp_chunkhdr ch;
  292. struct sctp_state_cookie cookie;
  293. } SCTP_PACKED;
  294. /* Cookie Acknowledgment (COOKIE ACK) */
  295. struct sctp_cookie_ack_chunk {
  296. struct sctp_chunkhdr ch;
  297. } SCTP_PACKED;
  298. /* Explicit Congestion Notification Echo (ECNE) */
  299. struct old_sctp_ecne_chunk {
  300. struct sctp_chunkhdr ch;
  301. uint32_t tsn;
  302. } SCTP_PACKED;
  303. struct sctp_ecne_chunk {
  304. struct sctp_chunkhdr ch;
  305. uint32_t tsn;
  306. uint32_t num_pkts_since_cwr;
  307. } SCTP_PACKED;
  308. /* Congestion Window Reduced (CWR) */
  309. struct sctp_cwr_chunk {
  310. struct sctp_chunkhdr ch;
  311. uint32_t tsn;
  312. } SCTP_PACKED;
  313. /* Shutdown Complete (SHUTDOWN COMPLETE) */
  314. struct sctp_shutdown_complete_chunk {
  315. struct sctp_chunkhdr ch;
  316. } SCTP_PACKED;
  317. struct sctp_adaptation_layer_indication {
  318. struct sctp_paramhdr ph;
  319. uint32_t indication;
  320. } SCTP_PACKED;
  321. /*
  322. * draft-ietf-tsvwg-addip-sctp
  323. */
  324. /* Address/Stream Configuration Change (ASCONF) */
  325. struct sctp_asconf_chunk {
  326. struct sctp_chunkhdr ch;
  327. uint32_t serial_number;
  328. /* lookup address parameter (mandatory) */
  329. /* asconf parameters follow */
  330. } SCTP_PACKED;
  331. /* Address/Stream Configuration Acknowledge (ASCONF ACK) */
  332. struct sctp_asconf_ack_chunk {
  333. struct sctp_chunkhdr ch;
  334. uint32_t serial_number;
  335. /* asconf parameters follow */
  336. } SCTP_PACKED;
  337. /* draft-ietf-tsvwg-prsctp */
  338. /* Forward Cumulative TSN (FORWARD TSN) */
  339. struct sctp_forward_tsn_chunk {
  340. struct sctp_chunkhdr ch;
  341. uint32_t new_cumulative_tsn;
  342. /* stream/sequence pairs (sctp_strseq) follow */
  343. } SCTP_PACKED;
  344. struct sctp_strseq {
  345. uint16_t sid;
  346. uint16_t ssn;
  347. } SCTP_PACKED;
  348. struct sctp_strseq_mid {
  349. uint16_t sid;
  350. uint16_t flags;
  351. uint32_t mid;
  352. };
  353. struct sctp_forward_tsn_msg {
  354. struct sctphdr sh;
  355. struct sctp_forward_tsn_chunk msg;
  356. } SCTP_PACKED;
  357. /* should be a multiple of 4 - 1 aka 3/7/11 etc. */
  358. #define SCTP_NUM_DB_TO_VERIFY 31
  359. struct sctp_chunk_desc {
  360. uint8_t chunk_type;
  361. uint8_t data_bytes[SCTP_NUM_DB_TO_VERIFY];
  362. uint32_t tsn_ifany;
  363. } SCTP_PACKED;
  364. struct sctp_pktdrop_chunk {
  365. struct sctp_chunkhdr ch;
  366. uint32_t bottle_bw;
  367. uint32_t current_onq;
  368. uint16_t trunc_len;
  369. uint16_t reserved;
  370. uint8_t data[];
  371. } SCTP_PACKED;
  372. /**********STREAM RESET STUFF ******************/
  373. struct sctp_stream_reset_request {
  374. struct sctp_paramhdr ph;
  375. uint32_t request_seq;
  376. } SCTP_PACKED;
  377. struct sctp_stream_reset_out_request {
  378. struct sctp_paramhdr ph;
  379. uint32_t request_seq; /* monotonically increasing seq no */
  380. uint32_t response_seq; /* if a response, the resp seq no */
  381. uint32_t send_reset_at_tsn; /* last TSN I assigned outbound */
  382. uint16_t list_of_streams[]; /* if not all list of streams */
  383. } SCTP_PACKED;
  384. struct sctp_stream_reset_in_request {
  385. struct sctp_paramhdr ph;
  386. uint32_t request_seq;
  387. uint16_t list_of_streams[]; /* if not all list of streams */
  388. } SCTP_PACKED;
  389. struct sctp_stream_reset_tsn_request {
  390. struct sctp_paramhdr ph;
  391. uint32_t request_seq;
  392. } SCTP_PACKED;
  393. struct sctp_stream_reset_response {
  394. struct sctp_paramhdr ph;
  395. uint32_t response_seq; /* if a response, the resp seq no */
  396. uint32_t result;
  397. } SCTP_PACKED;
  398. struct sctp_stream_reset_response_tsn {
  399. struct sctp_paramhdr ph;
  400. uint32_t response_seq; /* if a response, the resp seq no */
  401. uint32_t result;
  402. uint32_t senders_next_tsn;
  403. uint32_t receivers_next_tsn;
  404. } SCTP_PACKED;
  405. struct sctp_stream_reset_add_strm {
  406. struct sctp_paramhdr ph;
  407. uint32_t request_seq;
  408. uint16_t number_of_streams;
  409. uint16_t reserved;
  410. } SCTP_PACKED;
  411. #define SCTP_STREAM_RESET_RESULT_NOTHING_TO_DO 0x00000000 /* XXX: unused */
  412. #define SCTP_STREAM_RESET_RESULT_PERFORMED 0x00000001
  413. #define SCTP_STREAM_RESET_RESULT_DENIED 0x00000002
  414. #define SCTP_STREAM_RESET_RESULT_ERR__WRONG_SSN 0x00000003 /* XXX: unused */
  415. #define SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS 0x00000004
  416. #define SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO 0x00000005
  417. #define SCTP_STREAM_RESET_RESULT_IN_PROGRESS 0x00000006 /* XXX: unused */
  418. /*
  419. * convience structures, note that if you are making a request for specific
  420. * streams then the request will need to be an overlay structure.
  421. */
  422. struct sctp_stream_reset_tsn_req {
  423. struct sctp_chunkhdr ch;
  424. struct sctp_stream_reset_tsn_request sr_req;
  425. } SCTP_PACKED;
  426. struct sctp_stream_reset_resp {
  427. struct sctp_chunkhdr ch;
  428. struct sctp_stream_reset_response sr_resp;
  429. } SCTP_PACKED;
  430. /* respone only valid with a TSN request */
  431. struct sctp_stream_reset_resp_tsn {
  432. struct sctp_chunkhdr ch;
  433. struct sctp_stream_reset_response_tsn sr_resp;
  434. } SCTP_PACKED;
  435. /****************************************************/
  436. /*
  437. * Authenticated chunks support draft-ietf-tsvwg-sctp-auth
  438. */
  439. /* Should we make the max be 32? */
  440. #define SCTP_RANDOM_MAX_SIZE 256
  441. struct sctp_auth_random {
  442. struct sctp_paramhdr ph;/* type = 0x8002 */
  443. uint8_t random_data[];
  444. } SCTP_PACKED;
  445. struct sctp_auth_chunk_list {
  446. struct sctp_paramhdr ph;/* type = 0x8003 */
  447. uint8_t chunk_types[];
  448. } SCTP_PACKED;
  449. struct sctp_auth_hmac_algo {
  450. struct sctp_paramhdr ph;/* type = 0x8004 */
  451. uint16_t hmac_ids[];
  452. } SCTP_PACKED;
  453. struct sctp_auth_chunk {
  454. struct sctp_chunkhdr ch;
  455. uint16_t shared_key_id;
  456. uint16_t hmac_id;
  457. uint8_t hmac[];
  458. } SCTP_PACKED;
  459. /*
  460. * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing
  461. * pieces. If ENCE is missing we could have a couple of blocks. This way we
  462. * optimize so we MOST likely can bundle a SACK/ECN with the smallest size
  463. * data chunk I will split into. We could increase throughput slightly by
  464. * taking out these two but the 24-sack/8-CWR i.e. 32 bytes I pre-reserve I
  465. * feel is worth it for now.
  466. */
  467. #ifndef SCTP_MAX_OVERHEAD
  468. #ifdef INET6
  469. #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  470. sizeof(struct sctphdr) + \
  471. sizeof(struct sctp_ecne_chunk) + \
  472. sizeof(struct sctp_sack_chunk) + \
  473. sizeof(struct ip6_hdr))
  474. #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  475. sizeof(struct sctphdr) + \
  476. sizeof(struct ip6_hdr))
  477. #define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \
  478. sizeof(struct sctphdr))
  479. #else
  480. #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  481. sizeof(struct sctphdr) + \
  482. sizeof(struct sctp_ecne_chunk) + \
  483. sizeof(struct sctp_sack_chunk) + \
  484. sizeof(struct ip))
  485. #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  486. sizeof(struct sctphdr) + \
  487. sizeof(struct ip))
  488. #define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
  489. sizeof(struct sctphdr))
  490. #endif /* INET6 */
  491. #endif /* !SCTP_MAX_OVERHEAD */
  492. #define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  493. sizeof(struct sctphdr) + \
  494. sizeof(struct ip))
  495. #define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \
  496. sizeof(struct sctphdr))
  497. #if defined(_WIN32) && !defined(__Userspace__)
  498. #include <packoff.h>
  499. #endif
  500. #if defined(_WIN32) && defined(__Userspace__)
  501. #pragma pack(pop)
  502. #endif
  503. #undef SCTP_PACKED
  504. #endif /* !__sctp_header_h__ */