37 bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_ATTACH);
39 bmp->
context = ntohl (0xfeedface);
60 cert_mp->_vl_msg_id = ntohs (VL_API_APPLICATION_TLS_CERT_ADD);
62 cert_mp->
context = ntohl (0xfeedface);
69 key_mp->_vl_msg_id = ntohs (VL_API_APPLICATION_TLS_KEY_ADD);
71 key_mp->
context = ntohl (0xfeedface);
84 bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_DETACH);
86 bmp->
context = ntohl (0xfeedface);
97 bmp->_vl_msg_id = ntohs (VL_API_BIND_URI);
99 bmp->
context = ntohl (0xfeedface);
112 ump->_vl_msg_id = ntohs (VL_API_UNBIND_URI);
125 cmp->_vl_msg_id = ntohs (VL_API_CONNECT_URI);
139 dmp->_vl_msg_id = ntohs (VL_API_DISCONNECT_SESSION);
202 ECHO_FAIL (ECHO_FAIL_VL_API_APP_ATTACH,
"attach failed: %U",
209 ECHO_FAIL (ECHO_FAIL_VL_API_MISSING_SEGMENT_NAME,
210 "segment_name_length zero");
224 "vl_socket_client_recv_fd_msg failed");
228 if (mp->
fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT)
231 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
232 "svm_fifo_segment_attach failed on SSVM_SEGMENT_MEMFD");
236 if (mp->
fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
240 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
241 "svm_fifo_segment_attach ('%s') " 245 if (mp->
fd_flags & SESSION_FD_F_MQ_EVENTFD)
255 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
256 "svm_fifo_segment_attach ('%s') " 262 ECHO_LOG (1,
"Mapped segment 0x%lx", segment_handle);
278 ECHO_FAIL (ECHO_FAIL_VL_API_DETACH_REPLY,
279 "app detach returned with err: %d", mp->retval);
292 ECHO_LOG (1,
"Unmaped segment 0x%lx", segment_handle);
305 if (mp->
fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
311 "vl_socket_client_recv_fd_msg failed");
317 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
318 "svm_fifo_segment_attach ('%s') " 319 "failed on SSVM_SEGMENT_MEMFD", seg_name);
332 ECHO_FAIL (ECHO_FAIL_VL_API_FIFO_SEG_ATTACH,
333 "fifo_segment_attach ('%s') failed", seg_name);
338 ECHO_LOG (1,
"Mapped segment 0x%lx", segment_handle);
352 ECHO_FAIL (ECHO_FAIL_VL_API_BIND_URI_REPLY,
"bind failed: %U",
364 ECHO_FAIL (ECHO_FAIL_VL_API_UNBIND_REPLY,
"unbind_uri returned %d",
382 ECHO_FAIL (ECHO_FAIL_VL_API_DISCONNECT_SESSION_REPLY,
383 "vpp complained about disconnect: %d", ntohl (mp->
retval));
387 ECHO_LOG (1,
"Got disonnected reply for session 0x%lx", mp->
handle);
395 (vl_api_application_tls_cert_add_reply_t * mp)
398 ECHO_FAIL (ECHO_FAIL_VL_API_TLS_CERT_ADD_REPLY,
399 "failed to add application tls cert");
404 (vl_api_application_tls_key_add_reply_t * mp)
407 ECHO_FAIL (ECHO_FAIL_VL_API_TLS_KEY_ADD_REPLY,
408 "failed to add application tls key");
420 #define foreach_quic_echo_msg \ 421 _(BIND_URI_REPLY, bind_uri_reply) \ 422 _(UNBIND_URI_REPLY, unbind_uri_reply) \ 423 _(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \ 424 _(APPLICATION_ATTACH_REPLY, application_attach_reply) \ 425 _(APPLICATION_DETACH_REPLY, application_detach_reply) \ 426 _(MAP_ANOTHER_SEGMENT, map_another_segment) \ 427 _(UNMAP_SEGMENT, unmap_segment) \ 428 _(APPLICATION_TLS_CERT_ADD_REPLY, application_tls_cert_add_reply) \ 429 _(APPLICATION_TLS_KEY_ADD_REPLY, application_tls_key_add_reply) \ 430 _(CONNECT_URI_REPLY, connect_uri_reply) \ 436 vl_msg_api_set_handlers(VL_API_##N, #n, \ 437 vl_api_##n##_t_handler, \ 439 vl_api_##n##_t_endian, \ 440 vl_api_##n##_t_print, \ 441 sizeof(vl_api_##n##_t), 1); #define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define hash_set(h, key, value)
static void vl_api_disconnect_session_reply_t_handler(vl_api_disconnect_session_reply_t *mp)
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static void vl_api_connect_uri_reply_t_handler(vl_api_connect_uri_reply_t *mp)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
static void vl_api_unbind_uri_reply_t_handler(vl_api_unbind_uri_reply_t *mp)
#define hash_unset(h, key)
echo_session_t * sessions
static void echo_segment_handle_add_del(echo_main_t *em, u64 segment_handle, u8 add)
svm_queue_t * vl_input_queue
#define clib_memcpy_fast(a, b, c)
static void vl_api_application_tls_cert_add_reply_t_handler(vl_api_application_tls_cert_add_reply_t *mp)
static u8 * format_api_error(u8 *s, va_list *args)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
volatile connection_state_t state
void * vl_msg_api_alloc(int nbytes)
void echo_send_disconnect_session(u64 handle, u32 opaque)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static void vl_api_application_attach_reply_t_handler(vl_api_application_attach_reply_t *mp)
void(* connected_cb)(session_connected_bundled_msg_t *mp, u32 session_index, u8 is_failed)
enum ssvm_segment_type_ ssvm_segment_type_t
void echo_send_attach(echo_main_t *em)
static const u32 test_srv_key_rsa_len
static int ssvm_segment_attach(char *name, ssvm_segment_type_t type, int fd)
clib_spinlock_t segment_handles_lock
#define ECHO_FAIL(fail, _fmt, _args...)
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
char * segment_name
segment name
static void vl_api_map_another_segment_t_handler(vl_api_map_another_segment_t *mp)
vl_api_fib_path_type_t type
int fifo_segment_attach(fifo_segment_main_t *sm, fifo_segment_create_args_t *a)
Attach as slave to a fifo segment.
vpp->client unmap shared memory segment
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
client->vpp, attach application to session layer WILL BE DEPRECATED POST 20.01
void(* cleanup_cb)(echo_session_t *s, u8 parent_died)
void echo_api_hookup(echo_main_t *em)
static void vl_api_application_detach_reply_t_handler(vl_api_application_detach_reply_t *mp)
Unbind a given URI WILL BE DEPRECATED POST 20.01
static const char test_srv_crt_rsa[]
fifo_segment_main_t segment_main
u32 segment_size
size of the segment
void echo_send_connect(u8 *uri, u32 opaque)
clib_error_t * vl_socket_client_recv_fd_msg(int fds[], int n_fds, u32 wait)
svm_msg_q_t * our_event_queue
#define vec_free(V)
Free vector's memory (no header).
#define foreach_quic_echo_msg
uword * shared_segment_handles
#define ECHO_LOG(lvl, _fmt, _args...)
int memfd_fd
fd for memfd segments
Application attach reply WILL BE DEPRECATED POST 20.01
static const char test_srv_key_rsa[]
void(* disconnected_reply_cb)(echo_session_t *s)
#define uword_to_pointer(u, type)
u64 app_event_queue_address
client->vpp, attach application to session layer WILL BE DEPRECATED POST 20.01
void echo_send_unbind(echo_main_t *em)
vpp->client, please map an additional shared memory segment
echo_session_t * echo_get_session_from_handle(echo_main_t *em, u64 handle)
void svm_msg_q_set_consumer_eventfd(svm_msg_q_t *mq, int fd)
Set event fd for queue consumer.
static void vl_api_bind_uri_reply_t_handler(vl_api_bind_uri_reply_t *mp)
ssvm_segment_type_t segment_type
type of segment requested
void echo_send_detach(echo_main_t *em)
bidirectional disconnect API WILL BE DEPRECATED POST 20.01
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Bind to a given URI WILL BE DEPRECATED POST 20.01
void echo_send_listen(echo_main_t *em)
static void vl_api_application_tls_key_add_reply_t_handler(vl_api_application_tls_key_add_reply_t *mp)
Application add TLS certificate.
echo_proto_cb_vft_t * proto_cb_vft
static void vl_api_unmap_segment_t_handler(vl_api_unmap_segment_t *mp)
Connect to a given URI WILL BE DEPRECATED POST 20.01
bidirectional disconnect reply API WILL BE DEPRECATED POST 20.01
static const u32 test_srv_crt_rsa_len
u32 * new_segment_indices
return vec of new seg indices