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 #ifdef __cplusplus 32*7c478bd9Sstevel@tonic-gate extern "C" { 33*7c478bd9Sstevel@tonic-gate #endif 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate /* 36*7c478bd9Sstevel@tonic-gate * Internet Group Management Protocol (IGMP) definitions. 37*7c478bd9Sstevel@tonic-gate * 38*7c478bd9Sstevel@tonic-gate * Written by Steve Deering, Stanford, May 1988. 39*7c478bd9Sstevel@tonic-gate * Modified by Rosen Sharma, Stanford, Aug 1994 40*7c478bd9Sstevel@tonic-gate * Modified by Bill Fenner, Xerox PARC, April 1995 41*7c478bd9Sstevel@tonic-gate * 42*7c478bd9Sstevel@tonic-gate * MULTICAST 3.5.1.1 43*7c478bd9Sstevel@tonic-gate */ 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate /* 46*7c478bd9Sstevel@tonic-gate * IGMP packet format. 47*7c478bd9Sstevel@tonic-gate */ 48*7c478bd9Sstevel@tonic-gate struct igmp { 49*7c478bd9Sstevel@tonic-gate uchar_t igmp_type; /* version & type of IGMP message */ 50*7c478bd9Sstevel@tonic-gate uchar_t igmp_code; /* code for routing sub-msgs */ 51*7c478bd9Sstevel@tonic-gate ushort_t igmp_cksum; /* IP-style checksum */ 52*7c478bd9Sstevel@tonic-gate struct in_addr igmp_group; /* group address being reported */ 53*7c478bd9Sstevel@tonic-gate }; /* (zero for queries) */ 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate /* IGMPv3 Membership Report common header */ 56*7c478bd9Sstevel@tonic-gate struct igmp3r { 57*7c478bd9Sstevel@tonic-gate uchar_t igmp3r_type; /* version & type of IGMP message */ 58*7c478bd9Sstevel@tonic-gate uchar_t igmp3r_code; /* code for routing sub-msgs */ 59*7c478bd9Sstevel@tonic-gate ushort_t igmp3r_cksum; /* IP-style checksum */ 60*7c478bd9Sstevel@tonic-gate ushort_t igmp3r_res; /* Reserved */ 61*7c478bd9Sstevel@tonic-gate ushort_t igmp3r_numrec; /* Number of group records */ 62*7c478bd9Sstevel@tonic-gate }; 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate /* IGMPv3 Group Record header */ 65*7c478bd9Sstevel@tonic-gate struct grphdr { 66*7c478bd9Sstevel@tonic-gate uchar_t grphdr_type; /* type of record */ 67*7c478bd9Sstevel@tonic-gate uchar_t grphdr_auxlen; /* auxiliary data length */ 68*7c478bd9Sstevel@tonic-gate ushort_t grphdr_numsrc; /* number of sources */ 69*7c478bd9Sstevel@tonic-gate struct in_addr grphdr_group; /* group address being reported */ 70*7c478bd9Sstevel@tonic-gate }; 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate /* IGMPv3 Membership Query header */ 73*7c478bd9Sstevel@tonic-gate struct igmp3q { 74*7c478bd9Sstevel@tonic-gate uchar_t igmp3q_type; /* type of IGMP message */ 75*7c478bd9Sstevel@tonic-gate uchar_t igmp3q_mxrt; /* maximum response time */ 76*7c478bd9Sstevel@tonic-gate ushort_t igmp3q_cksum; /* IP-style checksum */ 77*7c478bd9Sstevel@tonic-gate struct in_addr igmp3q_group; /* group address being queried */ 78*7c478bd9Sstevel@tonic-gate ushort_t igmp3q_res; /* reserved */ 79*7c478bd9Sstevel@tonic-gate ushort_t igmp3q_numsrc; /* number of sources */ 80*7c478bd9Sstevel@tonic-gate }; 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 83*7c478bd9Sstevel@tonic-gate typedef struct igmp_s { 84*7c478bd9Sstevel@tonic-gate uint8_t igmp_type; /* version & type of IGMP message */ 85*7c478bd9Sstevel@tonic-gate uint8_t igmp_code; /* code for routing sub-msgs */ 86*7c478bd9Sstevel@tonic-gate uint8_t igmp_cksum[2]; /* IP-style checksum */ 87*7c478bd9Sstevel@tonic-gate uint8_t igmp_group[4]; /* group address being reported */ 88*7c478bd9Sstevel@tonic-gate } igmp_t; /* (zero for queries) */ 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate /* Aligned igmp header */ 91*7c478bd9Sstevel@tonic-gate typedef struct igmpa_s { 92*7c478bd9Sstevel@tonic-gate uint8_t igmpa_type; /* version & type of IGMP message */ 93*7c478bd9Sstevel@tonic-gate uint8_t igmpa_code; /* code for routing sub-msgs */ 94*7c478bd9Sstevel@tonic-gate uint16_t igmpa_cksum; /* IP-style checksum */ 95*7c478bd9Sstevel@tonic-gate ipaddr_t igmpa_group; /* group address being reported */ 96*7c478bd9Sstevel@tonic-gate } igmpa_t; /* (zero for queries) */ 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate /* Aligned IGMPv3 Membership Report common header */ 99*7c478bd9Sstevel@tonic-gate typedef struct igmp3ra_s { 100*7c478bd9Sstevel@tonic-gate uint8_t igmp3ra_type; /* version & type of IGMP message */ 101*7c478bd9Sstevel@tonic-gate uint8_t igmp3ra_res; /* Reserved */ 102*7c478bd9Sstevel@tonic-gate uint16_t igmp3ra_cksum; /* IP-style checksum */ 103*7c478bd9Sstevel@tonic-gate uint16_t igmp3ra_res1; /* Reserved */ 104*7c478bd9Sstevel@tonic-gate uint16_t igmp3ra_numrec; /* Number of group records */ 105*7c478bd9Sstevel@tonic-gate } igmp3ra_t; 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate /* Aligned IGMPv3 Group Record header */ 108*7c478bd9Sstevel@tonic-gate typedef struct grphdra_s { 109*7c478bd9Sstevel@tonic-gate uint8_t grphdra_type; /* type of record */ 110*7c478bd9Sstevel@tonic-gate uint8_t grphdra_auxlen; /* auxiliary data length */ 111*7c478bd9Sstevel@tonic-gate uint16_t grphdra_numsrc; /* number of sources */ 112*7c478bd9Sstevel@tonic-gate ipaddr_t grphdra_group; /* group addrss being reported */ 113*7c478bd9Sstevel@tonic-gate } grphdra_t; 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate /* Aligned IGMpv3 Membership Query header */ 116*7c478bd9Sstevel@tonic-gate typedef struct igmp3qa_s { 117*7c478bd9Sstevel@tonic-gate uint8_t igmp3qa_type; /* type of IGMP message */ 118*7c478bd9Sstevel@tonic-gate uint8_t igmp3qa_mxrc; /* maximum response code */ 119*7c478bd9Sstevel@tonic-gate uint16_t igmp3qa_cksum; /* IP-style checksum */ 120*7c478bd9Sstevel@tonic-gate ipaddr_t igmp3qa_group; /* group address being queried */ 121*7c478bd9Sstevel@tonic-gate uint8_t igmp3qa_sqrv; /* S Flag, Q's Robustness Variable */ 122*7c478bd9Sstevel@tonic-gate uint8_t igmp3qa_qqic; /* Querier's Query Interval Code */ 123*7c478bd9Sstevel@tonic-gate uint16_t igmp3qa_numsrc; /* number of sources */ 124*7c478bd9Sstevel@tonic-gate } igmp3qa_t; 125*7c478bd9Sstevel@tonic-gate 126*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate #define IGMP_MINLEN 8 130*7c478bd9Sstevel@tonic-gate #define IGMP_V3_QUERY_MINLEN 12 131*7c478bd9Sstevel@tonic-gate 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate /* 134*7c478bd9Sstevel@tonic-gate * Message types, including version number. 135*7c478bd9Sstevel@tonic-gate */ 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate #define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ 138*7c478bd9Sstevel@tonic-gate #define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Vers.1 membership report */ 139*7c478bd9Sstevel@tonic-gate #define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Vers.2 membership report */ 140*7c478bd9Sstevel@tonic-gate #define IGMP_V3_MEMBERSHIP_REPORT 0x22 /* Vers.3 membership report */ 141*7c478bd9Sstevel@tonic-gate #define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ 142*7c478bd9Sstevel@tonic-gate #define IGMP_DVMRP 0x13 /* DVMRP routing message */ 143*7c478bd9Sstevel@tonic-gate #define IGMP_PIM 0x14 /* PIM routing message */ 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate #define IGMP_MTRACE_RESP 0x1e /* traceroute resp to sender */ 146*7c478bd9Sstevel@tonic-gate #define IGMP_MTRACE 0x1f /* mcast traceroute messages */ 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate #define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ 149*7c478bd9Sstevel@tonic-gate /* query (in seconds) */ 150*7c478bd9Sstevel@tonic-gate /* according to RFC1112 */ 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate #define IGMP_V3_MAXRT_FPMIN 0x80 /* max resp code fp format */ 153*7c478bd9Sstevel@tonic-gate #define IGMP_V3_MAXRT_MANT_MASK 0x0f 154*7c478bd9Sstevel@tonic-gate #define IGMP_V3_MAXRT_EXP_MASK 0x70 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate #define IGMP_V3_SFLAG_MASK 0x8 /* mask off s part of sqrv */ 157*7c478bd9Sstevel@tonic-gate #define IGMP_V3_RV_MASK 0x7 /* mask off qrv part of sqrv */ 158*7c478bd9Sstevel@tonic-gate 159*7c478bd9Sstevel@tonic-gate #define IGMP_V3_QQI_FPMIN 0x80 /* qqi code fp format */ 160*7c478bd9Sstevel@tonic-gate #define IGMP_V3_QQI_MANT_MASK 0x0f 161*7c478bd9Sstevel@tonic-gate #define IGMP_V3_QQI_EXP_MASK 0x70 162*7c478bd9Sstevel@tonic-gate 163*7c478bd9Sstevel@tonic-gate /* 164*7c478bd9Sstevel@tonic-gate * IGMPv3/MLDv2-specific definitions 165*7c478bd9Sstevel@tonic-gate */ 166*7c478bd9Sstevel@tonic-gate /* 167*7c478bd9Sstevel@tonic-gate * Group Record Types. The values of these enums match the Record Type 168*7c478bd9Sstevel@tonic-gate * field values defined in RFCs 3376 and 3810 for IGMPv3 and MLDv2 reports. 169*7c478bd9Sstevel@tonic-gate */ 170*7c478bd9Sstevel@tonic-gate typedef enum { 171*7c478bd9Sstevel@tonic-gate MODE_IS_INCLUDE = 1, 172*7c478bd9Sstevel@tonic-gate MODE_IS_EXCLUDE, 173*7c478bd9Sstevel@tonic-gate CHANGE_TO_INCLUDE, 174*7c478bd9Sstevel@tonic-gate CHANGE_TO_EXCLUDE, 175*7c478bd9Sstevel@tonic-gate ALLOW_NEW_SOURCES, 176*7c478bd9Sstevel@tonic-gate BLOCK_OLD_SOURCES 177*7c478bd9Sstevel@tonic-gate } mcast_record_t; 178*7c478bd9Sstevel@tonic-gate 179*7c478bd9Sstevel@tonic-gate /* Router Alert Option */ 180*7c478bd9Sstevel@tonic-gate #define RTRALERT_LEN 4 181*7c478bd9Sstevel@tonic-gate #define RTRALERT_LEN_IN_WORDS 1 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate /* 184*7c478bd9Sstevel@tonic-gate * The following four defininitions are for backwards compatibility. 185*7c478bd9Sstevel@tonic-gate * They should be removed as soon as all applications are updated to 186*7c478bd9Sstevel@tonic-gate * use the new constant names. 187*7c478bd9Sstevel@tonic-gate */ 188*7c478bd9Sstevel@tonic-gate #define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY 189*7c478bd9Sstevel@tonic-gate #define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT 190*7c478bd9Sstevel@tonic-gate #define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT 191*7c478bd9Sstevel@tonic-gate #define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP 192*7c478bd9Sstevel@tonic-gate 193*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 194*7c478bd9Sstevel@tonic-gate } 195*7c478bd9Sstevel@tonic-gate #endif 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate #endif /* _NETINET_IGMP_H */ 198