fix bug that can cause recursive .forward files to fail
[unix-history] / usr / src / sys / netinet / tcp.h
index 922c906..b945f85 100644 (file)
@@ -1,10 +1,26 @@
 /*
 /*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1982, 1986, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- *     @(#)tcp.h       7.1 (Berkeley) %G%
+ * %sccs.include.redist.c%
+ *
+ *     @(#)tcp.h       8.1 (Berkeley) %G%
+ */
+#ifndef BYTE_ORDER
+/*
+ * Definitions for byte order,
+ * according to byte significance from low address to high.
  */
  */
+#define        LITTLE_ENDIAN   1234    /* least-significant byte first (vax) */
+#define        BIG_ENDIAN      4321    /* most-significant byte first (IBM, net) */
+#define        PDP_ENDIAN      3412    /* LSB first in word, MSW first in long (pdp) */
+
+#ifdef vax
+#define        BYTE_ORDER      LITTLE_ENDIAN
+#else
+#define        BYTE_ORDER      BIG_ENDIAN      /* mc68000, tahoe, most others */
+#endif
+#endif BYTE_ORDER
 
 typedef        u_long  tcp_seq;
 /*
 
 typedef        u_long  tcp_seq;
 /*
@@ -16,9 +32,13 @@ struct tcphdr {
        u_short th_dport;               /* destination port */
        tcp_seq th_seq;                 /* sequence number */
        tcp_seq th_ack;                 /* acknowledgement number */
        u_short th_dport;               /* destination port */
        tcp_seq th_seq;                 /* sequence number */
        tcp_seq th_ack;                 /* acknowledgement number */
-#ifdef vax
+#if BYTE_ORDER == LITTLE_ENDIAN
        u_char  th_x2:4,                /* (unused) */
                th_off:4;               /* data offset */
        u_char  th_x2:4,                /* (unused) */
                th_off:4;               /* data offset */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+       u_char  th_off:4,               /* data offset */
+               th_x2:4;                /* (unused) */
 #endif
        u_char  th_flags;
 #define        TH_FIN  0x01
 #endif
        u_char  th_flags;
 #define        TH_FIN  0x01
@@ -32,20 +52,33 @@ struct tcphdr {
        u_short th_urp;                 /* urgent pointer */
 };
 
        u_short th_urp;                 /* urgent pointer */
 };
 
-#define        TCPOPT_EOL      0
-#define        TCPOPT_NOP      1
-#define        TCPOPT_MAXSEG   2
+#define        TCPOPT_EOL              0
+#define        TCPOPT_NOP              1
+#define        TCPOPT_MAXSEG           2
+#define    TCPOLEN_MAXSEG              4
+#define TCPOPT_WINDOW          3
+#define    TCPOLEN_WINDOW              3
+#define TCPOPT_SACK_PERMITTED  4               /* Experimental */
+#define    TCPOLEN_SACK_PERMITTED      2
+#define TCPOPT_SACK            5               /* Experimental */
+#define TCPOPT_TIMESTAMP       8
+#define    TCPOLEN_TIMESTAMP           10
+#define    TCPOLEN_TSTAMP_APPA         (TCPOLEN_TIMESTAMP+2) /* appendix A */
+
+#define TCPOPT_TSTAMP_HDR      \
+    (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
 
 /*
  * Default maximum segment size for TCP.
  * With an IP MSS of 576, this is 536,
  * but 512 is probably more convenient.
 
 /*
  * Default maximum segment size for TCP.
  * With an IP MSS of 576, this is 536,
  * but 512 is probably more convenient.
+ * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
  */
  */
-#ifdef lint
-#define        TCP_MSS 536
-#else
-#define        TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr))
-#endif
+#define        TCP_MSS 512
+
+#define        TCP_MAXWIN      65535   /* largest value for (unscaled) window */
+
+#define TCP_MAX_WINSHIFT       14      /* maximum window shift */
 
 /*
  * User-settable options (used with setsockopt).
 
 /*
  * User-settable options (used with setsockopt).