xref: /titanic_41/usr/src/uts/common/netinet/igmp_var.h (revision f8919bdadda3ebb97bd55cc14a16e0271ed57615)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Internet Group Management Protocol (IGMP),
37  * implementation-specific definitions.
38  *
39  * Written by Steve Deering, Stanford, May 1988.
40  * Modified by Ajit Thyagarajan, PARC, August 1994.
41  *
42  * MULTICAST 3.5.1.1
43  */
44 
45 struct igmpstat {
46 	uint_t	igps_rcv_total;		/* total IGMP messages received    */
47 	uint_t	igps_rcv_tooshort;	/* received with too few bytes	   */
48 	uint_t	igps_rcv_badsum;	/* received with bad checksum	   */
49 	uint_t	igps_rcv_queries;	/* received membership queries	   */
50 	uint_t	igps_rcv_badqueries;	/* received invalid queries	   */
51 	uint_t	igps_rcv_reports;	/* received membership reports	   */
52 	uint_t	igps_rcv_badreports;	/* received invalid reports	   */
53 	uint_t	igps_rcv_ourreports;	/* received reports for our groups */
54 	uint_t	igps_snd_reports;	/* sent membership reports	   */
55 };
56 
57 #ifdef _KERNEL
58 /*
59  * slowtimo interval used for both IGMP and MLD
60  */
61 #define	MCAST_SLOWTIMO_INTERVAL	10000	/* milliseconds */
62 
63 
64 /*
65  * Macro to compute a random timer value between 1 and maxticks.
66  * Include <sys/random.h> for random_get_pseudo_bytes() declaration.
67  */
68 #include <sys/random.h>
69 #define	MCAST_RANDOM_DELAY(timer, maxticks)				      \
70 	/* uint_t timer; int maxticks */				      \
71 	(void) random_get_pseudo_bytes((uint8_t *)&(timer), sizeof (uint_t)); \
72 	(timer) = ((uint_t)(timer) % (maxticks)) + 1
73 
74 /*
75  * States for IGMPv2's leave processing
76  */
77 #define	IGMP_OTHERMEMBER			0
78 #define	IGMP_IREPORTEDLAST			1
79 
80 /*
81  * We must remember what version the subnet's querier is.
82  */
83 #define	IGMP_V1_ROUTER				0
84 #define	IGMP_V2_ROUTER				1
85 #define	IGMP_V3_ROUTER				2
86 
87 /*
88  * Map MLD versions to corresponding IGMP versions
89  */
90 #define	MLD_V1_ROUTER				IGMP_V2_ROUTER
91 #define	MLD_V2_ROUTER				IGMP_V3_ROUTER
92 
93 /*
94  * Default values for various IGMPv3/MLDv2 values
95  */
96 #define	MCAST_DEF_ROBUSTNESS			2
97 #define	MCAST_QUERY_RESP_INTERVAL		10	/* in seconds */
98 #define	MCAST_DEF_QUERY_INTERVAL		125	/* in seconds */
99 #define	MCAST_DEF_QUERY_RESP_INTERVAL		100	/* in tenths of secs */
100 #define	MCAST_DEF_UNSOL_RPT_INTERVAL		1	/* in seconds */
101 
102 /*
103  * IGMP and MLD mandate a TTL/Hop Limit of 1 for protocol messages
104  */
105 #define	IGMP_TTL	1
106 #define	MLD_HOP_LIMIT	1
107 
108 #endif	/* _KERNEL */
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif	/* _NETINET_IGMP_VAR_H */
115