]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/tcpdump/sctpHeader.h
This commit was generated by cvs2svn to compensate for changes in r122912,
[FreeBSD/FreeBSD.git] / contrib / tcpdump / sctpHeader.h
1 /* @(#) $Header: /tcpdump/master/tcpdump/sctpHeader.h,v 1.3 2001/08/01 03:34:00 guy Exp $ (LBL) */
2
3 /* SCTP reference Implementation Copyright (C) 1999 Cisco And Motorola
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
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.
15  *
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.
19  *
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.
31  *
32  * This file is part of the SCTP reference Implementation
33  *
34  * 
35  * Please send any bug reports or fixes you make to one of the following email
36  * addresses:
37  * 
38  * rstewar1@email.mot.com
39  * kmorneau@cisco.com
40  * qxie1@email.mot.com
41  * 
42  * Any bugs reported given to us we will try to fix... any fixes shared will
43  * be incorperated into the next SCTP release.
44  */
45
46
47 #ifndef __sctpHeader_h__
48 #define __sctpHeader_h__
49
50 #include <sctpConstants.h>
51
52 #ifdef  __cplusplus
53 extern "C" {
54 #endif
55
56 /* the sctp common header */
57
58 #ifdef TRU64
59  #define _64BITS 1
60 #endif 
61
62 struct sctpHeader{
63   u_short source;
64   u_short destination;
65   u_int verificationTag;
66   u_int adler32;
67 };
68
69 /* various descriptor parsers */
70
71 struct sctpChunkDesc{
72   u_char chunkID;
73   u_char chunkFlg;
74   u_short chunkLength;
75 };
76
77 struct sctpParamDesc{
78   u_short paramType;
79   u_short paramLength;
80 };
81
82
83 struct sctpRelChunkDesc{
84   struct sctpChunkDesc chk;
85   u_int serialNumber;
86 };
87
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;
93 };
94
95
96 /* Structures for the control parts */
97
98
99
100 /* Sctp association init request/ack */
101
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 */
108   u_int initialTSN;
109   /* optional param's follow in sctpParamDesc form */
110 };
111
112 struct sctpV4IpAddress{
113   struct sctpParamDesc p;       /* type is set to SCTP_IPV4_PARAM_TYPE, len=10 */
114   u_int  ipAddress;
115 };
116
117
118 struct sctpV6IpAddress{
119   struct sctpParamDesc p;       /* type is set to SCTP_IPV6_PARAM_TYPE, len=22 */
120   u_char  ipAddress[16];
121 };
122
123 struct sctpDNSName{
124   struct sctpParamDesc param;
125   u_char name[1];
126 };
127
128
129 struct sctpCookiePreserve{
130   struct sctpParamDesc p;       /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
131   u_int extraTime;
132 };
133
134
135 struct sctpTimeStamp{
136   u_int ts_sec;
137   u_int ts_usec;
138 };
139
140 /* wire structure of my cookie */
141 struct cookieMessage{
142   u_int TieTag_curTag;                  /* copied from assoc if present */
143   u_int TieTag_hisTag;          /* copied from assoc if present */
144   int 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_int addressWhereISent[4];           /* I make this 4 ints so I get 128bits for future */
148   int addrtype;                         /* address type */
149   u_short locScope;                     /* V6 local scope flag */
150   u_short 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.
154    */
155 };
156
157
158 /* this guy is for use when
159  * I have a initiate message gloming the
160  * things together.
161
162  */
163 struct sctpUnifiedInit{
164   struct sctpChunkDesc uh;
165   struct sctpInitiation initm;
166 };
167
168 struct sctpSendableInit{
169   struct sctpHeader mh;
170   struct sctpUnifiedInit msg;
171 };
172
173
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).
179  */
180
181 struct sctpSelectiveAck{
182   u_int highestConseqTSN;
183   u_int updatedRwnd;
184   u_short numberOfdesc;
185   u_short numDupTsns;
186 };
187
188 struct sctpSelectiveFrag{
189   u_short fragmentStart;
190   u_short fragmentEnd;
191 };
192
193
194 struct sctpUnifiedSack{
195   struct sctpChunkDesc uh;
196   struct sctpSelectiveAck sack;
197 };
198
199 /* for both RTT request/response the
200  * following is sent 
201  */
202
203 struct sctpHBrequest {
204   u_int time_value_1;
205   u_int time_value_2;
206 };
207
208 /* here is what I read and respond with to. */
209 struct sctpHBunified{
210   struct sctpChunkDesc hdr;
211   struct sctpParamDesc hb;
212 };
213
214
215 /* here is what I send */
216 struct sctpHBsender{
217   struct sctpChunkDesc hdr;
218   struct sctpParamDesc hb;
219   struct sctpHBrequest rtt;
220   char addrFmt[SCTP_ADDRMAX];
221   unsigned short userreq;
222 };
223   
224
225
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.
229  */
230 struct sctpUnifiedAbort{
231   struct sctpChunkDesc uh;
232 };
233
234 struct sctpUnifiedAbortLight{
235   struct sctpHeader mh;
236   struct sctpChunkDesc uh;
237 };
238
239 struct sctpUnifiedAbortHeavy{
240   struct sctpHeader mh;
241   struct sctpChunkDesc uh;
242   unsigned short causeCode;
243   unsigned short causeLen;
244 };
245
246 /* For the graceful shutdown we must carry
247  * the tag (in common header)  and the highest consequitive acking value
248  */
249 struct sctpShutdown {
250   u_int TSN_Seen;
251 };
252
253 struct sctpUnifiedShutdown{
254   struct sctpChunkDesc uh;
255   struct sctpShutdown shut;
256 };
257
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.
261  */
262 struct sctpOpErrorCause{
263   u_short cause;
264   u_short causeLen;
265 };
266
267 struct sctpUnifiedOpError{
268   struct sctpChunkDesc uh;
269   struct sctpOpErrorCause c;
270 };
271
272 struct sctpUnifiedStreamError{
273   struct sctpHeader mh;
274   struct sctpChunkDesc uh;
275   struct sctpOpErrorCause c;
276   u_short strmNum;
277   u_short reserved;
278 };
279
280 struct staleCookieMsg{
281   struct sctpHeader mh;
282   struct sctpChunkDesc uh;
283   struct sctpOpErrorCause c;
284   u_int moretime;
285 };
286
287 /* the following is used in all sends
288  * where nothing is needed except the
289  * chunk/type i.e. shutdownAck Abort */
290
291 struct sctpUnifiedSingleMsg{
292   struct sctpHeader mh;
293   struct sctpChunkDesc uh;
294 };
295
296 struct sctpDataPart{
297   u_int TSN;
298   u_short streamId;
299   u_short sequence;
300   u_int payloadtype;
301 };
302
303 struct sctpUnifiedDatagram{
304   struct sctpChunkDesc uh;
305   struct sctpDataPart dp;
306 };
307
308 struct sctpECN_echo{
309   struct sctpChunkDesc uh;
310   u_int Lowest_TSN;
311 };    
312
313
314 struct sctpCWR{
315   struct sctpChunkDesc uh;
316   u_int TSN_reduced_at;
317 };    
318
319 #ifdef  __cplusplus
320 }
321 #endif
322
323 #endif