igmp_var.h revision 128019
1130561Sobrien/* 2130561Sobrien * Copyright (c) 1988 Stephen Deering. 3130561Sobrien * Copyright (c) 1992, 1993 4130561Sobrien * The Regents of the University of California. All rights reserved. 5130561Sobrien * 6130561Sobrien * This code is derived from software contributed to Berkeley by 7130561Sobrien * Stephen Deering of Stanford University. 8130561Sobrien * 9130561Sobrien * Redistribution and use in source and binary forms, with or without 10130561Sobrien * modification, are permitted provided that the following conditions 11130561Sobrien * are met: 12130561Sobrien * 1. Redistributions of source code must retain the above copyright 13130561Sobrien * notice, this list of conditions and the following disclaimer. 14130561Sobrien * 2. Redistributions in binary form must reproduce the above copyright 15130561Sobrien * notice, this list of conditions and the following disclaimer in the 16130561Sobrien * documentation and/or other materials provided with the distribution. 17130561Sobrien * 4. Neither the name of the University nor the names of its contributors 18130561Sobrien * may be used to endorse or promote products derived from this software 19130561Sobrien * without specific prior written permission. 20130561Sobrien * 21130561Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22130561Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23130561Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24130561Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25130561Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26130561Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27130561Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28130561Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29130561Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30130561Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31130561Sobrien * SUCH DAMAGE. 32130561Sobrien * 33130561Sobrien * from: @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 34130561Sobrien * $FreeBSD: head/sys/netinet/igmp_var.h 128019 2004-04-07 20:46:16Z imp $ 35130561Sobrien */ 36130561Sobrien 37130561Sobrien#ifndef _NETINET_IGMP_VAR_H_ 38130561Sobrien#define _NETINET_IGMP_VAR_H_ 39130561Sobrien 40130561Sobrien/* 41130561Sobrien * Internet Group Management Protocol (IGMP), 42130561Sobrien * implementation-specific definitions. 43130561Sobrien * 44130561Sobrien * Written by Steve Deering, Stanford, May 1988. 45130561Sobrien * 46130561Sobrien * MULTICAST Revision: 3.5.1.3 47130561Sobrien */ 48130561Sobrien 49130561Sobrienstruct igmpstat { 50130561Sobrien u_int igps_rcv_total; /* total IGMP messages received */ 51130561Sobrien u_int igps_rcv_tooshort; /* received with too few bytes */ 52130561Sobrien u_int igps_rcv_badsum; /* received with bad checksum */ 53130561Sobrien u_int igps_rcv_queries; /* received membership queries */ 54130561Sobrien u_int igps_rcv_badqueries; /* received invalid queries */ 55130561Sobrien u_int igps_rcv_reports; /* received membership reports */ 56130561Sobrien u_int igps_rcv_badreports; /* received invalid reports */ 57130561Sobrien u_int igps_rcv_ourreports; /* received reports for our groups */ 58130561Sobrien u_int igps_snd_reports; /* sent membership reports */ 59130561Sobrien}; 60130561Sobrien 61130561Sobrien#ifdef _KERNEL 62130561Sobrien#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1) 63130561Sobrien 64130561Sobrien/* 65130561Sobrien * States for IGMPv2's leave processing 66130561Sobrien */ 67130561Sobrien#define IGMP_OTHERMEMBER 0 68130561Sobrien#define IGMP_IREPORTEDLAST 1 69130561Sobrien 70130561Sobrien/* 71130561Sobrien * We must remember what version the subnet's querier is. 72130561Sobrien * We conveniently use the IGMP message type for the proper 73130561Sobrien * membership report to keep this state. 74130561Sobrien */ 75130561Sobrien#define IGMP_V1_ROUTER IGMP_V1_MEMBERSHIP_REPORT 76130561Sobrien#define IGMP_V2_ROUTER IGMP_V2_MEMBERSHIP_REPORT 77130561Sobrien 78130561Sobrien/* 79130561Sobrien * Revert to new router if we haven't heard from an old router in 80130561Sobrien * this amount of time. 81130561Sobrien */ 82130561Sobrien#define IGMP_AGE_THRESHOLD 540 83130561Sobrien 84130561Sobrienvoid igmp_init(void); 85130561Sobrienvoid igmp_input(struct mbuf *, int); 86130561Sobrienvoid igmp_joingroup(struct in_multi *); 87130561Sobrienvoid igmp_leavegroup(struct in_multi *); 88130561Sobrienvoid igmp_fasttimo(void); 89130561Sobrienvoid igmp_slowtimo(void); 90130561Sobrien 91130561SobrienSYSCTL_DECL(_net_inet_igmp); 92130561Sobrien 93130561Sobrien#endif 94130561Sobrien 95130561Sobrien/* 96130561Sobrien * Names for IGMP sysctl objects 97130561Sobrien */ 98130561Sobrien#define IGMPCTL_STATS 1 /* statistics (read-only) */ 99130561Sobrien#define IGMPCTL_MAXID 2 100130561Sobrien 101130561Sobrien#define IGMPCTL_NAMES { \ 102130561Sobrien { 0, 0 }, \ 103130561Sobrien { "stats", CTLTYPE_STRUCT }, \ 104130561Sobrien} 105130561Sobrien#endif 106130561Sobrien