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