aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlibmemory')
-rw-r--r--src/vlibmemory/vlib.api24
-rw-r--r--src/vlibmemory/vlib_api.c12
-rw-r--r--src/vlibmemory/vlibapi_test.c25
3 files changed, 61 insertions, 0 deletions
diff --git a/src/vlibmemory/vlib.api b/src/vlibmemory/vlib.api
index 5e8ba47ba7d..c017fc7919a 100644
--- a/src/vlibmemory/vlib.api
+++ b/src/vlibmemory/vlib.api
@@ -243,6 +243,30 @@ define get_f64_increment_by_one_reply
f64 f64_value;
};
+/** \brief Control ping from client to api server request
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+define control_ping
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Control ping from the client to the server response
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the request
+ @param vpe_pid - the pid of the vpe, returned by the server
+*/
+define control_ping_reply
+{
+ u32 context;
+ i32 retval;
+ u32 client_index;
+ u32 vpe_pid;
+};
+
/*
* Local Variables:
* eval: (c-set-style "gnu")
diff --git a/src/vlibmemory/vlib_api.c b/src/vlibmemory/vlib_api.c
index e5d77eb5bf6..0d9444619af 100644
--- a/src/vlibmemory/vlib_api.c
+++ b/src/vlibmemory/vlib_api.c
@@ -329,6 +329,16 @@ vl_api_get_f64_increment_by_one_t_handler (
}));
}
+static void
+vl_api_control_ping_t_handler (vl_api_control_ping_t *mp)
+{
+ vl_api_control_ping_reply_t *rmp;
+ int rv = 0;
+
+ REPLY_MACRO2 (VL_API_CONTROL_PING_REPLY,
+ ({ rmp->vpe_pid = ntohl (getpid ()); }));
+}
+
#include <vlibmemory/vlib.api.c>
static clib_error_t *
vlib_apis_hookup (vlib_main_t *vm)
@@ -341,6 +351,8 @@ vlib_apis_hookup (vlib_main_t *vm)
msg_id_base = setup_message_id_table ();
am->is_mp_safe[VL_API_GET_NODE_GRAPH] = 1;
+ am->is_mp_safe[VL_API_CONTROL_PING] = 1;
+ am->is_mp_safe[VL_API_CONTROL_PING_REPLY] = 1;
return 0;
}
diff --git a/src/vlibmemory/vlibapi_test.c b/src/vlibmemory/vlibapi_test.c
index 820096ab80d..c91cd7942f9 100644
--- a/src/vlibmemory/vlibapi_test.c
+++ b/src/vlibmemory/vlibapi_test.c
@@ -449,6 +449,31 @@ api_get_node_graph (vat_main_t *vam)
return ret;
}
+static void
+vl_api_control_ping_reply_t_handler (vl_api_control_ping_reply_t *mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->result_ready = 1;
+ }
+ if (vam->socket_client_main)
+ vam->socket_client_main->control_pings_outstanding--;
+}
+
+static int
+api_control_ping (vat_main_t *vam)
+{
+ // not yet implemented
+ return -1;
+}
+
#define VL_API_LOCAL_SETUP_MESSAGE_ID_TABLE local_setup_message_id_table
static void
local_setup_message_id_table (vat_main_t *vam)