xref: /csrg-svn/sys/netinet/tcp.h (revision 23187)
1*23187Smckusick /*
2*23187Smckusick  * Copyright (c) 1982 Regents of the University of California.
3*23187Smckusick  * All rights reserved.  The Berkeley software License Agreement
4*23187Smckusick  * specifies the terms and conditions for redistribution.
5*23187Smckusick  *
6*23187Smckusick  *	@(#)tcp.h	6.3 (Berkeley) 06/08/85
7*23187Smckusick  */
84573Swnj 
95085Swnj typedef	u_long	tcp_seq;
104573Swnj /*
114899Swnj  * TCP header.
124924Swnj  * Per RFC 793, September, 1981.
134573Swnj  */
144899Swnj struct tcphdr {
154899Swnj 	u_short	th_sport;		/* source port */
164899Swnj 	u_short	th_dport;		/* destination port */
175085Swnj 	tcp_seq	th_seq;			/* sequence number */
185085Swnj 	tcp_seq	th_ack;			/* acknowledgement number */
199992Ssam #ifdef vax
209992Ssam 	u_char	th_x2:4,		/* (unused) */
214899Swnj 		th_off:4;		/* data offset */
229992Ssam #endif
234575Swnj 	u_char	th_flags;
245065Swnj #define	TH_FIN	0x01
255065Swnj #define	TH_SYN	0x02
265065Swnj #define	TH_RST	0x04
275065Swnj #define	TH_PUSH	0x08
285065Swnj #define	TH_ACK	0x10
295065Swnj #define	TH_URG	0x20
304899Swnj 	u_short	th_win;			/* window */
314899Swnj 	u_short	th_sum;			/* checksum */
324899Swnj 	u_short	th_urp;			/* urgent pointer */
334499Swnj };
345440Swnj 
355440Swnj #define	TCPOPT_EOL	0
365440Swnj #define	TCPOPT_NOP	1
375440Swnj #define	TCPOPT_MAXSEG	2
3817316Skarels 
3917316Skarels /*
4017316Skarels  *  Default maximum segment size for TCP.
4117316Skarels  *  With an IP MSS of 576, this is 536,
4217316Skarels  *  but 512 is probably more convenient.
4317316Skarels  */
4417316Skarels #define	TCP_MSS	MIN(512, IP_MSS - sizeof (struct tcpiphdr))
45