- * Internet multicast address structure. There is one of these for each IP
- * multicast group to which this host belongs on a given network interface.
- * For every entry on the interface's if_multiaddrs list which represents
- * an IP multicast group, there is one of these structures. They are also
- * kept on a system-wide list to make it easier to keep our legacy IGMP code
- * compatible with the rest of the world (see IN_FIRST_MULTI et al, below).
+ * IPv4 multicast IGMP-layer source entry.
+ */
+struct ip_msource {
+ RB_ENTRY(ip_msource) ims_link; /* RB tree links */
+ in_addr_t ims_haddr; /* host byte order */
+ struct ims_st {
+ uint16_t ex; /* # of exclusive members */
+ uint16_t in; /* # of inclusive members */
+ } ims_st[2]; /* state at t0, t1 */
+ uint8_t ims_stp; /* pending query */
+};
+
+/*
+ * IPv4 multicast PCB-layer source entry.
+ */
+struct in_msource {
+ RB_ENTRY(ip_msource) ims_link; /* RB tree links */
+ in_addr_t ims_haddr; /* host byte order */
+ uint8_t imsl_st[2]; /* state before/at commit */
+};
+
+RB_HEAD(ip_msource_tree, ip_msource); /* define struct ip_msource_tree */
+
+RB_PROTOTYPE_SC_PREV(__private_extern__, ip_msource_tree, ip_msource,
+ ims_link, ip_msource_cmp);
+
+/*
+ * IPv4 multicast PCB-layer group filter descriptor.
+ */
+struct in_mfilter {
+ struct ip_msource_tree imf_sources; /* source list for (S,G) */
+ u_long imf_nsrc; /* # of source entries */
+ uint8_t imf_st[2]; /* state before/at commit */
+};
+
+struct igmp_ifinfo;
+
+/*
+ * IPv4 group descriptor.
+ *
+ * For every entry on an ifnet's if_multiaddrs list which represents
+ * an IP multicast group, there is one of these structures.
+ *
+ * If any source filters are present, then a node will exist in the RB-tree
+ * to permit fast lookup by source whenever an operation takes place.
+ * This permits pre-order traversal when we issue reports.
+ * Source filter trees are kept separately from the socket layer to
+ * greatly simplify locking.
+ *
+ * When IGMPv3 is active, inm_timer is the response to group query timer.
+ * The state-change timer inm_sctimer is separate; whenever state changes
+ * for the group the state change record is generated and transmitted,
+ * and kept if retransmissions are necessary.
+ *
+ * FUTURE: inm_link is now only used when groups are being purged
+ * on a detaching ifnet. It could be demoted to a SLIST_ENTRY, but
+ * because it is at the very start of the struct, we can't do this
+ * w/o breaking the ABI for ifmcstat.