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 */
64 u_int16_t destination;
65 u_int32_t verificationTag;
69 /* various descriptor parsers */
74 u_int16_t chunkLength;
79 u_int16_t paramLength;
83 struct sctpRelChunkDesc{
84 struct sctpChunkDesc chk;
85 u_int32_t serialNumber;
88 struct sctpVendorSpecificParam {
89 struct sctpParamDesc p; /* type must be 0xfffe */
90 u_int32_t vendorId; /* vendor ID from RFC 1700 */
91 u_int16_t vendorSpecificType;
92 u_int16_t vendorSpecificLen;
96 /* Structures for the control parts */
100 /* Sctp association init request/ack */
102 /* this is used for init ack, too */
103 struct sctpInitiation{
104 u_int32_t initTag; /* tag of mine */
105 u_int32_t rcvWindowCredit; /* rwnd */
106 u_int16_t NumPreopenStreams; /* OS */
107 u_int16_t MaxInboundStreams; /* MIS */
108 u_int32_t initialTSN;
109 /* optional param's follow in sctpParamDesc form */
112 struct sctpV4IpAddress{
113 struct sctpParamDesc p; /* type is set to SCTP_IPV4_PARAM_TYPE, len=10 */
118 struct sctpV6IpAddress{
119 struct sctpParamDesc p; /* type is set to SCTP_IPV6_PARAM_TYPE, len=22 */
120 u_int8_t ipAddress[16];
124 struct sctpParamDesc param;
129 struct sctpCookiePreserve{
130 struct sctpParamDesc p; /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
135 struct sctpTimeStamp{
140 /* wire structure of my cookie */
141 struct cookieMessage{
142 u_int32_t TieTag_curTag; /* copied from assoc if present */
143 u_int32_t TieTag_hisTag; /* copied from assoc if present */
144 int32_t cookieLife; /* life I will award this cookie */
145 struct sctpTimeStamp timeEnteringState; /* the time I built cookie */
146 struct sctpInitiation initAckISent; /* the INIT-ACK that I sent to my peer */
147 u_int32_t addressWhereISent[4]; /* I make this 4 ints so I get 128bits for future */
148 int32_t addrtype; /* address type */
149 u_int16_t locScope; /* V6 local scope flag */
150 u_int16_t siteScope; /* V6 site scope flag */
151 /* at the end is tacked on the INIT chunk sent in
152 * its entirety and of course our
158 /* this guy is for use when
159 * I have a initiate message gloming the
163 struct sctpUnifiedInit{
164 struct sctpChunkDesc uh;
165 struct sctpInitiation initm;
168 struct sctpSendableInit{
169 struct sctpHeader mh;
170 struct sctpUnifiedInit msg;
174 /* Selective Acknowledgement
175 * has the following structure with
176 * a optional ammount of trailing int's
177 * on the last part (based on the numberOfDesc
181 struct sctpSelectiveAck{
182 u_int32_t highestConseqTSN;
183 u_int32_t updatedRwnd;
184 u_int16_t numberOfdesc;
185 u_int16_t numDupTsns;
188 struct sctpSelectiveFrag{
189 u_int16_t fragmentStart;
190 u_int16_t fragmentEnd;
194 struct sctpUnifiedSack{
195 struct sctpChunkDesc uh;
196 struct sctpSelectiveAck sack;
199 /* for both RTT request/response the
203 struct sctpHBrequest {
204 u_int32_t time_value_1;
205 u_int32_t time_value_2;
208 /* here is what I read and respond with to. */
209 struct sctpHBunified{
210 struct sctpChunkDesc hdr;
211 struct sctpParamDesc hb;
215 /* here is what I send */
217 struct sctpChunkDesc hdr;
218 struct sctpParamDesc hb;
219 struct sctpHBrequest rtt;
220 int8_t addrFmt[SCTP_ADDRMAX];
226 /* for the abort and shutdown ACK
227 * we must carry the init tag in the common header. Just the
228 * common header is all that is needed with a chunk descriptor.
230 struct sctpUnifiedAbort{
231 struct sctpChunkDesc uh;
234 struct sctpUnifiedAbortLight{
235 struct sctpHeader mh;
236 struct sctpChunkDesc uh;
239 struct sctpUnifiedAbortHeavy{
240 struct sctpHeader mh;
241 struct sctpChunkDesc uh;
246 /* For the graceful shutdown we must carry
247 * the tag (in common header) and the highest consequitive acking value
249 struct sctpShutdown {
253 struct sctpUnifiedShutdown{
254 struct sctpChunkDesc uh;
255 struct sctpShutdown shut;
258 /* in the unified message we add the trailing
259 * stream id since it is the only message
260 * that is defined as a operation error.
262 struct sctpOpErrorCause{
267 struct sctpUnifiedOpError{
268 struct sctpChunkDesc uh;
269 struct sctpOpErrorCause c;
272 struct sctpUnifiedStreamError{
273 struct sctpHeader mh;
274 struct sctpChunkDesc uh;
275 struct sctpOpErrorCause c;
280 struct staleCookieMsg{
281 struct sctpHeader mh;
282 struct sctpChunkDesc uh;
283 struct sctpOpErrorCause c;
287 /* the following is used in all sends
288 * where nothing is needed except the
289 * chunk/type i.e. shutdownAck Abort */
291 struct sctpUnifiedSingleMsg{
292 struct sctpHeader mh;
293 struct sctpChunkDesc uh;
300 u_int32_t payloadtype;
303 struct sctpUnifiedDatagram{
304 struct sctpChunkDesc uh;
305 struct sctpDataPart dp;
309 struct sctpChunkDesc uh;
310 u_int32_t Lowest_TSN;
315 struct sctpChunkDesc uh;
316 u_int32_t TSN_reduced_at;