| 1 | /* Modified for gcc/os2 by bird 2003
|
|---|
| 2 | *
|
|---|
| 3 | * Copyright (c) 1989 Stephen Deering.
|
|---|
| 4 | * Copyright (c) 1992, 1993
|
|---|
| 5 | * The Regents of the University of California. All rights reserved.
|
|---|
| 6 | *
|
|---|
| 7 | * This code is derived from software contributed to Berkeley by
|
|---|
| 8 | * Stephen Deering of Stanford University.
|
|---|
| 9 | *
|
|---|
| 10 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 11 | * modification, are permitted provided that the following conditions
|
|---|
| 12 | * are met:
|
|---|
| 13 | * 1. Redistributions of source code must retain the above copyright
|
|---|
| 14 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 15 | * 2. Redistributions in binary form must reproduce the above copyright
|
|---|
| 16 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 17 | * documentation and/or other materials provided with the distribution.
|
|---|
| 18 | * 3. All advertising materials mentioning features or use of this software
|
|---|
| 19 | * must display the following acknowledgement:
|
|---|
| 20 | * This product includes software developed by the University of
|
|---|
| 21 | * California, Berkeley and its contributors.
|
|---|
| 22 | * 4. Neither the name of the University nor the names of its contributors
|
|---|
| 23 | * may be used to endorse or promote products derived from this software
|
|---|
| 24 | * without specific prior written permission.
|
|---|
| 25 | *
|
|---|
| 26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|---|
| 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|---|
| 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|---|
| 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|---|
| 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|---|
| 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|---|
| 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|---|
| 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|---|
| 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|---|
| 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|---|
| 36 | * SUCH DAMAGE.
|
|---|
| 37 | *
|
|---|
| 38 | * @(#)ip_mroute.h 8.1 (Berkeley) 6/10/93
|
|---|
| 39 | * $FreeBSD: src/sys/netinet/ip_mroute.h,v 1.17.2.2 2002/11/20 23:20:55 luigi Exp $
|
|---|
| 40 | */
|
|---|
| 41 |
|
|---|
| 42 | #ifndef _NETINET_IP_MROUTE_H_
|
|---|
| 43 | #define _NETINET_IP_MROUTE_H_
|
|---|
| 44 | #ifndef TCPV40HDRS
|
|---|
| 45 |
|
|---|
| 46 | /*
|
|---|
| 47 | * Definitions for IP multicast forwarding.
|
|---|
| 48 | *
|
|---|
| 49 | * Written by David Waitzman, BBN Labs, August 1988.
|
|---|
| 50 | * Modified by Steve Deering, Stanford, February 1989.
|
|---|
| 51 | * Modified by Ajit Thyagarajan, PARC, August 1993.
|
|---|
| 52 | * Modified by Ajit Thyagarajan, PARC, August 1994.
|
|---|
| 53 | *
|
|---|
| 54 | * MROUTING Revision: 3.3.1.3
|
|---|
| 55 | */
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 | /*
|
|---|
| 59 | * Multicast Routing set/getsockopt commands.
|
|---|
| 60 | */
|
|---|
| 61 | #if 1 /* not on OS/2 - but let's include it anyway. */
|
|---|
| 62 | #define MRT_INIT 100 /* initialize forwarder */
|
|---|
| 63 | #define MRT_DONE 101 /* shut down forwarder */
|
|---|
| 64 | #define MRT_ADD_VIF 102 /* create virtual interface */
|
|---|
| 65 | #define MRT_DEL_VIF 103 /* delete virtual interface */
|
|---|
| 66 | #define MRT_ADD_MFC 104 /* insert forwarding cache entry */
|
|---|
| 67 | #define MRT_DEL_MFC 105 /* delete forwarding cache entry */
|
|---|
| 68 | #define MRT_VERSION 106 /* get kernel version number */
|
|---|
| 69 | #define MRT_ASSERT 107 /* enable PIM assert processing */
|
|---|
| 70 | #if 0
|
|---|
| 71 | #define GET_TIME(t) microtime(&t)
|
|---|
| 72 | #endif
|
|---|
| 73 | #endif
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | #if 1 /* OS2 only? It's aliases of the above defs it seems... */
|
|---|
| 77 | /*
|
|---|
| 78 | * DVMRP-specific setsockopt commands.
|
|---|
| 79 | */
|
|---|
| 80 | #define DVMRP_INIT 100
|
|---|
| 81 | #define DVMRP_DONE 101
|
|---|
| 82 | #define DVMRP_ADD_VIF 102
|
|---|
| 83 | #define DVMRP_DEL_VIF 103
|
|---|
| 84 | #define DVMRP_ADD_LGRP 104
|
|---|
| 85 | #define DVMRP_DEL_LGRP 105
|
|---|
| 86 | #define DVMRP_ADD_MRT 106
|
|---|
| 87 | #define DVMRP_DEL_MRT 107
|
|---|
| 88 | #endif
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 | /*
|
|---|
| 93 | * Types and macros for handling bitmaps with one bit per virtual interface.
|
|---|
| 94 | */
|
|---|
| 95 | #define MAXVIFS 32
|
|---|
| 96 | typedef u_long vifbitmap_t;
|
|---|
| 97 | typedef u_short vifi_t; /* type of a vif index */
|
|---|
| 98 | #if 0 /* no on OS2 */
|
|---|
| 99 | #define ALL_VIFS (vifi_t)-1
|
|---|
| 100 | #endif
|
|---|
| 101 |
|
|---|
| 102 | #define VIFM_SET(n, m) ((m) |= (1 << (n)))
|
|---|
| 103 | #define VIFM_CLR(n, m) ((m) &= ~(1 << (n)))
|
|---|
| 104 | #define VIFM_ISSET(n, m) ((m) & (1 << (n)))
|
|---|
| 105 | #define VIFM_CLRALL(m) ((m) = 0x00000000)
|
|---|
| 106 | #define VIFM_COPY(mfrom, mto) ((mto) = (mfrom))
|
|---|
| 107 | #define VIFM_SAME(m1, m2) ((m1) == (m2))
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 | /*
|
|---|
| 111 | * Argument structure for MRT_ADD_VIF.
|
|---|
| 112 | * (MRT_DEL_VIF takes a single vifi_t argument.)
|
|---|
| 113 | */
|
|---|
| 114 | #pragma pack(1) /* OS2 paranoia */
|
|---|
| 115 | struct vifctl {
|
|---|
| 116 | vifi_t vifc_vifi; /* the index of the vif to be added */
|
|---|
| 117 | u_char vifc_flags; /* VIFF_ flags defined below */
|
|---|
| 118 | u_char vifc_threshold; /* min ttl required to forward on vif */
|
|---|
| 119 | #if 0 /* not on OS/2 */
|
|---|
| 120 | u_int vifc_rate_limit; /* max rate */
|
|---|
| 121 | #endif
|
|---|
| 122 | struct in_addr vifc_lcl_addr; /* local interface address */
|
|---|
| 123 | struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */
|
|---|
| 124 | };
|
|---|
| 125 | #pragma pack()
|
|---|
| 126 |
|
|---|
| 127 | #define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */
|
|---|
| 128 | #if 0 /* no on OS/2 */
|
|---|
| 129 | #define VIFF_SRCRT 0x2 /* tunnel uses IP source routing */
|
|---|
| 130 |
|
|---|
| 131 | /*
|
|---|
| 132 | * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC
|
|---|
| 133 | * (mfcc_tos to be added at a future point)
|
|---|
| 134 | */
|
|---|
| 135 | struct mfcctl {
|
|---|
| 136 | struct in_addr mfcc_origin; /* ip origin of mcasts */
|
|---|
| 137 | struct in_addr mfcc_mcastgrp; /* multicast group associated*/
|
|---|
| 138 | vifi_t mfcc_parent; /* incoming vif */
|
|---|
| 139 | u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
|
|---|
| 140 | };
|
|---|
| 141 |
|
|---|
| 142 | /*
|
|---|
| 143 | * The kernel's multicast routing statistics.
|
|---|
| 144 | */
|
|---|
| 145 | struct mrtstat {
|
|---|
| 146 | u_long mrts_mfc_lookups; /* # forw. cache hash table hits */
|
|---|
| 147 | u_long mrts_mfc_misses; /* # forw. cache hash table misses */
|
|---|
| 148 | u_long mrts_upcalls; /* # calls to mrouted */
|
|---|
| 149 | u_long mrts_no_route; /* no route for packet's origin */
|
|---|
| 150 | u_long mrts_bad_tunnel; /* malformed tunnel options */
|
|---|
| 151 | u_long mrts_cant_tunnel; /* no room for tunnel options */
|
|---|
| 152 | u_long mrts_wrong_if; /* arrived on wrong interface */
|
|---|
| 153 | u_long mrts_upq_ovflw; /* upcall Q overflow */
|
|---|
| 154 | u_long mrts_cache_cleanups; /* # entries with no upcalls */
|
|---|
| 155 | u_long mrts_drop_sel; /* pkts dropped selectively */
|
|---|
| 156 | u_long mrts_q_overflow; /* pkts dropped - Q overflow */
|
|---|
| 157 | u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */
|
|---|
| 158 | u_long mrts_upq_sockfull; /* upcalls dropped - socket full */
|
|---|
| 159 | };
|
|---|
| 160 |
|
|---|
| 161 | /*
|
|---|
| 162 | * Argument structure used by mrouted to get src-grp pkt counts
|
|---|
| 163 | */
|
|---|
| 164 | struct sioc_sg_req {
|
|---|
| 165 | struct in_addr src;
|
|---|
| 166 | struct in_addr grp;
|
|---|
| 167 | u_long pktcnt;
|
|---|
| 168 | u_long bytecnt;
|
|---|
| 169 | u_long wrong_if;
|
|---|
| 170 | };
|
|---|
| 171 |
|
|---|
| 172 | /*
|
|---|
| 173 | * Argument structure used by mrouted to get vif pkt counts
|
|---|
| 174 | */
|
|---|
| 175 | struct sioc_vif_req {
|
|---|
| 176 | vifi_t vifi; /* vif number */
|
|---|
| 177 | u_long icount; /* Input packet count on vif */
|
|---|
| 178 | u_long ocount; /* Output packet count on vif */
|
|---|
| 179 | u_long ibytes; /* Input byte count on vif */
|
|---|
| 180 | u_long obytes; /* Output byte count on vif */
|
|---|
| 181 | };
|
|---|
| 182 |
|
|---|
| 183 |
|
|---|
| 184 | /*
|
|---|
| 185 | * The kernel's virtual-interface structure.
|
|---|
| 186 | */
|
|---|
| 187 | struct vif {
|
|---|
| 188 | u_char v_flags; /* VIFF_ flags defined above */
|
|---|
| 189 | u_char v_threshold; /* min ttl required to forward on vif*/
|
|---|
| 190 | u_int v_rate_limit; /* max rate */
|
|---|
| 191 | struct tbf *v_tbf; /* token bucket structure at intf. */
|
|---|
| 192 | struct in_addr v_lcl_addr; /* local interface address */
|
|---|
| 193 | struct in_addr v_rmt_addr; /* remote address (tunnels only) */
|
|---|
| 194 | struct ifnet *v_ifp; /* pointer to interface */
|
|---|
| 195 | u_long v_pkt_in; /* # pkts in on interface */
|
|---|
| 196 | u_long v_pkt_out; /* # pkts out on interface */
|
|---|
| 197 | u_long v_bytes_in; /* # bytes in on interface */
|
|---|
| 198 | u_long v_bytes_out; /* # bytes out on interface */
|
|---|
| 199 | struct route v_route; /* cached route if this is a tunnel */
|
|---|
| 200 | u_int v_rsvp_on; /* RSVP listening on this vif */
|
|---|
| 201 | struct socket *v_rsvpd; /* RSVP daemon socket */
|
|---|
| 202 | };
|
|---|
| 203 |
|
|---|
| 204 | /*
|
|---|
| 205 | * The kernel's multicast forwarding cache entry structure
|
|---|
| 206 | * (A field for the type of service (mfc_tos) is to be added
|
|---|
| 207 | * at a future point)
|
|---|
| 208 | */
|
|---|
| 209 | struct mfc {
|
|---|
| 210 | struct in_addr mfc_origin; /* IP origin of mcasts */
|
|---|
| 211 | struct in_addr mfc_mcastgrp; /* multicast group associated*/
|
|---|
| 212 | vifi_t mfc_parent; /* incoming vif */
|
|---|
| 213 | u_char mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
|
|---|
| 214 | u_long mfc_pkt_cnt; /* pkt count for src-grp */
|
|---|
| 215 | u_long mfc_byte_cnt; /* byte count for src-grp */
|
|---|
| 216 | u_long mfc_wrong_if; /* wrong if for src-grp */
|
|---|
| 217 | int mfc_expire; /* time to clean entry up */
|
|---|
| 218 | struct timeval mfc_last_assert; /* last time I sent an assert*/
|
|---|
| 219 | struct rtdetq *mfc_stall; /* q of packets awaiting mfc */
|
|---|
| 220 | struct mfc *mfc_next; /* next mfc entry */
|
|---|
| 221 | };
|
|---|
| 222 |
|
|---|
| 223 | /*
|
|---|
| 224 | * Struct used to communicate from kernel to multicast router
|
|---|
| 225 | * note the convenient similarity to an IP packet
|
|---|
| 226 | */
|
|---|
|
|---|