--- /dev/null
+/* $NetBSD: tcp.h,v 1.28 2007/12/25 18:33:47 perry Exp $ */\r
+\r
+/*\r
+ * Copyright (c) 1982, 1986, 1993\r
+ * The Regents of the University of California. All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the University nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * @(#)tcp.h 8.1 (Berkeley) 6/10/93\r
+ */\r
+\r
+#ifndef _NETINET_TCP_H_\r
+#define _NETINET_TCP_H_\r
+\r
+#include <sys/featuretest.h>\r
+\r
+#if defined(_NETBSD_SOURCE)\r
+\r
+typedef u_int32_t tcp_seq;\r
+/*\r
+ * TCP header.\r
+ * Per RFC 793, September, 1981.\r
+ * Updated by RFC 3168, September, 2001.\r
+ */\r
+struct tcphdr {\r
+ u_int16_t th_sport; /* source port */\r
+ u_int16_t th_dport; /* destination port */\r
+ tcp_seq th_seq; /* sequence number */\r
+ tcp_seq th_ack; /* acknowledgement number */\r
+#if BYTE_ORDER == LITTLE_ENDIAN\r
+ /*LINTED non-portable bitfields*/\r
+ u_int8_t th_x2:4, /* (unused) */\r
+ th_off:4; /* data offset */\r
+#endif\r
+#if BYTE_ORDER == BIG_ENDIAN\r
+ /*LINTED non-portable bitfields*/\r
+ u_int8_t th_off:4, /* data offset */\r
+ th_x2:4; /* (unused) */\r
+#endif\r
+ u_int8_t th_flags;\r
+#define TH_FIN 0x01\r
+#define TH_SYN 0x02\r
+#define TH_RST 0x04\r
+#define TH_PUSH 0x08\r
+#define TH_ACK 0x10\r
+#define TH_URG 0x20\r
+#define TH_ECE 0x40\r
+#define TH_CWR 0x80\r
+ u_int16_t th_win; /* window */\r
+ u_int16_t th_sum; /* checksum */\r
+ u_int16_t th_urp; /* urgent pointer */\r
+} __packed;\r
+\r
+#define TCPOPT_EOL 0\r
+#define TCPOPT_NOP 1\r
+#define TCPOPT_MAXSEG 2\r
+#define TCPOLEN_MAXSEG 4\r
+#define TCPOPT_WINDOW 3\r
+#define TCPOLEN_WINDOW 3\r
+#define TCPOPT_SACK_PERMITTED 4 /* Experimental */\r
+#define TCPOLEN_SACK_PERMITTED 2\r
+#define TCPOPT_SACK 5 /* Experimental */\r
+#define TCPOPT_TIMESTAMP 8\r
+#define TCPOLEN_TIMESTAMP 10\r
+#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */\r
+\r
+#define TCPOPT_TSTAMP_HDR \\r
+ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)\r
+\r
+#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */\r
+#define TCPOLEN_SIGNATURE 18\r
+#define TCPOLEN_SIGLEN (TCPOLEN_SIGNATURE+2) /* padding */\r
+\r
+#define MAX_TCPOPTLEN 40 /* max # bytes that go in options */\r
+\r
+/*\r
+ * Default maximum segment size for TCP.\r
+ * This is defined by RFC 1112 Sec 4.2.2.6.\r
+ */\r
+#define TCP_MSS 536\r
+\r
+#define TCP_MINMSS 216\r
+\r
+#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */\r
+\r
+#define TCP_MAX_WINSHIFT 14 /* maximum window shift */\r
+\r
+#define TCP_MAXBURST 4 /* maximum segments in a burst */\r
+\r
+#endif /* _NETBSD_SOURCE */\r
+\r
+/*\r
+ * User-settable options (used with setsockopt).\r
+ */\r
+#define TCP_NODELAY 1 /* don't delay send to coalesce packets */\r
+#define TCP_MAXSEG 2 /* set maximum segment size */\r
+#define TCP_KEEPIDLE 3\r
+#ifdef notyet\r
+#define TCP_NOPUSH 4 /* reserved for FreeBSD compat */\r
+#endif\r
+#define TCP_KEEPINTVL 5\r
+#define TCP_KEEPCNT 6\r
+#define TCP_KEEPINIT 7\r
+#ifdef notyet\r
+#define TCP_NOOPT 8 /* reserved for FreeBSD compat */\r
+#endif\r
+#define TCP_MD5SIG 0x10 /* use MD5 digests (RFC2385) */\r
+#define TCP_CONGCTL 0x20 /* selected congestion control */\r
+\r
+#endif /* !_NETINET_TCP_H_ */\r