xref: /titanic_41/usr/src/uts/common/netinet/tcp.h (revision dc41c81f4872a0d4ce52a59cd88a576aeb49183a)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
25  */
26 
27 /*
28  * Copyright (c) 1982, 1986 Regents of the University of California.
29  * All rights reserved.  The Berkeley software License Agreement
30  * specifies the terms and conditions for redistribution.
31  */
32 
33 #ifndef	_NETINET_TCP_H
34 #define	_NETINET_TCP_H
35 
36 /* tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86	*/
37 
38 
39 #include <sys/isa_defs.h>
40 #include <sys/inttypes.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 typedef	uint32_t	tcp_seq;
47 /*
48  * TCP header.
49  * Per RFC 793, September, 1981.
50  */
51 struct tcphdr {
52 	uint16_t	th_sport;	/* source port */
53 	uint16_t	th_dport;	/* destination port */
54 	tcp_seq		th_seq;		/* sequence number */
55 	tcp_seq		th_ack;		/* acknowledgement number */
56 #ifdef _BIT_FIELDS_LTOH
57 	uint_t	th_x2:4,		/* (unused) */
58 		th_off:4;		/* data offset */
59 #else
60 	uint_t	th_off:4,		/* data offset */
61 		th_x2:4;		/* (unused) */
62 #endif
63 	uchar_t	th_flags;
64 #define	TH_FIN	0x01
65 #define	TH_SYN	0x02
66 #define	TH_RST	0x04
67 #define	TH_PUSH	0x08
68 #define	TH_ACK	0x10
69 #define	TH_URG	0x20
70 #define	TH_ECE	0x40
71 #define	TH_CWR	0x80
72 	uint16_t	th_win;		/* window */
73 	uint16_t	th_sum;		/* checksum */
74 	uint16_t	th_urp;		/* urgent pointer */
75 };
76 
77 #define	TCPOPT_EOL	0
78 #define	TCPOPT_NOP	1
79 #define	TCPOPT_MAXSEG	2
80 #define	TCPOPT_WSCALE	3
81 #define	TCPOPT_SACK_PERMITTED	4
82 #define	TCPOPT_SACK	5
83 #define	TCPOPT_TSTAMP	8
84 
85 /*
86  * Default maximum segment size for TCP.
87  * With an IP MTU of 576, this is 536.
88  */
89 #define	TCP_MSS	536
90 
91 /*
92  * Options for use with [gs]etsockopt at the TCP level.
93  *
94  * Note: Some of the TCP_ namespace has conflict with and
95  * and is exposed through <xti.h>. (It also requires exposing
96  * options not implemented). The options with potential
97  * for conflicts use #ifndef guards.
98  */
99 #ifndef TCP_NODELAY
100 #define	TCP_NODELAY	0x01	/* don't delay send to coalesce packets */
101 #endif
102 
103 #ifndef TCP_MAXSEG
104 #define	TCP_MAXSEG	0x02	/* set maximum segment size */
105 #endif
106 
107 #ifndef TCP_KEEPALIVE
108 #define	TCP_KEEPALIVE	0x8	/* set keepalive timer */
109 #endif
110 
111 
112 #define	TCP_NOTIFY_THRESHOLD		0x10
113 #define	TCP_ABORT_THRESHOLD		0x11
114 #define	TCP_CONN_NOTIFY_THRESHOLD	0x12
115 #define	TCP_CONN_ABORT_THRESHOLD	0x13
116 #define	TCP_RECVDSTADDR			0x14
117 #define	TCP_INIT_CWND			0x15
118 #define	TCP_KEEPALIVE_THRESHOLD		0x16
119 #define	TCP_KEEPALIVE_ABORT_THRESHOLD	0x17
120 #define	TCP_CORK			0x18
121 #define	TCP_RTO_INITIAL			0x19
122 #define	TCP_RTO_MIN			0x1A
123 #define	TCP_RTO_MAX			0x1B
124 #define	TCP_LINGER2			0x1C
125 
126 /* gap for expansion of ``standard'' options */
127 #define	TCP_ANONPRIVBIND		0x20	/* for internal use only  */
128 #define	TCP_EXCLBIND			0x21	/* for internal use only  */
129 #define	TCP_KEEPIDLE			0x22
130 #define	TCP_KEEPCNT			0x23
131 #define	TCP_KEEPINTVL			0x24
132 
133 #ifdef	__cplusplus
134 }
135 #endif
136 
137 #endif	/* _NETINET_TCP_H */
138