source: trunk/src/emx/include/netinet/ip_var.h@ 1505

Last change on this file since 1505 was 183, checked in by bird, 23 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 *
  • Property svn:keywords set to Author Date Id Revision
File size: 10.7 KB
Line 
1/* Modified for gcc/os2 by bird 2003
2 *
3 * Copyright (c) 1982, 1986, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by the University of
17 * California, Berkeley and its contributors.
18 * 4. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)ip_var.h 8.2 (Berkeley) 1/9/95
35 * $FreeBSD: src/sys/netinet/ip_var.h,v 1.50.2.12 2003/02/27 04:50:02 silby Exp $
36 */
37
38#ifndef _NETINET_IP_VAR_H_
39#define _NETINET_IP_VAR_H_
40#ifndef TCPV40HDRS
41
42#if 0 /* not os/2 - no such header */
43#include <sys/queue.h>
44#endif
45
46/*
47 * Overlay for ip header used by other protocols (tcp, udp).
48 */
49#pragma pack(1) /* OS/2 paranoia */
50struct ipovly {
51#if 0 /* different on OS/2 */
52 u_char ih_x1[9]; /* (unused) */
53#else
54 caddr_t ih_next, ih_prev; /* for protocol sequence q's */
55 u_char ih_x1; /* (unused) */
56#endif
57 u_char ih_pr; /* protocol */
58 u_short ih_len; /* protocol length */
59 struct in_addr ih_src; /* source internet address */
60 struct in_addr ih_dst; /* destination internet address */
61};
62#pragma pack()
63
64/*
65 * Ip reassembly queue structure. Each fragment
66 * being reassembled is attached to one of these structures.
67 * They are timed out after ipq_ttl drops to 0, and may also
68 * be reclaimed if memory becomes tight.
69 */
70#pragma pack(1) /* OS/2 paranoia */
71struct ipq {
72 struct ipq *next,*prev; /* to other reass headers */
73 u_char ipq_ttl; /* time for reass q to live */
74 u_char ipq_p; /* protocol of this fragment */
75 u_short ipq_id; /* sequence id for reassembly */
76#if 0 /* Different on OS/2 */
77 struct mbuf *ipq_frags; /* to ip headers of fragments */
78 struct in_addr ipq_src,ipq_dst;
79 u_char ipq_nfrags; /* # frags in this packet */
80#ifdef IPDIVERT
81 u_int32_t ipq_div_info; /* ipfw divert port & flags */
82 u_int16_t ipq_div_cookie; /* ipfw divert cookie */
83#endif
84#else /* OS2: */
85 struct ipasfrag *ipq_next,*ipq_prev;
86 /* to ip headers of fragments */
87 struct in_addr ipq_src,ipq_dst;
88#endif
89};
90#pragma pack()
91
92
93/*
94 * Structure stored in mbuf in inpcb.ip_options
95 * and passed to ip_output when ip options are in use.
96 * The actual length of the options (including ipopt_dst)
97 * is in m_len.
98 */
99#define MAX_IPOPTLEN 40
100#if 0 /* different/not on OS/2 */
101struct ipoption {
102 struct in_addr ipopt_dst; /* first-hop dst if source routed */
103 char ipopt_list[MAX_IPOPTLEN]; /* options proper */
104};
105
106/*
107 * Structure attached to inpcb.ip_moptions and
108 * passed to ip_output when IP multicast options are in use.
109 */
110struct ip_moptions {
111 struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
112 struct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */
113 u_char imo_multicast_ttl; /* TTL for outgoing multicasts */
114 u_char imo_multicast_loop; /* 1 => hear sends if a member */
115 u_short imo_num_memberships; /* no. memberships this socket */
116 struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
117 u_long imo_multicast_vif; /* vif num outgoing multicasts */
118};
119
120#else /* OS2: */
121
122/*
123 * Ip header, when holding a fragment.
124 *
125 * Note: ipf_next must be at same offset as ipq_next above
126 */
127#pragma pack(1)
128struct ipasfrag {
129#if BYTE_ORDER == LITTLE_ENDIAN
130 unsigned ip_hl:4,
131 ip_v:4;
132#endif
133#if BYTE_ORDER == BIG_ENDIAN
134 unsigned ip_v:4,
135 ip_hl:4;
136#endif
137 u_char ipf_mff; /* XXX overlays ip_tos: use low bit
138 * to avoid destroying tos;
139 * copied from (ip_off&IP_MF) */
140 u_short ip_len; /* should be ushort rather than short */
141 u_short ip_id;
142 short ip_off;
143 u_char ip_ttl;
144 u_char ip_p;
145 u_short ip_sum;
146 struct ipasfrag *ipf_next; /* next fragment */
147 struct ipasfrag *ipf_prev; /* previous fragment */
148};
149#pragma pack()
150
151#endif /* OS2 */
152
153struct ipstat {
154 u_long ips_total; /* total packets received */
155 u_long ips_badsum; /* checksum bad */
156 u_long ips_tooshort; /* packet too short */
157 u_long ips_toosmall; /* not enough data */
158 u_long ips_badhlen; /* ip header length < data size */
159 u_long ips_badlen; /* ip length < ip header length */
160 u_long ips_fragments; /* fragments received */
161 u_long ips_fragdropped; /* frags dropped (dups, out of space) */
162 u_long ips_fragtimeout; /* fragments timed out */
163 u_long ips_forward; /* packets forwarded */
164#if 0 /* not on OS/2 */
165 u_long ips_fastforward; /* packets fast forwarded */
166#endif
167 u_long ips_cantforward; /* packets rcvd for unreachable dest */
168 u_long ips_redirectsent; /* packets forwarded on same net */
169 u_long ips_noproto; /* unknown or unsupported protocol */
170 u_long ips_delivered; /* datagrams delivered to upper level*/
171 u_long ips_localout; /* total ip packets generated here */
172 u_long ips_odropped; /* lost packets due to nobufs, etc. */
173 u_long ips_reassembled; /* total packets reassembled ok */
174 u_long ips_fragmented; /* datagrams successfully fragmented */
175 u_long ips_ofragments; /* output fragments created */
176 u_long ips_cantfrag; /* don't fragment flag was set, etc. */
177 u_long ips_badoptions; /* error in option processing */
178 u_long ips_noroute; /* packets discarded due to no route */
179 u_long ips_badvers; /* ip version != 4 */
180 u_long ips_rawout; /* total raw ip packets generated */
181#if 0 /* not on OS/2 */
182 u_long ips_toolong; /* ip length > max ip packet size */
183 u_long ips_notmember; /* multicasts for unregistered grps */
184 u_long ips_nogif; /* no match gif found */
185 u_long ips_badaddr; /* invalid address on header */
186#endif
187};
188
189#if 0 /* not on OS/2 */
190
191#ifdef _KERNEL
192
193/* flags passed to ip_output as last parameter */
194#define IP_FORWARDING 0x1 /* most of ip header exists */
195#define IP_RAWOUTPUT 0x2 /* raw ip header exists */
196#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */
197#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
198
199struct ip;
200struct inpcb;
201struct route;
202struct sockopt;
203
204extern struct ipstat ipstat;
205#ifndef RANDOM_IP_ID
206extern u_short ip_id; /* ip packet ctr, for ids */
207#endif
208extern int ip_defttl; /* default IP ttl */
209extern int ipforwarding; /* ip forwarding */
210extern struct route ipforward_rt; /* ip forwarding cached route */
211extern u_char ip_protox[];
212extern struct socket *ip_rsvpd; /* reservation protocol daemon */
213extern struct socket *ip_mrouter; /* multicast routing daemon */
214extern int (*legal_vif_num)(int);
215extern u_long (*ip_mcast_src)(int);
216extern int rsvp_on;
217extern struct pr_usrreqs rip_usrreqs;
218
219int ip_ctloutput(struct socket *, struct sockopt *sopt);
220void ip_drain(void);
221void ip_freemoptions(struct ip_moptions *);
222void ip_init(void);
223extern int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
224 struct ip_moptions *);
225int ip_output(struct mbuf *,
226 struct mbuf *, struct route *, int, struct ip_moptions *,
227 struct inpcb *);
228struct in_ifaddr *
229 ip_rtaddr(struct in_addr, struct route *);
230void ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *,
231 struct mbuf *);
232void ip_slowtimo(void);
233struct mbuf *
234 ip_srcroute(void);
235void ip_stripoptions(struct mbuf *, struct mbuf *);
236#ifdef RANDOM_IP_ID
237u_int16_t
238 ip_randomid(void);
239#endif
240int rip_ctloutput(struct socket *, struct sockopt *);
241void rip_ctlinput(int, struct sockaddr *, void *);
242void rip_init(void);
243void rip_input(struct mbuf *, int, int);
244int rip_output(struct mbuf *, struct socket *, u_long);
245extern void (*ipip_input)(struct mbuf *, int, int);
246void rsvp_input(struct mbuf *, int, int);
247int ip_rsvp_init(struct socket *);
248int ip_rsvp_done(void);
249extern int (*ip_rsvp_vif)(struct socket *, struct sockopt *);
250extern void (*ip_rsvp_force_done)(struct socket *);
251extern void (*rsvp_input_p)(struct mbuf *m, int off, int proto);
252
253#ifdef IPDIVERT
254void div_init(void);
255void div_input(struct mbuf *, int, int);
256void divert_packet(struct mbuf *m, int incoming, int port, int rule);
257extern struct pr_usrreqs div_usrreqs;
258#endif
259
260void in_delayed_cksum(struct mbuf *m);
261
262#endif /* _KERNEL */
263
264
265#else /*OS2: */
266
267/*
268 * Names for IP sysctl objects
269 */
270#define IPCTL_FORWARDING 1 /* act as router */
271#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
272#define IPCTL_INETCFG 40 /* Generic IP Inetcfg switching */
273#define IPCTL_INETVER 41 /* sysctl: AFINET Version */
274#define IPCTL_FORWARD 42 /* sysctl:IP Forwarding */
275#define IPCTL_FIREWALL 43 /* sysctl:FIREWALL flag */
276#define IPCTL_ARPTKILLC 44 /* sysctl:ARP cache completed entry TO */
277#define IPCTL_ARPTKILLI 45 /* sysctl:ARP cache incomplete entry TO */
278#define FRAGCTL_TTL 46 /* sysctl:Fragments TTL */
279#define IPCTL_SYNATTACK 47 /* sysctl:SYN Attack flg ON/OFF */
280#define IPCTL_MULTIDEFROUTES 48 /* sysctl:Multiple def routes. lynx stuff */
281
282#define IPCTL_NAMES { \
283 { 0, 0 }, \
284 { "forwarding", CTLTYPE_INT }, \
285 { "redirect", CTLTYPE_INT }, \
286 { "mtu", CTLTYPE_INT }, \
287 { "multi-default-routes", CTLTYPE_INT }, \
288 { "inetver", CTLTYPE_INETVER }, \
289 { "inetcfg", CTLTYPE_INETCFG }, \
290}
291#endif /* OS2 (else) */
292
293#endif /* !TCPV40HDRS */
294#endif /* !_NETINET_IP_VAR_H_ */
Note: See TracBrowser for help on using the repository browser.