1/* $FreeBSD: head/sys/netinet6/ip6_mroute.h 62587 2000-07-04 16:35:15Z itojun $ */ 2/* $KAME: ip6_mroute.h,v 1.10 2000/05/19 02:38:53 itojun Exp $ */ 3 |
4/* 5 * Copyright (C) 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE.
|
28 *
29 * $FreeBSD: head/sys/netinet6/ip6_mroute.h 56723 2000-01-28 05:27:14Z shin $
|
31 */ 32 33/* BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp */ 34 35/* 36 * Definitions for IP multicast forwarding. 37 * 38 * Written by David Waitzman, BBN Labs, August 1988. 39 * Modified by Steve Deering, Stanford, February 1989. 40 * Modified by Ajit Thyagarajan, PARC, August 1993. 41 * Modified by Ajit Thyagarajan, PARC, August 1994. 42 * Modified by Ahmed Helmy, USC, September 1996. 43 * 44 * MROUTING Revision: 1.2 45 */ 46 47#ifndef _NETINET6_IP6_MROUTE_H_
|
47#define _NETINET6_IP6_MROUTE_H_
48
49/*
50 * Multicast Routing set/getsockopt commands.
51 */
52#define MRT6_INIT 100 /* initialize forwarder */
53#define MRT6_DONE 101 /* shut down forwarder */
54#define MRT6_ADD_MIF 102 /* add multicast interface */
55#define MRT6_DEL_MIF 103 /* delete multicast interface */
56#define MRT6_ADD_MFC 104 /* insert forwarding cache entry */
57#define MRT6_DEL_MFC 105 /* delete forwarding cache entry */
58#define MRT6_PIM 107 /* enable pim code */
59
60#define GET_TIME(t) microtime(&t)
61
62/*
63 * Types and macros for handling bitmaps with one bit per multicast interface.
64 */
65typedef u_short mifi_t; /* type of a mif index */
66#define MAXMIFS 64
67
68#ifndef IF_SETSIZE
69#define IF_SETSIZE 256
70#endif
71
72typedef long if_mask;
73#define NIFBITS (sizeof(if_mask) * NBBY) /* bits per mask */
74
75#ifndef howmany
76#define howmany(x, y) (((x) + ((y) - 1)) / (y))
77#endif
78
79typedef struct if_set {
80 fd_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)];
81} if_set;
82
83#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
84#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
85#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
86#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
87#define IF_ZERO(p) bzero(p, sizeof(*(p)))
88
89/*
90 * Argument structure for MRT6_ADD_IF.
91 */
92struct mif6ctl {
93 mifi_t mif6c_mifi; /* the index of the mif to be added */
94 u_char mif6c_flags; /* MIFF_ flags defined below */
95 u_short mif6c_pifi; /* the index of the physical IF */
96};
97
98#define MIFF_REGISTER 0x1 /* mif represents a register end-point */
99
100/*
101 * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC
102 */
103struct mf6cctl {
104 struct sockaddr_in6 mf6cc_origin; /* IPv6 origin of mcasts */
105 struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */
106 mifi_t mf6cc_parent; /* incoming ifindex */
107 struct if_set mf6cc_ifset; /* set of forwarding ifs */
108};
109
110/*
111 * The kernel's multicast routing statistics.
112 */
113struct mrt6stat {
114 u_quad_t mrt6s_mfc_lookups; /* # forw. cache hash table hits */
115 u_quad_t mrt6s_mfc_misses; /* # forw. cache hash table misses */
116 u_quad_t mrt6s_upcalls; /* # calls to mrouted */
117 u_quad_t mrt6s_no_route; /* no route for packet's origin */
118 u_quad_t mrt6s_bad_tunnel; /* malformed tunnel options */
119 u_quad_t mrt6s_cant_tunnel; /* no room for tunnel options */
120 u_quad_t mrt6s_wrong_if; /* arrived on wrong interface */
121 u_quad_t mrt6s_upq_ovflw; /* upcall Q overflow */
122 u_quad_t mrt6s_cache_cleanups; /* # entries with no upcalls */
123 u_quad_t mrt6s_drop_sel; /* pkts dropped selectively */
124 u_quad_t mrt6s_q_overflow; /* pkts dropped - Q overflow */
125 u_quad_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */
126 u_quad_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */
127};
128
129/*
130 * Struct used to communicate from kernel to multicast router
131 * note the convenient similarity to an IPv6 header.
132 */
133struct mrt6msg {
134 u_long unused1;
135 u_char im6_msgtype; /* what type of message */
136#define MRT6MSG_NOCACHE 1
137#define MRT6MSG_WRONGMIF 2
138#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/
139 u_char im6_mbz; /* must be zero */
140 u_char im6_mif; /* mif rec'd on */
141 u_char unused2;
142 struct in6_addr im6_src, im6_dst;
143};
144
145/*
146 * Argument structure used by multicast routing daemon to get src-grp
147 * packet counts
148 */
149struct sioc_sg_req6 {
150 struct sockaddr_in6 src;
151 struct sockaddr_in6 grp;
152 u_quad_t pktcnt;
153 u_quad_t bytecnt;
154 u_quad_t wrong_if;
155};
156
157/*
158 * Argument structure used by mrouted to get mif pkt counts
159 */
160struct sioc_mif_req6 {
161 mifi_t mifi; /* mif number */
162 u_quad_t icount; /* Input packet count on mif */
163 u_quad_t ocount; /* Output packet count on mif */
164 u_quad_t ibytes; /* Input byte count on mif */
165 u_quad_t obytes; /* Output byte count on mif */
166};
167
168#if defined(_KERNEL) || defined(KERNEL)
169/*
170 * The kernel's multicast-interface structure.
171 */
172struct mif6 {
173 u_char m6_flags; /* MIFF_ flags defined above */
174 u_int m6_rate_limit; /* max rate */
175 struct in6_addr m6_lcl_addr; /* local interface address */
176 struct ifnet *m6_ifp; /* pointer to interface */
177 u_quad_t m6_pkt_in; /* # pkts in on interface */
178 u_quad_t m6_pkt_out; /* # pkts out on interface */
179 u_quad_t m6_bytes_in; /* # bytes in on interface */
180 u_quad_t m6_bytes_out; /* # bytes out on interface */
181 struct route_in6 m6_route;/* cached route if this is a tunnel */
182};
183
184/*
185 * The kernel's multicast forwarding cache entry structure
186 */
187struct mf6c {
188 struct sockaddr_in6 mf6c_origin; /* IPv6 origin of mcasts */
189 struct sockaddr_in6 mf6c_mcastgrp; /* multicast group associated*/
190 mifi_t mf6c_parent; /* incoming IF */
191 struct if_set mf6c_ifset; /* set of outgoing IFs */
192 u_quad_t mf6c_pkt_cnt; /* pkt count for src-grp */
193 u_quad_t mf6c_byte_cnt; /* byte count for src-grp */
194 u_quad_t mf6c_wrong_if; /* wrong if for src-grp */
195 int mf6c_expire; /* time to clean entry up */
196 struct timeval mf6c_last_assert; /* last time I sent an assert*/
197 struct rtdetq *mf6c_stall; /* pkts waiting for route */
198 struct mf6c *mf6c_next; /* hash table linkage */
199};
200
201#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1)
202
203/*
204 * Argument structure used for pkt info. while upcall is made
205 */
206#ifndef _NETINET_IP_MROUTE_H_
207struct rtdetq { /* XXX: rtdetq is also defined in ip_mroute.h */
208 struct mbuf *m; /* A copy of the packet */
209 struct ifnet *ifp; /* Interface pkt came in on */
210#ifdef UPCALL_TIMING
211 struct timeval t; /* Timestamp */
212#endif /* UPCALL_TIMING */
213 struct rtdetq *next;
214};
215#endif /* _NETINET_IP_MROUTE_H_ */
216
217#define MF6CTBLSIZ 256
218#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0 /* from sys:route.h */
219#define MF6CHASHMOD(h) ((h) & (MF6CTBLSIZ - 1))
220#else
221#define MF6CHASHMOD(h) ((h) % MF6CTBLSIZ)
222#endif
223
224#define MAX_UPQ6 4 /* max. no of pkts in upcall Q */
225
226int ip6_mrouter_set __P((struct socket *so, struct sockopt *sopt));
227int ip6_mrouter_get __P((struct socket *so, struct sockopt *sopt));
228int ip6_mrouter_done __P((void));
229int mrt6_ioctl __P((int, caddr_t));
230#endif /* _KERNEL */
231
232#endif /* !_NETINET6_IP6_MROUTE_H_ */
233/*
234 * Copyright (C) 1998 WIDE Project.
235 * All rights reserved.
236 *
237 * Redistribution and use in source and binary forms, with or without
238 * modification, are permitted provided that the following conditions
239 * are met:
240 * 1. Redistributions of source code must retain the above copyright
241 * notice, this list of conditions and the following disclaimer.
242 * 2. Redistributions in binary form must reproduce the above copyright
243 * notice, this list of conditions and the following disclaimer in the
244 * documentation and/or other materials provided with the distribution.
245 * 3. Neither the name of the project nor the names of its contributors
246 * may be used to endorse or promote products derived from this software
247 * without specific prior written permission.
248 *
249 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
250 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
251 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
252 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
253 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
254 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
255 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
256 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
257 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
259 * SUCH DAMAGE.
260 */
261
262/* BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp */
263
264/*
265 * Definitions for IP multicast forwarding.
266 *
267 * Written by David Waitzman, BBN Labs, August 1988.
268 * Modified by Steve Deering, Stanford, February 1989.
269 * Modified by Ajit Thyagarajan, PARC, August 1993.
270 * Modified by Ajit Thyagarajan, PARC, August 1994.
271 * Modified by Ahmed Helmy, USC, September 1996.
272 *
273 * MROUTING Revision: 1.2
274 */
275
276#ifndef _NETINET6_IP6_MROUTE_H_
|
48#define _NETINET6_IP6_MROUTE_H_ 49 50/* 51 * Multicast Routing set/getsockopt commands. 52 */
|
282#define MRT6_INIT 100 /* initialize forwarder */
|
53#ifdef _KERNEL 54#define MRT6_OINIT 100 /* initialize forwarder (omrt6msg) */ 55#endif |
56#define MRT6_DONE 101 /* shut down forwarder */ 57#define MRT6_ADD_MIF 102 /* add multicast interface */ 58#define MRT6_DEL_MIF 103 /* delete multicast interface */ 59#define MRT6_ADD_MFC 104 /* insert forwarding cache entry */ 60#define MRT6_DEL_MFC 105 /* delete forwarding cache entry */ 61#define MRT6_PIM 107 /* enable pim code */
|
62#define MRT6_INIT 108 /* initialize forwarder (mrt6msg) */ |
63
|
290#if BSD >= 199103
|
64#if BSD >= 199103 |
65#define GET_TIME(t) microtime(&t) 66#elif defined(sun) 67#define GET_TIME(t) uniqtime(&t) 68#else 69#define GET_TIME(t) ((t) = time) 70#endif 71 72/*
--- 61 unchanged lines hidden (view full) ---
134 u_quad_t mrt6s_upq_ovflw; /* upcall Q overflow */ 135 u_quad_t mrt6s_cache_cleanups; /* # entries with no upcalls */ 136 u_quad_t mrt6s_drop_sel; /* pkts dropped selectively */ 137 u_quad_t mrt6s_q_overflow; /* pkts dropped - Q overflow */ 138 u_quad_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */ 139 u_quad_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */ 140}; 141
|
142#ifdef MRT6_OINIT |
143/* 144 * Struct used to communicate from kernel to multicast router 145 * note the convenient similarity to an IPv6 header.
|
146 * XXX old version, superseded by mrt6msg. |
147 */
|
372struct mrt6msg {
|
148struct omrt6msg { |
149 u_long unused1; 150 u_char im6_msgtype; /* what type of message */
|
375#define MRT6MSG_NOCACHE 1
|
151#if 0 152#define MRT6MSG_NOCACHE 1 |
153#define MRT6MSG_WRONGMIF 2 154#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/
|
155#endif |
156 u_char im6_mbz; /* must be zero */ 157 u_char im6_mif; /* mif rec'd on */ 158 u_char unused2; 159 struct in6_addr im6_src, im6_dst; 160};
|
161#endif |
162 163/*
|
164 * Structure used to communicate from kernel to multicast router. 165 * We'll overlay the structure onto an MLD header (not an IPv6 header 166 * like igmpmsg{} used for IPv4 implementation). This is because this 167 * structure will be passed via an IPv6 raw socket, on which an application 168 * will only receive the payload i.e. the data after the IPv6 header and all 169 * the extension headers. (see Section 3 of draft-ietf-ipngwg-2292bis-01) 170 */ 171struct mrt6msg { 172#define MRT6MSG_NOCACHE 1 173#define MRT6MSG_WRONGMIF 2 174#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/ 175 u_char im6_mbz; /* must be zero */ 176 u_char im6_msgtype; /* what type of message */ 177 u_int16_t im6_mif; /* mif rec'd on */ 178 u_int32_t im6_pad; /* padding for 64bit arch */ 179 struct in6_addr im6_src, im6_dst; 180}; 181 182/* |
183 * Argument structure used by multicast routing daemon to get src-grp 184 * packet counts 185 */ 186struct sioc_sg_req6 { 187 struct sockaddr_in6 src; 188 struct sockaddr_in6 grp; 189 u_quad_t pktcnt; 190 u_quad_t bytecnt;
--- 15 unchanged lines hidden (view full) ---
206/* 207 * The kernel's multicast-interface structure. 208 */ 209struct mif6 { 210 u_char m6_flags; /* MIFF_ flags defined above */ 211 u_int m6_rate_limit; /* max rate */ 212#ifdef notyet 213 struct tbf *m6_tbf; /* token bucket structure at intf. */
|
416#endif
|
214#endif |
215 struct in6_addr m6_lcl_addr; /* local interface address */ 216 struct ifnet *m6_ifp; /* pointer to interface */ 217 u_quad_t m6_pkt_in; /* # pkts in on interface */ 218 u_quad_t m6_pkt_out; /* # pkts out on interface */ 219 u_quad_t m6_bytes_in; /* # bytes in on interface */ 220 u_quad_t m6_bytes_out; /* # bytes out on interface */ 221 struct route_in6 m6_route;/* cached route if this is a tunnel */ 222#ifdef notyet 223 u_int m6_rsvp_on; /* RSVP listening on this vif */ 224 struct socket *m6_rsvpd; /* RSVP daemon socket */
|
427#endif
|
225#endif |
226}; 227 228/*
|
431 * The kernel's multicast forwarding cache entry structure
|
229 * The kernel's multicast forwarding cache entry structure |
230 */ 231struct mf6c { 232 struct sockaddr_in6 mf6c_origin; /* IPv6 origin of mcasts */ 233 struct sockaddr_in6 mf6c_mcastgrp; /* multicast group associated*/ 234 mifi_t mf6c_parent; /* incoming IF */ 235 struct if_set mf6c_ifset; /* set of outgoing IFs */ 236 237 u_quad_t mf6c_pkt_cnt; /* pkt count for src-grp */
--- 25 unchanged lines hidden (view full) ---
263#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0 /* from sys:route.h */ 264#define MF6CHASHMOD(h) ((h) & (MF6CTBLSIZ - 1)) 265#else 266#define MF6CHASHMOD(h) ((h) % MF6CTBLSIZ) 267#endif 268 269#define MAX_UPQ6 4 /* max. no of pkts in upcall Q */ 270
|
473#if defined(__FreeBSD__) && __FreeBSD__ >= 3
|
271int ip6_mrouter_set __P((struct socket *so, struct sockopt *sopt)); 272int ip6_mrouter_get __P((struct socket *so, struct sockopt *sopt));
|
476#else
477int ip6_mrouter_set __P((int, struct socket *, struct mbuf *));
478int ip6_mrouter_get __P((int, struct socket *, struct mbuf **));
479#endif
|
273int ip6_mrouter_done __P((void)); 274int mrt6_ioctl __P((int, caddr_t)); 275#endif /* _KERNEL */ 276 277#endif /* !_NETINET6_IP6_MROUTE_H_ */
|