-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)
- u_char
- t_x2:4, /* (unused) */
- t_off:4; /* data offset */
+#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;
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ */
+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 */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ 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