aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps/sapi/vpp_echo_bapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/hs_apps/sapi/vpp_echo_bapi.c')
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_bapi.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_bapi.c b/src/plugins/hs_apps/sapi/vpp_echo_bapi.c
index 38fb522351c..868cc3a0591 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_bapi.c
+++ b/src/plugins/hs_apps/sapi/vpp_echo_bapi.c
@@ -103,6 +103,19 @@ echo_send_del_cert_key (echo_main_t * em)
vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
}
+int
+echo_bapi_recv_fd (echo_main_t *em, int *fds, int n_fds)
+{
+ clib_error_t *err;
+ err = vl_socket_client_recv_fd_msg (fds, n_fds, 5);
+ if (err)
+ {
+ clib_error_report (err);
+ return -1;
+ }
+ return 0;
+}
+
static u8
echo_transport_needs_crypto (transport_proto_t proto)
{
@@ -265,11 +278,11 @@ echo_segment_lookup (u64 segment_handle)
clib_spinlock_lock (&em->segment_handles_lock);
segment_idxp = hash_get (em->shared_segment_handles, segment_handle);
clib_spinlock_unlock (&em->segment_handles_lock);
- if (!segment_idxp)
- return ~0;
+ if (segment_idxp)
+ return ((u32) *segment_idxp);
ECHO_LOG (2, "Segment not mapped (0x%lx)", segment_handle);
- return ((u32) *segment_idxp);
+ return ~0;
}
void
@@ -543,11 +556,14 @@ _(APPLICATION_DETACH_REPLY, application_detach_reply) \
_(APP_ADD_CERT_KEY_PAIR_REPLY, app_add_cert_key_pair_reply) \
_(APP_DEL_CERT_KEY_PAIR_REPLY, app_del_cert_key_pair_reply)
-#define vl_print(handle, ...) fformat (handle, __VA_ARGS__)
#define vl_endianfun
#include <vnet/session/session.api.h>
#undef vl_endianfun
+#define vl_calcsizefun
+#include <vnet/session/session.api.h>
+#undef vl_calcsizefun
+
#define vl_printfun
#include <vnet/session/session.api.h>
#undef vl_printfun
@@ -569,10 +585,18 @@ echo_api_hookup (echo_main_t * em)
return;
#define _(N, n) \
- vl_msg_api_set_handlers (REPLY_MSG_ID_BASE + VL_API_##N, #n, \
- vl_api_##n##_t_handler, vl_noop_handler, \
- vl_api_##n##_t_endian, vl_api_##n##_t_print, \
- sizeof (vl_api_##n##_t), 1);
+ vl_msg_api_config (&(vl_msg_api_msg_config_t){ \
+ .id = REPLY_MSG_ID_BASE + VL_API_##N, \
+ .name = #n, \
+ .handler = vl_api_##n##_t_handler, \
+ .endian = vl_api_##n##_t_endian, \
+ .format_fn = vl_api_##n##_t_format, \
+ .size = sizeof (vl_api_##n##_t), \
+ .traced = 1, \
+ .tojson = vl_api_##n##_t_tojson, \
+ .fromjson = vl_api_##n##_t_fromjson, \
+ .calc_size = vl_api_##n##_t_calc_size, \
+ });
foreach_quic_echo_msg;
#undef _
}