|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
27 #include <vnet/session/session.api_enum.h>
28 #include <vnet/session/session.api_types.h>
30 #define REPLY_MSG_ID_BASE session_main.msg_id_base
39 return TRANSPORT_PROTO_TCP;
41 return TRANSPORT_PROTO_UDP;
43 return TRANSPORT_PROTO_TLS;
45 return TRANSPORT_PROTO_QUIC;
47 return TRANSPORT_PROTO_NONE;
51 static vl_api_transport_proto_t
56 case TRANSPORT_PROTO_TCP:
58 case TRANSPORT_PROTO_UDP:
60 case TRANSPORT_PROTO_TLS:
62 case TRANSPORT_PROTO_QUIC:
74 return SESSION_E_BAPI_NO_FD;
79 return SESSION_E_BAPI_SEND_FD;
118 session_event_t *evt;
159 m.
rmt.port = ct->c_rmt_port;
160 m.
lcl.port = ct->c_lcl_port;
169 return SESSION_E_MQ_MSG_ALLOC;
187 session_event_t *evt;
194 evt->event_type = evt_type;
213 for (
i = 0;
i <
f->shr->n_subscribers;
i++)
258 session_event_t *evt;
278 m.
retval = SESSION_E_REFUSED;
300 m.
lcl.port = cct->c_lcl_port;
301 m.
lcl.is_ip4 = cct->c_is_ip4;
316 s->
rx_fifo->shr->client_session_index = api_context;
317 s->
tx_fifo->shr->client_session_index = api_context;
324 return SESSION_E_MQ_MSG_ALLOC;
345 session_event_t *evt;
387 return SESSION_E_MQ_MSG_ALLOC;
405 session_event_t *evt;
428 session_event_t *evt;
464 session_event_t *evt;
490 fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
525 session_event_t *evt;
557 session_event_t *evt;
596 vl_api_session_enable_disable_reply_t *rmp;
607 int rv = 0, *fds = 0, n_fds = 0, n_workers,
i;
611 u8 fd_flags = 0, ctrl_thread;
623 rv = VNET_API_ERROR_FEATURE_DISABLED;
629 rv = VNET_API_ERROR_APP_UNSUPPORTED_CFG;
635 "Out of options, fix api message definition");
657 fd_flags |= SESSION_FD_F_VPP_MQ_SEGMENT;
658 fds[n_fds] = rx_mqs_seg->
ssvm.
fd;
664 fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
665 fds[n_fds] =
a->segment->fd;
670 fd_flags |= SESSION_FD_F_MQ_EVENTFD;
677 fd_flags |= SESSION_FD_F_VPP_MQ_EVENTFD;
678 for (
i = 0;
i < n_workers + 1;
i++)
691 ctrl_thread = n_workers ? 1 : 0;
693 rmp->
app_index = clib_host_to_net_u32 (
a->app_index);
725 rv = VNET_API_ERROR_FEATURE_DISABLED;
736 rv = VNET_API_ERROR_INVALID_VALUE;
742 .wrk_map_index = clib_net_to_host_u32 (mp->
wrk_index),
759 fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
760 fds[n_fds] = args.segment->fd;
765 fd_flags |= SESSION_FD_F_MQ_EVENTFD;
774 rmp->
wrk_index = clib_host_to_net_u32 (args.wrk_map_index);
782 if (
vec_len (args.segment->name))
797 vl_api_application_detach_reply_t *rmp;
798 int rv = VNET_API_ERROR_INVALID_VALUE_2;
804 rv = VNET_API_ERROR_FEATURE_DISABLED;
829 rv = VNET_API_ERROR_FEATURE_DISABLED;
839 .secret = clib_net_to_host_u64 (mp->
secret),
840 .sw_if_index = clib_net_to_host_u32 (mp->
sw_if_index),
841 .ip4_fib_id = clib_net_to_host_u32 (mp->
ip4_fib_id),
842 .ip6_fib_id = clib_net_to_host_u32 (mp->
ip6_fib_id),
852 rv = VNET_API_ERROR_UNSPECIFIED;
861 rmp->
appns_index = clib_host_to_net_u32 (appns_index);
871 u8 *ns_id = 0, *netns = 0;
877 rv = VNET_API_ERROR_FEATURE_DISABLED;
890 .secret = clib_net_to_host_u64 (mp->
secret),
891 .sw_if_index = clib_net_to_host_u32 (mp->
sw_if_index),
892 .ip4_fib_id = clib_net_to_host_u32 (mp->
ip4_fib_id),
893 .ip6_fib_id = clib_net_to_host_u32 (mp->
ip6_fib_id),
903 rv = VNET_API_ERROR_UNSPECIFIED;
912 rmp->
appns_index = clib_host_to_net_u32 (appns_index);
921 u8 *ns_id = 0, *netns = 0, *sock_name = 0;
926 rv = VNET_API_ERROR_FEATURE_DISABLED;
937 .sock_name = sock_name,
938 .secret = clib_net_to_host_u64 (mp->
secret),
939 .sw_if_index = clib_net_to_host_u32 (mp->
sw_if_index),
940 .ip4_fib_id = clib_net_to_host_u32 (mp->
ip4_fib_id),
941 .ip6_fib_id = clib_net_to_host_u32 (mp->
ip6_fib_id),
951 rv = VNET_API_ERROR_UNSPECIFIED;
960 rmp->
appns_index = clib_host_to_net_u32 (appns_index);
967 vl_api_session_rule_add_del_reply_t *rmp;
977 table_args->lcl_port = mp->
lcl_port;
978 table_args->rmt_port = mp->
rmt_port;
979 table_args->action_index = clib_net_to_host_u32 (mp->
action_index);
980 table_args->is_add = mp->
is_add;
981 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
982 table_args->tag =
format (0,
"%s", mp->
tag);
983 args.appns_index = clib_net_to_host_u32 (mp->
appns_index);
984 args.scope = mp->
scope;
985 args.transport_proto =
987 TRANSPORT_PROTO_UDP ? 1 : 0;
1002 session_mask_or_match_4_t *match =
1003 (session_mask_or_match_4_t *) & rule->match;
1004 session_mask_or_match_4_t *
mask =
1005 (session_mask_or_match_4_t *) & rule->mask;
1024 rmp->
action_index = clib_host_to_net_u32 (rule->action_index);
1028 rmp->
appns_index = clib_host_to_net_u32 (appns_index);
1044 session_mask_or_match_6_t *match =
1045 (session_mask_or_match_6_t *) & rule->match;
1046 session_mask_or_match_6_t *
mask =
1047 (session_mask_or_match_6_t *) & rule->mask;
1066 rmp->
action_index = clib_host_to_net_u32 (rule->action_index);
1070 rmp->
appns_index = clib_host_to_net_u32 (appns_index);
1085 mma_rule_16_t *rule16;
1086 mma_rule_40_t *rule40;
1087 mma_rules_table_16_t *srt16;
1088 mma_rules_table_40_t *srt40;
1095 srt16 = &srt->session_rules_tables_16;
1097 ri = mma_rules_table_rule_index_16 (srt16, rule16);
1108 srt40 = &srt->session_rules_tables_40;
1110 ri = mma_rules_table_rule_index_40 (srt40, rule40);
1135 st->active_fib_proto, tp,
1136 st->is_local, st->appns_index, reg,
1152 rv = VNET_API_ERROR_FEATURE_DISABLED;
1156 cert_len = clib_net_to_host_u16 (mp->
cert_len);
1157 if (cert_len > 10000)
1159 rv = VNET_API_ERROR_INVALID_VALUE;
1163 certkey_len = clib_net_to_host_u16 (mp->
certkey_len);
1164 if (certkey_len < cert_len)
1166 rv = VNET_API_ERROR_INVALID_VALUE;
1170 key_len = certkey_len - cert_len;
1173 rv = VNET_API_ERROR_INVALID_VALUE;
1180 a->cert_len = cert_len;
1188 rmp->
index = clib_host_to_net_u32 (
a->index);
1196 vl_api_app_del_cert_key_pair_reply_t *rmp;
1201 rv = VNET_API_ERROR_FEATURE_DISABLED;
1204 ckpair_index = clib_net_to_host_u32 (mp->
index);
1219 a->api_client_index = client_index;
1259 session_event_t *evt;
1271 fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
1272 fds[n_fds] = sp->
fd;
1309 session_event_t *evt;
1344 int rv = 0, *fds = 0, n_fds = 0,
i, n_workers;
1347 u8 fd_flags = 0, ctrl_thread;
1363 a->use_sock_api = 1;
1379 fd_flags |= SESSION_FD_F_VPP_MQ_SEGMENT;
1380 fds[n_fds] = rx_mqs_seg->
ssvm.
fd;
1386 fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
1387 fds[n_fds] =
a->segment->fd;
1392 fd_flags |= SESSION_FD_F_MQ_EVENTFD;
1399 fd_flags |= SESSION_FD_F_VPP_MQ_EVENTFD;
1400 for (
i = 0;
i < n_workers + 1;
i++)
1415 ctrl_thread = n_workers ? 1 : 0;
1431 handle->aah_app_wrk_index = app_wrk->
wrk_index;
1443 u16 sock_index = api_handle & 0xffff;
1470 u32 sapi_handle = -1;
1477 rv = VNET_API_ERROR_INVALID_VALUE;
1486 .api_client_index = sapi_handle,
1502 fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
1503 fds[n_fds] = args.segment->fd;
1508 fd_flags |= SESSION_FD_F_MQ_EVENTFD;
1533 handle->aah_app_wrk_index = app_wrk->
wrk_index;
1550 const u32 max_certkey_len = 2e4, max_cert_len = 1e4, max_key_len = 1e4;
1557 rv = SESSION_E_INVALID;
1567 rv = SESSION_E_INVALID;
1573 rv = SESSION_E_INVALID;
1579 rv = SESSION_E_INVALID;
1586 rv = SESSION_E_INVALID;
1621 u32 api_client_handle;
1632 .api_client_index = api_client_handle,
1680 handle->aah_app_wrk_index, msg.
type);
1694 clib_warning (
"called for app ns %u", handle->aah_app_ns_index);
1746 cf.file_descriptor = ccs->fd;
1749 cf.private_data = handle.as_u64;
1750 cf.description =
format (0,
"app sock conn fd: %d", ccs->fd);
1756 ccs->private_data = handle.as_u64;
1785 char *subdir =
"/app_ns_sockets/";
1788 struct stat file_stat;
1795 if (!app_ns->sock_name)
1796 app_ns->sock_name =
format (0,
"@vpp/session/%v%c", app_ns->ns_id, 0);
1797 if (app_ns->sock_name[0] !=
'@')
1798 return VNET_API_ERROR_INVALID_VALUE;
1808 return VNET_API_ERROR_SYSCALL_ERROR_1;
1811 if (!app_ns->sock_name)
1812 app_ns->sock_name =
format (0,
"%s%v%c", dir, app_ns->ns_id, 0);
1819 cs->config = (
char *)
vec_dup (app_ns->sock_name);
1830 if (!app_ns->netns && stat ((
char *) app_ns->sock_name, &file_stat) == -1)
1865 #include <vnet/session/session.api.c>
u32 ip4_mask_to_preflen(ip4_address_t *mask)
static void sapi_socket_detach(app_namespace_t *app_ns, clib_socket_t *cs)
#define CLIB_SOCKET_F_IS_SERVER
@ APP_SAPI_MSG_TYPE_ATTACH_REPLY
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static u32 vlib_num_workers()
u32 wrk_index
Worker index in global worker pool.
clib_file_main_t file_main
static u32 vl_api_registration_file_index(vl_api_registration_t *reg)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
enum session_error_ session_error_t
vl_api_transport_proto_t transport_proto
VL_MSG_API_REAPER_FUNCTION(application_reaper_cb)
svm_msg_q_t * application_rx_mq_get(application_t *app, u32 mq_index)
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
@ SESSION_RULE_SCOPE_API_GLOBAL
static session_cb_vft_t session_mq_sapi_cb_vft
Application detach from session layer.
#define REPLY_MACRO2(t, body)
struct _vnet_app_namespace_add_del_args vnet_app_namespace_add_del_args_t
static void mq_notify_close_subscribers(u32 app_index, session_handle_t sh, svm_fifo_t *f, session_evt_type_t evt_type)
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
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
#define APP_NAMESPACE_INVALID_INDEX
bool is_add[default=true]
void mq_send_unlisten_reply(app_worker_t *app_wrk, session_handle_t sh, u32 context, int rv)
static u8 svm_fifo_n_subscribers(svm_fifo_t *f)
Fifo number of subscribers getter.
struct _vnet_app_worker_add_del_args vnet_app_worker_add_del_args_t
@ SESSION_CTRL_EVT_CONNECTED
vl_api_interface_index_t sw_if_index[default=0xffffffff]
app_sapi_worker_add_del_reply_msg_t worker_add_del_reply
void session_get_endpoint(session_t *s, transport_endpoint_t *tep, u8 is_lcl)
@ SESSION_CTRL_EVT_DISCONNECTED
uword fifo_segment_msg_q_offset(fifo_segment_t *fs, u32 mq_index)
Message queue offset on segment.
static void mq_send_session_close_evt(app_worker_t *app_wrk, session_handle_t sh, session_evt_type_t evt_type)
static u64 listen_session_get_handle(session_t *s)
session_t * ct_session_get_peer(session_t *s)
void * svm_msg_q_msg_data(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Get data for message in queue.
static int mq_send_add_segment_sapi_cb(u32 app_wrk_index, u64 segment_handle)
struct _app_namespace app_namespace_t
static clib_error_t * clib_socket_recvmsg(clib_socket_t *s, void *msg, int msglen, int fds[], int num_fds)
@ TRANSPORT_PROTO_API_QUIC
session_t * app_listener_get_local_session(app_listener_t *al)
Reply for app worker add/del.
u64 session_segment_handle(session_t *s)
segment_manager_props_t * application_segment_manager_properties(application_t *app)
uword vpp_event_queue_address
clib_file_function_t * read_function
#define SESSION_INVALID_INDEX
u32 app_index
App index in app pool.
#define APP_INVALID_INDEX
@ SVM_Q_NOWAIT
non-blocking call - works with both condvar and eventfd signaling
int vnet_application_detach(vnet_app_detach_args_t *a)
Detach application from vpp.
u16 fp_len
The mask length.
session_handle_t app_listen_session_handle(session_t *ls)
Get app listener handle for listening session.
u8 thread_index
Index of the thread that allocated the session.
add/del application namespace
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static int mq_send_add_segment_cb(u32 app_wrk_index, u64 segment_handle)
static clib_error_t * session_api_hookup(vlib_main_t *vm)
u64 app_event_queue_address
static u32 session_thread_from_handle(session_handle_t handle)
static clib_socket_t * appns_sapi_get_socket(app_namespace_t *app_ns, u32 sock_index)
struct _vnet_app_detach_args_t vnet_app_detach_args_t
#define clib_error_report(e)
struct _transport_connection transport_connection_t
session_t * app_worker_first_listener(app_worker_t *app, u8 fib_proto, u8 transport_proto)
app_namespace_t * app_namespace_get(u32 index)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static void vl_api_app_del_cert_key_pair_t_handler(vl_api_app_del_cert_key_pair_t *mp)
@ TRANSPORT_PROTO_API_NONE
void sapi_socket_close_w_handle(u32 api_handle)
void ip_prefix_encode(const fib_prefix_t *in, vl_api_prefix_t *out)
@ TRANSPORT_PROTO_API_TLS
static clib_error_t * sapi_sock_write_ready(clib_file_t *cf)
int(* session_accept_callback)(session_t *new_session)
Notify server of newly accepted session.
static void vl_api_session_enable_disable_t_handler(vl_api_session_enable_disable_t *mp)
static int mq_send_del_segment_cb(u32 app_wrk_index, u64 segment_handle)
struct _svm_fifo svm_fifo_t
fifo_segment_t * segment_manager_get_segment_w_handle(u64 segment_handle)
static u32 appns_sapi_socket_index(app_namespace_t *app_ns, clib_socket_t *cs)
u8 application_use_private_rx_mqs(void)
@ SESSION_CLEANUP_TRANSPORT
@ APP_SAPI_MSG_TYPE_ADD_DEL_CERT_KEY_REPLY
application_t * application_get(u32 app_index)
static void vl_api_session_rules_dump_t_handler(vl_api_session_rules_dump_t *mp)
add/del application namespace
u32 app_wrk_index
Index of the app worker that owns the session.
#define pool_foreach(VAR, POOL)
Iterate through pool.
@ APP_SAPI_MSG_TYPE_ADD_DEL_CERT_KEY
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
u32 session_index
global listening session index
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
@ SESSION_CTRL_EVT_UNLISTEN_REPLY
static void sapi_add_del_worker_handler(app_namespace_t *app_ns, clib_socket_t *cs, app_sapi_worker_add_del_msg_t *mp)
struct _session_rules_table_t session_rules_table_t
Application attach to session layer.
static void mq_send_session_cleanup_cb(session_t *s, session_cleanup_ntf_t ntf)
transport_connection_t * session_get_transport(session_t *s)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
static int mq_try_lock_and_alloc_msg(svm_msg_q_t *app_mq, svm_msg_q_msg_t *msg)
static clib_error_t * clib_socket_close(clib_socket_t *sock)
static void vl_api_application_tls_cert_add_t_handler(vl_api_application_tls_cert_add_t *mp)
int vnet_app_del_cert_key_pair(u32 index)
session_handle_t new_handle
#define vlib_worker_thread_barrier_sync(X)
An API client registration, only in vpp/vlib.
app_worker_t * app_worker_get_if_valid(u32 wrk_index)
static void setup_message_id_table(api_main_t *am)
@ SESSION_CTRL_EVT_CLEANUP
#define session_table_foreach(VAR, BODY)
static void mq_send_session_reset_cb(session_t *s)
#define REPLY_MSG_ID_BASE
void ip_prefix_decode(const vl_api_prefix_t *in, fib_prefix_t *out)
fifo_segment_t * application_get_rx_mqs_segment(application_t *app)
static u8 session_type_is_ip4(session_type_t st)
static char * vlib_unix_get_runtime_dir(void)
static clib_error_t * clib_socket_sendmsg(clib_socket_t *s, void *msg, int msglen, int fds[], int num_fds)
static void vl_api_app_worker_add_del_t_handler(vl_api_app_worker_add_del_t *mp)
static clib_socket_t * appns_sapi_alloc_socket(app_namespace_t *app_ns)
static fib_protocol_t session_get_fib_proto(session_t *s)
static clib_error_t * sapi_sock_accept_ready(clib_file_t *scf)
static void send_session_rule_details4(mma_rule_16_t *rule, u8 is_local, u8 transport_proto, u32 appns_index, u8 *tag, vl_api_registration_t *reg, u32 context)
bool is_add[default=true]
@ SESSION_RULE_SCOPE_API_LOCAL
static session_handle_t session_handle(session_t *s)
u32 ns_index
Namespace the application belongs to.
static void send_session_rules_table_details(session_rules_table_t *srt, u8 fib_proto, u8 tp, u8 is_local, u32 appns_index, vl_api_registration_t *reg, u32 context)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
clib_error_t * vlib_unix_recursive_mkdir(char *path)
static void clib_socket_free(clib_socket_t *s)
application_t * application_get_if_valid(u32 app_index)
svm_msg_q_t * event_queue
Application listens for events on this svm queue.
int vnet_app_add_cert_key_pair(vnet_app_add_cert_key_pair_args_t *a)
#define STATIC_ASSERT(truth,...)
app_sapi_attach_reply_msg_t attach_reply
app_sapi_worker_add_del_msg_t worker_add_del
__clib_export clib_error_t * clib_socket_init_netns(clib_socket_t *s, u8 *namespace)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
struct _vnet_app_add_cert_key_pair_args_ vnet_app_add_cert_key_pair_args_t
Delete certificate and key.
static clib_file_t * clib_file_get(clib_file_main_t *fm, u32 file_index)
int application_is_proxy(application_t *app)
session_handle_t listener_handle
Parent listener session index if the result of an accept.
app_listener_t * app_listener_get_w_handle(session_handle_t handle)
Get app listener for listener session handle.
#define VL_API_INVALID_FI
int vnet_application_attach(vnet_app_attach_args_t *a)
Attach application to vpp.
static void mq_send_session_migrate_cb(session_t *s, session_handle_t new_sh)
static int mq_send_del_segment_sapi_cb(u32 app_wrk_index, u64 segment_handle)
u8 * session_rules_table_rule_tag(session_rules_table_t *srt, u32 ri, u8 is_ip4)
@ APP_SAPI_MSG_TYPE_SEND_FDS
ssvm_private_t ssvm
ssvm segment data
bool is_add[default=true]
#define vec_free(V)
Free vector's memory (no header).
static u32 appns_sapi_handle_sock_index(u32 sapi_sock_handle)
vl_api_session_rule_scope_t scope
@ APP_SAPI_MSG_TYPE_ADD_DEL_WORKER_REPLY
@ SESSION_CTRL_EVT_ACCEPTED
static void mq_send_session_disconnected_cb(session_t *s)
static clib_error_t * application_reaper_cb(u32 client_index)
static void sapi_add_del_cert_key_handler(app_namespace_t *app_ns, clib_socket_t *cs, app_sapi_cert_key_add_del_msg_t *mp)
app_sapi_cert_key_add_del_msg_t cert_key_add_del
static clib_error_t * vl_api_send_fd_msg(vl_api_registration_t *reg, int fds[], int n_fds)
static int session_send_fds(vl_api_registration_t *reg, int fds[], int n_fds)
int vl_api_vec_to_api_string(const u8 *vec, vl_api_string_t *str)
application_t * application_lookup(u32 api_client_index)
static u8 session_main_is_enabled()
static transport_proto_t api_session_transport_proto_decode(const vl_api_transport_proto_t *api_tp)
static session_cb_vft_t session_mq_cb_vft
description fragment has unexpected format
u32 app_namespace_index_from_id(const u8 *ns_id)
static void clib_file_del(clib_file_main_t *um, clib_file_t *f)
static vl_api_transport_proto_t api_session_transport_proto_encode(const transport_proto_t tp)
static void vl_api_application_tls_key_add_t_handler(vl_api_application_tls_key_add_t *mp)
vl_api_interface_index_t sw_if_index[default=0xffffffff]
bool is_add[default=true]
static u32 appns_sapi_socket_handle(app_namespace_t *app_ns, clib_socket_t *cs)
struct _session_rules_table_add_del_args session_rule_table_add_del_args_t
static void send_session_rule_details6(mma_rule_40_t *rule, u8 is_local, u8 transport_proto, u32 appns_index, u8 *tag, vl_api_registration_t *reg, u32 context)
#define TRANSPORT_N_PROTOS
ssvm_segment_type_t ssvm_type(const ssvm_private_t *ssvm)
static clib_error_t * sapi_sock_read_ready(clib_file_t *cf)
enum _transport_proto transport_proto_t
#define CLIB_SOCKET_F_ALLOW_GROUP_WRITE
static void vl_api_app_add_cert_key_pair_t_handler(vl_api_app_add_cert_key_pair_t *mp)
int mq_send_session_bound_cb(u32 app_wrk_index, u32 api_context, session_handle_t handle, int rv)
app_worker_t * app_worker_get(u32 wrk_index)
static void appns_sapi_free_socket(app_namespace_t *app_ns, clib_socket_t *cs)
enable/disable session layer
app_worker_t * application_get_worker(application_t *app, u32 wrk_map_index)
void vlib_rpc_call_main_thread(void *callback, u8 *args, u32 arg_size)
static uword clib_file_add(clib_file_main_t *um, clib_file_t *template)
Reply for app namespace add/del.
u32 app_namespace_index(app_namespace_t *app_ns)
static int mq_send_session_accepted_cb(session_t *s)
#define SESSION_INVALID_HANDLE
add/del application namespace
u8 * vl_api_from_api_to_new_vec(void *mp, vl_api_string_t *astr)
@ TRANSPORT_SERVICE_CL
connectionless service
int vnet_app_worker_add_del(vnet_app_worker_add_del_args_t *a)
vl_api_transport_proto_t transport_proto
u32 ip6_mask_to_preflen(ip6_address_t *mask)
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.
static transport_proto_t session_get_transport_proto(session_t *s)
@ TRANSPORT_PROTO_API_UDP
u32 wrk_map_index
Worker index in app's map pool.
vl_api_interface_index_t sw_if_index[default=0xffffffff]
static vlib_main_t * vlib_get_main(void)
static transport_service_type_t session_transport_service_type(session_t *s)
int mq_send_session_connected_cb(u32 app_wrk_index, u32 api_context, session_t *s, session_error_t err)
vl_api_session_rule_scope_t scope
Application add TLS certificate.
static clib_error_t * sapi_sock_error(clib_file_t *cf)
#define pool_free(p)
Free a pool.
#define CLIB_SOCKET_F_PASSCRED
static void vl_api_application_detach_t_handler(vl_api_application_detach_t *mp)
int vnet_session_rule_add_del(session_rule_add_del_args_t *args)
Application attach reply.
#define clib_warning(format, args...)
app_sapi_attach_msg_t attach
static void clib_file_del_by_index(clib_file_main_t *um, uword index)
@ APP_SAPI_MSG_TYPE_ATTACH
static void session_api_attach_handler(app_namespace_t *app_ns, clib_socket_t *cs, app_sapi_attach_msg_t *mp)
#define clib_error_free(e)
static void sapi_send_fds(app_worker_t *app_wrk, int *fds, int n_fds)
@ SESSION_CTRL_EVT_MIGRATED
void appns_sapi_del_ns_socket(app_namespace_t *app_ns)
Reply for app namespace add/del.
uword fifo_segment_fifo_offset(svm_fifo_t *f)
struct _vnet_app_attach_args_t vnet_app_attach_args_t
u32 app_index
Index of owning app.
struct _socket_t clib_socket_t
static void vl_api_app_namespace_add_del_v2_t_handler(vl_api_app_namespace_add_del_v2_t *mp)
static u8 session_has_transport(session_t *s)
static void vl_api_app_namespace_add_del_v3_t_handler(vl_api_app_namespace_add_del_v3_t *mp)
int vnet_app_namespace_add_del(vnet_app_namespace_add_del_args_t *a)
@ TRANSPORT_PROTO_API_TCP
@ SESSION_MQ_CTRL_EVT_RING
vl_api_registration_t * vl_mem_api_client_index_to_registration(u32 handle)
u32 api_client_index
API index for the worker.
VLIB_API_INIT_FUNCTION(session_api_hookup)
uword vpp_event_queue_address
add/del application worker
session_t * app_listener_get_session(app_listener_t *al)
static void vl_api_session_rule_add_del_t_handler(vl_api_session_rule_add_del_t *mp)
volatile u8 session_state
State in session layer state machine.
u8 appns_sapi_enabled(void)
app_sapi_cert_key_add_del_reply_msg_t cert_key_add_del_reply
static void vl_api_app_namespace_add_del_t_handler(vl_api_app_namespace_add_del_t *mp)
Aggregate type for a prefix.
static session_t * listen_session_get_from_handle(session_handle_t handle)
u64 app_event_queue_address
struct _session_lookup_table session_table_t
#define CLIB_SOCKET_F_SEQPACKET
int appns_sapi_add_ns_socket(app_namespace_t *app_ns)
static void vl_api_app_attach_t_handler(vl_api_app_attach_t *mp)
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
static int svm_msg_q_get_eventfd(svm_msg_q_t *mq)
struct _session_rule_add_del_args session_rule_add_del_args_t
@ SESSION_CTRL_EVT_APP_ADD_SEGMENT
__clib_export clib_error_t * clib_socket_accept(clib_socket_t *server, clib_socket_t *client)
void * vl_msg_api_alloc(int nbytes)
bool is_enable[default=true]
@ SESSION_CTRL_EVT_APP_DEL_SEGMENT