summaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_bapi.c
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2020-01-31 09:35:29 +0100
committerFlorin Coras <florin.coras@gmail.com>2020-03-05 15:26:51 +0000
commitb4e5e50fe898bf905aa7087e17740394b97e5cf9 (patch)
tree26e8afd851165d38def755048fe69d6578de9fe8 /src/vcl/vcl_bapi.c
parent5893747d72acd0a507f74fe61c13cae54de23630 (diff)
session: API cleanup
Use consistent API types. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Ib752a3425c076eb53bc5255a48039cbb74b1fcce Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'src/vcl/vcl_bapi.c')
-rw-r--r--src/vcl/vcl_bapi.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index efa5cc170ef..af2eb035a67 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -73,8 +73,9 @@ vl_api_app_attach_reply_t_handler (vl_api_app_attach_reply_t * mp)
vcl_worker_t *wrk = vcl_worker_get (0);
svm_msg_q_t *ctrl_mq;
u64 segment_handle;
- int *fds = 0, i;
+ int *fds = 0, i, rv;
u32 n_fds = 0;
+ char *segment_name = 0;
if (mp->retval)
{
@@ -108,9 +109,16 @@ vl_api_app_attach_reply_t_handler (vl_api_app_attach_reply_t * mp)
goto failed;
if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
- if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
- SSVM_SEGMENT_MEMFD, fds[n_fds++]))
- goto failed;
+ {
+ segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
+ rv =
+ vcl_segment_attach (segment_handle, segment_name,
+ SSVM_SEGMENT_MEMFD, fds[n_fds++]);
+ vec_free (segment_name);
+ if (rv != 0)
+ goto failed;
+ }
+
if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
{
@@ -123,8 +131,12 @@ vl_api_app_attach_reply_t_handler (vl_api_app_attach_reply_t * mp)
}
else
{
- if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
- SSVM_SEGMENT_SHM, -1))
+ segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
+ rv =
+ vcl_segment_attach (segment_handle, segment_name, SSVM_SEGMENT_SHM,
+ -1);
+ vec_free (segment_name);
+ if (rv != 0)
goto failed;
}
@@ -143,10 +155,11 @@ static void
vl_api_app_worker_add_del_reply_t_handler (vl_api_app_worker_add_del_reply_t *
mp)
{
- int n_fds = 0, *fds = 0, i;
+ int n_fds = 0, *fds = 0, i, rv;
u64 segment_handle;
vcl_worker_t *wrk;
u32 wrk_index;
+ char *segment_name = 0;
if (mp->retval)
{
@@ -189,9 +202,15 @@ vl_api_app_worker_add_del_reply_t_handler (vl_api_app_worker_add_del_reply_t *
goto failed;
if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
- if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
- SSVM_SEGMENT_MEMFD, fds[n_fds++]))
- goto failed;
+ {
+ segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
+ rv =
+ vcl_segment_attach (segment_handle, segment_name,
+ SSVM_SEGMENT_MEMFD, fds[n_fds++]);
+ vec_free (segment_name);
+ if (rv != 0)
+ goto failed;
+ }
if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
{
@@ -204,8 +223,12 @@ vl_api_app_worker_add_del_reply_t_handler (vl_api_app_worker_add_del_reply_t *
}
else
{
- if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
- SSVM_SEGMENT_SHM, -1))
+ segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
+ rv =
+ vcl_segment_attach (segment_handle, segment_name, SSVM_SEGMENT_SHM,
+ -1);
+ vec_free (segment_name);
+ if (rv != 0)
goto failed;
}
vcm->app_state = STATE_APP_READY;
@@ -313,8 +336,7 @@ vppcom_app_send_attach (void)
bmp->options[APP_OPTIONS_TLS_ENGINE] = tls_engine;
if (nsid_len)
{
- bmp->namespace_id_len = nsid_len;
- clib_memcpy_fast (bmp->namespace_id, vcm->cfg.namespace_id, nsid_len);
+ vl_api_vec_to_api_string (vcm->cfg.namespace_id, &bmp->namespace_id);
bmp->options[APP_OPTIONS_NAMESPACE_SECRET] = vcm->cfg.namespace_secret;
}
vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) & bmp);