Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / tcpdump / sctpConstants.h
blobf349d4ec8f87a186acb3162ff79ea49a2c1cfada
1 /* $NetBSD$ */
3 /* @(#) Header: /tcpdump/master/tcpdump/sctpConstants.h,v 1.4 2003/06/03 23:49:23 guy Exp (LBL) */
5 /* SCTP reference Implementation Copyright (C) 1999 Cisco And Motorola
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of Cisco nor of Motorola may be used
19 * to endorse or promote products derived from this software without
20 * specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
34 * This file is part of the SCTP reference Implementation
37 * Please send any bug reports or fixes you make to one of the following email
38 * addresses:
40 * rstewar1@email.mot.com
41 * kmorneau@cisco.com
42 * qxie1@email.mot.com
44 * Any bugs reported given to us we will try to fix... any fixes shared will
45 * be incorperated into the next SCTP release.
49 #ifndef __sctpConstants_h__
50 #define __sctpConstants_h__
53 /* If you wish to use MD5 instead of SLA uncomment the line
54 * below. Why you would like to do this:
55 * a) There may be IPR on SHA-1, or so the FIP-180-1 page says,
56 * b) MD5 is 3 times faster (has coded here).
58 * The disadvantage is, it is thought that MD5 has been
59 * cracked... see RFC2104.
61 /*#define USE_MD5 1*/
63 /* the SCTP protocol signature
64 * this includes the version number
65 * encoded in the last 4 bits of the
66 * signature.
68 #define PROTO_SIGNATURE_A 0x30000000
70 #define SCTP_VERSION_NUMBER 0x3
72 #define MAX_TSN 0xffffffff
73 #define MAX_SEQ 0xffff
75 /* option:
76 * If you comment out the following you will
77 * receive the old behavior of obeying cwnd for
78 * the fast retransmit algorithm. With this defined
79 * a FR happens right away with-out waiting for the
80 * flightsize to drop below the cwnd value (which
81 * is reduced by the FR to 1/2 the inflight packets).
83 #define SCTP_IGNORE_CWND_ON_FR 1
84 /* default max I can burst out after a fast retransmit */
85 #define SCTP_DEF_MAX_BURST 4
87 /* Packet transmit states in the sent
88 * field in the SCTP_transmitOnQueue struct
90 #define SCTP_DATAGRAM_UNSENT 0
91 #define SCTP_DATAGRAM_SENT 1
92 #define SCTP_DATAGRAM_RESEND1 2 /* not used */
93 #define SCTP_DATAGRAM_RESEND2 3 /* not used */
94 #define SCTP_DATAGRAM_RESEND3 4 /* not used */
95 #define SCTP_DATAGRAM_RESEND 5
96 #define SCTP_DATAGRAM_ACKED 10010
97 #define SCTP_DATAGRAM_INBOUND 10011
98 #define SCTP_READY_TO_TRANSMIT 10012
99 #define SCTP_DATAGRAM_MARKED 20010
101 #define MAX_FSID 64 /* debug 5 ints used for cc dynamic tracking */
103 /* The valid defines for all message
104 * types know to SCTP. 0 is reserved
106 #define SCTP_MSGTYPE_MASK 0xff
108 #define SCTP_DATA 0x00
109 #define SCTP_INITIATION 0x01
110 #define SCTP_INITIATION_ACK 0x02
111 #define SCTP_SELECTIVE_ACK 0x03
112 #define SCTP_HEARTBEAT_REQUEST 0x04
113 #define SCTP_HEARTBEAT_ACK 0x05
114 #define SCTP_ABORT_ASSOCIATION 0x06
115 #define SCTP_SHUTDOWN 0x07
116 #define SCTP_SHUTDOWN_ACK 0x08
117 #define SCTP_OPERATION_ERR 0x09
118 #define SCTP_COOKIE_ECHO 0x0a
119 #define SCTP_COOKIE_ACK 0x0b
120 #define SCTP_ECN_ECHO 0x0c
121 #define SCTP_ECN_CWR 0x0d
122 #define SCTP_SHUTDOWN_COMPLETE 0x0e
123 #define SCTP_FORWARD_CUM_TSN 0xc0
124 #define SCTP_RELIABLE_CNTL 0xc1
125 #define SCTP_RELIABLE_CNTL_ACK 0xc2
127 /* ABORT and SHUTDOWN COMPLETE FLAG */
128 #define SCTP_HAD_NO_TCB 0x01
130 /* Data Chuck Specific Flags */
131 #define SCTP_DATA_FRAG_MASK 0x03
132 #define SCTP_DATA_MIDDLE_FRAG 0x00
133 #define SCTP_DATA_LAST_FRAG 0x01
134 #define SCTP_DATA_FIRST_FRAG 0x02
135 #define SCTP_DATA_NOT_FRAG 0x03
136 #define SCTP_DATA_UNORDERED 0x04
138 #define SCTP_CRC_ENABLE_BIT 0x01 /* lower bit of reserved */
140 #define isSCTPControl(a) (a->chunkID != SCTP_DATA)
141 #define isSCTPData(a) (a->chunkID == SCTP_DATA)
143 /* sctp parameter types for init/init-ack */
145 #define SCTP_IPV4_PARAM_TYPE 0x0005
146 #define SCTP_IPV6_PARAM_TYPE 0x0006
147 #define SCTP_RESPONDER_COOKIE 0x0007
148 #define SCTP_UNRECOG_PARAM 0x0008
149 #define SCTP_COOKIE_PRESERVE 0x0009
150 #define SCTP_HOSTNAME_VIA_DNS 0x000b
151 #define SCTP_RESTRICT_ADDR_TO 0x000c
153 #define SCTP_ECN_I_CAN_DO_ECN 0x8000
154 #define SCTP_OPERATION_SUCCEED 0x4001
155 #define SCTP_ERROR_NOT_EXECUTED 0x4002
157 #define SCTP_UNRELIABLE_STRM 0xc000
158 #define SCTP_ADD_IP_ADDRESS 0xc001
159 #define SCTP_DEL_IP_ADDRESS 0xc002
160 #define SCTP_STRM_FLOW_LIMIT 0xc003
161 #define SCTP_PARTIAL_CSUM 0xc004
162 #define SCTP_ERROR_CAUSE_TLV 0xc005
163 #define SCTP_MIT_STACK_NAME 0xc006
164 #define SCTP_SETADDRESS_PRIMARY 0xc007
166 /* bits for TOS field */
167 #define SCTP_ECT_BIT 0x02
168 #define SCTP_CE_BIT 0x01
170 /* error codes */
171 #define SCTP_OP_ERROR_NO_ERROR 0x0000
172 #define SCTP_OP_ERROR_INV_STRM 0x0001
173 #define SCTP_OP_ERROR_MISS_PARAM 0x0002
174 #define SCTP_OP_ERROR_STALE_COOKIE 0x0003
175 #define SCTP_OP_ERROR_NO_RESOURCE 0x0004
176 #define SCTP_OP_ERROR_DNS_FAILED 0x0005
177 #define SCTP_OP_ERROR_UNK_CHUNK 0x0006
178 #define SCTP_OP_ERROR_INV_PARAM 0x0007
179 #define SCTP_OP_ERROR_UNK_PARAM 0x0008
180 #define SCTP_OP_ERROR_NO_USERD 0x0009
181 #define SCTP_OP_ERROR_COOKIE_SHUT 0x000a
182 #define SCTP_OP_ERROR_DELETE_LAST 0x000b
183 #define SCTP_OP_ERROR_RESOURCE_SHORT 0x000c
185 #define SCTP_MAX_ERROR_CAUSE 12
187 /* empty error causes i.e. nothing but the cause
188 * are SCTP_OP_ERROR_NO_RESOURCE, SCTP_OP_ERROR_INV_PARAM,
189 * SCTP_OP_ERROR_COOKIE_SHUT.
192 /* parameter for Heart Beat */
193 #define HEART_BEAT_PARAM 0x0001
197 /* send options for SCTP
199 #define SCTP_ORDERED_DELIVERY 0x01
200 #define SCTP_NON_ORDERED_DELIVERY 0x02
201 #define SCTP_DO_CRC16 0x08
202 #define SCTP_MY_ADDRESS_ONLY 0x10
204 /* below turns off above */
205 #define SCTP_FLEXIBLE_ADDRESS 0x20
206 #define SCTP_NO_HEARTBEAT 0x40
208 /* mask to get sticky */
209 #define SCTP_STICKY_OPTIONS_MASK 0x0c
211 /* MTU discovery flags */
212 #define SCTP_DONT_FRAGMENT 0x0100
213 #define SCTP_FRAGMENT_OK 0x0200
216 /* SCTP state defines for internal state machine */
217 #define SCTP_STATE_EMPTY 0x0000
218 #define SCTP_STATE_INUSE 0x0001
219 #define SCTP_STATE_COOKIE_WAIT 0x0002
220 #define SCTP_STATE_COOKIE_SENT 0x0004
221 #define SCTP_STATE_OPEN 0x0008
222 #define SCTP_STATE_SHUTDOWN 0x0010
223 #define SCTP_STATE_SHUTDOWN_RECV 0x0020
224 #define SCTP_STATE_SHUTDOWN_ACK_SENT 0x0040
225 #define SCTP_STATE_SHUTDOWN_PEND 0x0080
226 #define SCTP_STATE_MASK 0x007f
227 /* SCTP reachability state for each address */
228 #define SCTP_ADDR_NOT_REACHABLE 1
229 #define SCTP_ADDR_REACHABLE 2
230 #define SCTP_ADDR_NOHB 4
231 #define SCTP_ADDR_BEING_DELETED 8
233 /* How long a cookie lives */
234 #define SCTP_DEFAULT_COOKIE_LIFE 60 /* seconds */
236 /* resource limit of streams */
237 #define MAX_SCTP_STREAMS 2048
240 /* guess at how big to make the TSN mapping array */
241 #define SCTP_STARTING_MAPARRAY 10000
243 /* Here we define the timer types used
244 * by the implementation has
245 * arguments in the set/get timer type calls.
247 #define SCTP_TIMER_INIT 0
248 #define SCTP_TIMER_RECV 1
249 #define SCTP_TIMER_SEND 2
250 #define SCTP_TIMER_SHUTDOWN 3
251 #define SCTP_TIMER_HEARTBEAT 4
252 #define SCTP_TIMER_PMTU 5
253 /* number of timer types in the base SCTP
254 * structure used in the set/get and has
255 * the base default.
257 #define SCTP_NUM_TMRS 6
261 #define SCTP_IPV4_ADDRESS 2
262 #define SCTP_IPV6_ADDRESS 4
264 /* timer types */
265 #define SctpTimerTypeNone 0
266 #define SctpTimerTypeSend 1
267 #define SctpTimerTypeInit 2
268 #define SctpTimerTypeRecv 3
269 #define SctpTimerTypeShutdown 4
270 #define SctpTimerTypeHeartbeat 5
271 #define SctpTimerTypeCookie 6
272 #define SctpTimerTypeNewCookie 7
273 #define SctpTimerTypePathMtuRaise 8
274 #define SctpTimerTypeShutdownAck 9
275 #define SctpTimerTypeRelReq 10
277 /* Here are the timer directives given to the
278 * user provided function
280 #define SCTP_TIMER_START 1
281 #define SCTP_TIMER_STOP 2
283 /* running flag states in timer structure */
284 #define SCTP_TIMER_IDLE 0x0
285 #define SCTP_TIMER_EXPIRED 0x1
286 #define SCTP_TIMER_RUNNING 0x2
289 /* number of simultaneous timers running */
290 #define SCTP_MAX_NET_TIMERS 6 /* base of where net timers start */
291 #define SCTP_NUMBER_TIMERS 12 /* allows up to 6 destinations */
294 /* Of course we really don't collect stale cookies, being
295 * folks of decerning taste. However we do count them, if
296 * we get to many before the association comes up.. we
297 * give up. Below is the constant that dictates when
298 * we give it up...this is a implemenation dependant
299 * treatment. In ours we do not ask for a extension of
300 * time, but just retry this many times...
302 #define SCTP_MAX_STALE_COOKIES_I_COLLECT 10
304 /* max number of TSN's dup'd that I will hold */
305 #define SCTP_MAX_DUP_TSNS 20
307 /* Here we define the types used when
308 * setting the retry ammounts.
310 /* constants for type of set */
311 #define SCTP_MAXATTEMPT_INIT 2
312 #define SCTP_MAXATTEMPT_SEND 3
314 /* Here we define the default timers and the
315 * default number of attemts we make for
316 * each respective side (send/init).
319 /* init timer def = 3sec */
320 #define SCTP_INIT_SEC 3
321 #define SCTP_INIT_NSEC 0
323 /* send timer def = 3 seconds */
324 #define SCTP_SEND_SEC 1
325 #define SCTP_SEND_NSEC 0
327 /* recv timer def = 200ms (in nsec) */
328 #define SCTP_RECV_SEC 0
329 #define SCTP_RECV_NSEC 200000000
331 /* 30 seconds + RTO */
332 #define SCTP_HB_SEC 30
333 #define SCTP_HB_NSEC 0
336 /* 300 ms */
337 #define SCTP_SHUTDOWN_SEC 0
338 #define SCTP_SHUTDOWN_NSEC 300000000
340 #define SCTP_RTO_UPPER_BOUND 60000000 /* 60 sec in micro-second's */
341 #define SCTP_RTO_UPPER_BOUND_SEC 60 /* for the init timer */
342 #define SCTP_RTO_LOWER_BOUND 1000000 /* 1 sec in micro-sec's */
344 #define SCTP_DEF_MAX_INIT 8
345 #define SCTP_DEF_MAX_SEND 10
347 #define SCTP_DEF_PMTU_RAISE 600 /* 10 Minutes between raise attempts */
348 #define SCTP_DEF_PMTU_MIN 600
350 #define SCTP_MSEC_IN_A_SEC 1000
351 #define SCTP_USEC_IN_A_SEC 1000000
352 #define SCTP_NSEC_IN_A_SEC 1000000000
355 /* Events that SCTP will look for, these
356 * are or'd together to declare what SCTP
357 * wants. Each select mask/poll list should be
358 * set for the fd, if the bit is on.
360 #define SCTP_EVENT_READ 0x000001
361 #define SCTP_EVENT_WRITE 0x000002
362 #define SCTP_EVENT_EXCEPT 0x000004
364 /* The following constant is a value for this
365 * particular implemenation. It is quite arbitrary and
366 * is used to limit how much data will be queued up to
367 * a sender, waiting for cwnd to be larger than flightSize.
368 * All implementations will need this protection is some
369 * way due to buffer size constraints.
372 #define SCTP_MAX_OUTSTANDING_DG 10000
376 /* This constant (SCTP_MAX_READBUFFER) define
377 * how big the read/write buffer is
378 * when we enter the fd event notification
379 * the buffer is put on the stack, so the bigger
380 * it is the more stack you chew up, however it
381 * has got to be big enough to handle the bigest
382 * message this O/S will send you. In solaris
383 * with sockets (not TLI) we end up at a value
384 * of 64k. In TLI we could do partial reads to
385 * get it all in with less hassel.. but we
386 * write to sockets for generality.
388 #define SCTP_MAX_READBUFFER 65536
389 #define SCTP_ADDRMAX 60
391 /* amount peer is obligated to have in rwnd or
392 * I will abort
394 #define SCTP_MIN_RWND 1500
396 #define SCTP_WINDOW_MIN 1500 /* smallest rwnd can be */
397 #define SCTP_WINDOW_MAX 1048576 /* biggest I can grow rwnd to
398 * My playing around suggests a
399 * value greater than 64k does not
400 * do much, I guess via the kernel
401 * limitations on the stream/socket.
404 #define SCTP_MAX_BUNDLE_UP 256 /* max number of chunks I can bundle */
406 /* I can handle a 1meg re-assembly */
407 #define SCTP_DEFAULT_MAXMSGREASM 1048576
410 #define SCTP_DEFAULT_MAXWINDOW 32768 /* default rwnd size */
411 #define SCTP_DEFAULT_MAXSEGMENT 1500 /* MTU size, this is the default
412 * to which we set the smallestMTU
413 * size to. This governs what is the
414 * largest size we will use, of course
415 * PMTU will raise this up to
416 * the largest interface MTU or the
417 * ceiling below if there is no
418 * SIOCGIFMTU.
420 #ifdef LYNX
421 #define DEFAULT_MTU_CEILING 1500 /* Since Lynx O/S is brain dead
422 * in the way it handles the
423 * raw IP socket, insisting
424 * on makeing its own IP
425 * header, we limit the growth
426 * to that of the e-net size
428 #else
429 #define DEFAULT_MTU_CEILING 2048 /* If no SIOCGIFMTU, highest value
430 * to raise the PMTU to, i.e.
431 * don't try to raise above this
432 * value. Tune this per your
433 * largest MTU interface if your
434 * system does not support the
435 * SIOCGIFMTU ioctl.
437 #endif
438 #define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */
439 #define SCTP_HOW_MANY_SECRETS 2 /* how many secrets I keep */
440 /* This is how long a secret lives, NOT how long a cookie lives */
441 #define SCTP_HOW_LONG_COOKIE_LIVE 3600 /* how many seconds the current secret will live */
443 #define SCTP_NUMBER_OF_SECRETS 8 /* or 8 * 4 = 32 octets */
444 #define SCTP_SECRET_SIZE 32 /* number of octets in a 256 bits */
446 #ifdef USE_MD5
447 #define SCTP_SIGNATURE_SIZE 16 /* size of a MD5 signature */
448 #else
449 #define SCTP_SIGNATURE_SIZE 20 /* size of a SLA-1 signature */
450 #endif
451 /* Here are the notification constants
452 * that the code and upper layer will get
455 /* association is up */
456 #define SCTP_NOTIFY_ASSOC_UP 1
458 /* association is down */
459 #define SCTP_NOTIFY_ASSOC_DOWN 2
461 /* interface on a association is down
462 * and out of consideration for selection.
464 #define SCTP_NOTIFY_INTF_DOWN 3
466 /* interface on a association is up
467 * and now back in consideration for selection.
469 #define SCTP_NOTIFY_INTF_UP 4
471 /* The given datagram cannot be delivered
472 * to the peer, this will probably be followed
473 * by a SCTP_NOTFIY_ASSOC_DOWN.
475 #define SCTP_NOTIFY_DG_FAIL 5
477 /* Sent dg on non-open stream extreme code error!
479 #define SCTP_NOTIFY_STRDATA_ERR 6
481 #define SCTP_NOTIFY_ASSOC_ABORTED 7
483 /* The stream ones are not used yet, but could
484 * be when a association opens.
486 #define SCTP_NOTIFY_PEER_OPENED_STR 8
487 #define SCTP_NOTIFY_STREAM_OPENED_OK 9
489 /* association sees a restart event */
490 #define SCTP_NOTIFY_ASSOC_RESTART 10
492 /* a user requested HB returned */
493 #define SCTP_NOTIFY_HB_RESP 11
495 /* a result from a REL-REQ */
496 #define SCTP_NOTIFY_RELREQ_RESULT_OK 12
497 #define SCTP_NOTIFY_RELREQ_RESULT_FAILED 13
499 /* clock variance is 10ms or 10,000 us's */
500 #define SCTP_CLOCK_GRAINULARITY 10000
502 #define IP_HDR_SIZE 40 /* we use the size of a IP6 header here
503 * this detracts a small amount for ipv4
504 * but it simplifies the ipv6 addition
507 #define SCTP_NUM_FDS 3
509 /* raw IP filedescriptor */
510 #define SCTP_FD_IP 0
511 /* raw ICMP filedescriptor */
512 #define SCTP_FD_ICMP 1
513 /* processes contact me for requests here */
514 #define SCTP_REQUEST 2
517 #define SCTP_DEAMON_PORT 9899
519 /* Deamon registration message types/responses */
520 #define DEAMON_REGISTER 0x01
521 #define DEAMON_REGISTER_ACK 0x02
522 #define DEAMON_DEREGISTER 0x03
523 #define DEAMON_DEREGISTER_ACK 0x04
524 #define DEAMON_CHECKADDR_LIST 0x05
526 #define DEAMON_MAGIC_VER_LEN 0xff
528 /* max times I will attempt to send a message to deamon */
529 #define SCTP_MAX_ATTEMPTS_AT_DEAMON 5
530 #define SCTP_TIMEOUT_IN_POLL_FOR_DEAMON 1500 /* 1.5 seconds */
532 /* modular comparison */
533 /* True if a > b (mod = M) */
534 #define compare_with_wrap(a, b, M) ((a > b) && ((a - b) < (M >> 1))) || \
535 ((b > a) && ((b - a) > (M >> 1)))
537 #ifndef TIMEVAL_TO_TIMESPEC
538 #define TIMEVAL_TO_TIMESPEC(tv, ts) \
540 (ts)->tv_sec = (tv)->tv_sec; \
541 (ts)->tv_nsec = (tv)->tv_usec * 1000; \
543 #endif
545 /* pegs */
546 #define SCTP_NUMBER_OF_PEGS 21
547 /* peg index's */
548 #define SCTP_PEG_SACKS_SEEN 0
549 #define SCTP_PEG_SACKS_SENT 1
550 #define SCTP_PEG_TSNS_SENT 2
551 #define SCTP_PEG_TSNS_RCVD 3
552 #define SCTP_DATAGRAMS_SENT 4
553 #define SCTP_DATAGRAMS_RCVD 5
554 #define SCTP_RETRANTSN_SENT 6
555 #define SCTP_DUPTSN_RECVD 7
556 #define SCTP_HBR_RECV 8
557 #define SCTP_HBA_RECV 9
558 #define SCTP_HB_SENT 10
559 #define SCTP_DATA_DG_SENT 11
560 #define SCTP_DATA_DG_RECV 12
561 #define SCTP_TMIT_TIMER 13
562 #define SCTP_RECV_TIMER 14
563 #define SCTP_HB_TIMER 15
564 #define SCTP_FAST_RETRAN 16
565 #define SCTP_PEG_TSNS_READ 17
566 #define SCTP_NONE_LFT_TO 18
567 #define SCTP_NONE_LFT_RWND 19
568 #define SCTP_NONE_LFT_CWND 20
572 #endif