]> The Tcpdump Group git mirrors - tcpdump/blob - sctpHeader.h
Add SIGINFO handler from LBL
[tcpdump] / sctpHeader.h
1 /* @(#) $Header: /tcpdump/master/tcpdump/sctpHeader.h,v 1.2 2001-06-28 10:17:24 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 /* 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
148 * signature.
149 */
150 };
151
152
153 /* this guy is for use when
154 * I have a initiate message gloming the
155 * things together.
156
157 */
158 struct sctpUnifiedInit{
159 struct sctpChunkDesc uh;
160 struct sctpInitiation initm;
161 };
162
163 struct sctpSendableInit{
164 struct sctpHeader mh;
165 struct sctpUnifiedInit msg;
166 };
167
168
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
173 * field).
174 */
175
176 struct sctpSelectiveAck{
177 u_int highestConseqTSN;
178 u_int updatedRwnd;
179 u_short numberOfdesc;
180 u_short numDupTsns;
181 };
182
183 struct sctpSelectiveFrag{
184 u_short fragmentStart;
185 u_short fragmentEnd;
186 };
187
188
189 struct sctpUnifiedSack{
190 struct sctpChunkDesc uh;
191 struct sctpSelectiveAck sack;
192 };
193
194 /* for both RTT request/response the
195 * following is sent
196 */
197
198 struct sctpHBrequest {
199 u_int time_value_1;
200 u_int time_value_2;
201 };
202
203 /* here is what I read and respond with to. */
204 struct sctpHBunified{
205 struct sctpChunkDesc hdr;
206 struct sctpParamDesc hb;
207 };
208
209
210 /* here is what I send */
211 struct sctpHBsender{
212 struct sctpChunkDesc hdr;
213 struct sctpParamDesc hb;
214 struct sctpHBrequest rtt;
215 char addrFmt[SCTP_ADDRMAX];
216 unsigned short userreq;
217 };
218
219
220
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.
224 */
225 struct sctpUnifiedAbort{
226 struct sctpChunkDesc uh;
227 };
228
229 struct sctpUnifiedAbortLight{
230 struct sctpHeader mh;
231 struct sctpChunkDesc uh;
232 };
233
234 struct sctpUnifiedAbortHeavy{
235 struct sctpHeader mh;
236 struct sctpChunkDesc uh;
237 unsigned short causeCode;
238 unsigned short causeLen;
239 };
240
241 /* For the graceful shutdown we must carry
242 * the tag (in common header) and the highest consequitive acking value
243 */
244 struct sctpShutdown {
245 u_int TSN_Seen;
246 };
247
248 struct sctpUnifiedShutdown{
249 struct sctpChunkDesc uh;
250 struct sctpShutdown shut;
251 };
252
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.
256 */
257 struct sctpOpErrorCause{
258 u_short cause;
259 u_short causeLen;
260 };
261
262 struct sctpUnifiedOpError{
263 struct sctpChunkDesc uh;
264 struct sctpOpErrorCause c;
265 };
266
267 struct sctpUnifiedStreamError{
268 struct sctpHeader mh;
269 struct sctpChunkDesc uh;
270 struct sctpOpErrorCause c;
271 u_short strmNum;
272 u_short reserved;
273 };
274
275 struct staleCookieMsg{
276 struct sctpHeader mh;
277 struct sctpChunkDesc uh;
278 struct sctpOpErrorCause c;
279 u_int moretime;
280 };
281
282 /* the following is used in all sends
283 * where nothing is needed except the
284 * chunk/type i.e. shutdownAck Abort */
285
286 struct sctpUnifiedSingleMsg{
287 struct sctpHeader mh;
288 struct sctpChunkDesc uh;
289 };
290
291 struct sctpDataPart{
292 u_int TSN;
293 u_short streamId;
294 u_short sequence;
295 u_int payloadtype;
296 };
297
298 struct sctpUnifiedDatagram{
299 struct sctpChunkDesc uh;
300 struct sctpDataPart dp;
301 };
302
303 struct sctpECN_echo{
304 struct sctpChunkDesc uh;
305 u_int Lowest_TSN;
306 };
307
308
309 struct sctpCWR{
310 struct sctpChunkDesc uh;
311 u_int TSN_reduced_at;
312 };
313
314 #ifdef __cplusplus
315 }
316 #endif
317
318 #endif