|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution is only permitted until one year after the first shipment ! 6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 7: * binary forms are permitted provided that: (1) source distributions retain ! 8: * this entire copyright notice and comment, and (2) distributions including ! 9: * binaries display the following acknowledgement: This product includes ! 10: * software developed by the University of California, Berkeley and its ! 11: * contributors'' in the documentation or other materials provided with the ! 12: * distribution and in all advertising materials mentioning features or use ! 13: * of this software. Neither the name of the University nor the names of ! 14: * its contributors may be used to endorse or promote products derived from ! 15: * this software without specific prior written permission. ! 16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 19: * ! 20: * @(#)tcp_fsm.h 7.4 (Berkeley) 6/28/90 ! 21: */ ! 22: ! 23: /* ! 24: * TCP FSM state definitions. ! 25: * Per RFC793, September, 1981. ! 26: */ ! 27: ! 28: #define TCP_NSTATES 11 ! 29: ! 30: #define TCPS_CLOSED 0 /* closed */ ! 31: #define TCPS_LISTEN 1 /* listening for connection */ ! 32: #define TCPS_SYN_SENT 2 /* active, have sent syn */ ! 33: #define TCPS_SYN_RECEIVED 3 /* have send and received syn */ ! 34: /* states < TCPS_ESTABLISHED are those where connections not established */ ! 35: #define TCPS_ESTABLISHED 4 /* established */ ! 36: #define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ ! 37: /* states > TCPS_CLOSE_WAIT are those where user has closed */ ! 38: #define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ ! 39: #define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ ! 40: #define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ ! 41: /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ ! 42: #define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ ! 43: #define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ ! 44: ! 45: #define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) ! 46: #define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT) ! 47: ! 48: #ifdef TCPOUTFLAGS ! 49: /* ! 50: * Flags used when sending segments in tcp_output. ! 51: * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally ! 52: * determined by state, with the proviso that TH_FIN is sent only ! 53: * if all data queued for output is included in the segment. ! 54: */ ! 55: u_char tcp_outflags[TCP_NSTATES] = { ! 56: TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK, ! 57: TH_ACK, TH_ACK, ! 58: TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK, ! 59: }; ! 60: #endif ! 61: ! 62: #ifdef KPROF ! 63: int tcp_acounts[TCP_NSTATES][PRU_NREQ]; ! 64: #endif ! 65: ! 66: #ifdef TCPSTATES ! 67: char *tcpstates[] = { ! 68: "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", ! 69: "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", ! 70: "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", ! 71: }; ! 72: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.