1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */ 27*7c478bd9Sstevel@tonic-gate 28*7c478bd9Sstevel@tonic-gate #ifndef _NETINET_IGMP_H 29*7c478bd9Sstevel@tonic-gate #define _NETINET_IGMP_H 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 34*7c478bd9Sstevel@tonic-gate extern "C" { 35*7c478bd9Sstevel@tonic-gate #endif 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate /* 38*7c478bd9Sstevel@tonic-gate * Internet Group Management Protocol (IGMP) definitions. 39*7c478bd9Sstevel@tonic-gate * 40*7c478bd9Sstevel@tonic-gate * Written by Steve Deering, Stanford, May 1988. 41*7c478bd9Sstevel@tonic-gate * Modified by Rosen Sharma, Stanford, Aug 1994 42*7c478bd9Sstevel@tonic-gate * Modified by Bill Fenner, Xerox PARC, April 1995 43*7c478bd9Sstevel@tonic-gate * 44*7c478bd9Sstevel@tonic-gate * MULTICAST 3.5.1.1 45*7c478bd9Sstevel@tonic-gate */ 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate /* 48*7c478bd9Sstevel@tonic-gate * IGMP packet format. 49*7c478bd9Sstevel@tonic-gate */ 50*7c478bd9Sstevel@tonic-gate struct igmp { 51*7c478bd9Sstevel@tonic-gate uchar_t igmp_type; /* version & type of IGMP message */ 52*7c478bd9Sstevel@tonic-gate uchar_t igmp_code; /* code for routing sub-msgs */ 53*7c478bd9Sstevel@tonic-gate ushort_t igmp_cksum; /* IP-style checksum */ 54*7c478bd9Sstevel@tonic-gate struct in_addr igmp_group; /* group address being reported */ 55*7c478bd9Sstevel@tonic-gate }; /* (zero for queries) */ 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate /* IGMPv3 Membership Report common header */ 58*7c478bd9Sstevel@tonic-gate struct igmp3r { 59*7c478bd9Sstevel@tonic-gate uchar_t igmp3r_type; /* version & type of IGMP message */ 60*7c478bd9Sstevel@tonic-gate uchar_t igmp3r_code; /* code for routing sub-msgs */ 61*7c478bd9Sstevel@tonic-gate ushort_t igmp3r_cksum; /* IP-style checksum */ 62*7c478bd9Sstevel@tonic-gate ushort_t igmp3r_res; /* Reserved */ 63*7c478bd9Sstevel@tonic-gate ushort_t igmp3r_numrec; /* Number of group records */ 64*7c478bd9Sstevel@tonic-gate }; 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate /* IGMPv3 Group Record header */ 67*7c478bd9Sstevel@tonic-gate struct grphdr { 68*7c478bd9Sstevel@tonic-gate uchar_t grphdr_type; /* type of record */ 69*7c478bd9Sstevel@tonic-gate uchar_t grphdr_auxlen; /* auxiliary data length */ 70*7c478bd9Sstevel@tonic-gate ushort_t grphdr_numsrc; /* number of sources */ 71*7c478bd9Sstevel@tonic-gate struct in_addr grphdr_group; /* group address being reported */ 72*7c478bd9Sstevel@tonic-gate }; 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate /* IGMPv3 Membership Query header */ 75*7c478bd9Sstevel@tonic-gate struct igmp3q { 76*7c478bd9Sstevel@tonic-gate uchar_t igmp3q_type; /* type of IGMP message */ 77*7c478bd9Sstevel@tonic-gate uchar_t igmp3q_mxrt; /* maximum response time */ 78*7c478bd9Sstevel@tonic-gate ushort_t igmp3q_cksum; /* IP-style checksum */ 79*7c478bd9Sstevel@tonic-gate struct in_addr igmp3q_group; /* group address being queried */ 80*7c478bd9Sstevel@tonic-gate ushort_t igmp3q_res; /* reserved */ 81*7c478bd9Sstevel@tonic-gate ushort_t igmp3q_numsrc; /* number of sources */ 82*7c478bd9Sstevel@tonic-gate }; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 85*7c478bd9Sstevel@tonic-gate typedef struct igmp_s { 86*7c478bd9Sstevel@tonic-gate uint8_t igmp_type; /* version & type of IGMP message */ 87*7c478bd9Sstevel@tonic-gate uint8_t igmp_code; /* code for routing sub-msgs */ 88*7c478bd9Sstevel@tonic-gate uint8_t igmp_cksum[2]; /* IP-style checksum */ 89*7c478bd9Sstevel@tonic-gate uint8_t igmp_group[4]; /* group address being reported */ 90*7c478bd9Sstevel@tonic-gate } igmp_t; /* (zero for queries) */ 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate /* Aligned igmp header */ 93*7c478bd9Sstevel@tonic-gate typedef struct igmpa_s { 94*7c478bd9Sstevel@tonic-gate uint8_t igmpa_type; /* version & type of IGMP message */ 95*7c478bd9Sstevel@tonic-gate uint8_t igmpa_code; /* code for routing sub-msgs */ 96*7c478bd9Sstevel@tonic-gate uint16_t igmpa_cksum; /* IP-style checksum */ 97*7c478bd9Sstevel@tonic-gate ipaddr_t igmpa_group; /* group address being reported */ 98*7c478bd9Sstevel@tonic-gate } igmpa_t; /* (zero for queries) */ 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate /* Aligned IGMPv3 Membership Report common header */ 101*7c478bd9Sstevel@tonic-gate typedef struct igmp3ra_s { 102*7c478bd9Sstevel@tonic-gate uint8_t igmp3ra_type; /* version & type of IGMP message */ 103*7c478bd9Sstevel@tonic-gate uint8_t igmp3ra_res; /* Reserved */ 104*7c478bd9Sstevel@tonic-gate uint16_t igmp3ra_cksum; /* IP-style checksum */ 105*7c478bd9Sstevel@tonic-gate uint16_t igmp3ra_res1; /* Reserved */ 106*7c478bd9Sstevel@tonic-gate uint16_t igmp3ra_numrec; /* Number of group records */ 107*7c478bd9Sstevel@tonic-gate } igmp3ra_t; 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate /* Aligned IGMPv3 Group Record header */ 110*7c478bd9Sstevel@tonic-gate typedef struct grphdra_s { 111*7c478bd9Sstevel@tonic-gate uint8_t grphdra_type; /* type of record */ 112*7c478bd9Sstevel@tonic-gate uint8_t grphdra_auxlen; /* auxiliary data length */ 113*7c478bd9Sstevel@tonic-gate uint16_t grphdra_numsrc; /* number of sources */ 114*7c478bd9Sstevel@tonic-gate ipaddr_t grphdra_group; /* group addrss being reported */ 115*7c478bd9Sstevel@tonic-gate } grphdra_t; 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate /* Aligned IGMpv3 Membership Query header */ 118*7c478bd9Sstevel@tonic-gate typedef struct igmp3qa_s { 119*7c478bd9Sstevel@tonic-gate uint8_t igmp3qa_type; /* type of IGMP message */ 120*7c478bd9Sstevel@tonic-gate uint8_t igmp3qa_mxrc; /* maximum response code */ 121*7c478bd9Sstevel@tonic-gate uint16_t igmp3qa_cksum; /* IP-style checksum */ 122*7c478bd9Sstevel@tonic-gate ipaddr_t igmp3qa_group; /* group address being queried */ 123*7c478bd9Sstevel@tonic-gate uint8_t igmp3qa_sqrv; /* S Flag, Q's Robustness Variable */ 124*7c478bd9Sstevel@tonic-gate uint8_t igmp3qa_qqic; /* Querier's Query Interval Code */ 125*7c478bd9Sstevel@tonic-gate uint16_t igmp3qa_numsrc; /* number of sources */ 126*7c478bd9Sstevel@tonic-gate } igmp3qa_t; 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate #define IGMP_MINLEN 8 132*7c478bd9Sstevel@tonic-gate #define IGMP_V3_QUERY_MINLEN 12 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate /* 136*7c478bd9Sstevel@tonic-gate * Message types, including version number. 137*7c478bd9Sstevel@tonic-gate */ 138*7c478bd9Sstevel@tonic-gate 139*7c478bd9Sstevel@tonic-gate #define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ 140*7c478bd9Sstevel@tonic-gate #define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Vers.1 membership report */ 141*7c478bd9Sstevel@tonic-gate #define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Vers.2 membership report */ 142*7c478bd9Sstevel@tonic-gate #define IGMP_V3_MEMBERSHIP_REPORT 0x22 /* Vers.3 membership report */ 143*7c478bd9Sstevel@tonic-gate #define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ 144*7c478bd9Sstevel@tonic-gate #define IGMP_DVMRP 0x13 /* DVMRP routing message */ 145*7c478bd9Sstevel@tonic-gate #define IGMP_PIM 0x14 /* PIM routing message */ 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate #define IGMP_MTRACE_RESP 0x1e /* traceroute resp to sender */ 148*7c478bd9Sstevel@tonic-gate #define IGMP_MTRACE 0x1f /* mcast traceroute messages */ 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate #define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ 151*7c478bd9Sstevel@tonic-gate /* query (in seconds) */ 152*7c478bd9Sstevel@tonic-gate /* according to RFC1112 */ 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate #define IGMP_V3_MAXRT_FPMIN 0x80 /* max resp code fp format */ 155*7c478bd9Sstevel@tonic-gate #define IGMP_V3_MAXRT_MANT_MASK 0x0f 156*7c478bd9Sstevel@tonic-gate #define IGMP_V3_MAXRT_EXP_MASK 0x70 157*7c478bd9Sstevel@tonic-gate 158*7c478bd9Sstevel@tonic-gate #define IGMP_V3_SFLAG_MASK 0x8 /* mask off s part of sqrv */ 159*7c478bd9Sstevel@tonic-gate #define IGMP_V3_RV_MASK 0x7 /* mask off qrv part of sqrv */ 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate #define IGMP_V3_QQI_FPMIN 0x80 /* qqi code fp format */ 162*7c478bd9Sstevel@tonic-gate #define IGMP_V3_QQI_MANT_MASK 0x0f 163*7c478bd9Sstevel@tonic-gate #define IGMP_V3_QQI_EXP_MASK 0x70 164*7c478bd9Sstevel@tonic-gate 165*7c478bd9Sstevel@tonic-gate /* 166*7c478bd9Sstevel@tonic-gate * IGMPv3/MLDv2-specific definitions 167*7c478bd9Sstevel@tonic-gate */ 168*7c478bd9Sstevel@tonic-gate /* 169*7c478bd9Sstevel@tonic-gate * Group Record Types. The values of these enums match the Record Type 170*7c478bd9Sstevel@tonic-gate * field values defined in RFCs 3376 and 3810 for IGMPv3 and MLDv2 reports. 171*7c478bd9Sstevel@tonic-gate */ 172*7c478bd9Sstevel@tonic-gate typedef enum { 173*7c478bd9Sstevel@tonic-gate MODE_IS_INCLUDE = 1, 174*7c478bd9Sstevel@tonic-gate MODE_IS_EXCLUDE, 175*7c478bd9Sstevel@tonic-gate CHANGE_TO_INCLUDE, 176*7c478bd9Sstevel@tonic-gate CHANGE_TO_EXCLUDE, 177*7c478bd9Sstevel@tonic-gate ALLOW_NEW_SOURCES, 178*7c478bd9Sstevel@tonic-gate BLOCK_OLD_SOURCES 179*7c478bd9Sstevel@tonic-gate } mcast_record_t; 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate /* Router Alert Option */ 182*7c478bd9Sstevel@tonic-gate #define RTRALERT_LEN 4 183*7c478bd9Sstevel@tonic-gate #define RTRALERT_LEN_IN_WORDS 1 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate /* 186*7c478bd9Sstevel@tonic-gate * The following four defininitions are for backwards compatibility. 187*7c478bd9Sstevel@tonic-gate * They should be removed as soon as all applications are updated to 188*7c478bd9Sstevel@tonic-gate * use the new constant names. 189*7c478bd9Sstevel@tonic-gate */ 190*7c478bd9Sstevel@tonic-gate #define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY 191*7c478bd9Sstevel@tonic-gate #define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT 192*7c478bd9Sstevel@tonic-gate #define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT 193*7c478bd9Sstevel@tonic-gate #define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP 194*7c478bd9Sstevel@tonic-gate 195*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 196*7c478bd9Sstevel@tonic-gate } 197*7c478bd9Sstevel@tonic-gate #endif 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate #endif /* _NETINET_IGMP_H */ 200