aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-08-07 09:35:25 -0400
committerDave Wallace <dwallacelf@gmail.com>2017-08-10 00:13:08 +0000
commit52851e6aa9304054fd1059c8dd284abf8e532bf2 (patch)
treeefe4334245044e342817b28d69ee208fba9952ec /src/vlibmemory
parentb639b593372612fd3a55b3137b4fdd62df775d96 (diff)
TCP proxy prototype
- Clean up internal API client registration - Add proxy server - Add a reference count to the svm fifo Change-Id: I5ace1c85497062ed412d26ae76a9e6741af1e984 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vlibmemory')
-rw-r--r--src/vlibmemory/api_common.h1
-rw-r--r--src/vlibmemory/memory_vlib.c38
2 files changed, 39 insertions, 0 deletions
diff --git a/src/vlibmemory/api_common.h b/src/vlibmemory/api_common.h
index 53909cc4184..19daecdfb6a 100644
--- a/src/vlibmemory/api_common.h
+++ b/src/vlibmemory/api_common.h
@@ -126,6 +126,7 @@ int vl_client_connect_to_vlib_no_rx_pthread (const char *svm_name,
u16 vl_client_get_first_plugin_msg_id (const char *plugin_name);
void vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length);
+u32 vl_api_memclnt_create_internal (char *, unix_shared_memory_queue_t *);
#endif /* included_vlibmemory_api_common_h */
diff --git a/src/vlibmemory/memory_vlib.c b/src/vlibmemory/memory_vlib.c
index 004a997455e..688ce6044e0 100644
--- a/src/vlibmemory/memory_vlib.c
+++ b/src/vlibmemory/memory_vlib.c
@@ -137,6 +137,44 @@ vl_api_serialize_message_table (api_main_t * am, u8 * vector)
}
/*
+ * vl_api_memclnt_create_internal
+ */
+
+u32
+vl_api_memclnt_create_internal (char *name, unix_shared_memory_queue_t * q)
+{
+ vl_api_registration_t **regpp;
+ vl_api_registration_t *regp;
+ svm_region_t *svm;
+ void *oldheap;
+ api_main_t *am = &api_main;
+
+ ASSERT (vlib_get_thread_index () == 0);
+ pool_get (am->vl_clients, regpp);
+
+ svm = am->vlib_rp;
+
+ pthread_mutex_lock (&svm->mutex);
+ oldheap = svm_push_data_heap (svm);
+ *regpp = clib_mem_alloc (sizeof (vl_api_registration_t));
+
+ regp = *regpp;
+ memset (regp, 0, sizeof (*regp));
+ regp->registration_type = REGISTRATION_TYPE_SHMEM;
+ regp->vl_api_registration_pool_index = regpp - am->vl_clients;
+
+ regp->vl_input_queue = q;
+ regp->name = format (0, "%s%c", name, 0);
+
+ pthread_mutex_unlock (&svm->mutex);
+ svm_pop_heap (oldheap);
+ return vl_msg_api_handle_from_index_and_epoch
+ (regp->vl_api_registration_pool_index,
+ am->shmem_hdr->application_restarts);
+}
+
+
+/*
* vl_api_memclnt_create_t_handler
*/
void