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