+u8 *
+format_transport_proto (u8 * s, va_list * args)
+{
+ u32 transport_proto = va_arg (*args, u32);
+
+ if (tp_vfts[transport_proto].transport_options.name)
+ s = format (s, "%s", tp_vfts[transport_proto].transport_options.name);
+ else
+ s = format (s, "n/a");
+
+ return s;
+}
+
+u8 *
+format_transport_proto_short (u8 * s, va_list * args)
+{
+ u32 transport_proto = va_arg (*args, u32);
+ char *short_name;
+
+ short_name = tp_vfts[transport_proto].transport_options.short_name;
+ if (short_name)
+ s = format (s, "%s", short_name);
+ else
+ s = format (s, "NA");
+
+ return s;
+}
+
+u8 *
+format_transport_connection (u8 * s, va_list * args)
+{
+ u32 transport_proto = va_arg (*args, u32);
+ u32 conn_index = va_arg (*args, u32);
+ u32 thread_index = va_arg (*args, u32);
+ u32 verbose = va_arg (*args, u32);
+ transport_proto_vft_t *tp_vft;
+ transport_connection_t *tc;
+ u32 indent;
+
+ tp_vft = transport_protocol_get_vft (transport_proto);
+ if (!tp_vft)
+ return s;
+
+ s = format (s, "%U", tp_vft->format_connection, conn_index, thread_index,
+ verbose);
+ tc = tp_vft->get_connection (conn_index, thread_index);
+ if (tc && transport_connection_is_tx_paced (tc) && verbose > 1)
+ {
+ indent = format_get_indent (s) + 1;
+ s = format (s, "%Upacer: %U\n", format_white_space, indent,
+ format_transport_pacer, &tc->pacer, tc->thread_index);
+ s = format (s, "%Utransport: flags 0x%x\n", format_white_space, indent,
+ tc->flags);
+ }
+ return s;
+}
+
+u8 *
+format_transport_listen_connection (u8 * s, va_list * args)
+{
+ u32 transport_proto = va_arg (*args, u32);
+ transport_proto_vft_t *tp_vft;
+
+ tp_vft = transport_protocol_get_vft (transport_proto);
+ if (!tp_vft)
+ return s;
+
+ s = (tp_vft->format_listener) (s, args);
+ return s;
+}
+
+u8 *
+format_transport_half_open_connection (u8 * s, va_list * args)
+{
+ u32 transport_proto = va_arg (*args, u32);
+ u32 listen_index = va_arg (*args, u32);
+ transport_proto_vft_t *tp_vft;
+
+ tp_vft = transport_protocol_get_vft (transport_proto);
+ if (!tp_vft)
+ return s;
+
+ s = format (s, "%U", tp_vft->format_half_open, listen_index);
+ return s;
+}
+
+static u8
+unformat_transport_str_match (unformat_input_t * input, const char *str)
+{
+ int i;
+
+ if (strlen (str) > vec_len (input->buffer) - input->index)
+ return 0;
+
+ for (i = 0; i < strlen (str); i++)
+ {
+ if (input->buffer[i + input->index] != str[i])
+ return 0;
+ }
+ return 1;
+}
+
+uword
+unformat_transport_proto (unformat_input_t * input, va_list * args)
+{
+ u32 *proto = va_arg (*args, u32 *);
+ transport_proto_vft_t *tp_vft;
+ u8 longest_match = 0, match;
+ char *str, *str_match = 0;
+ transport_proto_t tp;
+
+ for (tp = 0; tp < vec_len (tp_vfts); tp++)
+ {
+ tp_vft = &tp_vfts[tp];
+ str = tp_vft->transport_options.name;
+ if (!str)
+ continue;
+ if (unformat_transport_str_match (input, str))
+ {
+ match = strlen (str);
+ if (match > longest_match)
+ {
+ *proto = tp;
+ longest_match = match;
+ str_match = str;
+ }
+ }
+ }
+ if (longest_match)
+ {
+ (void) unformat (input, str_match);
+ return 1;
+ }
+
+ return 0;
+}
+
+u8 *
+format_transport_protos (u8 * s, va_list * args)
+{
+ transport_proto_vft_t *tp_vft;
+
+ vec_foreach (tp_vft, tp_vfts)
+ s = format (s, "%s\n", tp_vft->transport_options.name);
+
+ return s;
+}