epoc32/include/libc/netinet/tcp_fsm.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /* TCP_FSM.H
     2  * 
     3  * Portions copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
     4  */
     5 
     6 /*
     7  * Copyright (c) 1982, 1986 Regents of the University of California.
     8  * All rights reserved.  The Berkeley software License Agreement
     9  * specifies the terms and conditions for redistribution.
    10  */
    11 
    12 /** @file
    13 @publishedAll
    14 @released
    15 */
    16 
    17 /*
    18  * TCP FSM state definitions.
    19  * Per RFC793, September, 1981.
    20  */
    21 
    22 #ifndef	_NETINET_TCP_FSM_H
    23 #define	_NETINET_TCP_FSM_H
    24 
    25 #ifdef	__cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 #define	TCP_NSTATES	11
    30 
    31 #define	TCPS_CLOSED		0	/* closed */
    32 #define	TCPS_LISTEN		1	/* listening for connection */
    33 #define	TCPS_SYN_SENT		2	/* active, have sent syn */
    34 #define	TCPS_SYN_RECEIVED	3	/* have send and received syn */
    35 /** 
    36 states < TCPS_ESTABLISHED are those where connections not established 
    37 */
    38 #define	TCPS_ESTABLISHED	4	/* established */
    39 #define	TCPS_CLOSE_WAIT		5	/* rcvd fin, waiting for close */
    40 
    41 /** 
    42 states > TCPS_CLOSE_WAIT are those where user has closed 
    43 */
    44 #define	TCPS_FIN_WAIT_1		6	/* have closed, sent fin */
    45 #define	TCPS_CLOSING		7	/* closed xchd FIN; await FIN ACK */
    46 #define	TCPS_LAST_ACK		8	/* had fin and close; await FIN ACK */
    47 
    48 /** 
    49 states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN 
    50 */
    51 #define	TCPS_FIN_WAIT_2		9	/* have closed, fin is acked */
    52 #define	TCPS_TIME_WAIT		10	/* in 2*msl quiet wait after close */
    53 
    54 #define	TCPS_HAVERCVDSYN(s)	((s) >= TCPS_SYN_RECEIVED)
    55 #define	TCPS_HAVERCVDFIN(s)	((s) >= TCPS_TIME_WAIT)
    56 
    57 #ifdef	TCPOUTFLAGS
    58 /**
    59 Flags used when sending segments in tcp_output.
    60 Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally
    61 determined by state, with the proviso that TH_FIN is sent only
    62 if all data queued for output is included in the segment.
    63 */
    64 const u_char	tcp_outflags[TCP_NSTATES] = {
    65     TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
    66     TH_ACK, TH_ACK,
    67     TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
    68 };
    69 #endif
    70 
    71 #ifdef	TCPSTATES
    72 
    73 const char *tcpstates[] = {
    74 	"CLOSED",	"LISTEN",	"SYN_SENT",	"SYN_RCVD",
    75 	"ESTABLISHED",	"CLOSE_WAIT",	"FIN_WAIT_1",	"CLOSING",
    76 	"LAST_ACK",	"FIN_WAIT_2",	"TIME_WAIT",
    77 };
    78 #endif
    79 
    80 #ifdef	__cplusplus
    81 }
    82 #endif
    83 
    84 #endif	/* _NETINET_TCP_FSM_H */