sl@0: /* TCP_FSM.H sl@0: * sl@0: * Portions Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: */ sl@0: sl@0: /* sl@0: * Copyright (c) 1982, 1986 Regents of the University of California. sl@0: * All rights reserved. The Berkeley software License Agreement sl@0: * specifies the terms and conditions for redistribution. sl@0: */ sl@0: sl@0: /** @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: /* sl@0: * TCP FSM state definitions. sl@0: * Per RFC793, September, 1981. sl@0: */ sl@0: sl@0: #ifndef _NETINET_TCP_FSM_H sl@0: #define _NETINET_TCP_FSM_H sl@0: sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: sl@0: #define TCP_NSTATES 11 sl@0: sl@0: #define TCPS_CLOSED 0 /* closed */ sl@0: #define TCPS_LISTEN 1 /* listening for connection */ sl@0: #define TCPS_SYN_SENT 2 /* active, have sent syn */ sl@0: #define TCPS_SYN_RECEIVED 3 /* have send and received syn */ sl@0: /** sl@0: states < TCPS_ESTABLISHED are those where connections not established sl@0: */ sl@0: #define TCPS_ESTABLISHED 4 /* established */ sl@0: #define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ sl@0: sl@0: /** sl@0: states > TCPS_CLOSE_WAIT are those where user has closed sl@0: */ sl@0: #define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ sl@0: #define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ sl@0: #define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ sl@0: sl@0: /** sl@0: states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN sl@0: */ sl@0: #define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ sl@0: #define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ sl@0: sl@0: #define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) sl@0: #define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT) sl@0: sl@0: #ifdef TCPOUTFLAGS sl@0: /** sl@0: Flags used when sending segments in tcp_output. sl@0: Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally sl@0: determined by state, with the proviso that TH_FIN is sent only sl@0: if all data queued for output is included in the segment. sl@0: */ sl@0: const u_char tcp_outflags[TCP_NSTATES] = { sl@0: TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK, sl@0: TH_ACK, TH_ACK, sl@0: TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK, sl@0: }; sl@0: #endif sl@0: sl@0: #ifdef TCPSTATES sl@0: sl@0: const char *tcpstates[] = { sl@0: "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", sl@0: "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", sl@0: "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", sl@0: }; sl@0: #endif sl@0: sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: sl@0: #endif /* _NETINET_TCP_FSM_H */