1139823Simp/*- 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 * 331541Srgrimes * @(#)igmp.h 8.1 (Berkeley) 6/10/93 3450477Speter * $FreeBSD$ 351541Srgrimes */ 361541Srgrimes 372169Spaul#ifndef _NETINET_IGMP_H_ 382169Spaul#define _NETINET_IGMP_H_ 392169Spaul 402531Swollman/* 412531Swollman * Internet Group Management Protocol (IGMP) definitions. 422531Swollman * 432531Swollman * Written by Steve Deering, Stanford, May 1988. 442531Swollman * 4514622Sfenner * MULTICAST Revision: 3.5.1.2 462531Swollman */ 471541Srgrimes 48189347Sbms/* Minimum length of any IGMP protocol message. */ 49189347Sbms#define IGMP_MINLEN 8 50189347Sbms 511541Srgrimes/* 52189347Sbms * IGMPv1/v2 query and host report format. 531541Srgrimes */ 541541Srgrimesstruct igmp { 551541Srgrimes u_char igmp_type; /* version & type of IGMP message */ 569209Swollman u_char igmp_code; /* subtype for routing msgs */ 571541Srgrimes u_short igmp_cksum; /* IP-style checksum */ 581541Srgrimes struct in_addr igmp_group; /* group address being reported */ 591541Srgrimes}; /* (zero for queries) */ 601541Srgrimes 61189347Sbms/* 62189347Sbms * IGMP v3 query format. 63189347Sbms */ 64170613Sbmsstruct igmpv3 { 65170613Sbms u_char igmp_type; /* version & type of IGMP message */ 66170613Sbms u_char igmp_code; /* subtype for routing msgs */ 67170613Sbms u_short igmp_cksum; /* IP-style checksum */ 68170613Sbms struct in_addr igmp_group; /* group address being reported */ 69170613Sbms /* (zero for queries) */ 70170613Sbms u_char igmp_misc; /* reserved/suppress/robustness */ 71170613Sbms u_char igmp_qqi; /* querier's query interval */ 72170613Sbms u_short igmp_numsrc; /* number of sources */ 73170613Sbms /*struct in_addr igmp_sources[1];*/ /* source addresses */ 74170613Sbms}; 75189347Sbms#define IGMP_V3_QUERY_MINLEN 12 76189347Sbms#define IGMP_EXP(x) (((x) >> 4) & 0x07) 77189347Sbms#define IGMP_MANT(x) ((x) & 0x0f) 78189347Sbms#define IGMP_QRESV(x) (((x) >> 4) & 0x0f) 79189347Sbms#define IGMP_SFLAG(x) (((x) >> 3) & 0x01) 80189347Sbms#define IGMP_QRV(x) ((x) & 0x07) 811541Srgrimes 82170613Sbmsstruct igmp_grouprec { 83170613Sbms u_char ig_type; /* record type */ 84170613Sbms u_char ig_datalen; /* length of auxiliary data */ 85170613Sbms u_short ig_numsrc; /* number of sources */ 86170613Sbms struct in_addr ig_group; /* group address being reported */ 87170613Sbms /*struct in_addr ig_sources[1];*/ /* source addresses */ 88170613Sbms}; 89189347Sbms#define IGMP_GRPREC_HDRLEN 8 90170613Sbms 91189347Sbms/* 92189347Sbms * IGMPv3 host membership report header. 93189347Sbms */ 94170613Sbmsstruct igmp_report { 95189347Sbms u_char ir_type; /* IGMP_v3_HOST_MEMBERSHIP_REPORT */ 96189347Sbms u_char ir_rsv1; /* must be zero */ 97170613Sbms u_short ir_cksum; /* checksum */ 98189347Sbms u_short ir_rsv2; /* must be zero */ 99170613Sbms u_short ir_numgrps; /* number of group records */ 100189347Sbms /*struct igmp_grouprec ir_groups[1];*/ /* group records */ 101170613Sbms}; 102189347Sbms#define IGMP_V3_REPORT_MINLEN 8 103189347Sbms#define IGMP_V3_REPORT_MAXRECS 65535 104170613Sbms 1059209Swollman/* 1069209Swollman * Message types, including version number. 1079209Swollman */ 108189347Sbms#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* membership query */ 109189347Sbms#define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ 11014622Sfenner#define IGMP_DVMRP 0x13 /* DVMRP routing message */ 111190011Sbms#define IGMP_PIM 0x14 /* PIMv1 message (historic) */ 112189347Sbms#define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ 113189347Sbms#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* Leave-group message */ 114189347Sbms#define IGMP_MTRACE_REPLY 0x1e /* mtrace(8) reply */ 115189347Sbms#define IGMP_MTRACE_QUERY 0x1f /* mtrace(8) probe */ 116189347Sbms#define IGMP_v3_HOST_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */ 1179209Swollman 118189347Sbms/* 119189347Sbms * IGMPv3 report modes. 120189347Sbms */ 121189347Sbms#define IGMP_DO_NOTHING 0 /* don't send a record */ 122189347Sbms#define IGMP_MODE_IS_INCLUDE 1 /* MODE_IN */ 123189347Sbms#define IGMP_MODE_IS_EXCLUDE 2 /* MODE_EX */ 124189347Sbms#define IGMP_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */ 125189347Sbms#define IGMP_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */ 126189347Sbms#define IGMP_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */ 127189347Sbms#define IGMP_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */ 128170613Sbms 129189347Sbms/* 130189347Sbms * IGMPv3 query types. 131189347Sbms */ 132189347Sbms#define IGMP_V3_GENERAL_QUERY 1 133189347Sbms#define IGMP_V3_GROUP_QUERY 2 134189347Sbms#define IGMP_V3_GROUP_SOURCE_QUERY 3 1359209Swollman 136189347Sbms/* 137189347Sbms * Maximum report interval for IGMP v1/v2 host membership reports [RFC 1112] 138189347Sbms */ 139189347Sbms#define IGMP_V1V2_MAX_RI 10 140189347Sbms#define IGMP_MAX_HOST_REPORT_DELAY IGMP_V1V2_MAX_RI 1419209Swollman 1429209Swollman/* 143189347Sbms * IGMP_TIMER_SCALE denotes that the igmp code field specifies 144189347Sbms * time in tenths of a second. 1459209Swollman */ 146189347Sbms#define IGMP_TIMER_SCALE 10 1472531Swollman 1482531Swollman#endif /* _NETINET_IGMP_H_ */ 149