1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_NETINET_IGMP_VAR_H
27 #define	_NETINET_IGMP_VAR_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * Internet Group Management Protocol (IGMP),
35  * implementation-specific definitions.
36  *
37  * Written by Steve Deering, Stanford, May 1988.
38  * Modified by Ajit Thyagarajan, PARC, August 1994.
39  *
40  * MULTICAST 3.5.1.1
41  */
42 
43 struct igmpstat {
44 	uint_t	igps_rcv_total;		/* total IGMP messages received    */
45 	uint_t	igps_rcv_tooshort;	/* received with too few bytes	   */
46 	uint_t	igps_rcv_badsum;	/* received with bad checksum	   */
47 	uint_t	igps_rcv_queries;	/* received membership queries	   */
48 	uint_t	igps_rcv_badqueries;	/* received invalid queries	   */
49 	uint_t	igps_rcv_reports;	/* received membership reports	   */
50 	uint_t	igps_rcv_badreports;	/* received invalid reports	   */
51 	uint_t	igps_rcv_ourreports;	/* received reports for our groups */
52 	uint_t	igps_snd_reports;	/* sent membership reports	   */
53 };
54 
55 #ifdef _KERNEL
56 /*
57  * slowtimo interval used for both IGMP and MLD
58  */
59 #define	MCAST_SLOWTIMO_INTERVAL	10000	/* milliseconds */
60 
61 
62 /*
63  * Macro to compute a random timer value between 1 and maxticks.
64  * Include <sys/random.h> for random_get_pseudo_bytes() declaration.
65  */
66 #include <sys/random.h>
67 #define	MCAST_RANDOM_DELAY(timer, maxticks)				      \
68 	/* uint_t timer; int maxticks */				      \
69 	(void) random_get_pseudo_bytes((uint8_t *)&(timer), sizeof (uint_t)); \
70 	(timer) = ((uint_t)(timer) % (maxticks)) + 1
71 
72 /*
73  * States for IGMPv2's leave processing
74  */
75 #define	IGMP_OTHERMEMBER			0
76 #define	IGMP_IREPORTEDLAST			1
77 
78 /*
79  * We must remember what version the subnet's querier is.
80  */
81 #define	IGMP_V1_ROUTER				0
82 #define	IGMP_V2_ROUTER				1
83 #define	IGMP_V3_ROUTER				2
84 
85 /*
86  * Map MLD versions to corresponding IGMP versions
87  */
88 #define	MLD_V1_ROUTER				IGMP_V2_ROUTER
89 #define	MLD_V2_ROUTER				IGMP_V3_ROUTER
90 
91 /*
92  * Default values for various IGMPv3/MLDv2 values
93  */
94 #define	MCAST_DEF_ROBUSTNESS			2
95 #define	MCAST_QUERY_RESP_INTERVAL		10	/* in seconds */
96 #define	MCAST_DEF_QUERY_INTERVAL		125	/* in seconds */
97 #define	MCAST_DEF_QUERY_RESP_INTERVAL		100	/* in tenths of secs */
98 #define	MCAST_DEF_UNSOL_RPT_INTERVAL		1	/* in seconds */
99 
100 /*
101  * IGMP and MLD mandate a TTL/Hop Limit of 1 for protocol messages
102  */
103 #define	IGMP_TTL	1
104 #define	MLD_HOP_LIMIT	1
105 
106 #endif	/* _KERNEL */
107 
108 #ifdef	__cplusplus
109 }
110 #endif
111 
112 #endif	/* _NETINET_IGMP_VAR_H */
113