xref: /csrg-svn/sys/netinet/tcp.h (revision 25895)
1 /*
2  * Copyright (c) 1982 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)tcp.h	6.4 (Berkeley) 01/13/86
7  */
8 
9 typedef	u_long	tcp_seq;
10 /*
11  * TCP header.
12  * Per RFC 793, September, 1981.
13  */
14 struct tcphdr {
15 	u_short	th_sport;		/* source port */
16 	u_short	th_dport;		/* destination port */
17 	tcp_seq	th_seq;			/* sequence number */
18 	tcp_seq	th_ack;			/* acknowledgement number */
19 #ifdef vax
20 	u_char	th_x2:4,		/* (unused) */
21 		th_off:4;		/* data offset */
22 #endif
23 	u_char	th_flags;
24 #define	TH_FIN	0x01
25 #define	TH_SYN	0x02
26 #define	TH_RST	0x04
27 #define	TH_PUSH	0x08
28 #define	TH_ACK	0x10
29 #define	TH_URG	0x20
30 	u_short	th_win;			/* window */
31 	u_short	th_sum;			/* checksum */
32 	u_short	th_urp;			/* urgent pointer */
33 };
34 
35 #define	TCPOPT_EOL	0
36 #define	TCPOPT_NOP	1
37 #define	TCPOPT_MAXSEG	2
38 
39 /*
40  *  Default maximum segment size for TCP.
41  *  With an IP MSS of 576, this is 536,
42  *  but 512 is probably more convenient.
43  */
44 #define	TCP_MSS	MIN(512, IP_MSS - sizeof (struct tcpiphdr))
45 
46 /*
47  * User-settable options (used with setsockopt).
48  */
49 #define	TCP_NODELAY	0x01	/* don't delay send to coalesce packets */
50 #define	TCP_MAXSEG	0x02	/* set maximum segment size */
51