igmp.h revision 331722
11553Srgrimes/*- 21553Srgrimes * Copyright (c) 1988 Stephen Deering. 31553Srgrimes * Copyright (c) 1992, 1993 41553Srgrimes * The Regents of the University of California. All rights reserved. 51553Srgrimes * 61553Srgrimes * This code is derived from software contributed to Berkeley by 71553Srgrimes * Stephen Deering of Stanford University. 81553Srgrimes * 91553Srgrimes * Redistribution and use in source and binary forms, with or without 101553Srgrimes * modification, are permitted provided that the following conditions 111553Srgrimes * are met: 121553Srgrimes * 1. Redistributions of source code must retain the above copyright 131553Srgrimes * notice, this list of conditions and the following disclaimer. 141553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 151553Srgrimes * notice, this list of conditions and the following disclaimer in the 161553Srgrimes * documentation and/or other materials provided with the distribution. 171553Srgrimes * 4. Neither the name of the University nor the names of its contributors 181553Srgrimes * may be used to endorse or promote products derived from this software 191553Srgrimes * without specific prior written permission. 201553Srgrimes * 211553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221553Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231553Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241553Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251553Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261553Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271553Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281553Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291553Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301553Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311553Srgrimes * SUCH DAMAGE. 321553Srgrimes * 331553Srgrimes * @(#)igmp.h 8.1 (Berkeley) 6/10/93 341553Srgrimes * $FreeBSD: stable/11/sys/netinet/igmp.h 331722 2018-03-29 02:50:57Z eadler $ 351553Srgrimes */ 361553Srgrimes 371553Srgrimes#ifndef _NETINET_IGMP_H_ 381553Srgrimes#define _NETINET_IGMP_H_ 391553Srgrimes 401553Srgrimes/* 411553Srgrimes * Internet Group Management Protocol (IGMP) definitions. 421553Srgrimes * 431553Srgrimes * Written by Steve Deering, Stanford, May 1988. 441553Srgrimes * 451553Srgrimes * MULTICAST Revision: 3.5.1.2 461553Srgrimes */ 471553Srgrimes 481553Srgrimes/* Minimum length of any IGMP protocol message. */ 491553Srgrimes#define IGMP_MINLEN 8 501553Srgrimes 511553Srgrimes/* 521553Srgrimes * IGMPv1/v2 query and host report format. 531553Srgrimes */ 541553Srgrimesstruct igmp { 551553Srgrimes u_char igmp_type; /* version & type of IGMP message */ 561553Srgrimes u_char igmp_code; /* subtype for routing msgs */ 571553Srgrimes u_short igmp_cksum; /* IP-style checksum */ 581553Srgrimes struct in_addr igmp_group; /* group address being reported */ 591553Srgrimes}; /* (zero for queries) */ 601553Srgrimes 611553Srgrimes/* 621553Srgrimes * IGMP v3 query format. 631553Srgrimes */ 641553Srgrimesstruct igmpv3 { 651553Srgrimes u_char igmp_type; /* version & type of IGMP message */ 661553Srgrimes u_char igmp_code; /* subtype for routing msgs */ 671553Srgrimes u_short igmp_cksum; /* IP-style checksum */ 6817829Spst struct in_addr igmp_group; /* group address being reported */ 691553Srgrimes /* (zero for queries) */ 701553Srgrimes u_char igmp_misc; /* reserved/suppress/robustness */ 7110087Sjkh u_char igmp_qqi; /* querier's query interval */ 7210087Sjkh u_short igmp_numsrc; /* number of sources */ 7310087Sjkh /*struct in_addr igmp_sources[1];*/ /* source addresses */ 7410087Sjkh}; 7510087Sjkh#define IGMP_V3_QUERY_MINLEN 12 7610087Sjkh#define IGMP_EXP(x) (((x) >> 4) & 0x07) 7710087Sjkh#define IGMP_MANT(x) ((x) & 0x0f) 7810087Sjkh#define IGMP_QRESV(x) (((x) >> 4) & 0x0f) 7910087Sjkh#define IGMP_SFLAG(x) (((x) >> 3) & 0x01) 8010087Sjkh#define IGMP_QRV(x) ((x) & 0x07) 8110087Sjkh 8210087Sjkhstruct igmp_grouprec { 8310087Sjkh u_char ig_type; /* record type */ 8410087Sjkh u_char ig_datalen; /* length of auxiliary data */ 8510087Sjkh u_short ig_numsrc; /* number of sources */ 8610087Sjkh struct in_addr ig_group; /* group address being reported */ 8710087Sjkh /*struct in_addr ig_sources[1];*/ /* source addresses */ 8810087Sjkh}; 8910087Sjkh#define IGMP_GRPREC_HDRLEN 8 9010087Sjkh 9110087Sjkh/* 9210087Sjkh * IGMPv3 host membership report header. 9310087Sjkh */ 9410087Sjkhstruct igmp_report { 9510087Sjkh u_char ir_type; /* IGMP_v3_HOST_MEMBERSHIP_REPORT */ 9610087Sjkh u_char ir_rsv1; /* must be zero */ 9710087Sjkh u_short ir_cksum; /* checksum */ 9810087Sjkh u_short ir_rsv2; /* must be zero */ 9910087Sjkh u_short ir_numgrps; /* number of group records */ 10017832Spst /*struct igmp_grouprec ir_groups[1];*/ /* group records */ 10117829Spst}; 10217829Spst#define IGMP_V3_REPORT_MINLEN 8 10310087Sjkh#define IGMP_V3_REPORT_MAXRECS 65535 10410087Sjkh 10510087Sjkh/* 10610087Sjkh * Message types, including version number. 10710087Sjkh */ 10810087Sjkh#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* membership query */ 10910087Sjkh#define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ 11010087Sjkh#define IGMP_DVMRP 0x13 /* DVMRP routing message */ 11110087Sjkh#define IGMP_PIM 0x14 /* PIMv1 message (historic) */ 11210087Sjkh#define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ 11310087Sjkh#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* Leave-group message */ 11410087Sjkh#define IGMP_MTRACE_REPLY 0x1e /* mtrace(8) reply */ 11510087Sjkh#define IGMP_MTRACE_QUERY 0x1f /* mtrace(8) probe */ 11610087Sjkh#define IGMP_v3_HOST_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */ 1171553Srgrimes 1181553Srgrimes/* 1191553Srgrimes * IGMPv3 report modes. 1201553Srgrimes */ 1211553Srgrimes#define IGMP_DO_NOTHING 0 /* don't send a record */ 1221553Srgrimes#define IGMP_MODE_IS_INCLUDE 1 /* MODE_IN */ 1231553Srgrimes#define IGMP_MODE_IS_EXCLUDE 2 /* MODE_EX */ 1241553Srgrimes#define IGMP_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */ 1251553Srgrimes#define IGMP_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */ 1261553Srgrimes#define IGMP_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */ 1271553Srgrimes#define IGMP_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */ 1281553Srgrimes 1291553Srgrimes/* 1301553Srgrimes * IGMPv3 query types. 1311553Srgrimes */ 1321553Srgrimes#define IGMP_V3_GENERAL_QUERY 1 1331553Srgrimes#define IGMP_V3_GROUP_QUERY 2 1341553Srgrimes#define IGMP_V3_GROUP_SOURCE_QUERY 3 1351553Srgrimes 1361553Srgrimes/* 1371553Srgrimes * Maximum report interval for IGMP v1/v2 host membership reports [RFC 1112] 1381553Srgrimes */ 1391553Srgrimes#define IGMP_V1V2_MAX_RI 10 1401553Srgrimes#define IGMP_MAX_HOST_REPORT_DELAY IGMP_V1V2_MAX_RI 1411553Srgrimes 1421553Srgrimes/* 1431553Srgrimes * IGMP_TIMER_SCALE denotes that the igmp code field specifies 14417829Spst * time in tenths of a second. 1451553Srgrimes */ 1461553Srgrimes#define IGMP_TIMER_SCALE 10 1471553Srgrimes 1481553Srgrimes#endif /* _NETINET_IGMP_H_ */ 1491553Srgrimes