1: /*
   2:  * Copyright (c) 1982, 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)tcp_fsm.h	7.1 (Berkeley) 6/5/86
   7:  */
   8: 
   9: /*
  10:  * TCP FSM state definitions.
  11:  * Per RFC793, September, 1981.
  12:  */
  13: 
  14: #define TCP_NSTATES 11
  15: 
  16: #define TCPS_CLOSED     0   /* closed */
  17: #define TCPS_LISTEN     1   /* listening for connection */
  18: #define TCPS_SYN_SENT       2   /* active, have sent syn */
  19: #define TCPS_SYN_RECEIVED   3   /* have send and received syn */
  20: /* states < TCPS_ESTABLISHED are those where connections not established */
  21: #define TCPS_ESTABLISHED    4   /* established */
  22: #define TCPS_CLOSE_WAIT     5   /* rcvd fin, waiting for close */
  23: /* states > TCPS_CLOSE_WAIT are those where user has closed */
  24: #define TCPS_FIN_WAIT_1     6   /* have closed, sent fin */
  25: #define TCPS_CLOSING        7   /* closed xchd FIN; await FIN ACK */
  26: #define TCPS_LAST_ACK       8   /* had fin and close; await FIN ACK */
  27: /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
  28: #define TCPS_FIN_WAIT_2     9   /* have closed, fin is acked */
  29: #define TCPS_TIME_WAIT      10  /* in 2*msl quiet wait after close */
  30: 
  31: #define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED)
  32: #define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
  33: 
  34: #ifdef  TCPOUTFLAGS
  35: /*
  36:  * Flags used when sending segments in tcp_output.
  37:  * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally
  38:  * determined by state, with the proviso that TH_FIN is sent only
  39:  * if all data queued for output is included in the segment.
  40:  */
  41: u_char  tcp_outflags[TCP_NSTATES] = {
  42:     TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
  43:     TH_ACK, TH_ACK,
  44:     TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
  45: };
  46: #endif
  47: 
  48: #ifdef KPROF
  49: int tcp_acounts[TCP_NSTATES][PRU_NREQ];
  50: #endif
  51: 
  52: #ifdef  TCPSTATES
  53: char *tcpstates[] = {
  54:     "CLOSED",   "LISTEN",   "SYN_SENT", "SYN_RCVD",
  55:     "ESTABLISHED",  "CLOSE_WAIT",   "FIN_WAIT_1",   "CLOSING",
  56:     "LAST_ACK", "FIN_WAIT_2",   "TIME_WAIT",
  57: };
  58: #endif

Defined variables

tcp_acounts defined in line 49; used 1 times
tcpstates defined in line 53; used 5 times

Defined macros

TCPS_CLOSING defined in line 25; used 1 times
TCPS_FIN_WAIT_1 defined in line 24; used 1 times
TCPS_HAVERCVDFIN defined in line 32; used 3 times
TCPS_LAST_ACK defined in line 26; used 1 times
TCPS_SYN_RECEIVED defined in line 19; used 5 times
TCPS_TIME_WAIT defined in line 29; used 4 times
TCP_NSTATES defined in line 14; used 3 times

Usage of this include

Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1037
Valid CSS Valid XHTML 1.0 Strict