route.h revision 1.4 1 1.4 roy /* $NetBSD: route.h,v 1.4 2019/04/29 16:12:30 roy Exp $ */
2 1.1 matt
3 1.1 matt /*
4 1.1 matt * Copyright (c) 1980, 1986, 1993
5 1.1 matt * The Regents of the University of California. All rights reserved.
6 1.1 matt *
7 1.1 matt * Redistribution and use in source and binary forms, with or without
8 1.1 matt * modification, are permitted provided that the following conditions
9 1.1 matt * are met:
10 1.1 matt * 1. Redistributions of source code must retain the above copyright
11 1.1 matt * notice, this list of conditions and the following disclaimer.
12 1.1 matt * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 matt * notice, this list of conditions and the following disclaimer in the
14 1.1 matt * documentation and/or other materials provided with the distribution.
15 1.1 matt * 3. Neither the name of the University nor the names of its contributors
16 1.1 matt * may be used to endorse or promote products derived from this software
17 1.1 matt * without specific prior written permission.
18 1.1 matt *
19 1.1 matt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 1.1 matt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.1 matt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1 matt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 1.1 matt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 matt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1 matt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1 matt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 matt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1 matt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1 matt * SUCH DAMAGE.
30 1.1 matt *
31 1.1 matt * @(#)route.h 8.5 (Berkeley) 2/8/95
32 1.1 matt */
33 1.1 matt
34 1.1 matt #ifndef _COMPAT_NET_ROUTE_H_
35 1.1 matt #define _COMPAT_NET_ROUTE_H_
36 1.1 matt
37 1.1 matt #include <sys/queue.h>
38 1.1 matt #include <sys/socket.h>
39 1.1 matt #include <sys/types.h>
40 1.1 matt #include <net/if.h>
41 1.1 matt
42 1.1 matt #if !(defined(_KERNEL) || defined(_STANDALONE))
43 1.1 matt #include <stdbool.h>
44 1.1 matt #endif
45 1.1 matt
46 1.1 matt /*
47 1.1 matt * These numbers are used by reliable protocols for determining
48 1.1 matt * retransmission behavior and are included in the routing structure.
49 1.1 matt */
50 1.1 matt struct rt_metrics50 {
51 1.1 matt u_long rmx_locks; /* Kernel must leave these values alone */
52 1.1 matt u_long rmx_mtu; /* MTU for this path */
53 1.1 matt u_long rmx_hopcount; /* max hops expected */
54 1.1 matt u_long rmx_expire; /* lifetime for route, e.g. redirect */
55 1.1 matt u_long rmx_recvpipe; /* inbound delay-bandwidth product */
56 1.1 matt u_long rmx_sendpipe; /* outbound delay-bandwidth product */
57 1.1 matt u_long rmx_ssthresh; /* outbound gateway buffer limit */
58 1.1 matt u_long rmx_rtt; /* estimated round trip time */
59 1.1 matt u_long rmx_rttvar; /* estimated rtt variance */
60 1.1 matt u_long rmx_pksent; /* packets sent using this route */
61 1.1 matt };
62 1.1 matt
63 1.1 matt /*
64 1.1 matt * Structures for routing messages.
65 1.1 matt */
66 1.1 matt struct rt_msghdr50 {
67 1.1 matt u_short rtm_msglen; /* to skip over non-understood messages */
68 1.1 matt u_char rtm_version; /* future binary compatibility */
69 1.1 matt u_char rtm_type; /* message type */
70 1.1 matt u_short rtm_index; /* index for associated ifp */
71 1.1 matt int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
72 1.1 matt int rtm_addrs; /* bitmask identifying sockaddrs in msg */
73 1.1 matt pid_t rtm_pid; /* identify sender */
74 1.1 matt int rtm_seq; /* for sender to identify action */
75 1.1 matt int rtm_errno; /* why failed */
76 1.1 matt int rtm_use; /* from rtentry */
77 1.1 matt u_long rtm_inits; /* which metrics we are initializing */
78 1.1 matt struct rt_metrics50 rtm_rmx; /* metrics themselves */
79 1.1 matt };
80 1.1 matt
81 1.1 matt #ifdef _KERNEL
82 1.1 matt extern struct route_info compat_50_route_info;
83 1.1 matt void compat_50_route_enqueue(struct mbuf *, int);
84 1.1 matt void compat_50_rt_ifannouncemsg(struct ifnet *, int);
85 1.1 matt void compat_50_rt_ieee80211msg(struct ifnet *, int, void *, size_t);
86 1.1 matt void compat_50_rt_ifmsg(struct ifnet *);
87 1.1 matt void compat_50_rt_missmsg(int, const struct rt_addrinfo *, int, int);
88 1.1 matt struct mbuf *
89 1.1 matt compat_50_rt_msg1(int, struct rt_addrinfo *, void *, int);
90 1.3 roy void compat_50_rt_addrmsg_rt(int, struct ifaddr *, int, struct rtentry *);
91 1.4 roy void compat_50_rt_addrmsg_src(int, struct ifaddr *, const struct sockaddr *);
92 1.3 roy void compat_50_rt_addrmsg(int, struct ifaddr *);
93 1.2 roy void compat_70_rt_newaddrmsg1(int, struct ifaddr *);
94 1.1 matt #endif
95 1.1 matt
96 1.1 matt #define RTM_OVERSION 3 /* Up the ante and ignore older versions */
97 1.1 matt
98 1.1 matt #define RT_OROUNDUP(a) RT_ROUNDUP2((a), sizeof(long))
99 1.1 matt #define RT_OADVANCE(x, n) (x += RT_OROUNDUP((n)->sa_len))
100 1.1 matt
101 1.1 matt #endif /* !_COMPAT_NET_ROUTE_H_ */
102