some more minor stuff and a lot of debugging stuff that will be removed later.
[dragonfly/vkernel-mp.git] / contrib / tcpdump-3.9 / sctpHeader.h
blob3b26094c1b82d60e7a395163a62ba053de0addc4
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
7 * are met:
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
30 * SUCH DAMAGE.
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
36 * addresses:
38 * rstewar1@email.mot.com
39 * kmorneau@cisco.com
40 * qxie1@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>
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
56 /* the sctp common header */
58 #ifdef TRU64
59 #define _64BITS 1
60 #endif
62 struct sctpHeader{
63 u_int16_t source;
64 u_int16_t destination;
65 u_int32_t verificationTag;
66 u_int32_t adler32;
69 /* various descriptor parsers */
71 struct sctpChunkDesc{
72 u_int8_t chunkID;
73 u_int8_t chunkFlg;
74 u_int16_t chunkLength;
77 struct sctpParamDesc{
78 u_int16_t paramType;
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 */
114 u_int32_t ipAddress;
118 struct sctpV6IpAddress{
119 struct sctpParamDesc p; /* type is set to SCTP_IPV6_PARAM_TYPE, len=22 */
120 u_int8_t ipAddress[16];
123 struct sctpDNSName{
124 struct sctpParamDesc param;
125 u_int8_t name[1];
129 struct sctpCookiePreserve{
130 struct sctpParamDesc p; /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
131 u_int32_t extraTime;
135 struct sctpTimeStamp{
136 u_int32_t ts_sec;
137 u_int32_t ts_usec;
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
153 * signature.
158 /* this guy is for use when
159 * I have a initiate message gloming the
160 * things together.
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
178 * field).
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
200 * following is sent
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 */
216 struct sctpHBsender{
217 struct sctpChunkDesc hdr;
218 struct sctpParamDesc hb;
219 struct sctpHBrequest rtt;
220 int8_t addrFmt[SCTP_ADDRMAX];
221 u_int16_t userreq;
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;
242 u_int16_t causeCode;
243 u_int16_t causeLen;
246 /* For the graceful shutdown we must carry
247 * the tag (in common header) and the highest consequitive acking value
249 struct sctpShutdown {
250 u_int32_t TSN_Seen;
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{
263 u_int16_t cause;
264 u_int16_t causeLen;
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;
276 u_int16_t strmNum;
277 u_int16_t reserved;
280 struct staleCookieMsg{
281 struct sctpHeader mh;
282 struct sctpChunkDesc uh;
283 struct sctpOpErrorCause c;
284 u_int32_t moretime;
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;
296 struct sctpDataPart{
297 u_int32_t TSN;
298 u_int16_t streamId;
299 u_int16_t sequence;
300 u_int32_t payloadtype;
303 struct sctpUnifiedDatagram{
304 struct sctpChunkDesc uh;
305 struct sctpDataPart dp;
308 struct sctpECN_echo{
309 struct sctpChunkDesc uh;
310 u_int32_t Lowest_TSN;
314 struct sctpCWR{
315 struct sctpChunkDesc uh;
316 u_int32_t TSN_reduced_at;
319 #ifdef __cplusplus
321 #endif
323 #endif