xref: /titanic_41/usr/src/uts/common/netinet/tcp.h (revision ed5289f91b9bf164dccd6c75398362be77a4478d)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 1982, 1986 Regents of the University of California.
8  * All rights reserved.  The Berkeley software License Agreement
9  * specifies the terms and conditions for redistribution.
10  */
11 
12 #ifndef	_NETINET_TCP_H
13 #define	_NETINET_TCP_H
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 /* tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86	*/
17 
18 
19 #include <sys/isa_defs.h>
20 #include <sys/inttypes.h>
21 
22 #ifdef	__cplusplus
23 extern "C" {
24 #endif
25 
26 typedef	uint32_t	tcp_seq;
27 /*
28  * TCP header.
29  * Per RFC 793, September, 1981.
30  */
31 struct tcphdr {
32 	uint16_t	th_sport;	/* source port */
33 	uint16_t	th_dport;	/* destination port */
34 	tcp_seq		th_seq;		/* sequence number */
35 	tcp_seq		th_ack;		/* acknowledgement number */
36 #ifdef _BIT_FIELDS_LTOH
37 	uint_t	th_x2:4,		/* (unused) */
38 		th_off:4;		/* data offset */
39 #else
40 	uint_t	th_off:4,		/* data offset */
41 		th_x2:4;		/* (unused) */
42 #endif
43 	uchar_t	th_flags;
44 #define	TH_FIN	0x01
45 #define	TH_SYN	0x02
46 #define	TH_RST	0x04
47 #define	TH_PUSH	0x08
48 #define	TH_ACK	0x10
49 #define	TH_URG	0x20
50 #define	TH_ECE	0x40
51 #define	TH_CWR	0x80
52 	uint16_t	th_win;		/* window */
53 	uint16_t	th_sum;		/* checksum */
54 	uint16_t	th_urp;		/* urgent pointer */
55 };
56 
57 #define	TCPOPT_EOL	0
58 #define	TCPOPT_NOP	1
59 #define	TCPOPT_MAXSEG	2
60 #define	TCPOPT_WSCALE	3
61 #define	TCPOPT_SACK_PERMITTED	4
62 #define	TCPOPT_SACK	5
63 #define	TCPOPT_TSTAMP	8
64 
65 /*
66  * Default maximum segment size for TCP.
67  * With an IP MTU of 576, this is 536.
68  */
69 #define	TCP_MSS	536
70 
71 /*
72  * Options for use with [gs]etsockopt at the TCP level.
73  *
74  * Note: Some of the TCP_ namespace has conflict with and
75  * and is exposed through <xti.h>. (It also requires exposing
76  * options not implemented). The options with potential
77  * for conflicts use #ifndef guards.
78  */
79 #ifndef TCP_NODELAY
80 #define	TCP_NODELAY	0x01	/* don't delay send to coalesce packets */
81 #endif
82 
83 #ifndef TCP_MAXSEG
84 #define	TCP_MAXSEG	0x02	/* set maximum segment size */
85 #endif
86 
87 #ifndef TCP_KEEPALIVE
88 #define	TCP_KEEPALIVE	0x8	/* set keepalive timer */
89 #endif
90 
91 
92 #define	TCP_NOTIFY_THRESHOLD		0x10
93 #define	TCP_ABORT_THRESHOLD		0x11
94 #define	TCP_CONN_NOTIFY_THRESHOLD	0x12
95 #define	TCP_CONN_ABORT_THRESHOLD	0x13
96 #define	TCP_RECVDSTADDR			0x14
97 #define	TCP_INIT_CWND			0x15
98 #define	TCP_KEEPALIVE_THRESHOLD		0x16
99 #define	TCP_KEEPALIVE_ABORT_THRESHOLD	0x17
100 #define	TCP_CORK			0x18
101 
102 /* gap for expansion of ``standard'' options */
103 #define	TCP_ANONPRIVBIND		0x20	/* for internal use only  */
104 #define	TCP_EXCLBIND			0x21	/* for internal use only  */
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif	/* _NETINET_TCP_H */
111