1 | /* Modified for emx by hv 1994,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: @(#)ip.h 7.10 (Berkeley) 6/28/90
|
---|
36 | * $Id: ip.h,v 1.4 1994/01/08 21:21:44 mycroft Exp $
|
---|
37 | */
|
---|
38 |
|
---|
39 | #ifndef _NETINET_IP_H_
|
---|
40 | #define _NETINET_IP_H_
|
---|
41 |
|
---|
42 | #include <machine/endian.h>
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * Definitions for internet protocol version 4.
|
---|
46 | * Per RFC 791, September 1981.
|
---|
47 | */
|
---|
48 | #define IPVERSION 4
|
---|
49 |
|
---|
50 | /*
|
---|
51 | * Structure of an internet header, naked of options.
|
---|
52 | *
|
---|
53 | * We declare ip_len and ip_off to be short, rather than u_short
|
---|
54 | * pragmatically since otherwise unsigned comparisons can result
|
---|
55 | * against negative integers quite easily, and fail in subtle ways.
|
---|
56 | */
|
---|
57 | #pragma pack(1)
|
---|
58 | struct ip {
|
---|
59 | #if BYTE_ORDER == LITTLE_ENDIAN
|
---|
60 | u_char ip_hl:4, /* header length */
|
---|
61 | ip_v:4; /* version */
|
---|
62 | #endif
|
---|
63 | #if BYTE_ORDER == BIG_ENDIAN
|
---|
64 | u_char ip_v:4, /* version */
|
---|
65 | ip_hl:4; /* header length */
|
---|
66 | #endif
|
---|
67 | u_char ip_tos; /* type of service */
|
---|
68 | short ip_len; /* total length */
|
---|
69 | u_short ip_id; /* identification */
|
---|
70 | short ip_off; /* fragment offset field */
|
---|
71 | #define IP_DF 0x4000 /* dont fragment flag */
|
---|
72 | #define IP_MF 0x2000 /* more fragments flag */
|
---|
73 | #ifndef TCPV40HDRS
|
---|
74 | #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
---|
75 | #endif
|
---|
76 | u_char ip_ttl; /* time to live */
|
---|
77 | u_char ip_p; /* protocol */
|
---|
78 | u_short ip_sum; /* checksum */
|
---|
79 | struct in_addr ip_src,ip_dst; /* source and dest address */
|
---|
80 | };
|
---|
81 | #pragma pack()
|
---|
82 |
|
---|
83 | #ifdef TCPV40HDRS
|
---|
84 | #define IP_MAXPACKET 32767 /* OS2 maximum packet size */
|
---|
85 | #else
|
---|
86 | #define IP_MAXPACKET 65535 /* maximum packet size */
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | /*
|
---|
90 | * Definitions for IP type of service (ip_tos)
|
---|
91 | */
|
---|
92 | #define IPTOS_LOWDELAY 0x10
|
---|
93 | #define IPTOS_THROUGHPUT 0x08
|
---|
94 | #define IPTOS_RELIABILITY 0x04
|
---|
95 |
|
---|
96 | /*
|
---|
97 | * Definitions for IP precedence (also in ip_tos) (hopefully unused)
|
---|
98 | */
|
---|
99 | #define IPTOS_PREC_NETCONTROL 0xe0
|
---|
100 | #define IPTOS_PREC_INTERNETCONTROL 0xc0
|
---|
101 | #define IPTOS_PREC_CRITIC_ECP 0xa0
|
---|
102 | #define IPTOS_PREC_FLASHOVERRIDE 0x80
|
---|
103 | #define IPTOS_PREC_FLASH 0x60
|
---|
104 | #define IPTOS_PREC_IMMEDIATE 0x40
|
---|
105 | #define IPTOS_PREC_PRIORITY 0x20
|
---|
106 | #ifdef TCPV40HDRS
|
---|
107 | #define IPTOS_PREC_ROUTINE 0x10
|
---|
108 | #else
|
---|
109 | #define IPTOS_PREC_ROUTINE 0x00
|
---|
110 | #endif
|
---|
111 |
|
---|
112 | /*
|
---|
113 | * Definitions for options.
|
---|
114 | */
|
---|
115 | #ifndef TCPV40HDRS
|
---|
116 | #define IPOPT_COPY 0x80
|
---|
117 | #endif
|
---|
118 | #define IPOPT_COPIED(o) ((o)&0x80)
|
---|
119 | #define IPOPT_CLASS(o) ((o)&0x60)
|
---|
120 | #define IPOPT_NUMBER(o) ((o)&0x1f)
|
---|
121 |
|
---|
122 | #define IPOPT_CONTROL 0x00
|
---|
123 | #define IPOPT_RESERVED1 0x20
|
---|
124 | #define IPOPT_DEBMEAS 0x40
|
---|
125 | #define IPOPT_RESERVED2 0x60
|
---|
126 |
|
---|
127 | #define IPOPT_EOL 0 /* end of option list */
|
---|
128 | #define IPOPT_NOP 1 /* no operation */
|
---|
129 |
|
---|
130 | #define IPOPT_RR 7 /* record packet route */
|
---|
131 | #define IPOPT_TS 68 /* timestamp */
|
---|
132 | #define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
|
---|
133 | #define IPOPT_LSRR 131 /* loose source route */
|
---|
134 | #define IPOPT_SATID 136 /* satnet id */
|
---|
135 | #define IPOPT_SSRR 137 /* strict source route */
|
---|
136 | #ifndef TCPV40HDRS
|
---|
137 | #define IPOPT_RALERT 148 /* router alert */
|
---|
138 | #endif
|
---|
139 |
|
---|
140 | /*
|
---|
141 | * Offsets to fields in options other than EOL and NOP.
|
---|
142 | */
|
---|
143 | #define IPOPT_OPTVAL 0 /* option ID */
|
---|
144 | #define IPOPT_OLEN 1 /* option length */
|
---|
145 | #define IPOPT_OFFSET 2 /* offset within option */
|
---|
146 | #define IPOPT_MINOFF 4 /* min value of above */
|
---|
147 |
|
---|
148 | /*
|
---|
149 | * Time stamp option structure.
|
---|
150 | */
|
---|
151 | #pragma pack(1)
|
---|
152 | struct ip_timestamp {
|
---|
153 | u_char ipt_code; /* IPOPT_TS */
|
---|
154 | u_char ipt_len; /* size of structure (variable) */
|
---|
155 | u_char ipt_ptr; /* index of current entry */
|
---|
156 | #if BYTE_ORDER == LITTLE_ENDIAN
|
---|
157 | u_char ipt_flg:4, /* flags, see below */
|
---|
158 | ipt_oflw:4; /* overflow counter */
|
---|
159 | #endif
|
---|
160 | #if BYTE_ORDER == BIG_ENDIAN
|
---|
161 | u_char ipt_oflw:4, /* overflow counter */
|
---|
162 | ipt_flg:4; /* flags, see below */
|
---|
163 | #endif
|
---|
164 | union ipt_timestamp {
|
---|
165 | n_long ipt_time[1];
|
---|
166 | struct ipt_ta {
|
---|
167 | struct in_addr ipt_addr;
|
---|
168 | n_long ipt_time;
|
---|
169 | } ipt_ta[1];
|
---|
170 | } ipt_timestamp;
|
---|
171 | };
|
---|
172 | #pragma pack()
|
---|
173 |
|
---|
174 | /* flag bits for ipt_flg */
|
---|
175 | #define IPOPT_TS_TSONLY 0 /* timestamps only */
|
---|
176 | #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
|
---|
177 | #ifdef TCPV40HDRS
|
---|
178 | #define IPOPT_TS_PRESPEC 2 /* specified modules only */
|
---|
179 | #else
|
---|
180 | #define IPOPT_TS_PRESPEC 3 /* specified modules only */
|
---|
181 | #endif
|
---|
182 |
|
---|
183 |
|
---|
184 | /* bits for security (not byte swapped) */
|
---|
185 | #define IPOPT_SECUR_UNCLASS 0x0000
|
---|
186 | #define IPOPT_SECUR_CONFID 0xf135
|
---|
187 | #define IPOPT_SECUR_EFTO 0x789a
|
---|
188 | #define IPOPT_SECUR_MMMM 0xbc4d
|
---|
189 | #define IPOPT_SECUR_RESTR 0xaf13
|
---|
190 | #define IPOPT_SECUR_SECRET 0xd788
|
---|
191 | #define IPOPT_SECUR_TOPSECRET 0x6bc5
|
---|
192 |
|
---|
193 | /*
|
---|
194 | * Internet implementation parameters.
|
---|
195 | */
|
---|
196 | #define MAXTTL 255 /* maximum time to live (seconds) */
|
---|
197 | /* This is being defined as TCP_TTL, UDP_TTL etc in tcp_time.h
|
---|
198 | #define IPDEFTTL 64
|
---|
199 | */
|
---|
200 | #define IPFRAGTTL 60 /* time to live for frags, slowhz */
|
---|
201 | #define IPTTLDEC 1 /* subtracted when forwarding */
|
---|
202 |
|
---|
203 | #define IP_MSS 576 /* default maximum segment size */
|
---|
204 |
|
---|
205 | #ifdef TCPV40HDRS
|
---|
206 | struct ipstat {
|
---|
207 | long ips_total;
|
---|
208 | long ips_badsum;
|
---|
209 | long ips_tooshort;
|
---|
210 | long ips_toosmall;
|
---|
211 | long ips_badhlen;
|
---|
212 | long ips_badlen;
|
---|
213 | long ips_fragments;
|
---|
214 | long ips_fragdropped;
|
---|
215 | long ips_fragtimeout;
|
---|
216 | long ips_forward;
|
---|
217 | long ips_cantforward;
|
---|
218 | long ips_redirectsent;
|
---|
219 | long ips_ipOutRequests;
|
---|
220 | long ips_ipOutNoRoutes;
|
---|
221 | long ips_ipFragFails;
|
---|
222 | long ips_ipFragOKs;
|
---|
223 | long ips_ipFragCreates;
|
---|
224 | long ips_ipReasmOKs;
|
---|
225 | long ips_ipOutDiscards;
|
---|
226 | long ips_ipInDiscards;
|
---|
227 | long ips_ipInAddrErrors;
|
---|
228 | long ips_ipInDelivers;
|
---|
229 | long ips_ipInUnknownProtos;
|
---|
230 | };
|
---|
231 | #endif /* TCPV40HDRS */
|
---|
232 |
|
---|
233 |
|
---|
234 | #endif /* !_NETINET_IP_H_ */
|
---|