aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/memclnt_api.c
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2021-07-23 22:03:05 +0000
committerOle Tr�an <otroan@employees.org>2021-10-18 07:03:12 +0000
commitf0e67d78ae23ff3d5751ea10e9e76cb6e81ba4a5 (patch)
treec63b1ac48809a7247bb288e01d5c9cdfb6038b7c /src/vlibmemory/memclnt_api.c
parent2e55823af6c1cc6856e4a1f2cea659170bd76fb7 (diff)
interface: add api test file
Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Ib07029204ecf12bf2adb5a39afa54bc98fb81f34
Diffstat (limited to 'src/vlibmemory/memclnt_api.c')
-rw-r--r--src/vlibmemory/memclnt_api.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/vlibmemory/memclnt_api.c b/src/vlibmemory/memclnt_api.c
index e7d689b614a..2b4a2393db3 100644
--- a/src/vlibmemory/memclnt_api.c
+++ b/src/vlibmemory/memclnt_api.c
@@ -29,6 +29,7 @@
#include <vlib/unix/unix.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
+#include <vlibapi/api_helper_macros.h>
/**
* @file
@@ -131,9 +132,20 @@ vl_api_api_versions_t_handler (vl_api_api_versions_t *mp)
vl_api_send_msg (reg, (u8 *) rmp);
}
+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 ()); }));
+}
+
#define foreach_vlib_api_msg \
_ (GET_FIRST_MSG_ID, get_first_msg_id) \
- _ (API_VERSIONS, api_versions)
+ _ (API_VERSIONS, api_versions) \
+ _ (CONTROL_PING, control_ping)
/*
* vl_api_init
@@ -141,6 +153,7 @@ vl_api_api_versions_t_handler (vl_api_api_versions_t *mp)
static int
vlib_api_init (void)
{
+ api_main_t *am = vlibapi_get_main ();
vl_msg_api_msg_config_t cfg;
vl_msg_api_msg_config_t *c = &cfg;
@@ -175,6 +188,9 @@ vlib_api_init (void)
foreach_vlib_api_msg;
#undef _
+ am->is_mp_safe[VL_API_CONTROL_PING] = 1;
+ am->is_mp_safe[VL_API_CONTROL_PING_REPLY] = 1;
+
return 0;
}