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