1 /* @(#) $Header: /tcpdump/master/tcpdump/sctpHeader.h,v 1.2 2001-06-28 10:17:24 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 */
65 u_int verificationTag
;
69 /* various descriptor parsers */
83 struct sctpRelChunkDesc
{
84 struct sctpChunkDesc chk
;
88 struct sctpVendorSpecificParam
{
89 struct sctpParamDesc p
; /* type must be 0xfffe */
90 u_int vendorId
; /* vendor ID from RFC 1700 */
91 u_short vendorSpecificType
;
92 u_short 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_int initTag
; /* tag of mine */
105 u_int rcvWindowCredit
; /* rwnd */
106 u_short NumPreopenStreams
; /* OS */
107 u_short MaxInboundStreams
; /* MIS */
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_char ipAddress
[16];
124 struct sctpParamDesc param
;
129 struct sctpCookiePreserve
{
130 struct sctpParamDesc p
; /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
135 /* wire structure of my cookie */
136 struct cookieMessage
{
137 u_int TieTag_curTag
; /* copied from assoc if present */
138 u_int TieTag_hisTag
; /* copied from assoc if present */
139 int cookieLife
; /* life I will award this cookie */
140 struct timespec timeEnteringState
; /* the time I built cookie */
141 struct sctpInitiation initAckISent
; /* the INIT-ACK that I sent to my peer */
142 u_int addressWhereISent
[4]; /* I make this 4 ints so I get 128bits for future */
143 int addrtype
; /* address type */
144 u_short locScope
; /* V6 local scope flag */
145 u_short siteScope
; /* V6 site scope flag */
146 /* at the end is tacked on the INIT chunk sent in
147 * its entirety and of course our
153 /* this guy is for use when
154 * I have a initiate message gloming the
158 struct sctpUnifiedInit
{
159 struct sctpChunkDesc uh
;
160 struct sctpInitiation initm
;
163 struct sctpSendableInit
{
164 struct sctpHeader mh
;
165 struct sctpUnifiedInit msg
;
169 /* Selective Acknowledgement
170 * has the following structure with
171 * a optional ammount of trailing int's
172 * on the last part (based on the numberOfDesc
176 struct sctpSelectiveAck
{
177 u_int highestConseqTSN
;
179 u_short numberOfdesc
;
183 struct sctpSelectiveFrag
{
184 u_short fragmentStart
;
189 struct sctpUnifiedSack
{
190 struct sctpChunkDesc uh
;
191 struct sctpSelectiveAck sack
;
194 /* for both RTT request/response the
198 struct sctpHBrequest
{
203 /* here is what I read and respond with to. */
204 struct sctpHBunified
{
205 struct sctpChunkDesc hdr
;
206 struct sctpParamDesc hb
;
210 /* here is what I send */
212 struct sctpChunkDesc hdr
;
213 struct sctpParamDesc hb
;
214 struct sctpHBrequest rtt
;
215 char addrFmt
[SCTP_ADDRMAX
];
216 unsigned short userreq
;
221 /* for the abort and shutdown ACK
222 * we must carry the init tag in the common header. Just the
223 * common header is all that is needed with a chunk descriptor.
225 struct sctpUnifiedAbort
{
226 struct sctpChunkDesc uh
;
229 struct sctpUnifiedAbortLight
{
230 struct sctpHeader mh
;
231 struct sctpChunkDesc uh
;
234 struct sctpUnifiedAbortHeavy
{
235 struct sctpHeader mh
;
236 struct sctpChunkDesc uh
;
237 unsigned short causeCode
;
238 unsigned short causeLen
;
241 /* For the graceful shutdown we must carry
242 * the tag (in common header) and the highest consequitive acking value
244 struct sctpShutdown
{
248 struct sctpUnifiedShutdown
{
249 struct sctpChunkDesc uh
;
250 struct sctpShutdown shut
;
253 /* in the unified message we add the trailing
254 * stream id since it is the only message
255 * that is defined as a operation error.
257 struct sctpOpErrorCause
{
262 struct sctpUnifiedOpError
{
263 struct sctpChunkDesc uh
;
264 struct sctpOpErrorCause c
;
267 struct sctpUnifiedStreamError
{
268 struct sctpHeader mh
;
269 struct sctpChunkDesc uh
;
270 struct sctpOpErrorCause c
;
275 struct staleCookieMsg
{
276 struct sctpHeader mh
;
277 struct sctpChunkDesc uh
;
278 struct sctpOpErrorCause c
;
282 /* the following is used in all sends
283 * where nothing is needed except the
284 * chunk/type i.e. shutdownAck Abort */
286 struct sctpUnifiedSingleMsg
{
287 struct sctpHeader mh
;
288 struct sctpChunkDesc uh
;
298 struct sctpUnifiedDatagram
{
299 struct sctpChunkDesc uh
;
300 struct sctpDataPart dp
;
304 struct sctpChunkDesc uh
;
310 struct sctpChunkDesc uh
;
311 u_int TSN_reduced_at
;