X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fhs_apps%2Fsapi%2Fvpp_echo_bapi.c;h=868cc3a0591efb4a90a69e1fa51e6c878b8c6e97;hb=HEAD;hp=2e997096f85c2e710cd3d38c96812f105ac4ae3b;hpb=9b7e8acf792cced80e6775bc5668d9db415cdb46;p=vpp.git diff --git a/src/plugins/hs_apps/sapi/vpp_echo_bapi.c b/src/plugins/hs_apps/sapi/vpp_echo_bapi.c index 2e997096f85..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,7 +556,6 @@ _(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 #undef vl_endianfun @@ -573,12 +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_api_##n##_t_print_json, \ - vl_api_##n##_t_tojson, vl_api_##n##_t_fromjson, \ - vl_api_##n##_t_calc_size); + 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 _ }