|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
15 #ifndef __included_uri_h__
16 #define __included_uri_h__
80 #define foreach_app_init_args \
81 _(u32, api_client_index) \
84 _(u8 *, namespace_id) \
85 _(session_cb_vft_t *, session_cb_vft) \
89 typedef struct _vnet_app_attach_args_t
91 #define _(_type, _name) _type _name;
99 typedef struct _vnet_app_detach_args_t
102 u32 api_client_index;
105 typedef struct _vnet_bind_args_t
123 typedef struct _vnet_unlisten_args_t
134 typedef struct _vnet_connect_args
150 typedef struct _vnet_shutdown_args_t
156 typedef struct _vnet_disconnect_args_t
162 typedef struct _vnet_application_add_tls_cert_args_t
168 typedef struct _vnet_application_add_tls_key_args_t
184 typedef struct _vnet_app_add_cert_key_pair_args_
226 #define foreach_app_options_flags \
227 _(ACCEPT_REDIRECT, "Use FIFO with redirects") \
228 _(ADD_SEGMENT, "Add segment and signal app if needed") \
229 _(IS_BUILTIN, "Application is builtin") \
230 _(IS_TRANSPORT_APP, "Application is a transport proto") \
231 _(IS_PROXY, "Application is proxying") \
232 _(USE_GLOBAL_SCOPE, "App can use global session scope") \
233 _(USE_LOCAL_SCOPE, "App can use local session scope") \
234 _(EVT_MQ_USE_EVENTFD, "Use eventfds for signaling") \
236 typedef enum _app_options
238 #define _(sym, str) APP_OPTIONS_##sym,
243 typedef enum _app_options_flags
245 #define _(sym, str) APP_OPTIONS_FLAGS_##sym = 1 << APP_OPTIONS_##sym,
250 #define foreach_fd_type \
251 _(VPP_MQ_SEGMENT, "Fd for vpp's event mq segment") \
252 _(MEMFD_SEGMENT, "Fd for memfd segment") \
253 _(MQ_EVENTFD, "Event fd used by message queue") \
254 _(VPP_MQ_EVENTFD, "Event fd used by vpp's message queue") \
258 #define _(sym, str) SESSION_FD_##sym,
266 #define _(sym, str) SESSION_FD_F_##sym = 1 << SESSION_FD_##sym,
298 #define foreach_app_session_field \
299 _(svm_fifo_t, *rx_fifo) \
300 _(svm_fifo_t, *tx_fifo) \
301 _(session_type_t, session_type) \
302 _(volatile u8, session_state) \
303 _(u32, session_index) \
304 _(app_session_transport_t, transport) \
305 _(svm_msg_q_t, *vpp_evt_q) \
310 #define _(type, name) type name;
583 app_evt->
evt->event_type = evt_type;
608 session_event_t *evt;
623 evt->session_index = session_index;
624 evt->event_type = evt_type;
636 evt->session_index = session_index;
637 evt->event_type = evt_type;
646 u8 do_evt,
u8 noblock)
742 &&
len >=
ph.data_length)
791 #define _(sym, str) str,
830 "Out of options, fix message definition");
887 sep_ext->ext_cfg = cfg;
static u8 svm_fifo_set_event(svm_fifo_t *f)
Set fifo event flag.
void * data
protocol specific data
@ APP_SAPI_MSG_TYPE_ATTACH_REPLY
enum crypto_engine_type_ crypto_engine_type_t
struct crypto_ctx_ crypto_context_t
enum session_error_ session_error_t
static char * session_error_str[]
int vnet_connect_uri(vnet_connect_args_t *a)
#define SESSION_CTRL_MSG_MAX_SIZE
struct app_session_transport_ app_session_transport_t
enum _app_options app_options_t
@ APP_OPTIONS_RX_FIFO_SIZE
static int app_send_stream_raw(svm_fifo_t *f, svm_msg_q_t *vpp_evt_q, u8 *data, u32 len, u8 evt_type, u8 do_evt, u8 noblock)
static void svm_fifo_unset_event(svm_fifo_t *f)
Unset fifo event flag.
@ APP_OPTIONS_HIGH_WATERMARK
void svm_msg_q_add_and_unlock(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Producer enqueue one message to queue with mutex held.
@ APP_SAPI_MSG_TYPE_ADD_DEL_WORKER
int vnet_listen(vnet_listen_args_t *a)
svm_msg_q_msg_t svm_msg_q_alloc_msg_w_ring(svm_msg_q_t *mq, u32 ring_index)
Allocate message buffer on ring.
static int svm_msg_q_try_lock(svm_msg_q_t *mq)
Try locking message queue.
app_sapi_worker_add_del_reply_msg_t worker_add_del_reply
struct session_accepted_reply_msg_ session_accepted_reply_msg_t
static int app_recv_dgram(app_session_t *s, u8 *buf, u32 len)
void * svm_msg_q_msg_data(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Get data for message in queue.
int svm_fifo_peek(svm_fifo_t *f, u32 offset, u32 len, u8 *dst)
Peek data from fifo.
static int app_send_stream(app_session_t *s, u8 *data, u32 len, u8 noblock)
int(* builtin_app_rx_callback)(session_t *session)
Direct RX callback for built-in application.
struct _session_endpoint_cfg session_endpoint_cfg_t
static int app_recv_stream_raw(svm_fifo_t *f, u8 *buf, u32 len, u8 clear_evt, u8 peek)
uword vpp_event_queue_address
ip46_address_t rmt_ip
remote ip
static int svm_msg_q_lock(svm_msg_q_t *mq)
Lock, or block trying, the message queue.
static int app_send_io_evt_to_vpp(svm_msg_q_t *mq, u32 session_index, u8 evt_type, u8 noblock)
Send fifo io event to vpp worker thread.
Unidirectional shared-memory multi-ring message queue.
static int app_recv_dgram_raw(svm_fifo_t *f, u8 *buf, u32 len, app_session_transport_t *at, u8 clear_evt, u8 peek)
struct session_disconnected_reply_msg_ session_disconnected_reply_msg_t
struct session_reset_msg_ session_reset_msg_t
u64 app_event_queue_address
struct _vnet_unlisten_args_t vnet_unlisten_args_t
u32 n_subscribers
refcount of sessions using said context
@ APP_OPTIONS_SEGMENT_SIZE
int vnet_app_add_cert_key_interest(u32 index, u32 app_index)
Ask for app cb on pair deletion.
struct session_worker_update_reply_msg_ session_worker_update_reply_msg_t
struct session_reset_reply_msg_ session_reset_reply_msg_t
struct _vnet_app_detach_args_t vnet_app_detach_args_t
struct session_unlisten_msg_ session_unlisten_msg_t
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
int vnet_app_del_cert_key_pair(u32 index)
@ APP_OPTIONS_NAMESPACE_SECRET
static void app_send_ctrl_evt_to_vpp(svm_msg_q_t *mq, app_session_evt_t *app_evt)
static int app_recv(app_session_t *s, u8 *data, u32 len)
struct session_listen_msg_ session_listen_msg_t
@ APP_OPTIONS_PROXY_TRANSPORT
#define SESSION_CONN_HDR_LEN
struct _vnet_shutdown_args_t vnet_shutdown_args_t
pool_header_t * ph(void *p)
GDB callable function: ph - call pool_header - get pool header.
int(* session_accept_callback)(session_t *new_session)
Notify server of newly accepted session.
u16 lcl_port
local port (network order)
enum app_sapi_msg_type app_sapi_msg_type_e
struct _svm_fifo svm_fifo_t
void(* session_cleanup_callback)(session_t *s, session_cleanup_ntf_t ntf)
Notify app that session or transport are about to be removed.
int svm_msg_q_wait_prod(svm_msg_q_t *mq)
Wait for message queue event as producer.
enum session_ft_action_ session_ft_action_t
int vnet_application_attach(vnet_app_attach_args_t *a)
Attach application to vpp.
static void session_endpoint_alloc_ext_cfg(session_endpoint_cfg_t *sep_ext, transport_endpt_ext_cfg_type_t type)
static u8 svm_msg_q_is_full(svm_msg_q_t *mq)
Check if message queue is full.
struct app_sapi_attach_msg_ app_sapi_attach_msg_t
struct _vnet_disconnect_args_t vnet_disconnect_args_t
int vnet_app_add_cert_key_pair(vnet_app_add_cert_key_pair_args_t *a)
struct app_sapi_worker_add_del_reply_msg_ app_sapi_worker_add_del_reply_msg_t
int svm_fifo_dequeue(svm_fifo_t *f, u32 len, u8 *dst)
Dequeue data from fifo.
struct session_transport_attr_msg_ session_transport_attr_msg_t
int vnet_bind_uri(vnet_listen_args_t *)
struct session_shutdown_msg_ session_shutdown_msg_t
session_handle_t new_handle
struct session_disconnect_msg_ session_disconnect_msg_t
struct _vnet_bind_args_t vnet_listen_args_t
struct session_cb_vft_ session_cb_vft_t
static int app_send(app_session_t *s, u8 *data, u32 len, u8 noblock)
ip46_address_t lcl_ip
local ip
struct app_unmap_segment_msg_ session_app_del_segment_msg_t
struct certificate_ app_cert_key_pair_t
int vnet_application_detach(vnet_app_detach_args_t *a)
Detach application from vpp.
int svm_fifo_enqueue_segments(svm_fifo_t *f, const svm_fifo_seg_t segs[], u32 n_segs, u8 allow_partial)
Enqueue array of svm_fifo_seg_t in order.
void(* session_disconnect_callback)(session_t *s)
Notify app that session is closing.
static int app_recv_stream(app_session_t *s, u8 *buf, u32 len)
void(* session_migrate_callback)(session_t *s, session_handle_t new_sh)
Notify app that session pool migration happened.
struct app_sapi_attach_reply_msg_ app_sapi_attach_reply_msg_t
transport_endpt_attr_t attr
struct session_connected_msg_ session_connected_msg_t
u32 client_index
app client index
int svm_fifo_dequeue_drop(svm_fifo_t *f, u32 len)
Dequeue and drop bytes from fifo.
struct app_sapi_worker_add_del_msg_ app_sapi_worker_add_del_msg_t
int svm_fifo_enqueue(svm_fifo_t *f, u32 len, const u8 *src)
Enqueue data to fifo.
int vnet_disconnect_session(vnet_disconnect_args_t *a)
struct session_connect_uri_msg_ session_connect_uri_msg_t
void(* session_reset_callback)(session_t *s)
Notify app that session was reset.
struct session_app_wrk_rpc_msg_ session_app_wrk_rpc_msg_t
@ APP_OPTIONS_ACCEPT_COOKIE
static int app_send_dgram_raw(svm_fifo_t *f, app_session_transport_t *at, svm_msg_q_t *vpp_evt_q, u8 *data, u32 len, u8 evt_type, u8 do_evt, u8 noblock)
static void app_alloc_ctrl_evt_to_vpp(svm_msg_q_t *mq, app_session_evt_t *app_evt, u8 evt_type)
struct session_cleanup_msg_ session_cleanup_msg_t
static int app_send_dgram(app_session_t *s, u8 *data, u32 len, u8 noblock)
#define foreach_app_init_args
app_sapi_attach_reply_msg_t attach_reply
app_sapi_worker_add_del_msg_t worker_add_del
struct _vnet_app_add_cert_key_pair_args_ vnet_app_add_cert_key_pair_args_t
u32 wrk_index
dst worker index
@ APP_OPTIONS_PREALLOC_FIFO_PAIRS
int vnet_unlisten(vnet_unlisten_args_t *a)
int vnet_connect(vnet_connect_args_t *a)
@ APP_SAPI_MSG_TYPE_SEND_FDS
int parse_uri(char *uri, session_endpoint_cfg_t *sep)
struct app_sapi_msg_ app_sapi_msg_t
u32 ctx_index
index in crypto context pool
int(* add_segment_callback)(u32 app_wrk_index, u64 segment_handle)
Notify server of new segment.
@ APP_OPTIONS_TX_FIFO_SIZE
@ APP_SAPI_MSG_TYPE_ADD_DEL_WORKER_REPLY
struct session_transport_attr_reply_msg_ session_transport_attr_reply_msg_t
enum session_fd_flag_ session_fd_flag_t
void(* session_transport_closed_callback)(session_t *s)
Notify app that transport is closed.
struct transport_endpt_ext_cfg_ transport_endpt_ext_cfg_t
static u32 svm_fifo_max_enqueue_prod(svm_fifo_t *f)
Maximum number of bytes that can be enqueued into fifo.
enum session_fd_type_ session_fd_type_t
@ APP_OPTIONS_ADD_SEGMENT_SIZE
int vnet_unbind_uri(vnet_unlisten_args_t *a)
description fragment has unexpected format
struct session_connect_msg_ session_connect_msg_t
static u8 * format_session_error(u8 *s, va_list *args)
static struct option options[]
enum _app_options_flags app_options_flags_t
@ APP_OPTIONS_EVT_QUEUE_SIZE
struct _session_endpoint session_endpoint_t
transport_endpt_attr_t attr
struct session_listen_uri_msg_ session_listen_uri_msg_t
struct _vnet_connect_args vnet_connect_args_t
#define foreach_app_session_field
flag for dgram mode
struct session_disconnected_msg_ session_disconnected_msg_t
int(* session_connected_callback)(u32 app_wrk_index, u32 opaque, session_t *s, session_error_t code)
Connection request callback.
struct session_worker_update_msg_ session_worker_update_msg_t
struct session_bound_msg_ session_bound_msg_t
int(* del_segment_callback)(u32 app_wrk_index, u64 segment_handle)
Notify server of new segment.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
int svm_msg_q_lock_and_alloc_msg_w_ring(svm_msg_q_t *mq, u32 ring_index, u8 noblock, svm_msg_q_msg_t *msg)
Lock message queue and allocate message buffer on ring.
struct session_accepted_msg_ session_accepted_msg_t
#define foreach_app_options_flags
struct session_app_detach_msg_ session_app_detach_msg_t
STATIC_ASSERT(sizeof(session_listen_msg_t)<=SESSION_CTRL_MSG_MAX_SIZE, "msg too large")
int(* builtin_app_tx_callback)(session_t *session)
Direct TX callback for built-in application.
struct session_unlisten_reply_msg_ session_unlisten_reply_msg_t
app_sapi_attach_msg_t attach
@ APP_SAPI_MSG_TYPE_ATTACH
struct session_migrate_msg_ session_migrated_msg_t
int(* fifo_tuning_callback)(session_t *s, svm_fifo_t *f, session_ft_action_t act, u32 bytes)
Delegate fifo-tuning-logic to application.
enum transport_endpt_ext_cfg_type_ transport_endpt_ext_cfg_type_t
u16 rmt_port
remote port (network order)
@ APP_OPTIONS_PREALLOC_FIFO_HDRS
struct app_session_event_ app_session_evt_t
struct _vnet_app_attach_args_t vnet_app_attach_args_t
@ APP_OPTIONS_PCT_FIRST_ALLOC
@ SVM_Q_WAIT
blocking call - best used in combination with condvars, for eventfds we don't yield the cpu
int vnet_shutdown_session(vnet_shutdown_args_t *a)
int(* app_cert_key_pair_delete_callback)(app_cert_key_pair_t *ckpair)
Cert and key pair delete notification.
@ SESSION_MQ_CTRL_EVT_RING
static u8 svm_msg_q_ring_is_full(svm_msg_q_t *mq, u32 ring_index)
u32 ckpair_index
certificate & key
static u32 svm_fifo_max_dequeue_cons(svm_fifo_t *f)
Fifo max bytes to dequeue optimized for consumer.
uword vpp_event_queue_address
@ APP_OPTIONS_MAX_FIFO_SIZE
app_attach_options_index_t
void(* half_open_cleanup_callback)(session_t *s)
Notify app that half open state was cleaned up (optional)
static void * clib_mem_alloc(uword size)
vl_api_fib_path_type_t type
@ APP_OPTIONS_PRIVATE_SEGMENT_COUNT
struct _vnet_application_add_tls_key_args_t vnet_app_add_tls_key_args_t
@ APP_OPTIONS_LOW_WATERMARK
struct app_map_another_segment_msg_ session_app_add_segment_msg_t
struct _vnet_application_add_tls_cert_args_t vnet_app_add_tls_cert_args_t
struct session_req_worker_update_msg_ session_req_worker_update_msg_t
u8 is_ip4
set if uses ip4 networking
static void svm_msg_q_unlock(svm_msg_q_t *mq)
Unlock message queue.