FreeBSD/Linux Kernel Cross Reference
sys/netinet6/mld6.h
1 /* $OpenBSD: mld6.h,v 1.2 2010/03/22 21:29:22 jsg Exp $ */
2 /* $FreeBSD: mld6.h,v 1.1 2009/04/29 11:31:23 bms Exp $ */
3 /*-
4 * Copyright (c) 2009 Bruce Simpson.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote
15 * products derived from this software without specific prior written
16 * permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 */
31
32 #ifndef _NETINET6_MLD6_H_
33 #define _NETINET6_MLD6_H_
34
35 /*
36 * Multicast Listener Discovery (MLD) definitions.
37 */
38
39 /* Minimum length of any MLD protocol message. */
40 #define MLD_MINLEN sizeof(struct icmp6_hdr)
41
42 /*
43 * MLD v2 query format.
44 * See <netinet/icmp6.h> for struct mld_hdr
45 * (MLDv1 query and host report format).
46 */
47 struct mldv2_query {
48 struct icmp6_hdr mld_icmp6_hdr; /* ICMPv6 header */
49 struct in6_addr mld_addr; /* address being queried */
50 uint8_t mld_misc; /* reserved/suppress/robustness */
51 uint8_t mld_qqi; /* querier's query interval */
52 uint16_t mld_numsrc; /* number of sources */
53 /* followed by 1..numsrc source addresses */
54 } __packed;
55 #define MLD_V2_QUERY_MINLEN sizeof(struct mldv2_query)
56 #define MLD_MRC_EXP(x) ((ntohs((x)) >> 12) & 0x0007)
57 #define MLD_MRC_MANT(x) (ntohs((x)) & 0x0fff)
58 #define MLD_QQIC_EXP(x) (((x) >> 4) & 0x07)
59 #define MLD_QQIC_MANT(x) ((x) & 0x0f)
60 #define MLD_QRESV(x) (((x) >> 4) & 0x0f)
61 #define MLD_SFLAG(x) (((x) >> 3) & 0x01)
62 #define MLD_QRV(x) ((x) & 0x07)
63
64 /*
65 * MLDv2 host membership report header.
66 * mld_type: MLDV2_LISTENER_REPORT
67 */
68 struct mldv2_report {
69 struct icmp6_hdr mld_icmp6_hdr;
70 /* followed by 1..numgrps records */
71 } __packed;
72 /* overlaid on struct icmp6_hdr. */
73 #define mld_numrecs mld_icmp6_hdr.icmp6_data16[1]
74
75 struct mldv2_record {
76 uint8_t mr_type; /* record type */
77 uint8_t mr_datalen; /* length of auxiliary data */
78 uint16_t mr_numsrc; /* number of sources */
79 struct in6_addr mr_addr; /* address being reported */
80 /* followed by 1..numsrc source addresses */
81 } __packed;
82 #define MLD_V2_REPORT_MAXRECS 65535
83
84 /*
85 * MLDv2 report modes.
86 */
87 #define MLD_DO_NOTHING 0 /* don't send a record */
88 #define MLD_MODE_IS_INCLUDE 1 /* MODE_IN */
89 #define MLD_MODE_IS_EXCLUDE 2 /* MODE_EX */
90 #define MLD_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */
91 #define MLD_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */
92 #define MLD_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */
93 #define MLD_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */
94
95 /*
96 * MLDv2 query types.
97 */
98 #define MLD_V2_GENERAL_QUERY 1
99 #define MLD_V2_GROUP_QUERY 2
100 #define MLD_V2_GROUP_SOURCE_QUERY 3
101
102 /*
103 * Maximum report interval for MLDv1 host membership reports (in seconds)
104 */
105 #define MLD_V1_MAX_RI 10
106
107 /*
108 * MLD_TIMER_SCALE denotes that the MLD code field specifies
109 * time in milliseconds.
110 */
111 #define MLD_TIMER_SCALE 1000
112
113 #endif /* _NETINET6_MLD6_H_ */
Cache object: 2689309f0e5270065a1634f63fecd886
|