author | Garrett D'Amore <garrett@nexenta.com> |
Wed, 17 Aug 2011 16:31:10 -0700 | |
changeset 13435 | 3185061eadee |
parent 12544 | 88a11088cbce |
permissions | -rw-r--r-- |
0 | 1 |
/* |
12544
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
2 |
* CDDL HEADER START |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
3 |
* |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
4 |
* The contents of this file are subject to the terms of the |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
7 |
* |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
9 |
* or http://www.opensolaris.org/os/licensing. |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
10 |
* See the License for the specific language governing permissions |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
11 |
* and limitations under the License. |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
12 |
* |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
18 |
* |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
19 |
* CDDL HEADER END |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
20 |
*/ |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
21 |
|
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
22 |
/* |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
23 |
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. |
13435
3185061eadee
1361 Add support for socket options TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL
Garrett D'Amore <garrett@nexenta.com>
parents:
12544
diff
changeset
|
24 |
* Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. |
0 | 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 |
|
12544
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
121 |
#define TCP_RTO_INITIAL 0x19 |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
122 |
#define TCP_RTO_MIN 0x1A |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
123 |
#define TCP_RTO_MAX 0x1B |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
0
diff
changeset
|
124 |
#define TCP_LINGER2 0x1C |
0 | 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 */ |
|
13435
3185061eadee
1361 Add support for socket options TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL
Garrett D'Amore <garrett@nexenta.com>
parents:
12544
diff
changeset
|
129 |
#define TCP_KEEPIDLE 0x22 |
3185061eadee
1361 Add support for socket options TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL
Garrett D'Amore <garrett@nexenta.com>
parents:
12544
diff
changeset
|
130 |
#define TCP_KEEPCNT 0x23 |
3185061eadee
1361 Add support for socket options TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL
Garrett D'Amore <garrett@nexenta.com>
parents:
12544
diff
changeset
|
131 |
#define TCP_KEEPINTVL 0x24 |
0 | 132 |
|
133 |
#ifdef __cplusplus |
|
134 |
} |
|
135 |
#endif |
|
136 |
||
137 |
#endif /* _NETINET_TCP_H */ |