diff options
author | Florin Coras <fcoras@cisco.com> | 2024-02-29 18:19:30 -0800 |
---|---|---|
committer | Dave Barach <vpp@barachs.net> | 2024-03-01 22:22:53 +0000 |
commit | 4f3da9c1f73043145f825491ef573f180af10fc9 (patch) | |
tree | 649810f1b98c5cee3f335b2362c5e14907b4922d /src/vnet/session | |
parent | 242fe13c62fe75fff0fa4d9ade0af0eec740d30f (diff) |
session: add api cb for listen and unlisten
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I28ccebf4d2f0728dd174ab3ee77a0d7ad4b90951
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/application.h | 7 | ||||
-rw-r--r-- | src/vnet/session/application_interface.h | 7 | ||||
-rw-r--r-- | src/vnet/session/session_api.c | 15 | ||||
-rw-r--r-- | src/vnet/session/session_input.c | 12 |
4 files changed, 24 insertions, 17 deletions
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h index 22896b174be..5fea61bdab4 100644 --- a/src/vnet/session/application.h +++ b/src/vnet/session/application.h @@ -406,13 +406,6 @@ app_cert_key_pair_t *app_cert_key_pair_get (u32 index); app_cert_key_pair_t *app_cert_key_pair_get_if_valid (u32 index); app_cert_key_pair_t *app_cert_key_pair_get_default (); -/* Needed while we support both bapi and mq ctrl messages */ -int mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context, - session_handle_t handle, int rv); -int mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context, - session_t * s, session_error_t err); -void mq_send_unlisten_reply (app_worker_t * app_wrk, session_handle_t sh, - u32 context, int rv); void sapi_socket_close_w_handle (u32 api_handle); crypto_engine_type_t app_crypto_engine_type_add (void); diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index b41f7a4c43f..c7ed5285ca4 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -62,6 +62,13 @@ typedef struct session_cb_vft_ /** Notify app that session pool migration happened */ void (*session_migrate_callback) (session_t * s, session_handle_t new_sh); + /** Notify app (external only) that listen was processed */ + int (*session_listened_callback) (u32 app_wrk_index, u32 api_context, + session_handle_t handle, int rv); + /** Notify app (external only) that unlisten was processed */ + void (*session_unlistened_callback) (u32 app_wrk_index, session_handle_t sh, + u32 context, int rv); + /** Direct RX callback for built-in application */ int (*builtin_app_rx_callback) (session_t * session); diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index 84d44e9fa3e..759c6ea86cf 100644 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -271,7 +271,7 @@ snd_msg: return 0; } -int +static int mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context, session_handle_t handle, int rv) { @@ -325,11 +325,14 @@ snd_msg: return 0; } -void -mq_send_unlisten_reply (app_worker_t * app_wrk, session_handle_t sh, - u32 context, int rv) +static void +mq_send_unlisten_cb (u32 app_wrk_index, session_handle_t sh, u32 context, + int rv) { session_unlisten_reply_msg_t m = { 0 }; + app_worker_t *app_wrk; + + app_wrk = app_worker_get (app_wrk_index); m.context = context; m.handle = sh; @@ -503,6 +506,8 @@ static session_cb_vft_t session_mq_cb_vft = { .session_reset_callback = mq_send_session_reset_cb, .session_migrate_callback = mq_send_session_migrate_cb, .session_cleanup_callback = mq_send_session_cleanup_cb, + .session_listened_callback = mq_send_session_bound_cb, + .session_unlistened_callback = mq_send_unlisten_cb, .add_segment_callback = mq_send_add_segment_cb, .del_segment_callback = mq_send_del_segment_cb, .builtin_app_rx_callback = mq_send_io_rx_event, @@ -1282,6 +1287,8 @@ static session_cb_vft_t session_mq_sapi_cb_vft = { .session_reset_callback = mq_send_session_reset_cb, .session_migrate_callback = mq_send_session_migrate_cb, .session_cleanup_callback = mq_send_session_cleanup_cb, + .session_listened_callback = mq_send_session_bound_cb, + .session_unlistened_callback = mq_send_unlisten_cb, .add_segment_callback = mq_send_add_segment_sapi_cb, .del_segment_callback = mq_send_del_segment_sapi_cb, .builtin_app_rx_callback = mq_send_io_rx_event, diff --git a/src/vnet/session/session_input.c b/src/vnet/session/session_input.c index b403f7ddc4c..41e8beb8abc 100644 --- a/src/vnet/session/session_input.c +++ b/src/vnet/session/session_input.c @@ -145,9 +145,9 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, /* No app cb function currently */ if (is_builtin) break; - mq_send_session_bound_cb (app_wrk->wrk_index, evt->as_u64[1] >> 32, - evt->session_handle, - evt->as_u64[1] & 0xffffffff); + app->cb_fns.session_listened_callback ( + app_wrk->wrk_index, evt->as_u64[1] >> 32, evt->session_handle, + evt->as_u64[1] & 0xffffffff); break; case SESSION_CTRL_EVT_ACCEPTED: s = session_get (evt->session_index, thread_index); @@ -208,9 +208,9 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, case SESSION_CTRL_EVT_UNLISTEN_REPLY: if (is_builtin) break; - mq_send_unlisten_reply (app_wrk, evt->session_handle, - evt->as_u64[1] >> 32, - evt->as_u64[1] & 0xffffffff); + app->cb_fns.session_unlistened_callback ( + app_wrk->wrk_index, evt->session_handle, evt->as_u64[1] >> 32, + evt->as_u64[1] & 0xffffffff); break; case SESSION_CTRL_EVT_MIGRATED: s = session_get (evt->session_index, thread_index); |