source: branches/libc-0.6/src/emx/include/netinet/tcp.h

Last change on this file was 183, checked in by bird, 22 years ago

#434: Initial tcpip header merges.

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.8 KB
Line 
1/* Modified for emx by hv 1996
2 * Modified for gcc/os2 by bird 2003
3 *
4 * Copyright (c) 1982, 1986 Regents of the University of California.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * from: @(#)tcp.h 7.7 (Berkeley) 6/28/90
36 * $Id: tcp.h,v 1.4 1994/01/08 21:21:56 mycroft Exp $
37 */
38
39#ifndef _NETINET_TCP_H_
40#define _NETINET_TCP_H_
41
42#include <machine/endian.h>
43
44typedef u_long tcp_seq;
45/*
46 * TCP header.
47 * Per RFC 793, September, 1981.
48 */
49#pragma pack(1)
50struct tcphdr {
51 u_short th_sport; /* source port */
52 u_short th_dport; /* destination port */
53 tcp_seq th_seq; /* sequence number */
54 tcp_seq th_ack; /* acknowledgement number */
55#ifdef TCPV40HDRS
56#if BYTE_ORDER == LITTLE_ENDIAN
57 u_int th_x2:4, /* (unused) */
58 th_off:4, /* data offset */
59 th_flags:8,
60 th_win:16;
61#endif
62#if BYTE_ORDER == BIG_ENDIAN
63 u_int th_win:16,
64 th_flags:8,
65 th_off:4, /* data offset */
66 th_x2:4; /* (unused) */
67#endif
68#define TH_FIN 0x01
69#define TH_SYN 0x02
70#define TH_RST 0x04
71#define TH_PUSH 0x08
72#define TH_ACK 0x10
73#define TH_URG 0x20
74#else
75#if BYTE_ORDER == LITTLE_ENDIAN
76 u_char th_x2:4, /* (unused) */
77 th_off:4; /* data offset */
78#endif
79#if BYTE_ORDER == BIG_ENDIAN
80 u_char th_off:4, /* data offset */
81 th_x2:4; /* (unused) */
82#endif
83 u_char th_flags;
84#define TH_FIN 0x01
85#define TH_SYN 0x02
86#define TH_RST 0x04
87#define TH_PUSH 0x08
88#define TH_ACK 0x10
89#define TH_URG 0x20
90 u_short th_win; /* window */
91#endif
92 u_short th_sum; /* checksum */
93 u_short th_urp; /* urgent pointer */
94};
95#pragma pack()
96
97#define TCPOPT_EOL 0
98#define TCPOPT_NOP 1
99#define TCPOPT_MAXSEG 2
100#ifndef TCPV40HDRS
101#define TCPOLEN_MAXSEG 4
102#define TCPOPT_WINDOW 3
103#define TCPOLEN_WINDOW 3
104#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
105#define TCPOLEN_SACK_PERMITTED 2
106#define TCPOPT_SACK 5 /* Experimental */
107#define TCPOPT_TIMESTAMP 8
108#define TCPOLEN_TIMESTAMP 10
109#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
110
111#define TCPOPT_CC 11 /* CC options: RFC-1644 */
112#define TCPOPT_CCNEW 12
113#define TCPOPT_CCECHO 13
114#define TCPOLEN_CC 6
115#define TCPOLEN_CC_APPA (TCPOLEN_CC+2)
116#define TCPOPT_CC_HDR(ccopt) \
117 (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
118#define TTCP_CLIENT_SND_WND 4096 /* dflt send window of ttcp client */
119#define TCPOPT_TSTAMP_HDR \
120 (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
121#endif /*!TCPV40HDRS*/
122
123/*
124 * Default maximum segment size for TCP.
125 * With an IP MSS of 576, this is 536,
126 * but 512 is probably more convenient.
127 * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
128 */
129#ifdef TCPV40HDRS
130#ifdef lint
131#define TCP_MSS 536
132#else
133#ifndef IP_MSS
134#define IP_MSS 576
135#endif
136#define TCP_MSS MIN(512, IP_MSS - 40)
137#endif
138#else /* TCPV40HDRS*/
139#define TCP_MSS 512
140#endif
141
142#define TCP_MAXWIN 65535 /* largest value for window */
143
144#ifndef TCPV40HDRS
145#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
146#endif
147
148/*
149 * User-settable options (used with setsockopt).
150 */
151#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
152#define TCP_MAXSEG 0x02 /* set maximum segment size */
153#ifndef TCPV40HDRS
154#define TCP_MSL 0x03 /* MSL HACK */
155#define TCP_TIMESTMP 0x04 /* RFC 1323 (RTTM TimeStamp) */
156#define TCP_WINSCALE 0x05 /* RFC 1323 (Window Scale) */
157#define TCP_CC 0x06 /* RFC 1644 (Connection Count) */
158#ifdef VEGAS
159#define TCP_TAHOE 3
160#define TCP_RENO 4
161#define TCP_VEGAS 5
162#define TCP_VEGAS_SPIKE_ON 6
163#define TCP_VEGAS_EXP_INC_OFF 7
164#define TCP_VEGAS_CONG_DETECT_OFF 8
165#define TCP_VEGAS_24 9
166#define TCP_VEGAS_CONG_DETECT_PRED_ON 10
167#endif
168#endif /*!TCPV40HDS*/
169
170#ifdef TCPV40HDRS
171#include <netinet/tcp_var.h>
172#endif
173
174#endif /* !_NETINET_TCP_H_ */
Note: See TracBrowser for help on using the repository browser.