10Sstevel@tonic-gate /* 2*12544SKacheong.Poon@Sun.COM * CDDL HEADER START 3*12544SKacheong.Poon@Sun.COM * 4*12544SKacheong.Poon@Sun.COM * The contents of this file are subject to the terms of the 5*12544SKacheong.Poon@Sun.COM * Common Development and Distribution License (the "License"). 6*12544SKacheong.Poon@Sun.COM * You may not use this file except in compliance with the License. 7*12544SKacheong.Poon@Sun.COM * 8*12544SKacheong.Poon@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*12544SKacheong.Poon@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*12544SKacheong.Poon@Sun.COM * See the License for the specific language governing permissions 11*12544SKacheong.Poon@Sun.COM * and limitations under the License. 12*12544SKacheong.Poon@Sun.COM * 13*12544SKacheong.Poon@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*12544SKacheong.Poon@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*12544SKacheong.Poon@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*12544SKacheong.Poon@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*12544SKacheong.Poon@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*12544SKacheong.Poon@Sun.COM * 19*12544SKacheong.Poon@Sun.COM * CDDL HEADER END 20*12544SKacheong.Poon@Sun.COM */ 21*12544SKacheong.Poon@Sun.COM 22*12544SKacheong.Poon@Sun.COM /* 23*12544SKacheong.Poon@Sun.COM * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* 270Sstevel@tonic-gate * Copyright (c) 1982, 1986 Regents of the University of California. 280Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 290Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifndef _NETINET_TCP_H 330Sstevel@tonic-gate #define _NETINET_TCP_H 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86 */ 360Sstevel@tonic-gate 370Sstevel@tonic-gate 380Sstevel@tonic-gate #include <sys/isa_defs.h> 390Sstevel@tonic-gate #include <sys/inttypes.h> 400Sstevel@tonic-gate 410Sstevel@tonic-gate #ifdef __cplusplus 420Sstevel@tonic-gate extern "C" { 430Sstevel@tonic-gate #endif 440Sstevel@tonic-gate 450Sstevel@tonic-gate typedef uint32_t tcp_seq; 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * TCP header. 480Sstevel@tonic-gate * Per RFC 793, September, 1981. 490Sstevel@tonic-gate */ 500Sstevel@tonic-gate struct tcphdr { 510Sstevel@tonic-gate uint16_t th_sport; /* source port */ 520Sstevel@tonic-gate uint16_t th_dport; /* destination port */ 530Sstevel@tonic-gate tcp_seq th_seq; /* sequence number */ 540Sstevel@tonic-gate tcp_seq th_ack; /* acknowledgement number */ 550Sstevel@tonic-gate #ifdef _BIT_FIELDS_LTOH 560Sstevel@tonic-gate uint_t th_x2:4, /* (unused) */ 570Sstevel@tonic-gate th_off:4; /* data offset */ 580Sstevel@tonic-gate #else 590Sstevel@tonic-gate uint_t th_off:4, /* data offset */ 600Sstevel@tonic-gate th_x2:4; /* (unused) */ 610Sstevel@tonic-gate #endif 620Sstevel@tonic-gate uchar_t th_flags; 630Sstevel@tonic-gate #define TH_FIN 0x01 640Sstevel@tonic-gate #define TH_SYN 0x02 650Sstevel@tonic-gate #define TH_RST 0x04 660Sstevel@tonic-gate #define TH_PUSH 0x08 670Sstevel@tonic-gate #define TH_ACK 0x10 680Sstevel@tonic-gate #define TH_URG 0x20 690Sstevel@tonic-gate #define TH_ECE 0x40 700Sstevel@tonic-gate #define TH_CWR 0x80 710Sstevel@tonic-gate uint16_t th_win; /* window */ 720Sstevel@tonic-gate uint16_t th_sum; /* checksum */ 730Sstevel@tonic-gate uint16_t th_urp; /* urgent pointer */ 740Sstevel@tonic-gate }; 750Sstevel@tonic-gate 760Sstevel@tonic-gate #define TCPOPT_EOL 0 770Sstevel@tonic-gate #define TCPOPT_NOP 1 780Sstevel@tonic-gate #define TCPOPT_MAXSEG 2 790Sstevel@tonic-gate #define TCPOPT_WSCALE 3 800Sstevel@tonic-gate #define TCPOPT_SACK_PERMITTED 4 810Sstevel@tonic-gate #define TCPOPT_SACK 5 820Sstevel@tonic-gate #define TCPOPT_TSTAMP 8 830Sstevel@tonic-gate 840Sstevel@tonic-gate /* 850Sstevel@tonic-gate * Default maximum segment size for TCP. 860Sstevel@tonic-gate * With an IP MTU of 576, this is 536. 870Sstevel@tonic-gate */ 880Sstevel@tonic-gate #define TCP_MSS 536 890Sstevel@tonic-gate 900Sstevel@tonic-gate /* 910Sstevel@tonic-gate * Options for use with [gs]etsockopt at the TCP level. 920Sstevel@tonic-gate * 930Sstevel@tonic-gate * Note: Some of the TCP_ namespace has conflict with and 940Sstevel@tonic-gate * and is exposed through <xti.h>. (It also requires exposing 950Sstevel@tonic-gate * options not implemented). The options with potential 960Sstevel@tonic-gate * for conflicts use #ifndef guards. 970Sstevel@tonic-gate */ 980Sstevel@tonic-gate #ifndef TCP_NODELAY 990Sstevel@tonic-gate #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ 1000Sstevel@tonic-gate #endif 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate #ifndef TCP_MAXSEG 1030Sstevel@tonic-gate #define TCP_MAXSEG 0x02 /* set maximum segment size */ 1040Sstevel@tonic-gate #endif 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate #ifndef TCP_KEEPALIVE 1070Sstevel@tonic-gate #define TCP_KEEPALIVE 0x8 /* set keepalive timer */ 1080Sstevel@tonic-gate #endif 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate #define TCP_NOTIFY_THRESHOLD 0x10 1120Sstevel@tonic-gate #define TCP_ABORT_THRESHOLD 0x11 1130Sstevel@tonic-gate #define TCP_CONN_NOTIFY_THRESHOLD 0x12 1140Sstevel@tonic-gate #define TCP_CONN_ABORT_THRESHOLD 0x13 1150Sstevel@tonic-gate #define TCP_RECVDSTADDR 0x14 1160Sstevel@tonic-gate #define TCP_INIT_CWND 0x15 1170Sstevel@tonic-gate #define TCP_KEEPALIVE_THRESHOLD 0x16 1180Sstevel@tonic-gate #define TCP_KEEPALIVE_ABORT_THRESHOLD 0x17 1190Sstevel@tonic-gate #define TCP_CORK 0x18 120*12544SKacheong.Poon@Sun.COM #define TCP_RTO_INITIAL 0x19 121*12544SKacheong.Poon@Sun.COM #define TCP_RTO_MIN 0x1A 122*12544SKacheong.Poon@Sun.COM #define TCP_RTO_MAX 0x1B 123*12544SKacheong.Poon@Sun.COM #define TCP_LINGER2 0x1C 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate /* gap for expansion of ``standard'' options */ 1260Sstevel@tonic-gate #define TCP_ANONPRIVBIND 0x20 /* for internal use only */ 1270Sstevel@tonic-gate #define TCP_EXCLBIND 0x21 /* for internal use only */ 1280Sstevel@tonic-gate 1290Sstevel@tonic-gate #ifdef __cplusplus 1300Sstevel@tonic-gate } 1310Sstevel@tonic-gate #endif 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate #endif /* _NETINET_TCP_H */ 134