1: /*
   2:  * Copyright (c) 1982, 1986 Regents of the University of California.
   3:  * All rights reserved.
   4:  *
   5:  * Redistribution and use in source and binary forms are permitted
   6:  * provided that this notice is preserved and that due credit is given
   7:  * to the University of California at Berkeley. The name of the University
   8:  * may not be used to endorse or promote products derived from this
   9:  * software without specific prior written permission. This software
  10:  * is provided ``as is'' without express or implied warranty.
  11:  *
  12:  *	@(#)tcp_fsm.h	7.2 (Berkeley) 12/7/87
  13:  */
  14: 
  15: /*
  16:  * TCP FSM state definitions.
  17:  * Per RFC793, September, 1981.
  18:  */
  19: 
  20: #define TCP_NSTATES 11
  21: 
  22: #define TCPS_CLOSED     0   /* closed */
  23: #define TCPS_LISTEN     1   /* listening for connection */
  24: #define TCPS_SYN_SENT       2   /* active, have sent syn */
  25: #define TCPS_SYN_RECEIVED   3   /* have send and received syn */
  26: /* states < TCPS_ESTABLISHED are those where connections not established */
  27: #define TCPS_ESTABLISHED    4   /* established */
  28: #define TCPS_CLOSE_WAIT     5   /* rcvd fin, waiting for close */
  29: /* states > TCPS_CLOSE_WAIT are those where user has closed */
  30: #define TCPS_FIN_WAIT_1     6   /* have closed, sent fin */
  31: #define TCPS_CLOSING        7   /* closed xchd FIN; await FIN ACK */
  32: #define TCPS_LAST_ACK       8   /* had fin and close; await FIN ACK */
  33: /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
  34: #define TCPS_FIN_WAIT_2     9   /* have closed, fin is acked */
  35: #define TCPS_TIME_WAIT      10  /* in 2*msl quiet wait after close */
  36: 
  37: #define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED)
  38: #define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
  39: 
  40: #ifdef  TCPOUTFLAGS
  41: /*
  42:  * Flags used when sending segments in tcp_output.
  43:  * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally
  44:  * determined by state, with the proviso that TH_FIN is sent only
  45:  * if all data queued for output is included in the segment.
  46:  */
  47: u_char  tcp_outflags[TCP_NSTATES] = {
  48:     TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
  49:     TH_ACK, TH_ACK,
  50:     TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
  51: };
  52: #endif
  53: 
  54: #ifdef KPROF
  55: int tcp_acounts[TCP_NSTATES][PRU_NREQ];
  56: #endif
  57: 
  58: #ifdef  TCPSTATES
  59: char *tcpstates[] = {
  60:     "CLOSED",   "LISTEN",   "SYN_SENT", "SYN_RCVD",
  61:     "ESTABLISHED",  "CLOSE_WAIT",   "FIN_WAIT_1",   "CLOSING",
  62:     "LAST_ACK", "FIN_WAIT_2",   "TIME_WAIT",
  63: };
  64: #endif

Defined variables

tcp_acounts defined in line 55; used 1 times

Defined macros

TCPS_CLOSING defined in line 31; used 1 times
TCPS_FIN_WAIT_1 defined in line 30; used 1 times
TCPS_HAVERCVDFIN defined in line 38; used 3 times
TCPS_LAST_ACK defined in line 32; used 1 times
TCPS_SYN_RECEIVED defined in line 25; used 5 times

Usage of this include

Last modified: 1988-04-27
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3626
Valid CSS Valid XHTML 1.0 Strict