|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
26: /*
27: * Copyright (c) 1989 Stephen Deering.
28: * Copyright (c) 1992, 1993
29: * The Regents of the University of California. All rights reserved.
30: *
31: * This code is derived from software contributed to Berkeley by
32: * Stephen Deering of Stanford University.
33: *
34: * Redistribution and use in source and binary forms, with or without
35: * modification, are permitted provided that the following conditions
36: * are met:
37: * 1. Redistributions of source code must retain the above copyright
38: * notice, this list of conditions and the following disclaimer.
39: * 2. Redistributions in binary form must reproduce the above copyright
40: * notice, this list of conditions and the following disclaimer in the
41: * documentation and/or other materials provided with the distribution.
42: * 3. All advertising materials mentioning features or use of this software
43: * must display the following acknowledgement:
44: * This product includes software developed by the University of
45: * California, Berkeley and its contributors.
46: * 4. Neither the name of the University nor the names of its contributors
47: * may be used to endorse or promote products derived from this software
48: * without specific prior written permission.
49: *
50: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60: * SUCH DAMAGE.
61: *
62: * @(#)ip_mroute.h 8.2 (Berkeley) 4/28/95
63: */
64:
65: /*
66: * Definitions for the kernel part of DVMRP,
67: * a Distance-Vector Multicast Routing Protocol.
68: * (See RFC-1075.)
69: *
70: * Written by David Waitzman, BBN Labs, August 1988.
71: * Modified by Steve Deering, Stanford, February 1989.
72: *
73: * MROUTING 1.0
74: */
75:
76:
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:
89:
90: /*
91: * Types and macros for handling bitmaps with one bit per virtual interface.
92: */
93: #define MAXVIFS 32
94: typedef u_long vifbitmap_t;
95: typedef u_short vifi_t; /* type of a vif index */
96:
97: #define VIFM_SET(n, m) ((m) |= (1 << (n)))
98: #define VIFM_CLR(n, m) ((m) &= ~(1 << (n)))
99: #define VIFM_ISSET(n, m) ((m) & (1 << (n)))
100: #define VIFM_CLRALL(m) ((m) = 0x00000000)
101: #define VIFM_COPY(mfrom, mto) ((mto) = (mfrom))
102: #define VIFM_SAME(m1, m2) ((m1) == (m2))
103:
104:
105: /*
106: * Agument structure for DVMRP_ADD_VIF.
107: * (DVMRP_DEL_VIF takes a single vifi_t argument.)
108: */
109: struct vifctl {
110: vifi_t vifc_vifi; /* the index of the vif to be added */
111: u_char vifc_flags; /* VIFF_ flags defined below */
112: u_char vifc_threshold; /* min ttl required to forward on vif */
113: struct in_addr vifc_lcl_addr; /* local interface address */
114: struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */
115: };
116:
117: #define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */
118:
119:
120: /*
121: * Argument structure for DVMRP_ADD_LGRP and DVMRP_DEL_LGRP.
122: */
123: struct lgrplctl {
124: vifi_t lgc_vifi;
125: struct in_addr lgc_gaddr;
126: };
127:
128:
129: /*
130: * Argument structure for DVMRP_ADD_MRT.
131: * (DVMRP_DEL_MRT takes a single struct in_addr argument, containing origin.)
132: */
133: struct mrtctl {
134: struct in_addr mrtc_origin; /* subnet origin of multicasts */
135: struct in_addr mrtc_originmask; /* subnet mask for origin */
136: vifi_t mrtc_parent; /* incoming vif */
137: vifbitmap_t mrtc_children; /* outgoing children vifs */
138: vifbitmap_t mrtc_leaves; /* subset of outgoing children vifs */
139: };
140:
141:
142: #ifdef _KERNEL
143:
144: /*
145: * The kernel's virtual-interface structure.
146: */
147: struct vif {
148: u_char v_flags; /* VIFF_ flags defined above */
149: u_char v_threshold; /* min ttl required to forward on vif */
150: struct in_addr v_lcl_addr; /* local interface address */
151: struct in_addr v_rmt_addr; /* remote address (tunnels only) */
152: struct ifnet *v_ifp; /* pointer to interface */
153: struct in_addr *v_lcl_grps; /* list of local grps (phyints only) */
154: int v_lcl_grps_max; /* malloc'ed number of v_lcl_grps */
155: int v_lcl_grps_n; /* used number of v_lcl_grps */
156: u_long v_cached_group; /* last grp looked-up (phyints only) */
157: int v_cached_result; /* last look-up result (phyints only) */
158: };
159:
160: /*
161: * The kernel's multicast route structure.
162: */
163: struct mrt {
164: struct in_addr mrt_origin; /* subnet origin of multicasts */
165: struct in_addr mrt_originmask; /* subnet mask for origin */
166: vifi_t mrt_parent; /* incoming vif */
167: vifbitmap_t mrt_children; /* outgoing children vifs */
168: vifbitmap_t mrt_leaves; /* subset of outgoing children vifs */
169: struct mrt *mrt_next; /* forward link */
170: };
171:
172:
173: #define MRTHASHSIZ 64
174: #if (MRTHASHSIZ & (MRTHASHSIZ - 1)) == 0 /* from sys:route.h */
175: #define MRTHASHMOD(h) ((h) & (MRTHASHSIZ - 1))
176: #else
177: #define MRTHASHMOD(h) ((h) % MRTHASHSIZ)
178: #endif
179:
180: /*
181: * The kernel's multicast routing statistics.
182: */
183: struct mrtstat {
184: u_long mrts_mrt_lookups; /* # multicast route lookups */
185: u_long mrts_mrt_misses; /* # multicast route cache misses */
186: u_long mrts_grp_lookups; /* # group address lookups */
187: u_long mrts_grp_misses; /* # group address cache misses */
188: u_long mrts_no_route; /* no route for packet's origin */
189: u_long mrts_bad_tunnel; /* malformed tunnel options */
190: u_long mrts_cant_tunnel; /* no room for tunnel options */
191: u_long mrts_wrong_if; /* arrived on the wrong interface */
192: };
193:
194:
195: int ip_mrouter_cmd __P((int, struct socket *, struct mbuf *));
196: int ip_mrouter_done __P((void));
197: #endif /* _KERNEL */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.