igmp.h revision 189347
1181053Srwatson/*- 2180701Srwatson * Copyright (c) 1988 Stephen Deering. 3155192Srwatson * Copyright (c) 1992, 1993 4155192Srwatson * The Regents of the University of California. All rights reserved. 5155192Srwatson * 6155192Srwatson * This code is derived from software contributed to Berkeley by 7155192Srwatson * Stephen Deering of Stanford University. 8155192Srwatson * 9155192Srwatson * Redistribution and use in source and binary forms, with or without 10155192Srwatson * modification, are permitted provided that the following conditions 11155192Srwatson * are met: 12155192Srwatson * 1. Redistributions of source code must retain the above copyright 13180701Srwatson * notice, this list of conditions and the following disclaimer. 14155192Srwatson * 2. Redistributions in binary form must reproduce the above copyright 15155192Srwatson * notice, this list of conditions and the following disclaimer in the 16155192Srwatson * documentation and/or other materials provided with the distribution. 17155192Srwatson * 4. Neither the name of the University nor the names of its contributors 18155192Srwatson * may be used to endorse or promote products derived from this software 19155192Srwatson * without specific prior written permission. 20155192Srwatson * 21155192Srwatson * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22155192Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23155192Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24155192Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25155192Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26155192Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27155192Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28155192Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29155192Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30155192Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31155192Srwatson * SUCH DAMAGE. 32155192Srwatson * 33155192Srwatson * @(#)igmp.h 8.1 (Berkeley) 6/10/93 34155192Srwatson * $FreeBSD: head/sys/netinet/igmp.h 189347 2009-03-04 03:22:03Z bms $ 35155192Srwatson */ 36155192Srwatson 37156882Srwatson#ifndef _NETINET_IGMP_H_ 38178617Srwatson#define _NETINET_IGMP_H_ 39155192Srwatson 40155192Srwatson/* 41155192Srwatson * Internet Group Management Protocol (IGMP) definitions. 42155192Srwatson * 43155192Srwatson * Written by Steve Deering, Stanford, May 1988. 44155192Srwatson * 45155192Srwatson * MULTICAST Revision: 3.5.1.2 46155192Srwatson */ 47155192Srwatson 48155192Srwatson/* Minimum length of any IGMP protocol message. */ 49155192Srwatson#define IGMP_MINLEN 8 50155192Srwatson 51170196Srwatson/* 52170196Srwatson * IGMPv1/v2 query and host report format. 53170196Srwatson */ 54170196Srwatsonstruct igmp { 55155192Srwatson u_char igmp_type; /* version & type of IGMP message */ 56155192Srwatson u_char igmp_code; /* subtype for routing msgs */ 57155192Srwatson u_short igmp_cksum; /* IP-style checksum */ 58155192Srwatson struct in_addr igmp_group; /* group address being reported */ 59155192Srwatson}; /* (zero for queries) */ 60155192Srwatson 61155192Srwatson/* 62155192Srwatson * IGMP v3 query format. 63155192Srwatson */ 64155192Srwatsonstruct igmpv3 { 65155192Srwatson u_char igmp_type; /* version & type of IGMP message */ 66155192Srwatson u_char igmp_code; /* subtype for routing msgs */ 67161970Srwatson u_short igmp_cksum; /* IP-style checksum */ 68161970Srwatson struct in_addr igmp_group; /* group address being reported */ 69161970Srwatson /* (zero for queries) */ 70161970Srwatson u_char igmp_misc; /* reserved/suppress/robustness */ 71161970Srwatson u_char igmp_qqi; /* querier's query interval */ 72161970Srwatson u_short igmp_numsrc; /* number of sources */ 73161970Srwatson /*struct in_addr igmp_sources[1];*/ /* source addresses */ 74161970Srwatson}; 75161970Srwatson#define IGMP_V3_QUERY_MINLEN 12 76161970Srwatson#define IGMP_EXP(x) (((x) >> 4) & 0x07) 77161970Srwatson#define IGMP_MANT(x) ((x) & 0x0f) 78161970Srwatson#define IGMP_QRESV(x) (((x) >> 4) & 0x0f) 79161970Srwatson#define IGMP_SFLAG(x) (((x) >> 3) & 0x01) 80161970Srwatson#define IGMP_QRV(x) ((x) & 0x07) 81161970Srwatson 82161970Srwatsonstruct igmp_grouprec { 83161970Srwatson u_char ig_type; /* record type */ 84161970Srwatson u_char ig_datalen; /* length of auxiliary data */ 85161970Srwatson u_short ig_numsrc; /* number of sources */ 86161970Srwatson struct in_addr ig_group; /* group address being reported */ 87161970Srwatson /*struct in_addr ig_sources[1];*/ /* source addresses */ 88161970Srwatson}; 89161970Srwatson#define IGMP_GRPREC_HDRLEN 8 90168688Scsjp 91161970Srwatson/* 92161970Srwatson * IGMPv3 host membership report header. 93161970Srwatson */ 94161970Srwatsonstruct igmp_report { 95161970Srwatson u_char ir_type; /* IGMP_v3_HOST_MEMBERSHIP_REPORT */ 96161970Srwatson u_char ir_rsv1; /* must be zero */ 97161970Srwatson u_short ir_cksum; /* checksum */ 98161970Srwatson u_short ir_rsv2; /* must be zero */ 99161970Srwatson u_short ir_numgrps; /* number of group records */ 100161970Srwatson /*struct igmp_grouprec ir_groups[1];*/ /* group records */ 101161970Srwatson}; 102161970Srwatson#define IGMP_V3_REPORT_MINLEN 8 103161970Srwatson#define IGMP_V3_REPORT_MAXRECS 65535 104161970Srwatson 105161970Srwatson/* 106161970Srwatson * Message types, including version number. 107161970Srwatson */ 108161970Srwatson#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* membership query */ 109161970Srwatson#define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ 110161970Srwatson#define IGMP_DVMRP 0x13 /* DVMRP routing message */ 111161970Srwatson#define IGMP_PIM 0x14 /* PIM routing message */ 112161970Srwatson#define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ 113155192Srwatson#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* Leave-group message */ 114161813Swsalamon#define IGMP_MTRACE_REPLY 0x1e /* mtrace(8) reply */ 115161813Swsalamon#define IGMP_MTRACE_QUERY 0x1f /* mtrace(8) probe */ 116161813Swsalamon#define IGMP_v3_HOST_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */ 117161970Srwatson 118161970Srwatson#ifndef BURN_BRIDGES 119155192Srwatson/* 120156889Srwatson * Legacy FreeBSD definitions for the above message types. 121156889Srwatson */ 122155192Srwatson#define IGMP_MEMBERSHIP_QUERY IGMP_HOST_MEMBERSHIP_QUERY 123155192Srwatson#define IGMP_V1_MEMBERSHIP_REPORT IGMP_v1_HOST_MEMBERSHIP_REPORT 124170196Srwatson#define IGMP_V2_MEMBERSHIP_REPORT IGMP_v2_HOST_MEMBERSHIP_REPORT 125170196Srwatson#define IGMP_MTRACE_RESP IGMP_MTRACE_REPLY 126170196Srwatson#define IGMP_MTRACE IGMP_MTRACE_QUERY 127155192Srwatson#define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE 128155192Srwatson#define IGMP_V3_MEMBERSHIP_REPORT IGMP_v3_HOST_MEMBERSHIP_REPORT 129155192Srwatson#endif /* BURN_BRIDGES */ 130155192Srwatson 131155192Srwatson/* 132156889Srwatson * IGMPv3 report modes. 133156889Srwatson */ 134156889Srwatson#define IGMP_DO_NOTHING 0 /* don't send a record */ 135156889Srwatson#define IGMP_MODE_IS_INCLUDE 1 /* MODE_IN */ 136156889Srwatson#define IGMP_MODE_IS_EXCLUDE 2 /* MODE_EX */ 137156889Srwatson#define IGMP_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */ 138156889Srwatson#define IGMP_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */ 139156889Srwatson#define IGMP_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */ 140156889Srwatson#define IGMP_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */ 141156889Srwatson 142156889Srwatson/* 143156889Srwatson * IGMPv3 query types. 144156889Srwatson */ 145156889Srwatson#define IGMP_V3_GENERAL_QUERY 1 146156889Srwatson#define IGMP_V3_GROUP_QUERY 2 147156889Srwatson#define IGMP_V3_GROUP_SOURCE_QUERY 3 148156889Srwatson 149156889Srwatson/* 150156889Srwatson * Maximum report interval for IGMP v1/v2 host membership reports [RFC 1112] 151156889Srwatson */ 152156889Srwatson#define IGMP_V1V2_MAX_RI 10 153156889Srwatson#define IGMP_MAX_HOST_REPORT_DELAY IGMP_V1V2_MAX_RI 154156889Srwatson 155156889Srwatson/* 156156889Srwatson * IGMP_TIMER_SCALE denotes that the igmp code field specifies 157160086Srwatson * time in tenths of a second. 158156889Srwatson */ 159156889Srwatson#define IGMP_TIMER_SCALE 10 160171066Scsjp 161156889Srwatson#endif /* _NETINET_IGMP_H_ */ 162156889Srwatson