+const char *udp_connection_flags_str[] = {
+#define _(sym, str) str,
+ foreach_udp_connection_flag
+#undef _
+};
+
+static u8 *
+format_udp_connection_flags (u8 * s, va_list * args)
+{
+ udp_connection_t *uc = va_arg (*args, udp_connection_t *);
+ int i, last = -1;
+
+ for (i = 0; i < UDP_CONN_N_FLAGS; i++)
+ if (uc->flags & (1 << i))
+ last = i;
+ for (i = 0; i < last; i++)
+ {
+ if (uc->flags & (1 << i))
+ s = format (s, "%s, ", udp_connection_flags_str[i]);
+ }
+ if (last >= 0)
+ s = format (s, "%s", udp_connection_flags_str[last]);
+ return s;
+}
+
+static u8 *
+format_udp_vars (u8 * s, va_list * args)
+{
+ udp_connection_t *uc = va_arg (*args, udp_connection_t *);
+ s = format (s, " index %u flags: %U", uc->c_c_index,
+ format_udp_connection_flags, uc);
+
+ if (!(uc->flags & UDP_CONN_F_LISTEN))
+ s = format (s, "\n");
+ return s;
+}
+