tcp.h revision 9cd928fe5e3ea4e05f64cfb380beb54b2623e7dc
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/* Copyright (c) 1990 Mentat Inc. */
#ifndef _INET_TCP_H
#define _INET_TCP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/inttypes.h>
#include <sys/socket_proto.h>
#include <inet/tcp_stack.h>
#include <inet/tcp_sack.h>
/* TCP states */
#define TCPS_CLOSED -6
/* states < TCPS_ESTABLISHED are those where connections not established */
#define TCPS_ESTABLISHED 0 /* established */
/* states > TCPS_CLOSE_WAIT are those where user has closed */
/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
/*
* Internal flags used in conjunction with the packet header flags.
* Used in tcp_input_data to keep track of what needs to be done.
*/
/*
* TCP sequence numbers are 32 bit integers operated
* on with modular arithmetic. These macros can be
* used to compare such integers.
*/
/* TCP Protocol header */
typedef struct tcphdr_s {
} tcph_t;
#define TCP_HDR_LENGTH(tcph) \
#define TCP_MAX_HDR_LENGTH 60
#define TCP_MIN_HEADER_LENGTH 20
#define TCP_MAXWIN 65535
#define TCP_PORT_LEN sizeof (in_port_t)
#define TCP_MAX_WINSHIFT 14
#define TCPIP_HDR_LENGTH(mp, n) \
/* TCP Protocol header (used if the header is known to be 32-bit aligned) */
typedef struct tcphdra_s {
} tcpha_t;
struct conn_s;
struct tcp_listen_cnt_s;
/*
* Control structure for each open TCP stream,
* defined only within the kernel or for a kmem user.
* NOTE: tcp_reinit_values MUST have a line for each field in this structure!
*/
typedef struct tcp_s {
struct tcp_s *tcp_time_wait_next;
/* Pointer to next T/W block */
struct tcp_s *tcp_time_wait_prev;
/* Pointer to previous T/W next */
/* data segment */
/* lbolt on last packet, used for PAWS */
/* Fields arranged in approximate access order along main paths */
/* Following manipulated by TCP under squeue protection */
#define tcp_dontdrop tcp_syn_defense
tcp_set_timer : 1,
tcp_pad_to_bit31 : 11;
/* Following manipulated by TCP under squeue protection */
tcp_snd_ts_ok : 1,
tcp_snd_ws_ok : 1,
tcp_reserved_port : 1,
tcp_in_free_list : 1,
tcp_pad_to_bit_31 : 18;
/* SACK related info */
int tcp_conn_req_cnt_q0; /* # of conn reqs in SYN_RCVD */
int tcp_conn_req_cnt_q; /* # of conn reqs in ESTABLISHED */
int tcp_conn_req_max; /* # of ESTABLISHED conn reqs allowed */
#define tcp_ip_addr_cache tcp_reass_tail
/* Cache ip addresses that */
/* complete the 3-way handshake */
/* all eagers form a circular list */
union {
} tcp_conn;
/* TCP Keepalive Timer members */
/*
* The header template lives in conn_ht_iphc allocated by tcp_build_hdrs
* We maintain three pointers into conn_ht_iphc.
*/
int tcp_ipsec_overhead;
struct tcp_s **tcp_ptpbhn;
/*
* All fusion-related fields are protected by squeue.
*/
tcp_fuse_to_bit_31 : 29;
/*
* This variable is accessed without any lock protection
* and therefore must not be declared as a bit field along
* with the rest which require such condition.
*/
/* protected by the tcp_non_sq_lock lock */
/*
* Kernel SSL session information
*/
/*
* tcp_closemp_used is protected by listener's tcp_eager_lock
* when used for eagers. When used for a tcp in TIME_WAIT state
* or in tcp_close(), it is not protected by any lock as we
* do not expect any other thread to use it concurrently.
* We do allow re-use of tcp_closemp in tcp_time_wait_collector()
* and tcp_close() but not concurrently.
*/
/*
* previous and next eagers in the list of droppable eagers. See
* the comments before MAKE_DROPPABLE(). These pointers are
* protected by listener's tcp_eager_lock.
*/
struct tcp_s *tcp_eager_prev_drop_q0;
struct tcp_s *tcp_eager_next_drop_q0;
/*
* Have we flow controlled xmitter?
* This variable can be modified outside the squeue and hence must
* not be declared as a bit field along with the rest that are
* modified only within the squeue.
* protected by the tcp_non_sq_lock lock.
*/
/*
* Sender's next sequence number at the time the window was shrunk.
*/
/*
* Socket generation number which is bumped when a connection attempt
* is initiated. Its main purpose is to ensure that the socket does not
* miss the asynchronous connected/disconnected notification.
*/
/* mblk_t used to enter TCP's squeue from the service routine. */
/* Mutex for accessing tcp_rsrv_mp */
/* For connection counting. */
struct tcp_listen_cnt_s *tcp_listen_cnt;
/* Segment reassembly timer. */
#ifdef DEBUG
#endif
} tcp_t;
#ifdef DEBUG
depth))
#else
#endif
extern void tcp_conn_reclaim(void *);
extern void tcp_ddi_g_init(void);
extern void tcp_ddi_g_destroy(void);
/*
* The TCP Fanout structure for bind and acceptor hashes.
* The hash tables and their linkage (tcp_*_hash, tcp_ptp*hn) are
* protected by the per-bucket tf_lock. Each tcp_t
* inserted in the list points back at this lock using tcp_*_lockp.
*
* The bind and acceptor hash queues are lists of tcp_t.
*/
/* listener hash and acceptor hash queue head */
typedef struct tf_s {
} tf_t;
/* Also used in ipclassifier.c */
extern struct kmem_cache *tcp_sack_info_cache;
#endif /* (defined(_KERNEL) || defined(_KMEMUSER)) */
/* Contract private interface between TCP and Clustering. */
typedef struct cl_tcp_info_s {
#ifdef _KERNEL
/* Note: V4_PART_OF_V6 is meant to be used only for _KERNEL defined stuff */
#endif /* _KERNEL */
/*
* Hook functions to enable cluster networking
* On non-clustered systems these vectors must always be NULL.
*/
/*
* Contracted Consolidation Private ioctl for aborting TCP connections.
* In order to keep the offsets and size of the structure the same between
* a 32-bit application and a 64-bit amd64 kernel, we use a #pragma
* pack(4).
*/
#pragma pack(4)
#endif
typedef struct tcp_ioc_abort_conn_s {
#pragma pack()
#endif
#ifdef __cplusplus
}
#endif
#endif /* _INET_TCP_H */