xref: /csrg-svn/sys/netinet/tcp.h (revision 4803)
1 /* tcp.h 1.14 81/11/08 */
2 
3 /*
4  * Tcp header.  Fits over the ip header after option removed.
5  *
6  * SHOULD MAKE A CLEAN HEADER FOR USE BY USERS.
7  */
8 struct th {
9 	struct	th *t_next;		/* -> next tcp on rcv chain */
10 	struct	th *t_prev;		/* -> prev tcp on rcv chain */
11 	u_char	t_x1;			/* (unused) */
12 	u_char	t_pr;			/* protocol */
13 /* by rights, t_len should be a u_short, but this makes operations */
14 /* on it very dangerous as comparisons become unsigned and comparing */
15 /* against negative numbers then fails... we don't expect any > 32767 */
16 /* byte segments, so pragmatically delcare it to be a short */
17 	short	t_len;			/* seg length */
18 	struct	ip_addr t_s;		/* source internet address */
19 	struct	ip_addr t_d;		/* destination internet address */
20 	u_short	t_src;			/* source port */
21 	u_short	t_dst;			/* destination port */
22 	seq_t	t_seq;			/* sequence number */
23 	seq_t	t_ackno;		/* acknowledgement number */
24 #define	t_end(x) (x->t_seq + x->t_len - 1)
25 	u_char
26 		t_x2:4,			/* (unused) */
27 		t_off:4;		/* data offset */
28 	u_char	th_flags;
29 #define	TH_FIN	001
30 #define	TH_SYN	002
31 #define	TH_RST	004
32 #define	TH_EOL	010
33 #define	TH_ACK	020
34 #define	TH_URG	040
35 	u_short	t_win;			/* window */
36 	u_short	t_sum;			/* checksum */
37 	u_short	t_urp;			/* urgent pointer */
38 };
39