1 /* @(#) $Header: /tcpdump/master/tcpdump/sctpHeader.h,v 1.6 2002-12-11 07:14:11 guy Exp $ (LBL) */
3 /* SCTP reference Implementation Copyright (C) 1999 Cisco And Motorola
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 4. Neither the name of Cisco nor of Motorola may be used
17 * to endorse or promote products derived from this software without
18 * specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * This file is part of the SCTP reference Implementation
35 * Please send any bug reports or fixes you make to one of the following email
38 * rstewar1@email.mot.com
42 * Any bugs reported given to us we will try to fix... any fixes shared will
43 * be incorperated into the next SCTP release.
47 #ifndef __sctpHeader_h__
48 #define __sctpHeader_h__
50 #include <sctpConstants.h>
56 /* the sctp common header */
60 u_int16_t destination
;
61 u_int32_t verificationTag
;
65 /* various descriptor parsers */
70 u_int16_t chunkLength
;
75 u_int16_t paramLength
;
79 struct sctpRelChunkDesc
{
80 struct sctpChunkDesc chk
;
81 u_int32_t serialNumber
;
84 struct sctpVendorSpecificParam
{
85 struct sctpParamDesc p
; /* type must be 0xfffe */
86 u_int32_t vendorId
; /* vendor ID from RFC 1700 */
87 u_int16_t vendorSpecificType
;
88 u_int16_t vendorSpecificLen
;
92 /* Structures for the control parts */
96 /* Sctp association init request/ack */
98 /* this is used for init ack, too */
99 struct sctpInitiation
{
100 u_int32_t initTag
; /* tag of mine */
101 u_int32_t rcvWindowCredit
; /* rwnd */
102 u_int16_t NumPreopenStreams
; /* OS */
103 u_int16_t MaxInboundStreams
; /* MIS */
104 u_int32_t initialTSN
;
105 /* optional param's follow in sctpParamDesc form */
108 struct sctpV4IpAddress
{
109 struct sctpParamDesc p
; /* type is set to SCTP_IPV4_PARAM_TYPE, len=10 */
114 struct sctpV6IpAddress
{
115 struct sctpParamDesc p
; /* type is set to SCTP_IPV6_PARAM_TYPE, len=22 */
116 u_int8_t ipAddress
[16];
120 struct sctpParamDesc param
;
125 struct sctpCookiePreserve
{
126 struct sctpParamDesc p
; /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
131 struct sctpTimeStamp
{
136 /* wire structure of my cookie */
137 struct cookieMessage
{
138 u_int32_t TieTag_curTag
; /* copied from assoc if present */
139 u_int32_t TieTag_hisTag
; /* copied from assoc if present */
140 int32_t cookieLife
; /* life I will award this cookie */
141 struct sctpTimeStamp timeEnteringState
; /* the time I built cookie */
142 struct sctpInitiation initAckISent
; /* the INIT-ACK that I sent to my peer */
143 u_int32_t addressWhereISent
[4]; /* I make this 4 ints so I get 128bits for future */
144 int32_t addrtype
; /* address type */
145 u_int16_t locScope
; /* V6 local scope flag */
146 u_int16_t siteScope
; /* V6 site scope flag */
147 /* at the end is tacked on the INIT chunk sent in
148 * its entirety and of course our
154 /* this guy is for use when
155 * I have a initiate message gloming the
159 struct sctpUnifiedInit
{
160 struct sctpChunkDesc uh
;
161 struct sctpInitiation initm
;
164 struct sctpSendableInit
{
165 struct sctpHeader mh
;
166 struct sctpUnifiedInit msg
;
170 /* Selective Acknowledgement
171 * has the following structure with
172 * a optional ammount of trailing int's
173 * on the last part (based on the numberOfDesc
177 struct sctpSelectiveAck
{
178 u_int32_t highestConseqTSN
;
179 u_int32_t updatedRwnd
;
180 u_int16_t numberOfdesc
;
181 u_int16_t numDupTsns
;
184 struct sctpSelectiveFrag
{
185 u_int16_t fragmentStart
;
186 u_int16_t fragmentEnd
;
190 struct sctpUnifiedSack
{
191 struct sctpChunkDesc uh
;
192 struct sctpSelectiveAck sack
;
195 /* for both RTT request/response the
199 struct sctpHBrequest
{
200 u_int32_t time_value_1
;
201 u_int32_t time_value_2
;
204 /* here is what I read and respond with to. */
205 struct sctpHBunified
{
206 struct sctpChunkDesc hdr
;
207 struct sctpParamDesc hb
;
211 /* here is what I send */
213 struct sctpChunkDesc hdr
;
214 struct sctpParamDesc hb
;
215 struct sctpHBrequest rtt
;
216 int8_t addrFmt
[SCTP_ADDRMAX
];
222 /* for the abort and shutdown ACK
223 * we must carry the init tag in the common header. Just the
224 * common header is all that is needed with a chunk descriptor.
226 struct sctpUnifiedAbort
{
227 struct sctpChunkDesc uh
;
230 struct sctpUnifiedAbortLight
{
231 struct sctpHeader mh
;
232 struct sctpChunkDesc uh
;
235 struct sctpUnifiedAbortHeavy
{
236 struct sctpHeader mh
;
237 struct sctpChunkDesc uh
;
242 /* For the graceful shutdown we must carry
243 * the tag (in common header) and the highest consequitive acking value
245 struct sctpShutdown
{
249 struct sctpUnifiedShutdown
{
250 struct sctpChunkDesc uh
;
251 struct sctpShutdown shut
;
254 /* in the unified message we add the trailing
255 * stream id since it is the only message
256 * that is defined as a operation error.
258 struct sctpOpErrorCause
{
263 struct sctpUnifiedOpError
{
264 struct sctpChunkDesc uh
;
265 struct sctpOpErrorCause c
;
268 struct sctpUnifiedStreamError
{
269 struct sctpHeader mh
;
270 struct sctpChunkDesc uh
;
271 struct sctpOpErrorCause c
;
276 struct staleCookieMsg
{
277 struct sctpHeader mh
;
278 struct sctpChunkDesc uh
;
279 struct sctpOpErrorCause c
;
283 /* the following is used in all sends
284 * where nothing is needed except the
285 * chunk/type i.e. shutdownAck Abort */
287 struct sctpUnifiedSingleMsg
{
288 struct sctpHeader mh
;
289 struct sctpChunkDesc uh
;
296 u_int32_t payloadtype
;
299 struct sctpUnifiedDatagram
{
300 struct sctpChunkDesc uh
;
301 struct sctpDataPart dp
;
305 struct sctpChunkDesc uh
;
306 u_int32_t Lowest_TSN
;
311 struct sctpChunkDesc uh
;
312 u_int32_t TSN_reduced_at
;