17c478bd9Sstevel@tonic-gate /* 2707e74bcSKacheong Poon * CDDL HEADER START 3707e74bcSKacheong Poon * 4707e74bcSKacheong Poon * The contents of this file are subject to the terms of the 5707e74bcSKacheong Poon * Common Development and Distribution License (the "License"). 6707e74bcSKacheong Poon * You may not use this file except in compliance with the License. 7707e74bcSKacheong Poon * 8707e74bcSKacheong Poon * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9707e74bcSKacheong Poon * or http://www.opensolaris.org/os/licensing. 10707e74bcSKacheong Poon * See the License for the specific language governing permissions 11707e74bcSKacheong Poon * and limitations under the License. 12707e74bcSKacheong Poon * 13707e74bcSKacheong Poon * When distributing Covered Code, include this CDDL HEADER in each 14707e74bcSKacheong Poon * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15707e74bcSKacheong Poon * If applicable, add the following below this CDDL HEADER, with the 16707e74bcSKacheong Poon * fields enclosed by brackets "[]" replaced with your own identifying 17707e74bcSKacheong Poon * information: Portions Copyright [yyyy] [name of copyright owner] 18707e74bcSKacheong Poon * 19707e74bcSKacheong Poon * CDDL HEADER END 20707e74bcSKacheong Poon */ 21707e74bcSKacheong Poon 22707e74bcSKacheong Poon /* 23707e74bcSKacheong Poon * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. 243d0a255cSGarrett D'Amore * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* 287c478bd9Sstevel@tonic-gate * Copyright (c) 1982, 1986 Regents of the University of California. 297c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 307c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 317c478bd9Sstevel@tonic-gate */ 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #ifndef _NETINET_TCP_H 347c478bd9Sstevel@tonic-gate #define _NETINET_TCP_H 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86 */ 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h> 407c478bd9Sstevel@tonic-gate #include <sys/inttypes.h> 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #ifdef __cplusplus 437c478bd9Sstevel@tonic-gate extern "C" { 447c478bd9Sstevel@tonic-gate #endif 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate typedef uint32_t tcp_seq; 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * TCP header. 497c478bd9Sstevel@tonic-gate * Per RFC 793, September, 1981. 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate struct tcphdr { 527c478bd9Sstevel@tonic-gate uint16_t th_sport; /* source port */ 537c478bd9Sstevel@tonic-gate uint16_t th_dport; /* destination port */ 547c478bd9Sstevel@tonic-gate tcp_seq th_seq; /* sequence number */ 557c478bd9Sstevel@tonic-gate tcp_seq th_ack; /* acknowledgement number */ 567c478bd9Sstevel@tonic-gate #ifdef _BIT_FIELDS_LTOH 577c478bd9Sstevel@tonic-gate uint_t th_x2:4, /* (unused) */ 587c478bd9Sstevel@tonic-gate th_off:4; /* data offset */ 597c478bd9Sstevel@tonic-gate #else 607c478bd9Sstevel@tonic-gate uint_t th_off:4, /* data offset */ 617c478bd9Sstevel@tonic-gate th_x2:4; /* (unused) */ 627c478bd9Sstevel@tonic-gate #endif 637c478bd9Sstevel@tonic-gate uchar_t th_flags; 647c478bd9Sstevel@tonic-gate #define TH_FIN 0x01 657c478bd9Sstevel@tonic-gate #define TH_SYN 0x02 667c478bd9Sstevel@tonic-gate #define TH_RST 0x04 677c478bd9Sstevel@tonic-gate #define TH_PUSH 0x08 687c478bd9Sstevel@tonic-gate #define TH_ACK 0x10 697c478bd9Sstevel@tonic-gate #define TH_URG 0x20 707c478bd9Sstevel@tonic-gate #define TH_ECE 0x40 717c478bd9Sstevel@tonic-gate #define TH_CWR 0x80 727c478bd9Sstevel@tonic-gate uint16_t th_win; /* window */ 737c478bd9Sstevel@tonic-gate uint16_t th_sum; /* checksum */ 747c478bd9Sstevel@tonic-gate uint16_t th_urp; /* urgent pointer */ 757c478bd9Sstevel@tonic-gate }; 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate #define TCPOPT_EOL 0 787c478bd9Sstevel@tonic-gate #define TCPOPT_NOP 1 797c478bd9Sstevel@tonic-gate #define TCPOPT_MAXSEG 2 807c478bd9Sstevel@tonic-gate #define TCPOPT_WSCALE 3 817c478bd9Sstevel@tonic-gate #define TCPOPT_SACK_PERMITTED 4 827c478bd9Sstevel@tonic-gate #define TCPOPT_SACK 5 837c478bd9Sstevel@tonic-gate #define TCPOPT_TSTAMP 8 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* 867c478bd9Sstevel@tonic-gate * Default maximum segment size for TCP. 877c478bd9Sstevel@tonic-gate * With an IP MTU of 576, this is 536. 887c478bd9Sstevel@tonic-gate */ 897c478bd9Sstevel@tonic-gate #define TCP_MSS 536 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* 927c478bd9Sstevel@tonic-gate * Options for use with [gs]etsockopt at the TCP level. 937c478bd9Sstevel@tonic-gate * 947c478bd9Sstevel@tonic-gate * Note: Some of the TCP_ namespace has conflict with and 957c478bd9Sstevel@tonic-gate * and is exposed through <xti.h>. (It also requires exposing 967c478bd9Sstevel@tonic-gate * options not implemented). The options with potential 977c478bd9Sstevel@tonic-gate * for conflicts use #ifndef guards. 987c478bd9Sstevel@tonic-gate */ 997c478bd9Sstevel@tonic-gate #ifndef TCP_NODELAY 1007c478bd9Sstevel@tonic-gate #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ 1017c478bd9Sstevel@tonic-gate #endif 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #ifndef TCP_MAXSEG 1047c478bd9Sstevel@tonic-gate #define TCP_MAXSEG 0x02 /* set maximum segment size */ 1057c478bd9Sstevel@tonic-gate #endif 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #ifndef TCP_KEEPALIVE 1087c478bd9Sstevel@tonic-gate #define TCP_KEEPALIVE 0x8 /* set keepalive timer */ 1097c478bd9Sstevel@tonic-gate #endif 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #define TCP_NOTIFY_THRESHOLD 0x10 1137c478bd9Sstevel@tonic-gate #define TCP_ABORT_THRESHOLD 0x11 1147c478bd9Sstevel@tonic-gate #define TCP_CONN_NOTIFY_THRESHOLD 0x12 1157c478bd9Sstevel@tonic-gate #define TCP_CONN_ABORT_THRESHOLD 0x13 1167c478bd9Sstevel@tonic-gate #define TCP_RECVDSTADDR 0x14 1177c478bd9Sstevel@tonic-gate #define TCP_INIT_CWND 0x15 1187c478bd9Sstevel@tonic-gate #define TCP_KEEPALIVE_THRESHOLD 0x16 1197c478bd9Sstevel@tonic-gate #define TCP_KEEPALIVE_ABORT_THRESHOLD 0x17 1207c478bd9Sstevel@tonic-gate #define TCP_CORK 0x18 121707e74bcSKacheong Poon #define TCP_RTO_INITIAL 0x19 122707e74bcSKacheong Poon #define TCP_RTO_MIN 0x1A 123707e74bcSKacheong Poon #define TCP_RTO_MAX 0x1B 124707e74bcSKacheong Poon #define TCP_LINGER2 0x1C 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate /* gap for expansion of ``standard'' options */ 1277c478bd9Sstevel@tonic-gate #define TCP_ANONPRIVBIND 0x20 /* for internal use only */ 1287c478bd9Sstevel@tonic-gate #define TCP_EXCLBIND 0x21 /* for internal use only */ 1293d0a255cSGarrett D'Amore #define TCP_KEEPIDLE 0x22 1303d0a255cSGarrett D'Amore #define TCP_KEEPCNT 0x23 1313d0a255cSGarrett D'Amore #define TCP_KEEPINTVL 0x24 132*d4994511SCody Peter Mello #define TCP_CONGESTION 0x25 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1357c478bd9Sstevel@tonic-gate } 1367c478bd9Sstevel@tonic-gate #endif 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate #endif /* _NETINET_TCP_H */ 139