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