1 /* SCTP reference Implementation Copyright (C) 1999 Cisco And Motorola
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
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.
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.
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
30 * This file is part of the SCTP reference Implementation
33 * Please send any bug reports or fixes you make to one of the following email
36 * rstewar1@email.mot.com
40 * Any bugs reported given to us we will try to fix... any fixes shared will
41 * be incorperated into the next SCTP release.
45 #ifndef __sctpHeader_h__
46 #define __sctpHeader_h__
48 #include <sctpConstants.h>
54 /* the sctp common header */
63 u_int verificationTag
;
67 /* various descriptor parsers */
81 struct sctpRelChunkDesc
{
82 struct sctpChunkDesc chk
;
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
;
94 /* Structures for the control parts */
98 /* Sctp association init request/ack */
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 */
107 /* optional param's follow in sctpParamDesc form */
110 struct sctpV4IpAddress
{
111 struct sctpParamDesc p
; /* type is set to SCTP_IPV4_PARAM_TYPE, len=10 */
116 struct sctpV6IpAddress
{
117 struct sctpParamDesc p
; /* type is set to SCTP_IPV6_PARAM_TYPE, len=22 */
118 u_char ipAddress
[16];
122 struct sctpParamDesc param
;
127 struct sctpCookiePreserve
{
128 struct sctpParamDesc p
; /* type is set to SCTP_COOKIE_PRESERVE, len=8 */
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
151 /* this guy is for use when
152 * I have a initiate message gloming the
156 struct sctpUnifiedInit
{
157 struct sctpChunkDesc uh
;
158 struct sctpInitiation initm
;
161 struct sctpSendableInit
{
162 struct sctpHeader mh
;
163 struct sctpUnifiedInit msg
;
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
174 struct sctpSelectiveAck
{
175 u_int highestConseqTSN
;
177 u_short numberOfdesc
;
181 struct sctpSelectiveFrag
{
182 u_short fragmentStart
;
187 struct sctpUnifiedSack
{
188 struct sctpChunkDesc uh
;
189 struct sctpSelectiveAck sack
;
192 /* for both RTT request/response the
196 struct sctpHBrequest
{
201 /* here is what I read and respond with to. */
202 struct sctpHBunified
{
203 struct sctpChunkDesc hdr
;
204 struct sctpParamDesc hb
;
208 /* here is what I send */
210 struct sctpChunkDesc hdr
;
211 struct sctpParamDesc hb
;
212 struct sctpHBrequest rtt
;
213 char addrFmt
[SCTP_ADDRMAX
];
214 unsigned short userreq
;
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.
223 struct sctpUnifiedAbort
{
224 struct sctpChunkDesc uh
;
227 struct sctpUnifiedAbortLight
{
228 struct sctpHeader mh
;
229 struct sctpChunkDesc uh
;
232 struct sctpUnifiedAbortHeavy
{
233 struct sctpHeader mh
;
234 struct sctpChunkDesc uh
;
235 unsigned short causeCode
;
236 unsigned short causeLen
;
239 /* For the graceful shutdown we must carry
240 * the tag (in common header) and the highest consequitive acking value
242 struct sctpShutdown
{
246 struct sctpUnifiedShutdown
{
247 struct sctpChunkDesc uh
;
248 struct sctpShutdown shut
;
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.
255 struct sctpOpErrorCause
{
260 struct sctpUnifiedOpError
{
261 struct sctpChunkDesc uh
;
262 struct sctpOpErrorCause c
;
265 struct sctpUnifiedStreamError
{
266 struct sctpHeader mh
;
267 struct sctpChunkDesc uh
;
268 struct sctpOpErrorCause c
;
273 struct staleCookieMsg
{
274 struct sctpHeader mh
;
275 struct sctpChunkDesc uh
;
276 struct sctpOpErrorCause c
;
280 /* the following is used in all sends
281 * where nothing is needed except the
282 * chunk/type i.e. shutdownAck Abort */
284 struct sctpUnifiedSingleMsg
{
285 struct sctpHeader mh
;
286 struct sctpChunkDesc uh
;
296 struct sctpUnifiedDatagram
{
297 struct sctpChunkDesc uh
;
298 struct sctpDataPart dp
;
302 struct sctpChunkDesc uh
;
308 struct sctpChunkDesc uh
;
309 u_int TSN_reduced_at
;