11eaf0ac3Slogwang /*- 2*d4a07e70Sfengbojiang * SPDX-License-Identifier: BSD-3-Clause 3*d4a07e70Sfengbojiang * 41eaf0ac3Slogwang * Copyright (c) 1988 Stephen Deering. 51eaf0ac3Slogwang * Copyright (c) 1992, 1993 61eaf0ac3Slogwang * The Regents of the University of California. All rights reserved. 71eaf0ac3Slogwang * 81eaf0ac3Slogwang * This code is derived from software contributed to Berkeley by 91eaf0ac3Slogwang * Stephen Deering of Stanford University. 101eaf0ac3Slogwang * 111eaf0ac3Slogwang * Redistribution and use in source and binary forms, with or without 121eaf0ac3Slogwang * modification, are permitted provided that the following conditions 131eaf0ac3Slogwang * are met: 141eaf0ac3Slogwang * 1. Redistributions of source code must retain the above copyright 151eaf0ac3Slogwang * notice, this list of conditions and the following disclaimer. 161eaf0ac3Slogwang * 2. Redistributions in binary form must reproduce the above copyright 171eaf0ac3Slogwang * notice, this list of conditions and the following disclaimer in the 181eaf0ac3Slogwang * documentation and/or other materials provided with the distribution. 19*d4a07e70Sfengbojiang * 3. Neither the name of the University nor the names of its contributors 201eaf0ac3Slogwang * may be used to endorse or promote products derived from this software 211eaf0ac3Slogwang * without specific prior written permission. 221eaf0ac3Slogwang * 231eaf0ac3Slogwang * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241eaf0ac3Slogwang * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251eaf0ac3Slogwang * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261eaf0ac3Slogwang * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271eaf0ac3Slogwang * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281eaf0ac3Slogwang * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291eaf0ac3Slogwang * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301eaf0ac3Slogwang * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311eaf0ac3Slogwang * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321eaf0ac3Slogwang * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331eaf0ac3Slogwang * SUCH DAMAGE. 341eaf0ac3Slogwang * 351eaf0ac3Slogwang * @(#)igmp.h 8.1 (Berkeley) 6/10/93 361eaf0ac3Slogwang * $FreeBSD$ 371eaf0ac3Slogwang */ 381eaf0ac3Slogwang 391eaf0ac3Slogwang #ifndef _NETINET_IGMP_H_ 401eaf0ac3Slogwang #define _NETINET_IGMP_H_ 411eaf0ac3Slogwang 421eaf0ac3Slogwang /* 431eaf0ac3Slogwang * Internet Group Management Protocol (IGMP) definitions. 441eaf0ac3Slogwang * 451eaf0ac3Slogwang * Written by Steve Deering, Stanford, May 1988. 461eaf0ac3Slogwang * 471eaf0ac3Slogwang * MULTICAST Revision: 3.5.1.2 481eaf0ac3Slogwang */ 491eaf0ac3Slogwang 501eaf0ac3Slogwang /* Minimum length of any IGMP protocol message. */ 511eaf0ac3Slogwang #define IGMP_MINLEN 8 521eaf0ac3Slogwang 531eaf0ac3Slogwang /* 541eaf0ac3Slogwang * IGMPv1/v2 query and host report format. 551eaf0ac3Slogwang */ 561eaf0ac3Slogwang struct igmp { 571eaf0ac3Slogwang u_char igmp_type; /* version & type of IGMP message */ 581eaf0ac3Slogwang u_char igmp_code; /* subtype for routing msgs */ 591eaf0ac3Slogwang u_short igmp_cksum; /* IP-style checksum */ 601eaf0ac3Slogwang struct in_addr igmp_group; /* group address being reported */ 611eaf0ac3Slogwang }; /* (zero for queries) */ 621eaf0ac3Slogwang 631eaf0ac3Slogwang /* 641eaf0ac3Slogwang * IGMP v3 query format. 651eaf0ac3Slogwang */ 661eaf0ac3Slogwang struct igmpv3 { 671eaf0ac3Slogwang u_char igmp_type; /* version & type of IGMP message */ 681eaf0ac3Slogwang u_char igmp_code; /* subtype for routing msgs */ 691eaf0ac3Slogwang u_short igmp_cksum; /* IP-style checksum */ 701eaf0ac3Slogwang struct in_addr igmp_group; /* group address being reported */ 711eaf0ac3Slogwang /* (zero for queries) */ 721eaf0ac3Slogwang u_char igmp_misc; /* reserved/suppress/robustness */ 731eaf0ac3Slogwang u_char igmp_qqi; /* querier's query interval */ 741eaf0ac3Slogwang u_short igmp_numsrc; /* number of sources */ 751eaf0ac3Slogwang /*struct in_addr igmp_sources[1];*/ /* source addresses */ 761eaf0ac3Slogwang }; 771eaf0ac3Slogwang #define IGMP_V3_QUERY_MINLEN 12 781eaf0ac3Slogwang #define IGMP_EXP(x) (((x) >> 4) & 0x07) 791eaf0ac3Slogwang #define IGMP_MANT(x) ((x) & 0x0f) 801eaf0ac3Slogwang #define IGMP_QRESV(x) (((x) >> 4) & 0x0f) 811eaf0ac3Slogwang #define IGMP_SFLAG(x) (((x) >> 3) & 0x01) 821eaf0ac3Slogwang #define IGMP_QRV(x) ((x) & 0x07) 831eaf0ac3Slogwang 841eaf0ac3Slogwang struct igmp_grouprec { 851eaf0ac3Slogwang u_char ig_type; /* record type */ 861eaf0ac3Slogwang u_char ig_datalen; /* length of auxiliary data */ 871eaf0ac3Slogwang u_short ig_numsrc; /* number of sources */ 881eaf0ac3Slogwang struct in_addr ig_group; /* group address being reported */ 891eaf0ac3Slogwang /*struct in_addr ig_sources[1];*/ /* source addresses */ 901eaf0ac3Slogwang }; 911eaf0ac3Slogwang #define IGMP_GRPREC_HDRLEN 8 921eaf0ac3Slogwang 931eaf0ac3Slogwang /* 941eaf0ac3Slogwang * IGMPv3 host membership report header. 951eaf0ac3Slogwang */ 961eaf0ac3Slogwang struct igmp_report { 971eaf0ac3Slogwang u_char ir_type; /* IGMP_v3_HOST_MEMBERSHIP_REPORT */ 981eaf0ac3Slogwang u_char ir_rsv1; /* must be zero */ 991eaf0ac3Slogwang u_short ir_cksum; /* checksum */ 1001eaf0ac3Slogwang u_short ir_rsv2; /* must be zero */ 1011eaf0ac3Slogwang u_short ir_numgrps; /* number of group records */ 1021eaf0ac3Slogwang /*struct igmp_grouprec ir_groups[1];*/ /* group records */ 1031eaf0ac3Slogwang }; 1041eaf0ac3Slogwang #define IGMP_V3_REPORT_MINLEN 8 1051eaf0ac3Slogwang #define IGMP_V3_REPORT_MAXRECS 65535 1061eaf0ac3Slogwang 1071eaf0ac3Slogwang /* 1081eaf0ac3Slogwang * Message types, including version number. 1091eaf0ac3Slogwang */ 1101eaf0ac3Slogwang #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* membership query */ 1111eaf0ac3Slogwang #define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ 1121eaf0ac3Slogwang #define IGMP_DVMRP 0x13 /* DVMRP routing message */ 1131eaf0ac3Slogwang #define IGMP_PIM 0x14 /* PIMv1 message (historic) */ 1141eaf0ac3Slogwang #define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ 1151eaf0ac3Slogwang #define IGMP_HOST_LEAVE_MESSAGE 0x17 /* Leave-group message */ 1161eaf0ac3Slogwang #define IGMP_MTRACE_REPLY 0x1e /* mtrace(8) reply */ 1171eaf0ac3Slogwang #define IGMP_MTRACE_QUERY 0x1f /* mtrace(8) probe */ 1181eaf0ac3Slogwang #define IGMP_v3_HOST_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */ 1191eaf0ac3Slogwang 1201eaf0ac3Slogwang /* 1211eaf0ac3Slogwang * IGMPv3 report modes. 1221eaf0ac3Slogwang */ 1231eaf0ac3Slogwang #define IGMP_DO_NOTHING 0 /* don't send a record */ 1241eaf0ac3Slogwang #define IGMP_MODE_IS_INCLUDE 1 /* MODE_IN */ 1251eaf0ac3Slogwang #define IGMP_MODE_IS_EXCLUDE 2 /* MODE_EX */ 1261eaf0ac3Slogwang #define IGMP_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */ 1271eaf0ac3Slogwang #define IGMP_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */ 1281eaf0ac3Slogwang #define IGMP_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */ 1291eaf0ac3Slogwang #define IGMP_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */ 1301eaf0ac3Slogwang 1311eaf0ac3Slogwang /* 1321eaf0ac3Slogwang * IGMPv3 query types. 1331eaf0ac3Slogwang */ 1341eaf0ac3Slogwang #define IGMP_V3_GENERAL_QUERY 1 1351eaf0ac3Slogwang #define IGMP_V3_GROUP_QUERY 2 1361eaf0ac3Slogwang #define IGMP_V3_GROUP_SOURCE_QUERY 3 1371eaf0ac3Slogwang 1381eaf0ac3Slogwang /* 1391eaf0ac3Slogwang * Maximum report interval for IGMP v1/v2 host membership reports [RFC 1112] 1401eaf0ac3Slogwang */ 1411eaf0ac3Slogwang #define IGMP_V1V2_MAX_RI 10 1421eaf0ac3Slogwang #define IGMP_MAX_HOST_REPORT_DELAY IGMP_V1V2_MAX_RI 1431eaf0ac3Slogwang 1441eaf0ac3Slogwang /* 1451eaf0ac3Slogwang * IGMP_TIMER_SCALE denotes that the igmp code field specifies 1461eaf0ac3Slogwang * time in tenths of a second. 1471eaf0ac3Slogwang */ 1481eaf0ac3Slogwang #define IGMP_TIMER_SCALE 10 1491eaf0ac3Slogwang 1501eaf0ac3Slogwang #endif /* _NETINET_IGMP_H_ */ 151