comparison packages/net/tcpip/current/include/netinet/tcp_fsm.h @ 97:ced4577552cd ecos-sw-2000-06-06

Merge from eCos master repository on 2000-06-06-08:44:00-BST
author jlarmour
date Tue, 06 Jun 2000 08:39:36 +0000
parents
children e0c0827131d1
comparison
equal deleted inserted replaced
96:b15c60e34c84 97:ced4577552cd
1 //==========================================================================
2 //
3 // include/netinet_tcp_fsm.h
4 //
5 //
6 //
7 //==========================================================================
8 //####COPYRIGHTBEGIN####
9 //
10 // -------------------------------------------
11 // The contents of this file are subject to the Red Hat eCos Public License
12 // Version 1.1 (the "License"); you may not use this file except in
13 // compliance with the License. You may obtain a copy of the License at
14 // http://www.redhat.com/
15 //
16 // Software distributed under the License is distributed on an "AS IS"
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
18 // License for the specific language governing rights and limitations under
19 // the License.
20 //
21 // The Original Code is eCos - Embedded Configurable Operating System,
22 // released September 30, 1998.
23 //
24 // The Initial Developer of the Original Code is Red Hat.
25 // Portions created by Red Hat are
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
27 // All Rights Reserved.
28 // -------------------------------------------
29 //
30 //####COPYRIGHTEND####
31 //####BSDCOPYRIGHTBEGIN####
32 //
33 // -------------------------------------------
34 //
35 // Portions of this software may have been derived from OpenBSD or other sources,
36 // and are covered by the appropriate copyright disclaimers included herein.
37 //
38 // -------------------------------------------
39 //
40 //####BSDCOPYRIGHTEND####
41 //==========================================================================
42 //#####DESCRIPTIONBEGIN####
43 //
44 // Author(s): gthomas
45 // Contributors: gthomas
46 // Date: 2000-01-10
47 // Purpose:
48 // Description:
49 //
50 //
51 //####DESCRIPTIONEND####
52 //
53 //==========================================================================
54
55
56 /* $OpenBSD: tcp_fsm.h,v 1.4 1997/11/08 19:54:12 deraadt Exp $ */
57 /* $NetBSD: tcp_fsm.h,v 1.6 1994/10/14 16:01:48 mycroft Exp $ */
58
59 /*
60 * Copyright (c) 1982, 1986, 1993
61 * The Regents of the University of California. All rights reserved.
62 *
63 * Redistribution and use in source and binary forms, with or without
64 * modification, are permitted provided that the following conditions
65 * are met:
66 * 1. Redistributions of source code must retain the above copyright
67 * notice, this list of conditions and the following disclaimer.
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in the
70 * documentation and/or other materials provided with the distribution.
71 * 3. All advertising materials mentioning features or use of this software
72 * must display the following acknowledgement:
73 * This product includes software developed by the University of
74 * California, Berkeley and its contributors.
75 * 4. Neither the name of the University nor the names of its contributors
76 * may be used to endorse or promote products derived from this software
77 * without specific prior written permission.
78 *
79 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
80 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
81 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
82 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
83 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
84 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
85 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
86 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
87 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
88 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
89 * SUCH DAMAGE.
90 *
91 * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93
92 */
93
94 #ifndef _NETINET_TCP_FSM_H_
95 #define _NETINET_TCP_FSM_H_
96
97 /*
98 * TCP FSM state definitions.
99 * Per RFC793, September, 1981.
100 */
101
102 #define TCP_NSTATES 11
103
104 #define TCPS_CLOSED 0 /* closed */
105 #define TCPS_LISTEN 1 /* listening for connection */
106 #define TCPS_SYN_SENT 2 /* active, have sent syn */
107 #define TCPS_SYN_RECEIVED 3 /* have sent and received syn */
108 /* states < TCPS_ESTABLISHED are those where connections not established */
109 #define TCPS_ESTABLISHED 4 /* established */
110 #define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */
111 /* states > TCPS_CLOSE_WAIT are those where user has closed */
112 #define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */
113 #define TCPS_CLOSING 7 /* closed xchd FIN; await ACK */
114 #define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */
115 /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
116 #define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */
117 #define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
118
119 #define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED)
120 #define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED)
121 #define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
122
123 #ifdef TCPOUTFLAGS
124 /*
125 * Flags used when sending segments in tcp_output.
126 * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally
127 * determined by state, with the proviso that TH_FIN is sent only
128 * if all data queued for output is included in the segment.
129 */
130 u_char tcp_outflags[TCP_NSTATES] = {
131 TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
132 TH_ACK, TH_ACK,
133 TH_FIN|TH_ACK, TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
134 };
135 #endif
136
137 #ifdef KPROF
138 int tcp_acounts[TCP_NSTATES][PRU_NREQ];
139 #endif
140
141 #ifdef TCPSTATES
142 char *tcpstates[] = {
143 "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD",
144 "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING",
145 "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT",
146 };
147 #endif
148
149 #endif // _NETINET_TCP_FSM_H_