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