igmp_var.h revision 22975
159191Skris/*
259191Skris * Copyright (c) 1988 Stephen Deering.
359191Skris * Copyright (c) 1992, 1993
459191Skris *	The Regents of the University of California.  All rights reserved.
559191Skris *
659191Skris * This code is derived from software contributed to Berkeley by
759191Skris * Stephen Deering of Stanford University.
859191Skris *
959191Skris * Redistribution and use in source and binary forms, with or without
1059191Skris * modification, are permitted provided that the following conditions
1159191Skris * are met:
1259191Skris * 1. Redistributions of source code must retain the above copyright
1359191Skris *    notice, this list of conditions and the following disclaimer.
1459191Skris * 2. Redistributions in binary form must reproduce the above copyright
1559191Skris *    notice, this list of conditions and the following disclaimer in the
1659191Skris *    documentation and/or other materials provided with the distribution.
1759191Skris * 3. All advertising materials mentioning features or use of this software
1859191Skris *    must display the following acknowledgement:
1959191Skris *	This product includes software developed by the University of
2059191Skris *	California, Berkeley and its contributors.
2159191Skris * 4. Neither the name of the University nor the names of its contributors
2259191Skris *    may be used to endorse or promote products derived from this software
2359191Skris *    without specific prior written permission.
2459191Skris *
2559191Skris * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2659191Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2759191Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2859191Skris * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2959191Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3059191Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3159191Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3259191Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3359191Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3459191Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3559191Skris * SUCH DAMAGE.
3659191Skris *
3759191Skris *	@(#)igmp_var.h	8.1 (Berkeley) 7/19/93
3859191Skris * $Id$
3959191Skris */
4059191Skris
4159191Skris#ifndef _NETINET_IGMP_VAR_H_
4259191Skris#define _NETINET_IGMP_VAR_H_
4359191Skris
4459191Skris/*
4559191Skris * Internet Group Management Protocol (IGMP),
4659191Skris * implementation-specific definitions.
4759191Skris *
4859191Skris * Written by Steve Deering, Stanford, May 1988.
4959191Skris *
50142425Snectar * MULTICAST Revision: 3.5.1.3
51142425Snectar */
52142425Snectar
53142425Snectarstruct igmpstat {
5459191Skris	u_int	igps_rcv_total;		/* total IGMP messages received */
5559191Skris	u_int	igps_rcv_tooshort;	/* received with too few bytes */
5659191Skris	u_int	igps_rcv_badsum;	/* received with bad checksum */
5759191Skris	u_int	igps_rcv_queries;	/* received membership queries */
5859191Skris	u_int	igps_rcv_badqueries;	/* received invalid queries */
5959191Skris	u_int	igps_rcv_reports;	/* received membership reports */
6059191Skris	u_int	igps_rcv_badreports;	/* received invalid reports */
6159191Skris	u_int	igps_rcv_ourreports;	/* received reports for our groups */
6259191Skris	u_int	igps_snd_reports;	/* sent membership reports */
6359191Skris};
6459191Skris
6559191Skris#ifdef KERNEL
6659191Skrisextern struct igmpstat igmpstat;
6759191Skris
6859191Skris#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1)
6959191Skris
7059191Skris/*
7159191Skris * States for IGMPv2's leave processing
7259191Skris */
7359191Skris#define IGMP_OTHERMEMBER			0
7459191Skris#define IGMP_IREPORTEDLAST			1
7559191Skris
76109998Smarkm/*
77109998Smarkm * We must remember what version the subnet's querier is.
7859191Skris * We conveniently use the IGMP message type for the proper
7959191Skris * membership report to keep this state.
8059191Skris */
8159191Skris#define IGMP_V1_ROUTER				IGMP_V1_MEMBERSHIP_REPORT
8259191Skris#define IGMP_V2_ROUTER				IGMP_V2_MEMBERSHIP_REPORT
8359191Skris
8459191Skris/*
85 * Revert to new router if we haven't heard from an old router in
86 * this amount of time.
87 */
88#define IGMP_AGE_THRESHOLD			540
89
90void	igmp_init __P((void));
91void	igmp_input __P((struct mbuf *, int));
92void	igmp_joingroup __P((struct in_multi *));
93void	igmp_leavegroup __P((struct in_multi *));
94void	igmp_fasttimo __P((void));
95void	igmp_slowtimo __P((void));
96#endif
97
98/*
99 * Names for IGMP sysctl objects
100 */
101#define IGMPCTL_STATS		1	/* statistics (read-only) */
102#define IGMPCTL_MAXID		2
103
104#define IGMPCTL_NAMES { \
105	{ 0, 0 }, \
106	{ "stats", CTLTYPE_STRUCT }, \
107}
108
109#endif
110
111
112