Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Modules/i386/include/netinet/ip_mroute.h

1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1989 Stephen Deering.
30 * Copyright (c) 1992, 1993
31 *The Regents of the University of California. All rights reserved.
32 *
33 * This code is derived from software contributed to Berkeley by
34 * Stephen Deering of Stanford University.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 *This product includes software developed by the University of
47 *California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 *@(#)ip_mroute.h8.1 (Berkeley) 6/10/93
65 */
66
67#ifndef _NETINET_IP_MROUTE_H_
68#define _NETINET_IP_MROUTE_H_
69#include <sys/appleapiopts.h>
70
71/*
72 * Definitions for IP multicast forwarding.
73 *
74 * Written by David Waitzman, BBN Labs, August 1988.
75 * Modified by Steve Deering, Stanford, February 1989.
76 * Modified by Ajit Thyagarajan, PARC, August 1993.
77 * Modified by Ajit Thyagarajan, PARC, August 1994.
78 *
79 * MROUTING Revision: 3.3.1.3
80 */
81
82
83/*
84 * Multicast Routing set/getsockopt commands.
85 */
86#defineMRT_INIT100/* initialize forwarder */
87#defineMRT_DONE101/* shut down forwarder */
88#defineMRT_ADD_VIF102/* create virtual interface */
89#defineMRT_DEL_VIF103/* delete virtual interface */
90#define MRT_ADD_MFC104/* insert forwarding cache entry */
91#define MRT_DEL_MFC105/* delete forwarding cache entry */
92#define MRT_VERSION106/* get kernel version number */
93#define MRT_ASSERT 107 /* enable PIM assert processing */
94
95
96
97#ifndef CONFIG_MAXVIFS
98#define CONFIG_MAXVIFS 32 /* 4635538 temp workaround */
99#endif
100
101#ifndef CONFIG_MFCTBLSIZ
102#define CONFIG_MFCTBLSIZ 256 /* 4635538 temp workaround */
103#endif
104
105/*
106 * Types and macros for handling bitmaps with one bit per virtual interface.
107 */
108typedef u_int32_t vifbitmap_t;
109typedef u_short vifi_t;/* type of a vif index */
110#define ALL_VIFS (vifi_t)-1
111
112#defineVIFM_SET(n, m)((m) |= (1 << (n)))
113#defineVIFM_CLR(n, m)((m) &= ~(1 << (n)))
114#defineVIFM_ISSET(n, m)((m) & (1 << (n)))
115#defineVIFM_CLRALL(m)((m) = 0x00000000)
116#defineVIFM_COPY(mfrom, mto)((mto) = (mfrom))
117#defineVIFM_SAME(m1, m2)((m1) == (m2))
118
119
120/*
121 * Argument structure for MRT_ADD_VIF.
122 * (MRT_DEL_VIF takes a single vifi_t argument.)
123 */
124struct vifctl {
125 vifi_tvifc_vifi; /* the index of the vif to be added */
126 u_charvifc_flags; /* VIFF_ flags defined below */
127 u_charvifc_threshold; /* min ttl required to forward on vif */
128 u_intvifc_rate_limit;/* max rate */
129 structin_addr vifc_lcl_addr;/* local interface address */
130 structin_addr vifc_rmt_addr;/* remote address (tunnels only) */
131};
132
133#defineVIFF_TUNNEL0x1/* vif represents a tunnel end-point */
134#define VIFF_SRCRT0x2/* tunnel uses IP source routing */
135
136/*
137 * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC
138 * (mfcc_tos to be added at a future point)
139 */
140struct mfcctl {
141 struct in_addrmfcc_origin;/* ip origin of mcasts */
142 struct in_addrmfcc_mcastgrp; /* multicast group associated*/
143 vifi_tmfcc_parent;/* incoming vif */
144 u_charmfcc_ttls[CONFIG_MAXVIFS];/* forwarding ttls on vifs */
145};
146
147/*
148 * The kernel's multicast routing statistics.
149 */
150struct mrtstat {
151 u_int32_tmrts_mfc_lookups;/* # forw. cache hash table hits */
152 u_int32_tmrts_mfc_misses;/* # forw. cache hash table misses */
153 u_int32_tmrts_upcalls;/* # calls to mrouted */
154 u_int32_tmrts_no_route;/* no route for packet's origin */
155 u_int32_tmrts_bad_tunnel;/* malformed tunnel options */
156 u_int32_tmrts_cant_tunnel;/* no room for tunnel options */
157 u_int32_tmrts_wrong_if;/* arrived on wrong interface */
158 u_int32_tmrts_upq_ovflw;/* upcall Q overflow */
159 u_int32_tmrts_cache_cleanups;/* # entries with no upcalls */
160 u_int32_tmrts_drop_sel;/* pkts dropped selectively */
161 u_int32_tmrts_q_overflow;/* pkts dropped - Q overflow */
162 u_int32_tmrts_pkt2large;/* pkts dropped - size > BKT SIZE */
163 u_int32_tmrts_upq_sockfull;/* upcalls dropped - socket full */
164};
165
166/*
167 * Argument structure used by mrouted to get src-grp pkt counts
168 */
169struct sioc_sg_req {
170 struct in_addrsrc;
171 struct in_addrgrp;
172 u_int32_tpktcnt;
173 u_int32_tbytecnt;
174 u_int32_twrong_if;
175};
176
177/*
178 * Argument structure used by mrouted to get vif pkt counts
179 */
180struct sioc_vif_req {
181 vifi_tvifi;/* vif number*/
182 u_int32_ticount;/* Input packet count on vif*/
183 u_int32_tocount;/* Output packet count on vif*/
184 u_int32_tibytes;/* Input byte count on vif*/
185 u_int32_tobytes;/* Output byte count on vif*/
186};
187
188
189/*
190 * The kernel's multicast forwarding cache entry structure
191 * (A field for the type of service (mfc_tos) is to be added
192 * at a future point)
193 */
194struct mfc {
195 struct in_addr mfc_origin; /* IP origin of mcasts */
196 struct in_addr mfc_mcastgrp; /* multicast group associated*/
197 vifi_t mfc_parent; /* incoming vif */
198 u_char mfc_ttls[CONFIG_MAXVIFS]; /* forwarding ttls on vifs */
199 u_int32_t mfc_pkt_cnt;/* pkt count for src-grp */
200 u_int32_t mfc_byte_cnt;/* byte count for src-grp */
201 u_int32_t mfc_wrong_if;/* wrong if for src-grp */
202 int mfc_expire;/* time to clean entry up */
203 struct timeval mfc_last_assert;/* last time I sent an assert*/
204 struct rtdetq *mfc_stall;/* q of packets awaiting mfc */
205 struct mfc *mfc_next;/* next mfc entry */
206};
207
208/*
209 * Struct used to communicate from kernel to multicast router
210 * note the convenient similarity to an IP packet
211 */
212struct igmpmsg {
213 u_int32_t unused1;
214 u_int32_t unused2;
215 u_char im_msgtype;/* what type of message */
216#define IGMPMSG_NOCACHE1
217#define IGMPMSG_WRONGVIF2
218 u_char im_mbz;/* must be zero */
219 u_char im_vif;/* vif rec'd on */
220 u_char unused3;
221 struct in_addr im_src, im_dst;
222};
223
224#define MFCTBLSIZ CONFIG_MFCTBLSIZ
225
226#endif /* _NETINET_IP_MROUTE_H_ */
227

Archive Download this file

Revision: 1621