|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
34 bmp->_vl_msg_id =
ntohs (VL_API_APP_ATTACH);
36 bmp->
context = ntohl (0xfeedface);
61 bmp->_vl_msg_id =
ntohs (VL_API_APPLICATION_DETACH);
63 bmp->
context = ntohl (0xfeedface);
78 bmp->_vl_msg_id =
ntohs (VL_API_APP_ADD_CERT_KEY_PAIR);
80 bmp->
context = ntohl (0xfeedface);
81 bmp->
cert_len = clib_host_to_net_u16 (cert_len);
96 bmp->_vl_msg_id =
ntohs (VL_API_APP_DEL_CERT_KEY_PAIR);
98 bmp->
context = ntohl (0xfeedface);
106 return proto == TRANSPORT_PROTO_TLS ||
proto == TRANSPORT_PROTO_DTLS ||
107 proto == TRANSPORT_PROTO_QUIC;
120 memset (&cfg, 0,
sizeof (cfg));
122 cfg.
len =
sizeof (cfg);
137 memset (mp, 0,
sizeof (*mp));
139 mp->
context = ntohl (0xfeedface);
159 memset (mp, 0,
sizeof (*mp));
181 memset (mp, 0,
sizeof (*mp));
208 memset (mp, 0,
sizeof (*mp));
210 mp->
handle =
a->session_handle;
234 a->segment_name = (
char *)
name;
235 a->segment_type =
type;
247 a->new_segment_indices[0]);
260 ECHO_LOG (3,
"Check if segment mapped 0x%lx...", segment_handle);
268 ECHO_LOG (2,
"Segment not mapped (0x%lx)", segment_handle);
269 return ((
u32) *segment_idxp);
279 if (segment_index == (
u32) ~0)
295 u32 fs_index, eqs_index;
299 if (fs_index == (
u32) ~0)
301 ECHO_LOG (0,
"ERROR: segment for session %u is not mounted!",
306 if (mq_offset != (
uword) ~0)
317 s->rx_fifo->segment_index = fs_index;
318 s->tx_fifo->segment_index = fs_index;
319 s->rx_fifo->shr->client_session_index = s->session_index;
320 s->tx_fifo->shr->client_session_index = s->session_index;
322 if (mq_offset != (
uword) ~0)
326 s->rx_fifo->shr->slice_index);
343 if (fs_index == (
u32) ~0)
345 ECHO_LOG (0,
"ERROR: mq segment %lx for is not attached!",
370 if (fs_index == (
u32) ~0)
372 ECHO_LOG (0,
"ERROR: mq segment %lx for is not attached!",
401 ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_ADD_REPLY,
402 "Adding cert and key returned %d",
403 clib_net_to_host_u32 (mp->
retval));
409 ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_ADD_REPLY,
"Wrong state");
418 (vl_api_app_del_cert_key_pair_reply_t * mp)
423 ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_DEL_REPLY,
424 "Delete cert and key returned %d",
425 clib_net_to_host_u32 (mp->retval));
438 char *segment_name = 0;
445 ECHO_FAIL (ECHO_FAIL_VL_API_APP_ATTACH,
"attach failed: %U",
452 ECHO_FAIL (ECHO_FAIL_VL_API_NULL_APP_MQ,
"NULL app_mq");
462 "vl_socket_client_recv_fd_msg failed");
466 if (mp->
fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT)
470 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
471 "svm_fifo_segment_attach failed on SSVM_SEGMENT_MEMFD");
477 if (mp->
fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
484 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
485 "svm_fifo_segment_attach ('%s') "
486 "failed on SSVM_SEGMENT_MEMFD", segment_name);
494 if (mp->
fd_flags & SESSION_FD_F_MQ_EVENTFD)
506 ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
507 "svm_fifo_segment_attach ('%s') "
508 "failed on SSVM_SEGMENT_SHM", segment_name);
514 ECHO_LOG (2,
"Mapped segment 0x%lx", segment_handle);
530 ECHO_FAIL (ECHO_FAIL_VL_API_DETACH_REPLY,
531 "app detach returned with err: %d", mp->retval);
537 #define foreach_quic_echo_msg \
538 _(APP_ATTACH_REPLY, app_attach_reply) \
539 _(APPLICATION_DETACH_REPLY, application_detach_reply) \
540 _(APP_ADD_CERT_KEY_PAIR_REPLY, app_add_cert_key_pair_reply) \
541 _(APP_DEL_CERT_KEY_PAIR_REPLY, app_del_cert_key_pair_reply)
547 vl_msg_api_set_handlers(VL_API_##N, #n, \
548 vl_api_##n##_t_handler, \
550 vl_api_##n##_t_endian, \
551 vl_api_##n##_t_print, \
552 sizeof(vl_api_##n##_t), 1);
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
fifo_segment_main_t segment_main
foreach_app_session_field u64 vpp_session_handle
#define hash_set(h, key, value)
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)
sll srl srl sll sra u16x4 i
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
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
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)
struct echo_main_t::@681 uri_elts
#define hash_unset(h, key)
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...)
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)