ioam: remove api boilerplate
[vpp.git] / src / plugins / ioam / lib-trace / trace_test.c
index a135432..8981478 100644 (file)
 #include <vat/vat.h>
 #include <vlibapi/api.h>
 #include <vlibmemory/api.h>
-#include <vlibsocket/api.h>
+
 #include <vppinfra/error.h>
 
 #define __plugin_msg_base trace_test_main.msg_id_base
 #include <vlibapi/vat_helper_macros.h>
 
 /* Declare message IDs */
-#include <ioam/lib-trace/trace_msg_enum.h>
-
-/* define message structures */
-#define vl_typedefs
-#include <ioam/lib-trace/trace_all_api_h.h>
-#undef vl_typedefs
-
-/* declare message handlers for each api */
+#include <ioam/lib-trace/trace.api_enum.h>
+#include <ioam/lib-trace/trace.api_types.h>
 
 #define vl_endianfun           /* define message structures */
-#include <ioam/lib-trace/trace_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...)
 #define vl_printfun
-#include <ioam/lib-trace/trace_all_api_h.h>
-#undef vl_printfun
-
-/* Get the API version number. */
 #define vl_api_version(n,v) static u32 api_version=(v);
-#include <ioam/lib-trace/trace_all_api_h.h>
+#define vl_print(handle, ...)
+#include <ioam/lib-trace/trace.api.h>
+#undef vl_endianfun
+#undef vl_printfun
 #undef vl_api_version
 
-
 typedef struct
 {
   /* API message ID base */
@@ -125,11 +112,10 @@ api_trace_profile_add (vat_main_t * vam)
   vl_api_trace_profile_add_t *mp;
   u8 trace_type = 0;
   u8 num_elts = 0;
-  int rv = 0;
   u32 node_id = 0;
   u32 app_data = 0;
   u8 trace_tsp = 0;
-  f64 timeout;
+  int ret;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -157,10 +143,9 @@ api_trace_profile_add (vat_main_t * vam)
   mp->app_data = htonl (app_data);
   mp->num_elts = num_elts;
 
-  S;
-  W;
-
-  return (rv);
+  S (mp);
+  W (ret);
+  return ret;
 }
 
 
@@ -169,23 +154,24 @@ static int
 api_trace_profile_del (vat_main_t * vam)
 {
   vl_api_trace_profile_del_t *mp;
-  f64 timeout;
+  int ret;
 
   M (TRACE_PROFILE_DEL, mp);
-  S;
-  W;
-  return 0;
+  S (mp);
+  W (ret);
+  return ret;
 }
 
 static int
 api_trace_profile_show_config (vat_main_t * vam)
 {
   vl_api_trace_profile_show_config_t *mp;
-  f64 timeout;
+  int ret;
+
   M (TRACE_PROFILE_SHOW_CONFIG, mp);
-  S;
-  W;
-  return 0;
+  S (mp);
+  W (ret);
+  return ret;
 }
 
 /*
@@ -227,7 +213,7 @@ ioam_trace_vat_api_hookup (vat_main_t * vam)
 }
 
 clib_error_t *
-vat_plugin_register (vat_main_t * vam)
+trace_vat_plugin_register (vat_main_t * vam)
 {
   trace_test_main_t *sm = &trace_test_main;
   u8 *name;