date and time created 82/12/16 14:38:25 by sam
[unix-history] / usr / src / sys / netinet / tcp.h
index 648ec87..4432b03 100644 (file)
@@ -1,38 +1,43 @@
-/* tcp.h 1.15 81/11/14 */
+/* tcp.h 1.21 82/01/18 */
 
 
+typedef        u_long  tcp_seq;
 /*
 /*
- * Tcp header.  Fits over the ip header after option removed.
- *
- * SHOULD MAKE A CLEAN HEADER FOR USE BY USERS.
+ * TCP header.
+ * Per RFC 793, September, 1981.
  */
  */
-struct tcpiphdr {
-       struct  tcpiphdr *t_next;               /* -> next tcp on rcv chain */
-       struct  tcpiphdr *t_prev;               /* -> prev tcp on rcv chain */
-       u_char  t_x1;                   /* (unused) */
-       u_char  t_pr;                   /* protocol */
-/* by rights, t_len should be a u_short, but this makes operations */
-/* on it very dangerous as comparisons become unsigned and comparing */
-/* against negative numbers then fails... we don't expect any > 32767 */
-/* byte segments, so pragmatically delcare it to be a short */
-       short   t_len;                  /* seg length */
-       struct  ip_addr t_s;            /* source internet address */
-       struct  ip_addr t_d;            /* destination internet address */
-       u_short t_src;                  /* source port */
-       u_short t_dst;                  /* destination port */
-       seq_t   t_seq;                  /* sequence number */
-       seq_t   t_ackno;                /* acknowledgement number */
-#define        t_end(x) (x->t_seq + x->t_len - 1)
+struct tcphdr {
+       u_short th_sport;               /* source port */
+       u_short th_dport;               /* destination port */
+       tcp_seq th_seq;                 /* sequence number */
+       tcp_seq th_ack;                 /* acknowledgement number */
        u_char
        u_char
-               t_x2:4,                 /* (unused) */
-               t_off:4;                /* data offset */
+               th_x2:4,                /* (unused) */
+               th_off:4;               /* data offset */
        u_char  th_flags;
        u_char  th_flags;
-#define        TH_FIN  001
-#define        TH_SYN  002
-#define        TH_RST  004
-#define        TH_EOL  010
-#define        TH_ACK  020
-#define        TH_URG  040
-       u_short t_win;                  /* window */
-       u_short t_sum;                  /* checksum */
-       u_short t_urp;                  /* urgent pointer */
+#define        TH_FIN  0x01
+#define        TH_SYN  0x02
+#define        TH_RST  0x04
+#define        TH_PUSH 0x08
+#define        TH_ACK  0x10
+#define        TH_URG  0x20
+       u_short th_win;                 /* window */
+       u_short th_sum;                 /* checksum */
+       u_short th_urp;                 /* urgent pointer */
 };
 };
+
+#define        TCPOPT_EOL      0
+#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.
+ */
+#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