|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
21 #define REPLY_MSG_ID_BASE msg_id_base
39 bmp->
context = ntohl (0xfeedface);
66 bmp->
context = ntohl (0xfeedface);
83 bmp->
context = ntohl (0xfeedface);
84 bmp->
cert_len = clib_host_to_net_u16 (cert_len);
101 bmp->
context = ntohl (0xfeedface);
109 return proto == TRANSPORT_PROTO_TLS ||
proto == TRANSPORT_PROTO_DTLS ||
110 proto == TRANSPORT_PROTO_QUIC;
123 memset (&cfg, 0,
sizeof (cfg));
125 cfg.
len =
sizeof (cfg);
140 memset (mp, 0,
sizeof (*mp));
142 mp->
context = ntohl (0xfeedface);
162 memset (mp, 0,
sizeof (*mp));
184 memset (mp, 0,
sizeof (*mp));
211 memset (mp, 0,
sizeof (*mp));
213 mp->
handle =
a->session_handle;
237 a->segment_name = (
char *)
name;
238 a->segment_type =
type;
250 a->new_segment_indices[0]);
263 ECHO_LOG (3,
"Check if segment mapped 0x%lx...", segment_handle);
271 ECHO_LOG (2,
"Segment not mapped (0x%lx)", segment_handle);
272 return ((
u32) *segment_idxp);
282 if (segment_index == (
u32) ~0)
298 u32 fs_index, eqs_index;
302 if (fs_index == (
u32) ~0)
304 ECHO_LOG (0,
"ERROR: segment for session %u is not mounted!",
309 if (mq_offset != (
uword) ~0)
320 s->rx_fifo->segment_index = fs_index;
321 s->tx_fifo->segment_index = fs_index;
322 s->rx_fifo->shr->client_session_index = s->session_index;
323 s->tx_fifo->shr->client_session_index = s->session_index;
325 if (mq_offset != (
uword) ~0)
329 s->rx_fifo->shr->slice_index);
346 if (fs_index == (
u32) ~0)
348 ECHO_LOG (0,
"ERROR: mq segment %lx for is not attached!",
373 if (fs_index == (
u32) ~0)
375 ECHO_LOG (0,
"ERROR: mq segment %lx for is not attached!",
404 ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_ADD_REPLY,
405 "Adding cert and key returned %d",
406 clib_net_to_host_u32 (mp->
retval));
412 ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_ADD_REPLY,
"Wrong state");
421 (vl_api_app_del_cert_key_pair_reply_t * mp)
426 ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_DEL_REPLY,
427 "Delete cert and key returned %d",
428 clib_net_to_host_u32 (mp->retval));
441 char *segment_name = 0;
448 ECHO_FAIL (ECHO_FAIL_VL_API_APP_ATTACH,
"attach failed: %U",
455 ECHO_FAIL (ECHO_FAIL_VL_API_NULL_APP_MQ,
"NULL app_mq");
465 "vl_socket_client_recv_fd_msg failed");
469 if (mp->
fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT)
473 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
474 "svm_fifo_segment_attach failed on SSVM_SEGMENT_MEMFD");
480 if (mp->
fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
487 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
488 "svm_fifo_segment_attach ('%s') "
489 "failed on SSVM_SEGMENT_MEMFD", segment_name);
497 if (mp->
fd_flags & SESSION_FD_F_MQ_EVENTFD)
509 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
510 "svm_fifo_segment_attach ('%s') "
511 "failed on SSVM_SEGMENT_SHM", segment_name);
517 ECHO_LOG (2,
"Mapped segment 0x%lx", segment_handle);
533 ECHO_FAIL (ECHO_FAIL_VL_API_DETACH_REPLY,
534 "app detach returned with err: %d", mp->retval);
540 #define foreach_quic_echo_msg \
541 _(APP_ATTACH_REPLY, app_attach_reply) \
542 _(APPLICATION_DETACH_REPLY, application_detach_reply) \
543 _(APP_ADD_CERT_KEY_PAIR_REPLY, app_add_cert_key_pair_reply) \
544 _(APP_DEL_CERT_KEY_PAIR_REPLY, app_del_cert_key_pair_reply)
546 #define vl_print(handle, ...) fformat (handle, __VA_ARGS__)
548 #include <vnet/session/session.api.h>
552 #include <vnet/session/session.api.h>
555 #define vl_api_version(n, v) static u32 api_version = v;
556 #include <vnet/session/session.api.h>
557 #undef vl_api_version
562 u8 *
name =
format (0,
"session_%08x%c", api_version, 0);
572 vl_msg_api_set_handlers (REPLY_MSG_ID_BASE + VL_API_##N, #n, \
573 vl_api_##n##_t_handler, vl_noop_handler, \
574 vl_api_##n##_t_endian, vl_api_##n##_t_print, \
575 sizeof (vl_api_##n##_t), 1);
#define hash_set(h, key, value)
uword fifo_segment_chunk_offset(fifo_segment_t *fs, svm_fifo_chunk_t *c)
int echo_segment_attach(u64 segment_handle, char *name, ssvm_segment_type_t type, int fd)
description security check failed
Application detach from session layer.
void fifo_segment_delete(fifo_segment_main_t *sm, fifo_segment_t *s)
@ APP_OPTIONS_RX_FIFO_SIZE
int echo_attach_session(uword segment_handle, uword rxf_offset, uword txf_offset, uword mq_offset, echo_session_t *s)
clib_error_t * vl_socket_client_recv_fd_msg(int fds[], int n_fds, u32 wait)
#define ECHO_FAIL(fail, _fmt, _args...)
fifo_segment_t * fifo_segment_get_segment(fifo_segment_main_t *sm, u32 segment_index)
void echo_api_hookup(echo_main_t *em)
svm_msg_q_t * fifo_segment_msg_q_attach(fifo_segment_t *fs, uword offset, u32 mq_index)
Attach message queue at fifo segment offset.
svm_fifo_t * fifo_segment_alloc_fifo_w_offset(fifo_segment_t *fs, uword offset)
static void echo_msg_add_crypto_ext_config(echo_main_t *em, uword *offset)
@ SESSION_CTRL_EVT_CONNECT
volatile connection_state_t state
svm_fifo_chunk_t * echo_segment_alloc_chunk(uword segment_handle, u32 slice_index, u32 size, uword *offset)
static void vl_api_app_del_cert_key_pair_reply_t_handler(vl_api_app_del_cert_key_pair_reply_t *mp)
@ APP_OPTIONS_SEGMENT_SIZE
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
@ APP_OPTIONS_NAMESPACE_SECRET
static void app_send_ctrl_evt_to_vpp(svm_msg_q_t *mq, app_session_evt_t *app_evt)
enum ssvm_segment_type_ ssvm_segment_type_t
#define REPLY_MSG_ID_BASE
#define hash_unset(h, key)
fifo_segment_main_t segment_main
foreach_app_session_field u64 vpp_session_handle
void echo_send_detach(echo_main_t *em)
#define ECHO_MQ_SEG_HANDLE
echo_proto_cb_vft_t * proto_cb_vft
@ SESSION_CTRL_EVT_UNLISTEN
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void echo_send_disconnect_session(echo_main_t *em, void *args)
Application attach to session layer.
static const char test_srv_key_rsa[]
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
static u8 * format_api_error(u8 *s, va_list *args)
int fifo_segment_attach(fifo_segment_main_t *sm, fifo_segment_create_args_t *a)
Attach as slave to a fifo segment.
#define foreach_quic_echo_msg
@ SESSION_CTRL_EVT_LISTEN
static void vl_api_application_detach_reply_t_handler(vl_api_application_detach_reply_t *mp)
int echo_segment_attach_mq(uword segment_handle, uword mq_offset, u32 mq_index, svm_msg_q_t **mq)
static u8 echo_transport_needs_crypto(transport_proto_t proto)
u32 echo_segment_lookup(u64 segment_handle)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static void app_alloc_ctrl_evt_to_vpp(svm_msg_q_t *mq, app_session_evt_t *app_evt, u8 evt_type)
void echo_send_connect(echo_main_t *em, void *args)
clib_spinlock_t segment_handles_lock
Delete certificate and key.
#define clib_atomic_sub_fetch(a, b)
@ APP_OPTIONS_PREALLOC_FIFO_PAIRS
svm_fifo_chunk_t * fifo_segment_alloc_chunk_w_slice(fifo_segment_t *fs, u32 slice_index, u32 chunk_size)
uword * shared_segment_handles
u16 vl_client_get_first_plugin_msg_id(const char *plugin_name)
volatile int max_sim_connects
#define vec_free(V)
Free vector's memory (no header).
void svm_msg_q_set_eventfd(svm_msg_q_t *mq, int fd)
Set event fd for queue.
template key/value backing page structure
@ APP_OPTIONS_TX_FIFO_SIZE
void echo_segment_detach(u64 segment_handle)
static void vl_api_app_attach_reply_t_handler(vl_api_app_attach_reply_t *mp)
int vl_api_vec_to_api_string(const u8 *vec, vl_api_string_t *str)
static const char test_srv_crt_rsa[]
@ APP_OPTIONS_ADD_SEGMENT_SIZE
description fragment has unexpected format
static void vl_api_app_add_cert_key_pair_reply_t_handler(vl_api_app_add_cert_key_pair_reply_t *mp)
void echo_send_unbind(echo_main_t *em, echo_session_t *s)
enum _transport_proto transport_proto_t
@ APP_OPTIONS_EVT_QUEUE_SIZE
static const u32 test_srv_crt_rsa_len
svm_queue_t * vl_input_queue
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
@ SESSION_CTRL_EVT_DISCONNECT
Application attach reply.
#define ECHO_LOG(lvl, _fmt, _args...)
struct echo_main_t::@691 uri_elts
void(* sent_disconnect_cb)(echo_session_t *s)
void echo_send_attach(echo_main_t *em)
void echo_send_listen(echo_main_t *em, ip46_address_t *ip)
char * vl_api_from_api_to_new_c_string(vl_api_string_t *astr)
transport_endpt_crypto_cfg_t crypto
void echo_send_add_cert_key(echo_main_t *em)
@ TRANSPORT_ENDPT_EXT_CFG_CRYPTO
vl_api_fib_path_type_t type
void echo_send_del_cert_key(echo_main_t *em)
echo_session_t * echo_get_session_from_handle(echo_main_t *em, u64 handle)
static const u32 test_srv_key_rsa_len
void * vl_msg_api_alloc(int nbytes)