/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 2009 Bruce Simpson.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13* 3. The name of the author may not be used to endorse or promote14* products derived from this software without specific prior written15* permission.16*17* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND18* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE19* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE20* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE21* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL22* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS23* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)24* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT25* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY26* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF27* SUCH DAMAGE.28*/2930#ifndef _NETINET6_MLD6_H_31#define _NETINET6_MLD6_H_3233/*34* Multicast Listener Discovery (MLD) definitions.35*/3637/* Minimum length of any MLD protocol message. */38#define MLD_MINLEN sizeof(struct icmp6_hdr)3940/*41* MLD v2 query format.42* See <netinet/icmp6.h> for struct mld_hdr43* (MLDv1 query and host report format).44*/45struct mldv2_query {46struct icmp6_hdr mld_icmp6_hdr; /* ICMPv6 header */47struct in6_addr mld_addr; /* address being queried */48uint8_t mld_misc; /* reserved/suppress/robustness */49uint8_t mld_qqi; /* querier's query interval */50uint16_t mld_numsrc; /* number of sources */51/* followed by 1..numsrc source addresses */52} __packed;53#define MLD_V2_QUERY_MINLEN sizeof(struct mldv2_query)54#define MLD_MRC_EXP(x) ((ntohs((x)) >> 12) & 0x0007)55#define MLD_MRC_MANT(x) (ntohs((x)) & 0x0fff)56#define MLD_QQIC_EXP(x) (((x) >> 4) & 0x07)57#define MLD_QQIC_MANT(x) ((x) & 0x0f)58#define MLD_QRESV(x) (((x) >> 4) & 0x0f)59#define MLD_SFLAG(x) (((x) >> 3) & 0x01)60#define MLD_QRV(x) ((x) & 0x07)6162/*63* MLDv2 host membership report header.64* mld_type: MLDV2_LISTENER_REPORT65*/66struct mldv2_report {67struct icmp6_hdr mld_icmp6_hdr;68/* followed by 1..numgrps records */69} __packed;70/* overlaid on struct icmp6_hdr. */71#define mld_numrecs mld_icmp6_hdr.icmp6_data16[1]7273struct mldv2_record {74uint8_t mr_type; /* record type */75uint8_t mr_datalen; /* length of auxiliary data */76uint16_t mr_numsrc; /* number of sources */77struct in6_addr mr_addr; /* address being reported */78/* followed by 1..numsrc source addresses */79} __packed;80#define MLD_V2_REPORT_MAXRECS 655358182/*83* MLDv2 report modes.84*/85#define MLD_DO_NOTHING 0 /* don't send a record */86#define MLD_MODE_IS_INCLUDE 1 /* MODE_IN */87#define MLD_MODE_IS_EXCLUDE 2 /* MODE_EX */88#define MLD_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */89#define MLD_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */90#define MLD_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */91#define MLD_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */9293/*94* MLDv2 query types.95*/96#define MLD_V2_GENERAL_QUERY 197#define MLD_V2_GROUP_QUERY 298#define MLD_V2_GROUP_SOURCE_QUERY 399100/*101* Maximum report interval for MLDv1 host membership reports.102*/103#define MLD_V1_MAX_RI 10104105/*106* MLD_TIMER_SCALE denotes that the MLD code field specifies107* time in milliseconds.108*/109#define MLD_TIMER_SCALE 1000110111#endif /* _NETINET6_MLD6_H_ */112113114