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