]> The Tcpdump Group git mirrors - tcpdump/blob - sctpHeader.h
remove unused macro from sctpHeader.h
[tcpdump] / sctpHeader.h
1 /* @(#) $Header: /tcpdump/master/tcpdump/sctpHeader.h,v 1.6 2002-12-11 07:14:11 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 struct sctpHeader{
59 u_int16_t source;
60 u_int16_t destination;
61 u_int32_t verificationTag;
62 u_int32_t adler32;
63 };
64
65 /* various descriptor parsers */
66
67 struct sctpChunkDesc{
68 u_int8_t chunkID;
69 u_int8_t chunkFlg;
70 u_int16_t chunkLength;
71 };
72
73 struct sctpParamDesc{
74 u_int16_t paramType;
75 u_int16_t paramLength;
76 };
77
78
79 struct sctpRelChunkDesc{
80 struct sctpChunkDesc chk;
81 u_int32_t serialNumber;
82 };
83
84 struct sctpVendorSpecificParam {
85 struct sctpParamDesc p; /* type must be 0xfffe */
86 u_int32_t vendorId; /* vendor ID from RFC 1700 */
87 u_int16_t vendorSpecificType;
88 u_int16_t vendorSpecificLen;
89 };
90
91
92 /* Structures for the control parts */
93
94
95
96 /* Sctp association init request/ack */
97
98 /* this is used for init ack, too */
99 struct sctpInitiation{
100 u_int32_t initTag; /* tag of mine */
101 u_int32_t rcvWindowCredit; /* rwnd */
102 u_int16_t NumPreopenStreams; /* OS */
103 u_int16_t MaxInboundStreams; /* MIS */
104 u_int32_t initialTSN;
105 /* optional param's follow in sctpParamDesc form */
106 };
107
108 struct sctpV4IpAddress{
109 struct sctpParamDesc p; /* type is set to SCTP_IPV4_PARAM_TYPE, len=10 */
110 u_int32_t ipAddress;
111 };
112
113
114 struct sctpV6IpAddress{
115 struct sctpParamDesc p; /* type is set to SCTP_IPV6_PARAM_TYPE, len=22 */
116 u_int8_t ipAddress[16];
117 };
118
119 struct sctpDNSName{
120 struct sctpParamDesc param;
121 u_int8_t name[1];
122 };
123
124
125 struct sctpCookiePreserve{
126 struct sctpParamDesc p; /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
127 u_int32_t extraTime;
128 };
129
130
131 struct sctpTimeStamp{
132 u_int32_t ts_sec;
133 u_int32_t ts_usec;
134 };
135
136 /* wire structure of my cookie */
137 struct cookieMessage{
138 u_int32_t TieTag_curTag; /* copied from assoc if present */
139 u_int32_t TieTag_hisTag; /* copied from assoc if present */
140 int32_t cookieLife; /* life I will award this cookie */
141 struct sctpTimeStamp timeEnteringState; /* the time I built cookie */
142 struct sctpInitiation initAckISent; /* the INIT-ACK that I sent to my peer */
143 u_int32_t addressWhereISent[4]; /* I make this 4 ints so I get 128bits for future */
144 int32_t addrtype; /* address type */
145 u_int16_t locScope; /* V6 local scope flag */
146 u_int16_t siteScope; /* V6 site scope flag */
147 /* at the end is tacked on the INIT chunk sent in
148 * its entirety and of course our
149 * signature.
150 */
151 };
152
153
154 /* this guy is for use when
155 * I have a initiate message gloming the
156 * things together.
157
158 */
159 struct sctpUnifiedInit{
160 struct sctpChunkDesc uh;
161 struct sctpInitiation initm;
162 };
163
164 struct sctpSendableInit{
165 struct sctpHeader mh;
166 struct sctpUnifiedInit msg;
167 };
168
169
170 /* Selective Acknowledgement
171 * has the following structure with
172 * a optional ammount of trailing int's
173 * on the last part (based on the numberOfDesc
174 * field).
175 */
176
177 struct sctpSelectiveAck{
178 u_int32_t highestConseqTSN;
179 u_int32_t updatedRwnd;
180 u_int16_t numberOfdesc;
181 u_int16_t numDupTsns;
182 };
183
184 struct sctpSelectiveFrag{
185 u_int16_t fragmentStart;
186 u_int16_t fragmentEnd;
187 };
188
189
190 struct sctpUnifiedSack{
191 struct sctpChunkDesc uh;
192 struct sctpSelectiveAck sack;
193 };
194
195 /* for both RTT request/response the
196 * following is sent
197 */
198
199 struct sctpHBrequest {
200 u_int32_t time_value_1;
201 u_int32_t time_value_2;
202 };
203
204 /* here is what I read and respond with to. */
205 struct sctpHBunified{
206 struct sctpChunkDesc hdr;
207 struct sctpParamDesc hb;
208 };
209
210
211 /* here is what I send */
212 struct sctpHBsender{
213 struct sctpChunkDesc hdr;
214 struct sctpParamDesc hb;
215 struct sctpHBrequest rtt;
216 int8_t addrFmt[SCTP_ADDRMAX];
217 u_int16_t userreq;
218 };
219
220
221
222 /* for the abort and shutdown ACK
223 * we must carry the init tag in the common header. Just the
224 * common header is all that is needed with a chunk descriptor.
225 */
226 struct sctpUnifiedAbort{
227 struct sctpChunkDesc uh;
228 };
229
230 struct sctpUnifiedAbortLight{
231 struct sctpHeader mh;
232 struct sctpChunkDesc uh;
233 };
234
235 struct sctpUnifiedAbortHeavy{
236 struct sctpHeader mh;
237 struct sctpChunkDesc uh;
238 u_int16_t causeCode;
239 u_int16_t causeLen;
240 };
241
242 /* For the graceful shutdown we must carry
243 * the tag (in common header) and the highest consequitive acking value
244 */
245 struct sctpShutdown {
246 u_int32_t TSN_Seen;
247 };
248
249 struct sctpUnifiedShutdown{
250 struct sctpChunkDesc uh;
251 struct sctpShutdown shut;
252 };
253
254 /* in the unified message we add the trailing
255 * stream id since it is the only message
256 * that is defined as a operation error.
257 */
258 struct sctpOpErrorCause{
259 u_int16_t cause;
260 u_int16_t causeLen;
261 };
262
263 struct sctpUnifiedOpError{
264 struct sctpChunkDesc uh;
265 struct sctpOpErrorCause c;
266 };
267
268 struct sctpUnifiedStreamError{
269 struct sctpHeader mh;
270 struct sctpChunkDesc uh;
271 struct sctpOpErrorCause c;
272 u_int16_t strmNum;
273 u_int16_t reserved;
274 };
275
276 struct staleCookieMsg{
277 struct sctpHeader mh;
278 struct sctpChunkDesc uh;
279 struct sctpOpErrorCause c;
280 u_int32_t moretime;
281 };
282
283 /* the following is used in all sends
284 * where nothing is needed except the
285 * chunk/type i.e. shutdownAck Abort */
286
287 struct sctpUnifiedSingleMsg{
288 struct sctpHeader mh;
289 struct sctpChunkDesc uh;
290 };
291
292 struct sctpDataPart{
293 u_int32_t TSN;
294 u_int16_t streamId;
295 u_int16_t sequence;
296 u_int32_t payloadtype;
297 };
298
299 struct sctpUnifiedDatagram{
300 struct sctpChunkDesc uh;
301 struct sctpDataPart dp;
302 };
303
304 struct sctpECN_echo{
305 struct sctpChunkDesc uh;
306 u_int32_t Lowest_TSN;
307 };
308
309
310 struct sctpCWR{
311 struct sctpChunkDesc uh;
312 u_int32_t TSN_reduced_at;
313 };
314
315 #ifdef __cplusplus
316 }
317 #endif
318
319 #endif