api: multiple connections per process
Type: feature
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I2272521d6e69edcd385ef684af6dd4eea5eaa953
diff --git a/src/vpp-api/client/client.c b/src/vpp-api/client/client.c
index fa83696..0579095 100644
--- a/src/vpp-api/client/client.c
+++ b/src/vpp-api/client/client.c
@@ -177,7 +177,7 @@
vl_api_memclnt_keepalive_t *mp;
vl_api_memclnt_keepalive_reply_t *rmp;
vac_main_t *pm = &vac_main;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main();
vl_shmem_hdr_t *shmem_hdr;
uword msg;
@@ -237,7 +237,7 @@
{
vl_api_memclnt_read_timeout_t *ep;
vac_main_t *pm = &vac_main;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main();
struct timespec ts;
struct timeval tv;
int rv;
@@ -272,7 +272,7 @@
void
vac_rx_suspend (void)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main();
vac_main_t *pm = &vac_main;
vl_api_memclnt_rx_thread_suspend_t *ep;
@@ -306,14 +306,14 @@
static uword *
vac_msg_table_get_hash (void)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main();
return (am->msg_index_by_name_and_crc);
}
int
vac_msg_table_size(void)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main();
return hash_elts(am->msg_index_by_name_and_crc);
}
@@ -390,7 +390,7 @@
int
vac_disconnect (void)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main();
vac_main_t *pm = &vac_main;
uword junk;
int rv = 0;
@@ -442,7 +442,7 @@
vac_read (char **p, int *l, u16 timeout)
{
svm_queue_t *q;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main();
vac_main_t *pm = &vac_main;
vl_api_memclnt_keepalive_t *mp;
vl_api_memclnt_keepalive_reply_t *rmp;
@@ -489,7 +489,7 @@
shmem_hdr = am->shmem_hdr;
vl_msg_api_send_shmem(shmem_hdr->vl_input_queue, (u8 *)&rmp);
vl_msg_api_free((void *) msg);
- /*
+ /*
* Python code is blissfully unaware of these pings, so
* act as if it never happened...
*/
@@ -535,14 +535,14 @@
static u32
vac_client_index (void)
{
- return (api_main.my_client_index);
+ return (vlibapi_get_main()->my_client_index);
}
int
vac_write (char *p, int l)
{
int rv = -1;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main();
vl_api_header_t *mp = vl_msg_api_alloc(l);
svm_queue_t *q;
vac_main_t *pm = &vac_main;