summaryrefslogtreecommitdiffstats
path: root/src/plugins/igmp/igmp_group.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-06-07 23:48:20 -0700
committerFlorin Coras <florin.coras@gmail.com>2018-07-09 21:10:53 +0000
commit947ea6222dad1ef04595c34273e9231395aef443 (patch)
tree8990854b2901ff8cc2241b9abfc99b0b4b54d517 /src/plugins/igmp/igmp_group.h
parentdd47ecadcf63772a6037a1bb3715772d80e87f51 (diff)
IGMP improvements
- Enable/Disable an interface for IGMP - improve logging - refactor common code - no orphaned timers - IGMP state changes in main thread only - Large groups split over multiple state-change reports - SSM range configuration API. - more tests Change-Id: If5674f1044e7e97274a711f47807c9ba689d7b9a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/igmp/igmp_group.h')
-rw-r--r--src/plugins/igmp/igmp_group.h156
1 files changed, 156 insertions, 0 deletions
diff --git a/src/plugins/igmp/igmp_group.h b/src/plugins/igmp/igmp_group.h
new file mode 100644
index 00000000000..dc0fc7a0f8a
--- /dev/null
+++ b/src/plugins/igmp/igmp_group.h
@@ -0,0 +1,156 @@
+/*
+ *------------------------------------------------------------------
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#ifndef __IGMP_GROUP_H__
+#define __IGMP_GROUP_H__
+
+#include <igmp/igmp_types.h>
+#include <igmp/igmp_src.h>
+
+/**
+ * Types of timers maintained for each group
+ */
+typedef enum igmp_group_timer_type_t_
+{
+ /**
+ * Timer running to reply to a G/SG specific query
+ */
+ IGMP_GROUP_TIMER_QUERY_REPLY,
+ /**
+ * wait for response from a sent G/SG specfic query.
+ * Sent when a host leaves a group
+ */
+ IGMP_GROUP_TIMER_QUERY_SENT,
+ /**
+ * Timer running to resend report
+ */
+ IGMP_GROUP_TIMER_RESEND_REPORT,
+ /**
+ * filter-mode change timer, to check if the group can swap to
+ * INCLUDE mode (section 6.2.2)
+ */
+ IGMP_GROUP_TIMER_FILTER_MODE_CHANGE,
+} igmp_group_timer_type_t;
+
+#define IGMP_GROUP_N_TIMERS (IGMP_GROUP_TIMER_FILTER_MODE_CHANGE + 1)
+
+/**
+ * @brief IGMP group
+ * A multicast group address for which reception has been requested.
+ */
+typedef struct igmp_group_t_
+{
+ /** The group's key within the per-interface config */
+ igmp_key_t *key;
+
+ /**
+ * A vector of running timers for the group. this can include:
+ * - group-specific query, sent on reception of a host 'leave'
+ * - filter-mode change timer, to check if the group can swap to
+ * INCLUDE mode (section 6.2.2)
+ */
+ u32 timers[IGMP_GROUP_N_TIMERS];
+
+ /**
+ * The current filter mode of the group (see 6.2.1)
+ */
+ igmp_filter_mode_t router_filter_mode;
+
+ /**
+ * The pool index of the config object this group is in
+ */
+ u32 config;
+
+ /**
+ * The number of times the last report has been sent
+ */
+ u32 n_reports_sent;
+
+ /**
+ * Source list per-filter mode
+ */
+ uword *igmp_src_by_key[IGMP_N_FILTER_MODES];
+} igmp_group_t;
+
+#define FOR_EACH_SRC(_src, _group, _filter, _body) \
+do { \
+ igmp_key_t *__key__; \
+ u32 __sid__; \
+ hash_foreach_mem(__key__, __sid__, ((igmp_group_t*)_group)->igmp_src_by_key[(_filter)], \
+ ({ \
+ _src = pool_elt_at_index(igmp_main.srcs, __sid__); \
+ do { _body; } while (0); \
+ })); \
+ } while (0);
+
+/**
+ * Forward declarations
+ */
+struct igmp_config_t_;
+
+extern void igmp_group_clear (igmp_group_t * group);
+extern void igmp_group_free_all_srcs (igmp_group_t * group);
+
+extern igmp_group_t *igmp_group_alloc (struct igmp_config_t_ *config,
+ const igmp_key_t * gkey,
+ igmp_filter_mode_t mode);
+
+extern igmp_src_t *igmp_group_src_update (igmp_group_t * group,
+ const igmp_key_t * skey,
+ igmp_mode_t mode);
+
+extern void igmp_group_src_remove (igmp_group_t * group, igmp_src_t * src);
+
+extern ip46_address_t *igmp_group_present_minus_new (igmp_group_t * group,
+ igmp_filter_mode_t mode,
+ const ip46_address_t *
+ saddrs);
+
+extern ip46_address_t *igmp_group_new_minus_present (igmp_group_t * group,
+ igmp_filter_mode_t mode,
+ const ip46_address_t *
+ saddrs);
+
+extern ip46_address_t *igmp_group_new_intersect_present (igmp_group_t * group,
+ igmp_filter_mode_t
+ mode,
+ const ip46_address_t
+ * saddrs);
+
+extern u32 igmp_group_n_srcs (const igmp_group_t * group,
+ igmp_filter_mode_t mode);
+
+
+/** \brief igmp group lookup
+ @param group - igmp group
+ @param key - igmp key
+*/
+extern igmp_src_t *igmp_src_lookup (igmp_group_t * group,
+ const igmp_key_t * key);
+
+extern u32 igmp_group_index (const igmp_group_t * g);
+extern igmp_group_t *igmp_group_get (u32 index);
+
+#endif
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */