api: API trace improvements
[vpp.git] / src / vlibapi / api.h
index 49f5d5f..d05395a 100644 (file)
 #include <stddef.h>
 #include <vppinfra/error.h>
 #include <svm/svm.h>
+#include <svm/queue.h>
 #include <vlib/vlib.h>
-#include <vlibmemory/unix_shared_memory_queue.h>
 #include <vlib/unix/unix.h>
 #include <vlibapi/api_common.h>
 
 /* *INDENT-OFF* */
-typedef CLIB_PACKED
-(struct
- {
-   u8 endian; u8 wrapped;
+typedef CLIB_PACKED ( struct {
    u32 nitems;
+   u32 msgtbl_size;
+   u8 wrapped;
 }) vl_api_trace_file_header_t;
 /* *INDENT-ON* */
 
-int vl_msg_api_trace_save (api_main_t * am,
-                          vl_api_trace_which_t which, FILE * fp);
+int vl_msg_api_trace_save (api_main_t *am, vl_api_trace_which_t which,
+                          FILE *fp, u8 is_json);
 
 #define VLIB_API_INIT_FUNCTION(x) VLIB_DECLARE_INIT_FUNCTION(x,api_init)
 
@@ -56,7 +55,6 @@ int vl_msg_api_trace_save (api_main_t * am,
     _error;                                                             \
   })
 
-
 #define _VL_MSG_API_FUNCTION_SYMBOL(x, type)   \
   _vl_msg_api_##type##_function_##x
 
@@ -70,7 +68,7 @@ static void __vl_msg_api_add_##tag##_function_##x (void)                \
                                                                         \
 static void __vl_msg_api_add_##tag##_function_##x (void)                \
 {                                                                       \
- api_main_t * am = &api_main;                                           \
+ api_main_t * am = vlibapi_get_main();                                  \
  static _vl_msg_api_function_list_elt_t _vl_msg_api_function;           \
  _vl_msg_api_function.next_init_function                                \
     = am->tag##_function_registrations;                                 \
@@ -107,20 +105,29 @@ int vl_msg_api_trace_onoff (api_main_t * am, vl_api_trace_which_t which,
 int vl_msg_api_trace_free (api_main_t * am, vl_api_trace_which_t which);
 int vl_msg_api_trace_configure (api_main_t * am, vl_api_trace_which_t which,
                                u32 nitems);
-void vl_msg_api_handler_with_vm_node (api_main_t * am,
+void vl_msg_api_handler_with_vm_node (api_main_t * am, svm_region_t * vlib_rp,
                                      void *the_msg, vlib_main_t * vm,
-                                     vlib_node_runtime_t * node);
+                                     vlib_node_runtime_t * node,
+                                     u8 is_private);
+u32 vl_msg_api_max_length (void *mp);
 vl_api_trace_t *vl_msg_api_trace_get (api_main_t * am,
                                      vl_api_trace_which_t which);
 void vl_msg_api_add_msg_name_crc (api_main_t * am, const char *string,
                                  u32 id);
+void vl_msg_api_add_version (api_main_t * am, const char *string,
+                            u32 major, u32 minor, u32 patch);
 /* node_serialize.c prototypes */
-u8 *vlib_node_serialize (vlib_node_main_t * nm, u8 * vector,
-                        u32 max_threads, int include_nexts,
-                        int include_stats);
-vlib_node_t **vlib_node_unserialize (u8 * vector);
+u8 *vlib_node_serialize (vlib_main_t * vm, vlib_node_t *** node_dups,
+                        u8 * vector, int include_nexts, int include_stats);
+vlib_node_t ***vlib_node_unserialize (u8 * vector);
+
 u32 vl_msg_api_get_msg_length (void *msg_arg);
 
+typedef int (*vl_msg_traverse_trace_fn) (u8 *, void *);
+
+int vl_msg_traverse_trace (vl_api_trace_t *tp, vl_msg_traverse_trace_fn fn,
+                          void *ctx);
+
 #endif /* included_api_h */
 /*
  * fd.io coding-style-patch-verification: ON