]> The Tcpdump Group git mirrors - tcpdump/blob - sctpHeader.h
Get rid of definitions of "packetp" and "snapend" outside
[tcpdump] / sctpHeader.h
1 /* SCTP reference Implementation Copyright (C) 1999 Cisco And Motorola
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
5 * are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * 4. Neither the name of Cisco nor of Motorola may be used
15 * to endorse or promote products derived from this software without
16 * specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * This file is part of the SCTP reference Implementation
31 *
32 *
33 * Please send any bug reports or fixes you make to one of the following email
34 * addresses:
35 *
36 * rstewar1@email.mot.com
37 * kmorneau@cisco.com
38 * qxie1@email.mot.com
39 *
40 * Any bugs reported given to us we will try to fix... any fixes shared will
41 * be incorperated into the next SCTP release.
42 */
43
44
45 #ifndef __sctpHeader_h__
46 #define __sctpHeader_h__
47
48 #include <sctpConstants.h>
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 /* the sctp common header */
55
56 #ifdef TRU64
57 #define _64BITS 1
58 #endif
59
60 struct sctpHeader{
61 u_short source;
62 u_short destination;
63 u_int verificationTag;
64 u_int adler32;
65 };
66
67 /* various descriptor parsers */
68
69 struct sctpChunkDesc{
70 u_char chunkID;
71 u_char chunkFlg;
72 u_short chunkLength;
73 };
74
75 struct sctpParamDesc{
76 u_short paramType;
77 u_short paramLength;
78 };
79
80
81 struct sctpRelChunkDesc{
82 struct sctpChunkDesc chk;
83 u_int serialNumber;
84 };
85
86 struct sctpVendorSpecificParam {
87 struct sctpParamDesc p; /* type must be 0xfffe */
88 u_int vendorId; /* vendor ID from RFC 1700 */
89 u_short vendorSpecificType;
90 u_short vendorSpecificLen;
91 };
92
93
94 /* Structures for the control parts */
95
96
97
98 /* Sctp association init request/ack */
99
100 /* this is used for init ack, too */
101 struct sctpInitiation{
102 u_int initTag; /* tag of mine */
103 u_int rcvWindowCredit; /* rwnd */
104 u_short NumPreopenStreams; /* OS */
105 u_short MaxInboundStreams; /* MIS */
106 u_int initialTSN;
107 /* optional param's follow in sctpParamDesc form */
108 };
109
110 struct sctpV4IpAddress{
111 struct sctpParamDesc p; /* type is set to SCTP_IPV4_PARAM_TYPE, len=10 */
112 u_int ipAddress;
113 };
114
115
116 struct sctpV6IpAddress{
117 struct sctpParamDesc p; /* type is set to SCTP_IPV6_PARAM_TYPE, len=22 */
118 u_char ipAddress[16];
119 };
120
121 struct sctpDNSName{
122 struct sctpParamDesc param;
123 u_char name[1];
124 };
125
126
127 struct sctpCookiePreserve{
128 struct sctpParamDesc p; /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
129 u_int extraTime;
130 };
131
132
133 /* wire structure of my cookie */
134 struct cookieMessage{
135 u_int TieTag_curTag; /* copied from assoc if present */
136 u_int TieTag_hisTag; /* copied from assoc if present */
137 int cookieLife; /* life I will award this cookie */
138 struct timespec timeEnteringState; /* the time I built cookie */
139 struct sctpInitiation initAckISent; /* the INIT-ACK that I sent to my peer */
140 u_int addressWhereISent[4]; /* I make this 4 ints so I get 128bits for future */
141 int addrtype; /* address type */
142 u_short locScope; /* V6 local scope flag */
143 u_short siteScope; /* V6 site scope flag */
144 /* at the end is tacked on the INIT chunk sent in
145 * its entirety and of course our
146 * signature.
147 */
148 };
149
150
151 /* this guy is for use when
152 * I have a initiate message gloming the
153 * things together.
154
155 */
156 struct sctpUnifiedInit{
157 struct sctpChunkDesc uh;
158 struct sctpInitiation initm;
159 };
160
161 struct sctpSendableInit{
162 struct sctpHeader mh;
163 struct sctpUnifiedInit msg;
164 };
165
166
167 /* Selective Acknowledgement
168 * has the following structure with
169 * a optional ammount of trailing int's
170 * on the last part (based on the numberOfDesc
171 * field).
172 */
173
174 struct sctpSelectiveAck{
175 u_int highestConseqTSN;
176 u_int updatedRwnd;
177 u_short numberOfdesc;
178 u_short numDupTsns;
179 };
180
181 struct sctpSelectiveFrag{
182 u_short fragmentStart;
183 u_short fragmentEnd;
184 };
185
186
187 struct sctpUnifiedSack{
188 struct sctpChunkDesc uh;
189 struct sctpSelectiveAck sack;
190 };
191
192 /* for both RTT request/response the
193 * following is sent
194 */
195
196 struct sctpHBrequest {
197 u_int time_value_1;
198 u_int time_value_2;
199 };
200
201 /* here is what I read and respond with to. */
202 struct sctpHBunified{
203 struct sctpChunkDesc hdr;
204 struct sctpParamDesc hb;
205 };
206
207
208 /* here is what I send */
209 struct sctpHBsender{
210 struct sctpChunkDesc hdr;
211 struct sctpParamDesc hb;
212 struct sctpHBrequest rtt;
213 char addrFmt[SCTP_ADDRMAX];
214 unsigned short userreq;
215 };
216
217
218
219 /* for the abort and shutdown ACK
220 * we must carry the init tag in the common header. Just the
221 * common header is all that is needed with a chunk descriptor.
222 */
223 struct sctpUnifiedAbort{
224 struct sctpChunkDesc uh;
225 };
226
227 struct sctpUnifiedAbortLight{
228 struct sctpHeader mh;
229 struct sctpChunkDesc uh;
230 };
231
232 struct sctpUnifiedAbortHeavy{
233 struct sctpHeader mh;
234 struct sctpChunkDesc uh;
235 unsigned short causeCode;
236 unsigned short causeLen;
237 };
238
239 /* For the graceful shutdown we must carry
240 * the tag (in common header) and the highest consequitive acking value
241 */
242 struct sctpShutdown {
243 u_int TSN_Seen;
244 };
245
246 struct sctpUnifiedShutdown{
247 struct sctpChunkDesc uh;
248 struct sctpShutdown shut;
249 };
250
251 /* in the unified message we add the trailing
252 * stream id since it is the only message
253 * that is defined as a operation error.
254 */
255 struct sctpOpErrorCause{
256 u_short cause;
257 u_short causeLen;
258 };
259
260 struct sctpUnifiedOpError{
261 struct sctpChunkDesc uh;
262 struct sctpOpErrorCause c;
263 };
264
265 struct sctpUnifiedStreamError{
266 struct sctpHeader mh;
267 struct sctpChunkDesc uh;
268 struct sctpOpErrorCause c;
269 u_short strmNum;
270 u_short reserved;
271 };
272
273 struct staleCookieMsg{
274 struct sctpHeader mh;
275 struct sctpChunkDesc uh;
276 struct sctpOpErrorCause c;
277 u_int moretime;
278 };
279
280 /* the following is used in all sends
281 * where nothing is needed except the
282 * chunk/type i.e. shutdownAck Abort */
283
284 struct sctpUnifiedSingleMsg{
285 struct sctpHeader mh;
286 struct sctpChunkDesc uh;
287 };
288
289 struct sctpDataPart{
290 u_int TSN;
291 u_short streamId;
292 u_short sequence;
293 u_int payloadtype;
294 };
295
296 struct sctpUnifiedDatagram{
297 struct sctpChunkDesc uh;
298 struct sctpDataPart dp;
299 };
300
301 struct sctpECN_echo{
302 struct sctpChunkDesc uh;
303 u_int Lowest_TSN;
304 };
305
306
307 struct sctpCWR{
308 struct sctpChunkDesc uh;
309 u_int TSN_reduced_at;
310 };
311
312 #ifdef __cplusplus
313 }
314 #endif
315
316 #endif