need time.h if no user.h
[unix-history] / usr / src / sys / netinet / tcp.h
index 4432b03..bf64c3f 100644 (file)
@@ -1,4 +1,36 @@
-/* tcp.h 1.21 82/01/18 */
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ *     @(#)tcp.h       7.6 (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;
 /*
@@ -10,9 +42,14 @@ 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 */
-       u_char
-               th_x2:4,                /* (unused) */
+#if BYTE_ORDER == LITTLE_ENDIAN
+       u_char  th_x2:4,                /* (unused) */
                th_off:4;               /* data offset */
                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
 #define        TH_SYN  0x02
        u_char  th_flags;
 #define        TH_FIN  0x01
 #define        TH_SYN  0x02
@@ -29,15 +66,18 @@ struct tcphdr {
 #define        TCPOPT_NOP      1
 #define        TCPOPT_MAXSEG   2
 
 #define        TCPOPT_NOP      1
 #define        TCPOPT_MAXSEG   2
 
-#ifdef TCPTRUEOOB
 /*
 /*
- * True out-of-band as value added option.
- * Advertise willingness with TCPOPT_WILOOB in
- * initial segment.  If peer is willing, will receive
- * such also.  Then can send TCPOPT_OOBDATA whenever oob data
- * exists; peer should ack with TCPOPT_OOBACK in segment.
+ * 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)).
  */
  */
-#define        TCPOPT_WILLOOB  64              /* bytes: 64, 2 */
-#define        TCPOPT_OOBDATA  65              /* bytes: 65, 8, seq#, data, markseq */
-#define        TCPOPT_OOBACK   66              /* bytes: 66, 3, ack# */
-#endif
+#define        TCP_MSS 512
+
+#define        TCP_MAXWIN      65535           /* largest value for window */
+
+/*
+ * User-settable options (used with setsockopt).
+ */
+#define        TCP_NODELAY     0x01    /* don't delay send to coalesce packets */
+#define        TCP_MAXSEG      0x02    /* set maximum segment size */