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