longer TTL's
[unix-history] / usr / src / sys / netinet / tcp_var.h
index 16ccc00..df54206 100644 (file)
@@ -1,73 +1,32 @@
-/*     tcp_var.h       4.7     81/11/24        */
-
 /*
 /*
- * Kernel variables for tcp.
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)tcp_var.h   6.6 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
- * Tcp+ip header, after ip options removed.
- */
-struct tcpiphdr {
-       struct  ipovly ti_i;            /* overlaid ip structure */
-       struct  tcphdr ti_t;            /* tcp header */
-};
-#define        ti_next         ti_i.ih_next
-#define        ti_prev         ti_i.ih_prev
-#define        ti_x1           ti_i.ih_x1
-#define        ti_pr           ti_i.ih_pr
-#define        ti_len          ti_i.ih_len
-#define        ti_src          ti_i.ih_src
-#define        ti_dst          ti_i.ih_dst
-#define        ti_sport        ti_t.th_sport
-#define        ti_dport        ti_t.th_dport
-#define        ti_seq          ti_t.th_seq
-#define        ti_ackno        ti_t.th_ackno
-#define        ti_x2           ti_t.th_x2
-#define        ti_off          ti_t.th_off
-#define        ti_flags        ti_t.th_flags
-#define        ti_win          ti_t.th_win
-#define        ti_sum          ti_t.th_sum
-#define        ti_urp          ti_t.th_urp
-
-/*
- * TCP sequence numbers are 32 bit integers operated
- * on with modular arithmetic.  These macros can be
- * used to compare such integers.
- */
-#define        SEQ_LT(a,b)     ((int)((a)-(b)) < 0)
-#define        SEQ_LEQ(a,b)    ((int)((a)-(b)) <= 0)
-#define        SEQ_GT(a,b)     ((int)((a)-(b)) > 0)
-#define        SEQ_GEQ(a,b)    ((int)((a)-(b)) >= 0)
-
-/*
- * Definitions of the TCP timers.  These timers are counted
- * down PR_SLOWHZ times a second.
+ * Kernel variables for tcp.
  */
  */
-#define        TCPT_NTIMERS    7
-
-#define        TCPT_INIT       0               /* initialization */
-#define        TCPT_REXMT      1               /* retransmit */
-#define        TCPT_REXMTTL    2               /* retransmit too long */
-#define        TCPT_KEEP       3               /* keep alive */
-#define        TCPT_KEEPTTL    4               /* keep alive too long */
-#define        TCPT_PERSIST    5               /* retransmit persistance */
-#define        TCPT_2MSL       6               /* 2*msl quiet time timer */
 
 /*
 
 /*
- * Tcp control block.
+ * Tcp control block, one per tcp; fields:
  */
 struct tcpcb {
  */
 struct tcpcb {
-       struct  tcpiphdr *seg_next,*seg_prev;   /* seq queue */
-       short   seqcnt;                 /* count of chars in seq queue */
-       u_char  t_state;                /* state of this connection */
-       short   t_timers[TCPT_NTIMERS]; /* tcp timers */
-       u_char  t_options;              /* connection options: */
-#define        TO_PUSH         0x01                    /* push mode */
-#define        TO_URG          0x02                    /* urgent mode */
-#define        TO_KEEP         0x04                    /* use keep-alives */
+       struct  tcpiphdr *seg_next;     /* sequencing queue */
+       struct  tcpiphdr *seg_prev;
+       short   t_state;                /* state of this connection */
+       short   t_timer[TCPT_NTIMERS];  /* tcp timers */
+       short   t_rxtshift;             /* log(2) of rexmt exp. backoff */
+       struct  mbuf *t_tcpopt;         /* tcp options */
+       short   t_maxseg;               /* maximum segment size */
+       char    t_force;                /* 1 if forcing out a byte */
        u_char  t_flags;
        u_char  t_flags;
-#define        TF_OWEACK       0x01                    /* owe ack to peer */
-       struct  mbuf *seg_unack;        /* unacked message queue */
+#define        TF_ACKNOW       0x01            /* ack peer immediately */
+#define        TF_DELACK       0x02            /* ack, but try to delay it */
+#define        TF_NODELAY      0x04            /* don't delay packets to coalesce */
+#define        TF_NOOPT        0x08            /* don't use tcp options */
        struct  tcpiphdr *t_template;   /* skeletal packet for transmit */
        struct  inpcb *t_inpcb;         /* back pointer to internet pcb */
 /*
        struct  tcpiphdr *t_template;   /* skeletal packet for transmit */
        struct  inpcb *t_inpcb;         /* back pointer to internet pcb */
 /*
@@ -77,58 +36,44 @@ struct tcpcb {
 /* send sequence variables */
        tcp_seq snd_una;                /* send unacknowledged */
        tcp_seq snd_nxt;                /* send next */
 /* send sequence variables */
        tcp_seq snd_una;                /* send unacknowledged */
        tcp_seq snd_nxt;                /* send next */
-       u_short snd_wnd;                /* send window */
        tcp_seq snd_up;                 /* send urgent pointer */
        tcp_seq snd_wl1;                /* window update seg seq number */
        tcp_seq snd_wl2;                /* window update seg ack number */
        tcp_seq iss;                    /* initial send sequence number */
        tcp_seq snd_up;                 /* send urgent pointer */
        tcp_seq snd_wl1;                /* window update seg seq number */
        tcp_seq snd_wl2;                /* window update seg ack number */
        tcp_seq iss;                    /* initial send sequence number */
+       u_short snd_wnd;                /* send window */
 /* receive sequence variables */
 /* receive sequence variables */
-       tcp_seq rcv_nxt;                /* receive next */
        u_short rcv_wnd;                /* receive window */
        u_short rcv_wnd;                /* receive window */
+       tcp_seq rcv_nxt;                /* receive next */
        tcp_seq rcv_up;                 /* receive urgent pointer */
        tcp_seq irs;                    /* initial receive sequence number */
 /*
  * Additional variables for this implementation.
  */
        tcp_seq rcv_up;                 /* receive urgent pointer */
        tcp_seq irs;                    /* initial receive sequence number */
 /*
  * Additional variables for this implementation.
  */
-/* send variables */
-       tcp_seq snd_off;        /*??*/  /* seq # of first datum in send buf */
-       tcp_seq seq_fin;        /*??*/  /* seq # of FIN sent */
-       tcp_seq snd_hi;         /*??*/  /* highest seq # sent */
-       tcp_seq snd_end;        /*??*/  /* send eol pointer */
-       tcp_seq snd_lst;        /*??*/  /* seq # of last sent datum */
-       tcp_seq snd_wl;         /*??*/  /* seq # of last sent window */
-       tcp_seq snd_wnd;        /*??*/  /* send window max */
-/* retransmit variables */
-       tcp_seq t_rexmt_val;    /*??*/  /* val saved in rexmt timer */
-       tcp_seq t_rtl_val;      /*??*/  /* val saved in rexmt too long timer */
-       tcp_seq t_xmt_val;      /*??*/  /* seq # sent when xmt timer started */
-       u_char  t_xmtime;       /*??*/  /* current rexmt time */
-       short   t_xmt;          /*??*/  /* round trip transmission time */
 /* receive variables */
 /* receive variables */
-       tcp_seq rcv_end;        /*??*/  /* rcv eol pointer */
-       tcp_seq rcv_adv;        /*??*/  /* advertised window */
+       tcp_seq rcv_adv;                /* advertised window */
+/* retransmit variables */
+       tcp_seq snd_max;                /* highest sequence number sent
+                                        * used to recognize retransmits
+                                        */
+/* congestion control (for source quench) */
+       u_short snd_cwnd;               /* congestion-controlled window */
+/* transmit timing stuff */
+       short   t_idle;                 /* inactivity time */
+       short   t_rtt;                  /* round trip time */
+       u_short max_rcvd;               /* most peer has sent into window */
+       tcp_seq t_rtseq;                /* sequence number being timed */
+       float   t_srtt;                 /* smoothed round-trip time */
+       u_short max_sndwnd;             /* largest window peer has offered */
+/* out-of-band data */
+       char    t_oobflags;             /* have some */
+       char    t_iobc;                 /* input character */
+#define        TCPOOB_HAVEDATA 0x01
+#define        TCPOOB_HADDATA  0x02
 };
 
 #define        intotcpcb(ip)   ((struct tcpcb *)(ip)->inp_ppcb)
 #define        sototcpcb(so)   (intotcpcb(sotoinpcb(so)))
 
 };
 
 #define        intotcpcb(ip)   ((struct tcpcb *)(ip)->inp_ppcb)
 #define        sototcpcb(so)   (intotcpcb(sotoinpcb(so)))
 
