1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. 25 * Copyright 2024 Oxide Computer Company 26 */ 27 28 /* 29 * Copyright (c) 1982, 1986 Regents of the University of California. 30 * All rights reserved. The Berkeley software License Agreement 31 * specifies the terms and conditions for redistribution. 32 */ 33 34 #ifndef _NETINET_TCP_H 35 #define _NETINET_TCP_H 36 37 /* tcp.h 1.11 88/08/19 SMI; from UCB 7.2 10/28/86 */ 38 39 40 #include <sys/isa_defs.h> 41 #include <sys/inttypes.h> 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 typedef uint32_t tcp_seq; 48 /* 49 * TCP header. 50 * Per RFC 793, September, 1981. 51 */ 52 struct tcphdr { 53 uint16_t th_sport; /* source port */ 54 uint16_t th_dport; /* destination port */ 55 tcp_seq th_seq; /* sequence number */ 56 tcp_seq th_ack; /* acknowledgement number */ 57 #ifdef _BIT_FIELDS_LTOH 58 uint_t th_x2:4, /* (unused) */ 59 th_off:4; /* data offset */ 60 #else 61 uint_t th_off:4, /* data offset */ 62 th_x2:4; /* (unused) */ 63 #endif 64 uchar_t th_flags; 65 #define TH_FIN 0x01 66 #define TH_SYN 0x02 67 #define TH_RST 0x04 68 #define TH_PUSH 0x08 69 #define TH_ACK 0x10 70 #define TH_URG 0x20 71 #define TH_ECE 0x40 72 #define TH_CWR 0x80 73 uint16_t th_win; /* window */ 74 uint16_t th_sum; /* checksum */ 75 uint16_t th_urp; /* urgent pointer */ 76 }; 77 78 #define TCPOPT_EOL 0 79 #define TCPOPT_NOP 1 80 #define TCPOPT_MAXSEG 2 81 #define TCPOPT_WSCALE 3 82 #define TCPOPT_SACK_PERMITTED 4 83 #define TCPOPT_SACK 5 84 #define TCPOPT_TSTAMP 8 85 #define TCPOPT_MD5 19 /* RFC 2385 */ 86 87 /* 88 * Default maximum segment size for TCP. 89 * With an IP MTU of 576, this is 536. 90 */ 91 #define TCP_MSS 536 92 93 /* 94 * Options for use with [gs]etsockopt at the TCP level. 95 * 96 * Note: Some of the TCP_ namespace has conflict with and 97 * and is exposed through <xti.h>. (It also requires exposing 98 * options not implemented). The options with potential 99 * for conflicts use #ifndef guards. 100 */ 101 #ifndef TCP_NODELAY 102 #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ 103 #endif 104 105 #ifndef TCP_MAXSEG 106 #define TCP_MAXSEG 0x02 /* set maximum segment size */ 107 #endif 108 109 #ifndef TCP_KEEPALIVE 110 #define TCP_KEEPALIVE 0x8 /* set keepalive timer */ 111 #endif 112 113 114 #define TCP_NOTIFY_THRESHOLD 0x10 115 #define TCP_ABORT_THRESHOLD 0x11 116 #define TCP_CONN_NOTIFY_THRESHOLD 0x12 117 #define TCP_CONN_ABORT_THRESHOLD 0x13 118 #define TCP_RECVDSTADDR 0x14 119 #define TCP_INIT_CWND 0x15 120 #define TCP_KEEPALIVE_THRESHOLD 0x16 121 #define TCP_KEEPALIVE_ABORT_THRESHOLD 0x17 122 #define TCP_CORK 0x18 123 #define TCP_RTO_INITIAL 0x19 124 #define TCP_RTO_MIN 0x1A 125 #define TCP_RTO_MAX 0x1B 126 #define TCP_LINGER2 0x1C 127 128 /* gap for expansion of ``standard'' options */ 129 #define TCP_ANONPRIVBIND 0x20 /* for internal use only */ 130 #define TCP_EXCLBIND 0x21 /* for internal use only */ 131 #define TCP_KEEPIDLE 0x22 132 #define TCP_KEEPCNT 0x23 133 #define TCP_KEEPINTVL 0x24 134 #define TCP_CONGESTION 0x25 135 #define TCP_QUICKACK 0x26 /* enable/disable quick acks */ 136 #define TCP_MD5SIG 0x27 137 138 #ifdef __cplusplus 139 } 140 #endif 141 142 #endif /* _NETINET_TCP_H */ 143