summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2009-03-04 03:22:03 +0000
committerbms <bms@FreeBSD.org>2009-03-04 03:22:03 +0000
commit24af7b630b13d91614dd9783bce4b45606128e57 (patch)
tree67eb9e93ddff0695cdfec04705e8ccf93fd48a54 /sys/netinet
parent28b42e9e29e039295bbaeda2d239fac5eae5e894 (diff)
downloadFreeBSD-src-24af7b630b13d91614dd9783bce4b45606128e57.zip
FreeBSD-src-24af7b630b13d91614dd9783bce4b45606128e57.tar.gz
Merge header file definitions used by the new IGMPv3 implementation.
This is a partial merge. Compatibility defines are retained for the existing IGMPv2 implementation.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/igmp.h106
1 files changed, 68 insertions, 38 deletions
diff --git a/sys/netinet/igmp.h b/sys/netinet/igmp.h
index 109fb3e..186142d 100644
--- a/sys/netinet/igmp.h
+++ b/sys/netinet/igmp.h
@@ -45,8 +45,11 @@
* MULTICAST Revision: 3.5.1.2
*/
+/* Minimum length of any IGMP protocol message. */
+#define IGMP_MINLEN 8
+
/*
- * IGMP packet format.
+ * IGMPv1/v2 query and host report format.
*/
struct igmp {
u_char igmp_type; /* version & type of IGMP message */
@@ -55,6 +58,9 @@ struct igmp {
struct in_addr igmp_group; /* group address being reported */
}; /* (zero for queries) */
+/*
+ * IGMP v3 query format.
+ */
struct igmpv3 {
u_char igmp_type; /* version & type of IGMP message */
u_char igmp_code; /* subtype for routing msgs */
@@ -66,6 +72,12 @@ struct igmpv3 {
u_short igmp_numsrc; /* number of sources */
/*struct in_addr igmp_sources[1];*/ /* source addresses */
};
+#define IGMP_V3_QUERY_MINLEN 12
+#define IGMP_EXP(x) (((x) >> 4) & 0x07)
+#define IGMP_MANT(x) ((x) & 0x0f)
+#define IGMP_QRESV(x) (((x) >> 4) & 0x0f)
+#define IGMP_SFLAG(x) (((x) >> 3) & 0x01)
+#define IGMP_QRV(x) ((x) & 0x07)
struct igmp_grouprec {
u_char ig_type; /* record type */
@@ -74,58 +86,76 @@ struct igmp_grouprec {
struct in_addr ig_group; /* group address being reported */
/*struct in_addr ig_sources[1];*/ /* source addresses */
};
+#define IGMP_GRPREC_HDRLEN 8
+/*
+ * IGMPv3 host membership report header.
+ */
struct igmp_report {
- u_char ir_type; /* record type */
- u_char ir_rsv1; /* reserved */
+ u_char ir_type; /* IGMP_v3_HOST_MEMBERSHIP_REPORT */
+ u_char ir_rsv1; /* must be zero */
u_short ir_cksum; /* checksum */
- u_short ir_rsv2; /* reserved */
+ u_short ir_rsv2; /* must be zero */
u_short ir_numgrps; /* number of group records */
- struct igmp_grouprec ir_groups[1]; /* group records */
+ /*struct igmp_grouprec ir_groups[1];*/ /* group records */
};
-
-#define IGMP_MINLEN 8
-#define IGMP_HDRLEN 8
-#define IGMP_GRPREC_HDRLEN 8
-#define IGMP_PREPEND 0
-
-#if 0
-#define IGMP_QRV(pigmp) ((pigmp)->igmp_misc & (0x07)) /* XXX */
-#define IGMP_MAXSOURCES(len) (((len) - 12) >> 2) /* XXX */
-#endif
+#define IGMP_V3_REPORT_MINLEN 8
+#define IGMP_V3_REPORT_MAXRECS 65535
/*
* Message types, including version number.
*/
-#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */
-#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */
-#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */
-#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */
-
+#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* membership query */
+#define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */
#define IGMP_DVMRP 0x13 /* DVMRP routing message */
-#define IGMP_PIM 0x14 /* PIM routing message */
-
-#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/
-#define IGMP_MTRACE 0x1f /* mcast traceroute messages */
-
-#define IGMP_V3_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */
+#define IGMP_PIM 0x14 /* PIM routing message */
+#define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */
+#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* Leave-group message */
+#define IGMP_MTRACE_REPLY 0x1e /* mtrace(8) reply */
+#define IGMP_MTRACE_QUERY 0x1f /* mtrace(8) probe */
+#define IGMP_v3_HOST_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */
+
+#ifndef BURN_BRIDGES
+/*
+ * Legacy FreeBSD definitions for the above message types.
+ */
+#define IGMP_MEMBERSHIP_QUERY IGMP_HOST_MEMBERSHIP_QUERY
+#define IGMP_V1_MEMBERSHIP_REPORT IGMP_v1_HOST_MEMBERSHIP_REPORT
+#define IGMP_V2_MEMBERSHIP_REPORT IGMP_v2_HOST_MEMBERSHIP_REPORT
+#define IGMP_MTRACE_RESP IGMP_MTRACE_REPLY
+#define IGMP_MTRACE IGMP_MTRACE_QUERY
+#define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE
+#define IGMP_V3_MEMBERSHIP_REPORT IGMP_v3_HOST_MEMBERSHIP_REPORT
+#endif /* BURN_BRIDGES */
-#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */
- /* query (in seconds) according */
- /* to RFC1112 */
+/*
+ * IGMPv3 report modes.
+ */
+#define IGMP_DO_NOTHING 0 /* don't send a record */
+#define IGMP_MODE_IS_INCLUDE 1 /* MODE_IN */
+#define IGMP_MODE_IS_EXCLUDE 2 /* MODE_EX */
+#define IGMP_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */
+#define IGMP_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */
+#define IGMP_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */
+#define IGMP_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */
+/*
+ * IGMPv3 query types.
+ */
+#define IGMP_V3_GENERAL_QUERY 1
+#define IGMP_V3_GROUP_QUERY 2
+#define IGMP_V3_GROUP_SOURCE_QUERY 3
-#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */
- /* specifies time in 10th of seconds*/
+/*
+ * Maximum report interval for IGMP v1/v2 host membership reports [RFC 1112]
+ */
+#define IGMP_V1V2_MAX_RI 10
+#define IGMP_MAX_HOST_REPORT_DELAY IGMP_V1V2_MAX_RI
/*
- * The following four defininitions are for backwards compatibility.
- * They should be removed as soon as all applications are updated to
- * use the new constant names.
+ * IGMP_TIMER_SCALE denotes that the igmp code field specifies
+ * time in tenths of a second.
*/
-#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY
-#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT
-#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT
-#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP
+#define IGMP_TIMER_SCALE 10
#endif /* _NETINET_IGMP_H_ */
OpenPOWER on IntegriCloud