-#define        ISSINCR         128             /* increment for iss each second */
-#define        TCPSIZE         20              /* size of TCP leader (bytes) */
-
-#define        TCP_TTL         30              /* time to live for TCP segs: 30s */
-/*
- * TCPSC constants give various timeouts in ``slow-clock'' ticks.
- */
-#define        TCPSC_MSL       (TCP_TTL*PR_SLOWHZ)     /* max seg lifetime */
-#define        TCPSC_REXMT     (1*PR_SLOWHZ)           /* base retransmit time */
-#define        TCPSC_REXMTTL   (TCP_TTL*2*PR_SLOWHZ)   /* retransmit too long */
-#define        TCPSC_KEEP      (TCP_TTL*4*PR_SLOWHZ)   /* keep alive */
-#define        TCPSC_KEEPTTL   (4*TCPSC_KEEP)          /* keep alive too long */
-#define        TCPSC_PERSIST   (5*PR_SLOWHZ)           /* retransmit persistance */
-#define        TCPSC_2MSL      (TCP_TTL*2*PR_SLOWHZ)   /* 2*msl quiet time timer */
-
-#define        TCPSC_REMAX     (TCP_TTL*PR_SLOWHZ)     /* maximum rexmt time */
-
 struct tcpstat {
        int     tcps_badsum;
        int     tcps_badoff;
 struct tcpstat {
        int     tcps_badsum;
        int     tcps_badoff;
@@ -138,14 +83,9 @@ struct      tcpstat {
 };
 
 #ifdef KERNEL
 };
 
 #ifdef KERNEL
-tcp_seq        tcp_iss;                /* tcp initial send seq # */
 struct inpcb tcb;              /* head of queue of active tcpcb's */
 struct tcpstat tcpstat;        /* tcp statistics */
 struct inpcb tcb;              /* head of queue of active tcpcb's */
 struct tcpstat tcpstat;        /* tcp statistics */
-#endif
 struct tcpiphdr *tcp_template();
 struct tcpiphdr *tcp_template();
-#endif
-
-#ifdef TCPTIMERS
-char *tcptimers[] =
-    { "INIT", "REXMT", "REXMTTL", "KEEP", "KEEPTTL", "PERSIST", "2MSL" };
+struct tcpcb *tcp_close(), *tcp_drop();
+struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();
 #endif
 #endif