|
root / base / usr / src / uts / common / netinet / igmp_var.h
igmp_var.h C 113 lines 3.2 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_NETINET_IGMP_VAR_H
#define	_NETINET_IGMP_VAR_H

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * Internet Group Management Protocol (IGMP),
 * implementation-specific definitions.
 *
 * Written by Steve Deering, Stanford, May 1988.
 * Modified by Ajit Thyagarajan, PARC, August 1994.
 *
 * MULTICAST 3.5.1.1
 */

struct igmpstat {
	uint_t	igps_rcv_total;		/* total IGMP messages received    */
	uint_t	igps_rcv_tooshort;	/* received with too few bytes	   */
	uint_t	igps_rcv_badsum;	/* received with bad checksum	   */
	uint_t	igps_rcv_queries;	/* received membership queries	   */
	uint_t	igps_rcv_badqueries;	/* received invalid queries	   */
	uint_t	igps_rcv_reports;	/* received membership reports	   */
	uint_t	igps_rcv_badreports;	/* received invalid reports	   */
	uint_t	igps_rcv_ourreports;	/* received reports for our groups */
	uint_t	igps_snd_reports;	/* sent membership reports	   */
};

#ifdef _KERNEL
/*
 * slowtimo interval used for both IGMP and MLD
 */
#define	MCAST_SLOWTIMO_INTERVAL	10000	/* milliseconds */


/*
 * Macro to compute a random timer value between 1 and maxticks.
 * Include <sys/random.h> for random_get_pseudo_bytes() declaration.
 */
#include <sys/random.h>
#define	MCAST_RANDOM_DELAY(timer, maxticks)				      \
	/* uint_t timer; int maxticks */				      \
	(void) random_get_pseudo_bytes((uint8_t *)&(timer), sizeof (uint_t)); \
	(timer) = ((uint_t)(timer) % (maxticks)) + 1

/*
 * States for IGMPv2's leave processing
 */
#define	IGMP_OTHERMEMBER			0
#define	IGMP_IREPORTEDLAST			1

/*
 * We must remember what version the subnet's querier is.
 */
#define	IGMP_V1_ROUTER				0
#define	IGMP_V2_ROUTER				1
#define	IGMP_V3_ROUTER				2

/*
 * Map MLD versions to corresponding IGMP versions
 */
#define	MLD_V1_ROUTER				IGMP_V2_ROUTER
#define	MLD_V2_ROUTER				IGMP_V3_ROUTER

/*
 * Default values for various IGMPv3/MLDv2 values
 */
#define	MCAST_DEF_ROBUSTNESS			2
#define	MCAST_QUERY_RESP_INTERVAL		10	/* in seconds */
#define	MCAST_DEF_QUERY_INTERVAL		125	/* in seconds */
#define	MCAST_DEF_QUERY_RESP_INTERVAL		100	/* in tenths of secs */
#define	MCAST_DEF_UNSOL_RPT_INTERVAL		1	/* in seconds */

/*
 * IGMP and MLD mandate a TTL/Hop Limit of 1 for protocol messages
 */
#define	IGMP_TTL	1
#define	MLD_HOP_LIMIT	1

#endif	/* _KERNEL */

#ifdef	__cplusplus
}
#endif

#endif	/* _NETINET_IGMP_VAR_H */