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