summaryrefslogtreecommitdiffstats
path: root/src/plugins/igmp/igmp_group.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-11-13 13:27:18 +0000
committerOle Trøan <otroan@employees.org>2018-11-13 14:45:40 +0000
commite82eb635b1377c2b14d28127a121eabd10b3b83d (patch)
treec152b97a71b8e44a3a5b7918f69cfe492bdfb06d /src/plugins/igmp/igmp_group.c
parent5d9df1db07969fea8f391bd48ba14cceb840da1e (diff)
IGMP: improve CLI debug output
Change-Id: If88fc3acdba1f73b3e8be94d8014556c5239596c Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/igmp/igmp_group.c')
-rw-r--r--src/plugins/igmp/igmp_group.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/plugins/igmp/igmp_group.c b/src/plugins/igmp/igmp_group.c
index 38499e4778f..51a44d2dfd5 100644
--- a/src/plugins/igmp/igmp_group.c
+++ b/src/plugins/igmp/igmp_group.c
@@ -280,6 +280,46 @@ igmp_group_get (u32 index)
return (pool_elt_at_index (igmp_main.groups, index));
}
+u8 *
+format_igmp_group_timer_type (u8 * s, va_list * args)
+{
+ igmp_group_timer_type_t type = va_arg (*args, igmp_group_timer_type_t);
+
+ switch (type)
+ {
+#define _(v,t) case IGMP_GROUP_TIMER_##v: return (format (s, "%s", t));
+ foreach_igmp_group_timer
+#undef _
+ }
+ return (s);
+}
+
+u8 *
+format_igmp_group (u8 * s, va_list * args)
+{
+ igmp_group_t *group = va_arg (*args, igmp_group_t *);
+ u32 indent = va_arg (*args, u32);
+ igmp_src_t *src;
+ u32 ii;
+
+ s = format (s, "%U%U",
+ format_white_space, indent, format_igmp_key, group->key);
+
+ for (ii = 0; ii < IGMP_GROUP_N_TIMERS; ii++)
+ s = format (s, "\n%U %U:%U", format_white_space, indent,
+ format_igmp_group_timer_type, ii,
+ format_igmp_timer_id, group->timers[ii]);
+
+ /* *INDENT-OFF* */
+ FOR_EACH_SRC (src, group, IGMP_FILTER_MODE_INCLUDE,
+ ({
+ s = format (s, "\n%U", format_igmp_src, src, indent+4);
+ }));
+ /* *INDENT-ON* */
+
+ return (s);
+}
+
/*
* fd.io coding-style-patch-verification: ON
*