source: vendor/emx/current/include/net/route.h

Last change on this file was 18, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 7.2 KB
Line 
1/* Modified for emx by hv and em 1994,1996
2 *
3 * Copyright (c) 1980, 1986 Regents of the University of California.
4 * 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 * from: @(#)route.h 7.13 (Berkeley) 4/25/91
35 * $Id: route.h,v 1.3 1993/05/20 03:06:10 cgd Exp $
36 */
37
38#ifndef _NET_ROUTE_H_
39#define _NET_ROUTE_H_
40
41#include <net/if.h>
42
43#if defined (__cplusplus)
44extern "C" {
45#endif
46
47/*
48 * Kernel resident routing tables.
49 *
50 * The routing tables are initialized when interface addresses
51 * are set by making entries for all directly connected interfaces.
52 */
53
54/*
55 * A route consists of a destination address and a reference
56 * to a routing entry. These are often held by protocols
57 * in their control blocks, e.g. inpcb.
58 */
59struct route {
60 struct rtentry *ro_rt;
61 struct sockaddr ro_dst;
62};
63
64/*
65 * rmx_rtt and rmx_rttvar are stored as microseconds;
66 * RTTTOPRHZ(rtt) converts to a value suitable for use
67 * by a protocol slowtimo counter.
68 */
69#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
70#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
71
72/*
73 * We distinguish between routes to hosts and routes to networks,
74 * preferring the former if available. For each route we infer
75 * the interface to use from the gateway address supplied when
76 * the route was entered. Routes that forward packets through
77 * gateways are marked so that the output routines know to address the
78 * gateway rather than the ultimate destination.
79 *
80 * Following structure necessary for 4.3 compatibility;
81 */
82struct rtentry {
83 u_long rt_hash; /* to speed lookups */
84 struct sockaddr rt_dst; /* key */
85 struct sockaddr rt_gateway; /* value */
86 short rt_flags; /* up/down?, host/net */
87 short rt_refcnt; /* # held references */
88 u_long rt_use; /* raw # packets forwarded */
89 struct ifnet *rt_ifp; /* the answer: interface to use */
90 long metric1,metric2,metric3,metric4; /*IBM special */
91};
92
93#define RTF_UP 0x1 /* route useable */
94#define RTF_GATEWAY 0x2 /* destination is a gateway */
95#define RTF_HOST 0x4 /* host entry (net otherwise) */
96#define RTF_REJECT 0x8 /* host or net unreachable */
97#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
98#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
99#define RTF_DONE 0x40 /* message confirmed */
100#define RTF_MASK 0x80 /* subnet mask present */
101#define RTF_CLONING 0x100 /* generate new routes on use */
102#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
103#define RTF_LLINFO 0x400 /* generated by ARP or ESIS */
104#define RTF_STATIC 0x800 /* route manually added */
105#define RTF_BLACKHOLE 0x1000 /* discard packets during updates */
106#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
107#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
108
109
110/*
111 * Routing statistics.
112 */
113struct rtstat {
114 short rts_badredirect; /* bogus redirect calls */
115 short rts_dynamic; /* routes created by redirects */
116 short rts_newgateway; /* routes modified by redirects */
117 short rts_unreach; /* lookups which failed */
118 short rts_wildcard; /* lookups satisfied by a wildcard */
119};
120/*
121 * Structures for routing messages.
122 */
123#ifndef __EMX__
124struct rt_msghdr {
125 u_short rtm_msglen; /* to skip over non-understood messages */
126 u_char rtm_version; /* future binary compatability */
127 u_char rtm_type; /* message type */
128 u_short rtm_index; /* index for associated ifp */
129 pid_t rtm_pid; /* identify sender */
130 int rtm_addrs; /* bitmask identifying sockaddrs in msg */
131 int rtm_seq; /* for sender to identify action */
132 int rtm_errno; /* why failed */
133 int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
134 int rtm_use; /* from rtentry */
135 u_long rtm_inits; /* which metrics we are initializing */
136 struct rt_metrics rtm_rmx; /* metrics themselves */
137};
138
139struct route_cb {
140 int ip_count;
141 int ns_count;
142 int iso_count;
143 int any_count;
144};
145#define RTM_VERSION 2 /* Up the ante and ignore older versions */
146
147#define RTM_ADD 0x1 /* Add Route */
148#define RTM_DELETE 0x2 /* Delete Route */
149#define RTM_CHANGE 0x3 /* Change Metrics or flags */
150#define RTM_GET 0x4 /* Report Metrics */
151#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */
152#define RTM_REDIRECT 0x6 /* Told to use different route */
153#define RTM_MISS 0x7 /* Lookup failed on this address */
154#define RTM_LOCK 0x8 /* fix specified metrics */
155#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
156#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
157#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */
158
159#define RTV_MTU 0x1 /* init or lock _mtu */
160#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
161#define RTV_EXPIRE 0x4 /* init or lock _hopcount */
162#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
163#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
164#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
165#define RTV_RTT 0x40 /* init or lock _rtt */
166#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
167
168#define RTA_DST 0x1 /* destination sockaddr present */
169#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
170#define RTA_NETMASK 0x4 /* netmask sockaddr present */
171#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
172#define RTA_IFP 0x10 /* interface name sockaddr present */
173#define RTA_IFA 0x20 /* interface addr sockaddr present */
174#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
175#endif
176
177/* IBM: hv: I think this is the internal structure of the RT table of the
178 * router daemon. Don't think it belongs here, but the toolkit has it as well
179 */
180#define RTENTRY_COUNT 512
181struct rtentries {
182 short hostcount;
183 short netcount;
184 struct rtentry rttable[RTENTRY_COUNT];
185};
186
187#if defined (__cplusplus)
188}
189#endif
190
191#endif /* !_NET_ROUTE_H_ */
Note: See TracBrowser for help on using the repository browser.