igmp_var.h revision 170613
1139823Simp/*-a 21541Srgrimes * Copyright (c) 1988 Stephen Deering. 31541Srgrimes * Copyright (c) 1992, 1993 41541Srgrimes * The Regents of the University of California. All rights reserved. 51541Srgrimes * 61541Srgrimes * This code is derived from software contributed to Berkeley by 71541Srgrimes * Stephen Deering of Stanford University. 81541Srgrimes * 91541Srgrimes * Redistribution and use in source and binary forms, with or without 101541Srgrimes * modification, are permitted provided that the following conditions 111541Srgrimes * are met: 121541Srgrimes * 1. Redistributions of source code must retain the above copyright 131541Srgrimes * notice, this list of conditions and the following disclaimer. 141541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 151541Srgrimes * notice, this list of conditions and the following disclaimer in the 161541Srgrimes * documentation and/or other materials provided with the distribution. 171541Srgrimes * 4. Neither the name of the University nor the names of its contributors 181541Srgrimes * may be used to endorse or promote products derived from this software 191541Srgrimes * without specific prior written permission. 201541Srgrimes * 211541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311541Srgrimes * SUCH DAMAGE. 321541Srgrimes * 3344511Swollman * from: @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 3450477Speter * $FreeBSD: head/sys/netinet/igmp_var.h 170613 2007-06-12 16:24:56Z bms $ 351541Srgrimes */ 361541Srgrimes 372169Spaul#ifndef _NETINET_IGMP_VAR_H_ 382169Spaul#define _NETINET_IGMP_VAR_H_ 392169Spaul 401541Srgrimes/* 411541Srgrimes * Internet Group Management Protocol (IGMP), 421541Srgrimes * implementation-specific definitions. 431541Srgrimes * 441541Srgrimes * Written by Steve Deering, Stanford, May 1988. 451541Srgrimes * 4614622Sfenner * MULTICAST Revision: 3.5.1.3 471541Srgrimes */ 481541Srgrimes 491541Srgrimesstruct igmpstat { 509209Swollman u_int igps_rcv_total; /* total IGMP messages received */ 519209Swollman u_int igps_rcv_tooshort; /* received with too few bytes */ 529209Swollman u_int igps_rcv_badsum; /* received with bad checksum */ 539209Swollman u_int igps_rcv_queries; /* received membership queries */ 549209Swollman u_int igps_rcv_badqueries; /* received invalid queries */ 559209Swollman u_int igps_rcv_reports; /* received membership reports */ 569209Swollman u_int igps_rcv_badreports; /* received invalid reports */ 579209Swollman u_int igps_rcv_ourreports; /* received reports for our groups */ 589209Swollman u_int igps_snd_reports; /* sent membership reports */ 59170613Sbms u_int igps_rcv_toolong; /* received with too many bytes */ 601541Srgrimes}; 611541Srgrimes 6255205Speter#ifdef _KERNEL 632531Swollman#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1) 641541Srgrimes 6514622Sfenner/* 6614622Sfenner * States for IGMPv2's leave processing 6714622Sfenner */ 6814622Sfenner#define IGMP_OTHERMEMBER 0 6914622Sfenner#define IGMP_IREPORTEDLAST 1 7014622Sfenner 7114622Sfenner/* 72170613Sbms * State masks for IGMPv3 73170613Sbms */ 74170613Sbms#define IGMP_V3_NONEXISTENT 0x01 75170613Sbms#define IGMP_V3_OTHERMEMBER 0x02 76170613Sbms#define IGMP_V3_IREPORTEDLAST 0x04 77170613Sbms 78170613Sbms/* 7914622Sfenner * We must remember what version the subnet's querier is. 8014622Sfenner * We conveniently use the IGMP message type for the proper 8114622Sfenner * membership report to keep this state. 8214622Sfenner */ 8314622Sfenner#define IGMP_V1_ROUTER IGMP_V1_MEMBERSHIP_REPORT 8414622Sfenner#define IGMP_V2_ROUTER IGMP_V2_MEMBERSHIP_REPORT 85170613Sbms#define IGMP_V3_ROUTER IGMP_V3_MEMBERSHIP_REPORT 8614622Sfenner 8714622Sfenner/* 8814622Sfenner * Revert to new router if we haven't heard from an old router in 8914622Sfenner * this amount of time. 9014622Sfenner */ 9114622Sfenner#define IGMP_AGE_THRESHOLD 540 9214622Sfenner 93170613Sbms/* 94170613Sbms * IGMPv3 protocol defaults 95170613Sbms */ 96170613Sbms#define IGMP_INIT_ROBVAR 2 /* Robustness */ 97170613Sbms#define IGMP_MAX_ROBVAR 7 98170613Sbms#define IGMP_INIT_QRYINT 125 /* Querier's Query interval */ 99170613Sbms#define IGMP_MAX_QRYINT 255 100170613Sbms#define IGMP_INIT_QRYRSP 10 /* Query Response interval */ 101170613Sbms#define IGMP_DEF_QRYMRT 10 102170613Sbms#define IGMP_UNSOL_INT 1 /* Unsolicited Report interval */ 103170613Sbms 104170613Sbms/* 105170613Sbms * IGMPv3 report types 106170613Sbms */ 107170613Sbms#define IGMP_REPORT_MODE_IN 1 /* mode-is-include */ 108170613Sbms#define IGMP_REPORT_MODE_EX 2 /* mode-is-exclude */ 109170613Sbms#define IGMP_REPORT_TO_IN 3 /* change-to-include */ 110170613Sbms#define IGMP_REPORT_TO_EX 4 /* change-to-exclude */ 111170613Sbms#define IGMP_REPORT_ALLOW_NEW 5 /* allow-new-sources */ 112170613Sbms#define IGMP_REPORT_BLOCK_OLD 6 /* block-old-sources */ 113170613Sbms 114170613Sbms/* 115170613Sbms * Report types 116170613Sbms */ 117170613Sbms#define IGMP_MASK_CUR_STATE 0x01 /* Report current-state */ 118170613Sbms#define IGMP_MASK_ALLOW_NEW 0x02 /* Report source as allow-new */ 119170613Sbms#define IGMP_MASK_BLOCK_OLD 0x04 /* Report source as block-old */ 120170613Sbms#define IGMP_MASK_TO_IN 0x08 /* Report source as to_in */ 121170613Sbms#define IGMP_MASK_TO_EX 0x10 /* Report source as to_ex */ 122170613Sbms#define IGMP_MASK_STATE_T1 0x20 /* State at T1 */ 123170613Sbms#define IGMP_MASK_STATE_T2 0x40 /* State at T2 */ 124170613Sbms#define IGMP_MASK_IF_STATE 0x80 /* Report current-state per interface */ 125170613Sbms 126170613Sbms#define IGMP_MASK_STATE_TX (IGMP_MASK_STATE_T1 | IGMP_MASK_STATE_T2) 127170613Sbms#define IGMP_MASK_PENDING (IGMP_MASK_CUR_STATE | \ 128170613Sbms IGMP_MASK_ALLOW_NEW | \ 129170613Sbms IGMP_MASK_BLOCK_OLD) 130170613Sbms 131170613Sbms/* 132170613Sbms * List identifiers 133170613Sbms */ 134170613Sbms#define IGMP_EXCLUDE_LIST 1 /* exclude list used to tag report */ 135170613Sbms#define IGMP_INCLUDE_LIST 2 /* include list used to tag report */ 136170613Sbms#define IGMP_RECORDED_LIST 3 /* recorded list used to tag report */ 137170613Sbms 13892723Salfredvoid igmp_init(void); 13992723Salfredvoid igmp_input(struct mbuf *, int); 14092723Salfredvoid igmp_joingroup(struct in_multi *); 14192723Salfredvoid igmp_leavegroup(struct in_multi *); 14292723Salfredvoid igmp_fasttimo(void); 14392723Salfredvoid igmp_slowtimo(void); 14444511Swollman 14544511SwollmanSYSCTL_DECL(_net_inet_igmp); 14644511Swollman 1471541Srgrimes#endif 1482169Spaul 1496472Swollman/* 1506472Swollman * Names for IGMP sysctl objects 1516472Swollman */ 1526472Swollman#define IGMPCTL_STATS 1 /* statistics (read-only) */ 1536472Swollman#define IGMPCTL_MAXID 2 1546472Swollman 1556472Swollman#define IGMPCTL_NAMES { \ 1566472Swollman { 0, 0 }, \ 157170613Sbms { "stats", CTLTYPE_STRUCT } \ 1586472Swollman} 1592169Spaul#endif 160