-struct tcb {
-/* first four elements of this struct must match tcphead below */
- struct th *t_rcv_next; /* first el on rcv queue */
- struct th *t_rcv_prev; /* last el on rcv queue */
- struct tcb *tcb_next; /* next tcb */
- struct tcb *tcb_prev; /* next tcb */
-/* end must match */
- struct th *t_template; /* skeletal packet for transmit */
- struct ucb *t_ucb; /* ucb */
- struct mbuf *t_rcv_unack; /* unacked message queue */
- short seqcnt;
- short xxx;
- seq_t iss; /* initial send seq # */
- seq_t irs; /* initial recv seq # */
- seq_t rcv_urp; /* rcv urgent pointer */
- seq_t rcv_nxt; /* next seq # to rcv */
- seq_t rcv_end; /* rcv eol pointer */
- seq_t snd_off; /* seq # of first datum in send buf */
- seq_t seq_fin; /* seq # of FIN sent */
- seq_t snd_end; /* send eol pointer */
- seq_t snd_urp; /* snd urgent pointer */
- seq_t snd_lst; /* seq # of last sent datum */
- seq_t snd_nxt; /* seq # of next datum to send */
- seq_t snd_una; /* seq # of first unacked datum */
- seq_t snd_wl; /* seq # of last sent window */
- seq_t snd_hi; /* highest seq # sent */
- seq_t snd_wnd; /* send window max */
- seq_t t_rexmt_val; /* val saved in rexmt timer */
- seq_t t_rtl_val; /* val saved in rexmt too long timer */
- seq_t t_xmt_val; /* seq # sent when xmt timer started */
-
- /* various flags and state variables */
-
- u_short tc_flags;
-#define TC_ACK_DUE 0x0001 /* must we send ACK */
-#define TC_CANCELLED 0x0002 /* retransmit timer cancelled */
-#define TC_DROPPED_TXT 0x0004 /* dropped incoming data */
-#define TC_FIN_RCVD 0x0008 /* FIN received */
-#define TC_FORCE_ONE 0x0010 /* force sending of one byte */
-#define TC_NEW_WINDOW 0x0020 /* received new window size */
-#define TC_REXMT 0x0040 /* this msg is a retransmission */
-#define TC_SND_FIN 0x0080 /* FIN should be sent */
-#define TC_SND_RST 0x0100 /* RST should be sent */
-#define TC_SND_URG 0x0200 /* urgent data to send */
-#define TC_SYN_ACKED 0x0400 /* SYN has been ACKed */
-#define TC_SYN_RCVD 0x0800 /* SYN has been received */
-#define TC_USR_CLOSED 0x1000 /* user has closed connection */
-#define TC_WAITED_2_ML 0x2000 /* wait time for FIN ACK is up */
-#define TC_NET_KEEP 0x4000 /* don't free this net input */
-#define TC_USR_ABORT 0x8000 /* user has closed and does not expect
- to receive any more data */
-
- u_short t_lport; /* local port */
- u_short t_fport; /* foreign port */
- u_char t_state; /* state of this connection */
- u_char t_xmtime; /* current rexmt time */
-
- /* timers */
-
- u_char t_init; /* initialization too long */
- u_char t_rexmt; /* retransmission */
- u_char t_rexmttl; /* retransmit too long */
- u_char t_persist; /* retransmit persistance */
- u_char t_finack; /* fin acknowledged */
- u_char t_xmt; /* round trip transmission time */
-
- seq_t rcv_adv; /* advertised window */
-};
-struct tcbhead {
- struct th *t_rcv_next,*t_rcv_prev;
- struct tcb *tcb_next,*tcb_prev;
+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 ENDIAN == LITTLE
+ u_char th_x2:4, /* (unused) */
+ th_off:4; /* data offset */
+#endif
+#if ENDIAN == BIG
+ u_char th_off:4, /* data offset */
+ th_x2:4; /* (unused) */
+#endif
+ u_char th_flags;
+#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 */