api: refactor vlibmemory
[vpp.git] / src / vpp / api / api.c
index d2b06ff..70b1042 100644 (file)
@@ -72,6 +72,7 @@
 #include <vpp/api/vpe_all_api_h.h>
 #undef vl_printfun
 #include <vlibapi/api_helper_macros.h>
+
 #define foreach_vpe_api_msg                                             \
 _(CONTROL_PING, control_ping)                                           \
 _(CLI, cli)                                                             \
@@ -84,6 +85,7 @@ _(GET_NEXT_INDEX, get_next_index)                                       \
 
 #define QUOTE_(x) #x
 #define QUOTE(x) QUOTE_(x)
+
 typedef enum
 {
   RESOLVE_IP4_ADD_DEL_ROUTE = 1,
@@ -162,7 +164,7 @@ static void
 vl_api_cli_t_handler (vl_api_cli_t * mp)
 {
   vl_api_cli_reply_t *rp;
-  unix_shared_memory_queue_t *q;
+  svm_queue_t *q;
   vlib_main_t *vm = vlib_get_main ();
   api_main_t *am = &api_main;
   unformat_input_t input;
@@ -365,6 +367,7 @@ vl_api_get_node_graph_t_handler (vl_api_get_node_graph_t * mp)
   vlib_main_t *vm = vlib_get_main ();
   void *oldheap;
   vl_api_get_node_graph_reply_t *rmp;
+  vlib_node_t ***node_dups;
 
   pthread_mutex_lock (&am->vlib_rp->mutex);
   oldheap = svm_push_data_heap (am->vlib_rp);
@@ -376,9 +379,9 @@ vl_api_get_node_graph_t_handler (vl_api_get_node_graph_t * mp)
   vec_reset_length (vector);
 
   /* $$$$ FIXME */
-  vector = vlib_node_serialize (&vm->node_main, vector,
-                               (u32) ~ 0 /* all threads */ ,
-                               1 /* include nexts */ ,
+  node_dups = vlib_node_get_nodes (vm, (u32) ~ 0 /* all threads */ ,
+                                  1 /* include stats */ );
+  vector = vlib_node_serialize (vm, node_dups, vector, 1 /* include nexts */ ,
                                1 /* include stats */ );
 
   svm_pop_heap (oldheap);
@@ -398,7 +401,7 @@ static void vl_api_##nn##_t_handler (                                   \
 {                                                                       \
     vpe_client_registration_t *reg;                                     \
     vpe_api_main_t * vam = &vpe_api_main;                               \
-    unix_shared_memory_queue_t * q;                                     \
+    svm_queue_t * q;                                     \
                                                                         \
     /* One registration only... */                                      \
     pool_foreach(reg, vam->nn##_registrations,                          \
@@ -482,7 +485,7 @@ vpe_api_init (vlib_main_t * vm)
 #undef _
 
   vl_set_memory_region_name ("/vpe-api");
-  vl_enable_disable_memory_api (vm, 1 /* enable it */ );
+  vl_mem_api_enable_disable (vm, 1 /* enable it */ );
 
   return 0;
 }