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