aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi/api_shared.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-05 03:20:25 -0800
committerDave Barach <openvpp@barachs.net>2018-01-09 18:33:08 +0000
commite86a8edd3c14fb41ace2a12efd17bc7772bf623f (patch)
tree480219864cadd743fdb95c21379aeaf88a985e23 /src/vlibapi/api_shared.c
parent4363ad6c96b5641fca1b16c5a6ec22e2364adcfd (diff)
api: refactor vlibmemory
- separate client/server code for both memory and socket apis - separate memory api code from generic vlib api code - move unix_shared_memory_fifo to svm and rename to svm_fifo_t - overall declutter Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vlibapi/api_shared.c')
-rw-r--r--src/vlibapi/api_shared.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 4d11b519cf2..d4196264064 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -754,11 +754,11 @@ vl_msg_api_set_cleanup_handler (int msg_id, void *fp)
}
void
-vl_msg_api_queue_handler (unix_shared_memory_queue_t * q)
+vl_msg_api_queue_handler (svm_queue_t * q)
{
uword msg;
- while (!unix_shared_memory_queue_sub (q, (u8 *) & msg, 0))
+ while (!svm_queue_sub (q, (u8 *) & msg, 0))
vl_msg_api_handler ((void *) msg);
}
@@ -940,6 +940,21 @@ vl_msg_api_add_version (api_main_t * am, const char *string,
vec_add1 (am->api_version_list, version);
}
+u32
+vl_msg_api_get_msg_index (u8 * name_and_crc)
+{
+ api_main_t *am = &api_main;
+ uword *p;
+
+ if (am->msg_index_by_name_and_crc)
+ {
+ p = hash_get_mem (am->msg_index_by_name_and_crc, name_and_crc);
+ if (p)
+ return p[0];
+ }
+ return ~0;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*