lacp: custom dump for sw_interface_lacp_dump
Add custom dump code for sw_interface_lacp_dump
Type: fix
/* instantiate all the print functions we know about */
#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
-#define vl_printfun
-#include <lacp/lacp_all_api_h.h>
-#undef vl_printfun
/* Get the API version number */
#define vl_api_version(n,v) static u32 api_version=(v);
#include <lacp/lacp_all_api_h.h>
#undef vl_api_version
+/* Macro to finish up custom dump fns */
+#define FINISH \
+ vec_add1 (s, 0); \
+ vl_print (handle, (char *)s); \
+ vec_free (s); \
+ return handle;
+
#define REPLY_MSG_ID_BASE lm->msg_id_base
#include <vlibapi/api_helper_macros.h>
@@ -126,6 +130,17 @@ vl_api_sw_interface_lacp_dump_t_handler (vl_api_sw_interface_lacp_dump_t * mp)
vec_free (lacpifs);
}
+static void *
+vl_api_sw_interface_lacp_dump_t_print (vl_api_sw_interface_lacp_dump_t * mp,
+ void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: sw_interface_lacp_dump ");
+
+ FINISH;
+}
+
#define vl_msg_name_crc_list
#include <lacp/lacp_all_api_h.h>
#undef vl_msg_name_crc_list
@@ -139,6 +154,16 @@ setup_message_id_table (lacp_main_t * lm, api_main_t * am)
#undef _
}
+static void
+plugin_custom_dump_configure (lacp_main_t * lm)
+{
+#define _(n,f) api_main.msg_print_handlers \
+ [VL_API_##n + lm->msg_id_base] \
+ = (void *) vl_api_##f##_t_print;
+ foreach_lacp_plugin_api_msg;
+#undef _
+}
+
/* Set up the API message handling tables */
clib_error_t *
lacp_plugin_api_hookup (vlib_main_t * vm)
@@ -170,6 +195,8 @@ lacp_plugin_api_hookup (vlib_main_t * vm)
*/
setup_message_id_table (lm, am);
+ plugin_custom_dump_configure (lm);
+
vec_free (name);
return 0;
}
