misc: move to new pool_foreach macros
[vpp.git] / src / vpp / api / api.c
index 2ed9cee..6007b72 100644 (file)
@@ -39,7 +39,6 @@
 #include <vppinfra/bitmap.h>
 #include <vppinfra/fifo.h>
 #include <vppinfra/time.h>
-#include <vppinfra/mheap.h>
 #include <vppinfra/heap.h>
 #include <vppinfra/pool.h>
 #include <vppinfra/format.h>
@@ -212,7 +211,7 @@ vl_api_cli_inband_t_handler (vl_api_cli_inband_t * mp)
   vlib_main_t *vm = vlib_get_main ();
   unformat_input_t input;
   u8 *out_vec = 0;
-  u32 len = 0;
+  u8 *cmd_vec = 0;
 
   if (vl_msg_api_get_msg_length (mp) <
       vl_api_string_len (&mp->cmd) + sizeof (*mp))
@@ -221,20 +220,21 @@ vl_api_cli_inband_t_handler (vl_api_cli_inband_t * mp)
       goto error;
     }
 
-  unformat_init_string (&input, (char *) vl_api_from_api_string (&mp->cmd),
+  cmd_vec = vl_api_from_api_to_new_vec (mp, &mp->cmd);
+
+  unformat_init_string (&input, (char *) cmd_vec,
                        vl_api_string_len (&mp->cmd));
   rv = vlib_cli_input (vm, &input, inband_cli_output, (uword) & out_vec);
 
-  len = vec_len (out_vec);
-
 error:
   /* *INDENT-OFF* */
-  REPLY_MACRO3(VL_API_CLI_INBAND_REPLY, len,
+  REPLY_MACRO3(VL_API_CLI_INBAND_REPLY, vec_len (out_vec),
   ({
-    vl_api_to_api_string(len, (const char *)out_vec, &rmp->reply);
+    vl_api_vec_to_api_string(out_vec, &rmp->reply);
   }));
   /* *INDENT-ON* */
   vec_free (out_vec);
+  vec_free (cmd_vec);
 }
 
 static void
@@ -273,7 +273,7 @@ get_thread_data (vl_api_thread_data_t * td, int index)
   td->pid = htonl (w->lwp);
   td->cpu_id = htonl (w->cpu_id);
   td->core = htonl (w->core_id);
-  td->cpu_socket = htonl (w->socket_id);
+  td->cpu_socket = htonl (w->numa_id);
 }
 
 static void
@@ -341,7 +341,7 @@ vl_api_get_node_index_t_handler (vl_api_get_node_index_t * mp)
   /* *INDENT-OFF* */
   REPLY_MACRO2(VL_API_GET_NODE_INDEX_REPLY,
   ({
-    rmp->node_index = ntohl(node_index);
+    rmp->node_index = htonl(node_index);
   }));
   /* *INDENT-ON* */
 }
@@ -388,7 +388,7 @@ out:
   /* *INDENT-OFF* */
   REPLY_MACRO2(VL_API_GET_NEXT_INDEX_REPLY,
   ({
-    rmp->next_index = ntohl(next_index);
+    rmp->next_index = htonl(next_index);
   }));
   /* *INDENT-ON* */
 }
@@ -419,9 +419,9 @@ vl_api_add_node_next_t_handler (vl_api_add_node_next_t * mp)
 
 out:
   /* *INDENT-OFF* */
-  REPLY_MACRO2(VL_API_GET_NODE_INDEX_REPLY,
+  REPLY_MACRO2(VL_API_ADD_NODE_NEXT_REPLY,
   ({
-    rmp->next_index = ntohl(next_index);
+    rmp->next_index = htonl(next_index);
   }));
   /* *INDENT-ON* */
 }
@@ -581,7 +581,7 @@ static void vl_api_##nn##_t_handler (                                   \
     svm_queue_t * q;                                     \
                                                                         \
     /* One registration only... */                                      \
-    pool_foreach(reg, vam->nn##_registrations,                          \
+    pool_foreach (reg, vam->nn##_registrations)                          \
     ({                                                                  \
         q = vl_api_client_index_to_input_queue (reg->client_index);     \
         if (q) {                                                        \