Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 1 | /* |
Florin Coras | 288eaab | 2019-02-03 15:26:14 -0800 | [diff] [blame] | 2 | * Copyright (c) 2017-2019 Cisco and/or its affiliates. |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #ifndef SRC_VNET_SESSION_APPLICATION_H_ |
| 17 | #define SRC_VNET_SESSION_APPLICATION_H_ |
| 18 | |
Florin Coras | c1a4265 | 2019-02-08 18:27:29 -0800 | [diff] [blame] | 19 | #include <vnet/session/application_interface.h> |
| 20 | #include <vnet/session/application_namespace.h> |
Florin Coras | 1ee7830 | 2019-02-05 15:51:15 -0800 | [diff] [blame] | 21 | #include <vnet/session/session_types.h> |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 22 | #include <vnet/session/segment_manager.h> |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 23 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 24 | #define APP_DEBUG 0 |
| 25 | |
| 26 | #if APP_DEBUG > 0 |
| 27 | #define APP_DBG(_fmt, _args...) clib_warning (_fmt, ##_args) |
| 28 | #else |
| 29 | #define APP_DBG(_fmt, _args...) |
| 30 | #endif |
| 31 | |
Florin Coras | 20c2423 | 2021-11-22 21:19:01 -0800 | [diff] [blame] | 32 | typedef struct app_wrk_postponed_msg_ |
| 33 | { |
| 34 | u32 len; |
| 35 | u8 event_type; |
| 36 | u8 ring; |
| 37 | u8 is_sapi; |
| 38 | int fd; |
Florin Coras | 6ac74e4 | 2022-01-10 14:26:21 -0800 | [diff] [blame] | 39 | u8 data[SESSION_CTRL_MSG_TX_MAX_SIZE]; |
Florin Coras | 20c2423 | 2021-11-22 21:19:01 -0800 | [diff] [blame] | 40 | } app_wrk_postponed_msg_t; |
| 41 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 42 | typedef struct app_worker_ |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 43 | { |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 44 | CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); |
| 45 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 46 | /** Worker index in global worker pool*/ |
| 47 | u32 wrk_index; |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 48 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 49 | /** Worker index in app's map pool */ |
| 50 | u32 wrk_map_index; |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 51 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 52 | /** Index of owning app */ |
| 53 | u32 app_index; |
Florin Coras | cea194d | 2017-10-02 00:18:51 -0700 | [diff] [blame] | 54 | |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 55 | /** Application listens for events on this svm queue */ |
Florin Coras | 3c2fed5 | 2018-07-04 04:15:05 -0700 | [diff] [blame] | 56 | svm_msg_q_t *event_queue; |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 57 | |
Florin Coras | 94a6df0 | 2021-05-06 15:32:14 -0700 | [diff] [blame] | 58 | /** |
| 59 | * Segment manager used for outgoing connects issued by the app. By |
| 60 | * convention this is the first segment manager allocated by the worker |
| 61 | * so it's also the one that holds the first segment with the app's |
| 62 | * message queue in it. |
| 63 | */ |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 64 | u32 connects_seg_manager; |
| 65 | |
Florin Coras | c87c91d | 2017-08-16 19:55:49 -0700 | [diff] [blame] | 66 | /** Lookup tables for listeners. Value is segment manager index */ |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 67 | uword *listeners_table; |
| 68 | |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 69 | /** API index for the worker. Needed for multi-process apps */ |
Florin Coras | c1f5a43 | 2018-11-20 11:31:26 -0800 | [diff] [blame] | 70 | u32 api_client_index; |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 71 | |
Florin Coras | 20c2423 | 2021-11-22 21:19:01 -0800 | [diff] [blame] | 72 | /** Set if mq is congested */ |
| 73 | u8 mq_congested; |
| 74 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 75 | u8 app_is_builtin; |
Florin Coras | d50ff7f | 2020-04-16 04:30:22 +0000 | [diff] [blame] | 76 | |
Florin Coras | ea72764 | 2021-05-07 19:39:43 -0700 | [diff] [blame] | 77 | /** Pool of half-open session handles. Tracked in case worker detaches */ |
| 78 | session_handle_t *half_open_table; |
Florin Coras | c8e812f | 2020-05-14 05:32:18 +0000 | [diff] [blame] | 79 | |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 80 | /* Per vpp worker fifos of events for app worker */ |
| 81 | session_event_t **wrk_evts; |
| 82 | |
| 83 | /* Vector of vpp workers mq congestion flags */ |
| 84 | u8 *wrk_mq_congested; |
| 85 | |
Florin Coras | c8e812f | 2020-05-14 05:32:18 +0000 | [diff] [blame] | 86 | /** Protects detached seg managers */ |
| 87 | clib_spinlock_t detached_seg_managers_lock; |
| 88 | |
| 89 | /** Vector of detached listener segment managers */ |
| 90 | u32 *detached_seg_managers; |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 91 | } app_worker_t; |
| 92 | |
| 93 | typedef struct app_worker_map_ |
| 94 | { |
| 95 | u32 wrk_index; |
| 96 | } app_worker_map_t; |
| 97 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 98 | typedef struct app_listener_ |
| 99 | { |
| 100 | clib_bitmap_t *workers; /**< workers accepting connections */ |
| 101 | u32 accept_rotor; /**< last worker to accept a connection */ |
Florin Coras | 87d6633 | 2019-06-11 12:31:31 -0700 | [diff] [blame] | 102 | u32 al_index; /**< app listener index in app pool */ |
| 103 | u32 app_index; /**< owning app index */ |
| 104 | u32 local_index; /**< local listening session index */ |
| 105 | u32 session_index; /**< global listening session index */ |
| 106 | session_handle_t ls_handle; /**< session handle of the local or global |
| 107 | listening session that also identifies |
| 108 | the app listener */ |
Florin Coras | 7428eaa | 2023-12-11 16:04:57 -0800 | [diff] [blame] | 109 | u32 *cl_listeners; /**< vector that maps app workers to their |
| 110 | cl sessions with fifos */ |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 111 | } app_listener_t; |
| 112 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 113 | typedef enum app_rx_mq_flags_ |
| 114 | { |
| 115 | APP_RX_MQ_F_PENDING = 1 << 0, |
| 116 | APP_RX_MQ_F_POSTPONED = 1 << 1, |
| 117 | } app_rx_mq_flags_t; |
| 118 | |
| 119 | typedef struct app_rx_mq_elt_ |
| 120 | { |
| 121 | struct app_rx_mq_elt_ *next; |
| 122 | struct app_rx_mq_elt_ *prev; |
| 123 | svm_msg_q_t *mq; |
| 124 | uword file_index; |
| 125 | u32 app_index; |
| 126 | u8 flags; |
| 127 | } app_rx_mq_elt_t; |
| 128 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 129 | typedef struct application_ |
| 130 | { |
| 131 | /** App index in app pool */ |
| 132 | u32 app_index; |
| 133 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 134 | /** Flags */ |
| 135 | u32 flags; |
| 136 | |
| 137 | /** Callbacks: shoulder-taps for the server/client */ |
| 138 | session_cb_vft_t cb_fns; |
| 139 | |
| 140 | /** Segment manager properties. Shared by all segment managers */ |
Florin Coras | 88001c6 | 2019-04-24 14:44:46 -0700 | [diff] [blame] | 141 | segment_manager_props_t sm_properties; |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 142 | |
| 143 | /** Pool of mappings that keep track of workers associated to this app */ |
| 144 | app_worker_map_t *worker_maps; |
| 145 | |
| 146 | /** Name registered by builtin apps */ |
| 147 | u8 *name; |
| 148 | |
| 149 | /** Namespace the application belongs to */ |
| 150 | u32 ns_index; |
| 151 | |
| 152 | u16 proxied_transports; |
| 153 | |
Florin Coras | 58d36f0 | 2018-03-09 13:05:53 -0800 | [diff] [blame] | 154 | /** Preferred tls engine */ |
| 155 | u8 tls_engine; |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 156 | |
Nathan Skrzypczak | c298f37 | 2019-11-12 16:41:00 +0100 | [diff] [blame] | 157 | /** quic initialization vector */ |
| 158 | char quic_iv[17]; |
| 159 | u8 quic_iv_set; |
Nathan Skrzypczak | 60f3e65 | 2019-03-19 13:57:31 +0100 | [diff] [blame] | 160 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 161 | /** Segment where rx mqs were allocated */ |
| 162 | fifo_segment_t rx_mqs_segment; |
| 163 | |
| 164 | /** |
| 165 | * Fixed vector of rx mqs that can be a part of pending_rx_mqs |
| 166 | * linked list maintained by the app sublayer for each worker |
| 167 | */ |
| 168 | app_rx_mq_elt_t *rx_mqs; |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 169 | } application_t; |
| 170 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 171 | typedef struct app_rx_mq_handle_ |
| 172 | { |
| 173 | union |
| 174 | { |
| 175 | struct |
| 176 | { |
| 177 | u32 app_index; |
| 178 | u32 thread_index; |
| 179 | }; |
| 180 | u64 as_u64; |
| 181 | }; |
| 182 | } __attribute__ ((aligned (sizeof (u64)))) app_rx_mq_handle_t; |
| 183 | |
| 184 | /** |
| 185 | * App sublayer per vpp worker state |
| 186 | */ |
| 187 | typedef struct asl_wrk_ |
| 188 | { |
| 189 | /** Linked list of mqs with pending messages */ |
| 190 | app_rx_mq_elt_t *pending_rx_mqs; |
| 191 | } appsl_wrk_t; |
| 192 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 193 | typedef struct app_main_ |
| 194 | { |
| 195 | /** |
| 196 | * Pool from which we allocate all applications |
| 197 | */ |
| 198 | application_t *app_pool; |
| 199 | |
Florin Coras | 97fef28 | 2023-12-21 19:41:12 -0800 | [diff] [blame] | 200 | /** Pool of app listeners */ |
| 201 | app_listener_t *listeners; |
| 202 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 203 | /** |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 204 | * Hash table of apps by api client index |
| 205 | */ |
| 206 | uword *app_by_api_client_index; |
| 207 | |
| 208 | /** |
| 209 | * Hash table of builtin apps by name |
| 210 | */ |
| 211 | uword *app_by_name; |
Nathan Skrzypczak | 79f8953 | 2019-09-13 11:08:13 +0200 | [diff] [blame] | 212 | |
| 213 | /** |
| 214 | * Pool from which we allocate certificates (key, cert) |
| 215 | */ |
| 216 | app_cert_key_pair_t *cert_key_pair_store; |
Florin Coras | 79ba25d | 2019-10-20 19:32:47 -0700 | [diff] [blame] | 217 | |
| 218 | /* |
| 219 | * Last registered crypto engine type |
| 220 | */ |
| 221 | crypto_engine_type_t last_crypto_engine; |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 222 | |
| 223 | /** |
| 224 | * App sublayer per-worker state |
| 225 | */ |
| 226 | appsl_wrk_t *wrk; |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 227 | } app_main_t; |
| 228 | |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 229 | typedef struct app_init_args_ |
| 230 | { |
| 231 | #define _(_type, _name) _type _name; |
| 232 | foreach_app_init_args |
| 233 | #undef _ |
| 234 | } app_init_args_t; |
| 235 | |
| 236 | typedef struct _vnet_app_worker_add_del_args |
| 237 | { |
| 238 | u32 app_index; /**< App for which a new worker is requested */ |
Florin Coras | 349f8ca | 2018-11-20 16:52:49 -0800 | [diff] [blame] | 239 | u32 wrk_map_index; /**< Index to delete or return value if add */ |
Florin Coras | c1f5a43 | 2018-11-20 11:31:26 -0800 | [diff] [blame] | 240 | u32 api_client_index; /**< Binary API client index */ |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 241 | ssvm_private_t *segment; /**< First segment in segment manager */ |
Florin Coras | fa76a76 | 2018-11-29 12:40:10 -0800 | [diff] [blame] | 242 | u64 segment_handle; /**< Handle for the segment */ |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 243 | svm_msg_q_t *evt_q; /**< Worker message queue */ |
| 244 | u8 is_add; /**< Flag set if addition */ |
| 245 | } vnet_app_worker_add_del_args_t; |
| 246 | |
Florin Coras | cea194d | 2017-10-02 00:18:51 -0700 | [diff] [blame] | 247 | #define APP_INVALID_INDEX ((u32)~0) |
| 248 | #define APP_NS_INVALID_INDEX ((u32)~0) |
Florin Coras | c87c91d | 2017-08-16 19:55:49 -0700 | [diff] [blame] | 249 | #define APP_INVALID_SEGMENT_MANAGER_INDEX ((u32) ~0) |
| 250 | |
Florin Coras | 97fef28 | 2023-12-21 19:41:12 -0800 | [diff] [blame] | 251 | app_listener_t *app_listener_get (u32 al_index); |
Florin Coras | c9940fc | 2019-02-05 20:55:11 -0800 | [diff] [blame] | 252 | int app_listener_alloc_and_init (application_t * app, |
| 253 | session_endpoint_cfg_t * sep, |
| 254 | app_listener_t ** listener); |
| 255 | void app_listener_cleanup (app_listener_t * app_listener); |
| 256 | session_handle_t app_listener_handle (app_listener_t * app_listener); |
| 257 | app_listener_t *app_listener_lookup (application_t * app, |
| 258 | session_endpoint_cfg_t * sep); |
Florin Coras | 7428eaa | 2023-12-11 16:04:57 -0800 | [diff] [blame] | 259 | session_t *app_listener_select_wrk_cl_session (session_t *ls, |
| 260 | session_dgram_hdr_t *hdr); |
Florin Coras | 87d6633 | 2019-06-11 12:31:31 -0700 | [diff] [blame] | 261 | |
| 262 | /** |
| 263 | * Get app listener handle for listening session |
| 264 | * |
| 265 | * For a given listening session, this can return either the session |
| 266 | * handle of the app listener associated to the listening session or, |
| 267 | * if no such app listener exists, the session's handle |
| 268 | * |
| 269 | * @param ls listening session |
| 270 | * @return app listener or listening session handle |
| 271 | */ |
| 272 | session_handle_t app_listen_session_handle (session_t * ls); |
| 273 | /** |
| 274 | * Get app listener for listener session handle |
| 275 | * |
| 276 | * Should only be called on handles that have an app listener, i.e., |
| 277 | * were obtained at the end of a @ref vnet_listen call. |
| 278 | * |
| 279 | * @param handle handle of the app listener. This is the handle of |
| 280 | * either the global or local listener |
| 281 | * @return pointer to app listener or 0 |
| 282 | */ |
Florin Coras | c9940fc | 2019-02-05 20:55:11 -0800 | [diff] [blame] | 283 | app_listener_t *app_listener_get_w_handle (session_handle_t handle); |
Florin Coras | c9940fc | 2019-02-05 20:55:11 -0800 | [diff] [blame] | 284 | session_t *app_listener_get_session (app_listener_t * al); |
Florin Coras | d4295e6 | 2019-02-22 13:11:38 -0800 | [diff] [blame] | 285 | session_t *app_listener_get_local_session (app_listener_t * al); |
Florin Coras | 7428eaa | 2023-12-11 16:04:57 -0800 | [diff] [blame] | 286 | session_t *app_listener_get_wrk_cl_session (app_listener_t *al, u32 wrk_index); |
Florin Coras | c9940fc | 2019-02-05 20:55:11 -0800 | [diff] [blame] | 287 | |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 288 | application_t *application_get (u32 index); |
Florin Coras | e04c299 | 2017-03-01 08:17:34 -0800 | [diff] [blame] | 289 | application_t *application_get_if_valid (u32 index); |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 290 | application_t *application_lookup (u32 api_client_index); |
Florin Coras | 0bee9ce | 2018-03-22 21:24:31 -0700 | [diff] [blame] | 291 | application_t *application_lookup_name (const u8 * name); |
Florin Coras | 1553197 | 2018-08-12 23:50:53 -0700 | [diff] [blame] | 292 | app_worker_t *application_get_worker (application_t * app, u32 wrk_index); |
| 293 | app_worker_t *application_get_default_worker (application_t * app); |
Florin Coras | c9940fc | 2019-02-05 20:55:11 -0800 | [diff] [blame] | 294 | app_worker_t *application_listener_select_worker (session_t * ls); |
Florin Coras | 623eb56 | 2019-02-03 19:28:34 -0800 | [diff] [blame] | 295 | int application_change_listener_owner (session_t * s, app_worker_t * app_wrk); |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 296 | int application_is_proxy (application_t * app); |
Florin Coras | 7999e83 | 2017-10-31 01:51:04 -0700 | [diff] [blame] | 297 | int application_is_builtin (application_t * app); |
| 298 | int application_is_builtin_proxy (application_t * app); |
Florin Coras | cea194d | 2017-10-02 00:18:51 -0700 | [diff] [blame] | 299 | u32 application_session_table (application_t * app, u8 fib_proto); |
| 300 | u32 application_local_session_table (application_t * app); |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 301 | const u8 *application_name_from_index (u32 app_or_wrk); |
Florin Coras | cea194d | 2017-10-02 00:18:51 -0700 | [diff] [blame] | 302 | u8 application_has_local_scope (application_t * app); |
| 303 | u8 application_has_global_scope (application_t * app); |
Florin Coras | 7999e83 | 2017-10-31 01:51:04 -0700 | [diff] [blame] | 304 | void application_setup_proxy (application_t * app); |
| 305 | void application_remove_proxy (application_t * app); |
Nathan Skrzypczak | b3ea73e | 2021-08-05 10:22:52 +0200 | [diff] [blame] | 306 | void application_namespace_cleanup (app_namespace_t *app_ns); |
qinyang | af9b715 | 2023-06-27 01:11:53 -0700 | [diff] [blame] | 307 | int application_original_dst_is_enabled (application_t *app); |
Florin Coras | 7999e83 | 2017-10-31 01:51:04 -0700 | [diff] [blame] | 308 | |
Florin Coras | 88001c6 | 2019-04-24 14:44:46 -0700 | [diff] [blame] | 309 | segment_manager_props_t *application_get_segment_manager_properties (u32 |
| 310 | app_index); |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 311 | |
Florin Coras | 88001c6 | 2019-04-24 14:44:46 -0700 | [diff] [blame] | 312 | segment_manager_props_t |
Florin Coras | a332c46 | 2018-01-31 06:52:17 -0800 | [diff] [blame] | 313 | * application_segment_manager_properties (application_t * app); |
| 314 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 315 | svm_msg_q_t *application_rx_mq_get (application_t *app, u32 mq_index); |
| 316 | u8 application_use_private_rx_mqs (void); |
| 317 | fifo_segment_t *application_get_rx_mqs_segment (application_t *app); |
| 318 | void application_enable_rx_mqs_nodes (u8 is_en); |
| 319 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 320 | /* |
Florin Coras | 623eb56 | 2019-02-03 19:28:34 -0800 | [diff] [blame] | 321 | * App worker |
| 322 | */ |
| 323 | |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 324 | always_inline u8 |
| 325 | app_worker_mq_is_congested (app_worker_t *app_wrk) |
| 326 | { |
| 327 | return app_wrk->mq_congested > 0; |
| 328 | } |
| 329 | |
Florin Coras | 623eb56 | 2019-02-03 19:28:34 -0800 | [diff] [blame] | 330 | app_worker_t *app_worker_alloc (application_t * app); |
| 331 | int application_alloc_worker_and_init (application_t * app, |
| 332 | app_worker_t ** wrk); |
| 333 | app_worker_t *app_worker_get (u32 wrk_index); |
| 334 | app_worker_t *app_worker_get_if_valid (u32 wrk_index); |
| 335 | application_t *app_worker_get_app (u32 wrk_index); |
| 336 | int app_worker_own_session (app_worker_t * app_wrk, session_t * s); |
| 337 | void app_worker_free (app_worker_t * app_wrk); |
Florin Coras | 89a9f61 | 2021-05-11 11:55:07 -0700 | [diff] [blame] | 338 | int app_worker_connect_session (app_worker_t *app, session_endpoint_cfg_t *sep, |
| 339 | session_handle_t *rsh); |
Filip Tehlar | 0028e6f | 2023-06-28 10:47:32 +0200 | [diff] [blame] | 340 | session_error_t app_worker_start_listen (app_worker_t *app_wrk, |
| 341 | app_listener_t *lstnr); |
Florin Coras | c9940fc | 2019-02-05 20:55:11 -0800 | [diff] [blame] | 342 | int app_worker_stop_listen (app_worker_t * app_wrk, app_listener_t * al); |
Florin Coras | a27a46e | 2019-02-18 13:02:28 -0800 | [diff] [blame] | 343 | int app_worker_init_accepted (session_t * s); |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 344 | int app_worker_listened_notify (app_worker_t *app_wrk, session_handle_t alsh, |
Damjan Marion | 804255c | 2024-04-24 11:21:05 +0000 | [diff] [blame] | 345 | u32 opaque, session_error_t err); |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 346 | int app_worker_unlisten_reply (app_worker_t *app_wrk, session_handle_t sh, |
| 347 | u32 opaque, session_error_t err); |
Florin Coras | a27a46e | 2019-02-18 13:02:28 -0800 | [diff] [blame] | 348 | int app_worker_accept_notify (app_worker_t * app_wrk, session_t * s); |
| 349 | int app_worker_init_connected (app_worker_t * app_wrk, session_t * s); |
| 350 | int app_worker_connect_notify (app_worker_t * app_wrk, session_t * s, |
Florin Coras | 00e01d3 | 2019-10-21 16:07:46 -0700 | [diff] [blame] | 351 | session_error_t err, u32 opaque); |
Florin Coras | ea72764 | 2021-05-07 19:39:43 -0700 | [diff] [blame] | 352 | int app_worker_add_half_open (app_worker_t *app_wrk, session_handle_t sh); |
Florin Coras | 2c876f9 | 2021-05-10 21:12:27 -0700 | [diff] [blame] | 353 | int app_worker_del_half_open (app_worker_t *app_wrk, session_t *s); |
Florin Coras | bf7ce2c | 2019-03-06 14:44:42 -0800 | [diff] [blame] | 354 | int app_worker_close_notify (app_worker_t * app_wrk, session_t * s); |
Florin Coras | 692b949 | 2019-07-12 15:01:53 -0700 | [diff] [blame] | 355 | int app_worker_transport_closed_notify (app_worker_t * app_wrk, |
| 356 | session_t * s); |
Florin Coras | 69b68ef | 2019-04-02 11:38:51 -0700 | [diff] [blame] | 357 | int app_worker_reset_notify (app_worker_t * app_wrk, session_t * s); |
Florin Coras | 70f26d5 | 2019-07-08 11:47:18 -0700 | [diff] [blame] | 358 | int app_worker_cleanup_notify (app_worker_t * app_wrk, session_t * s, |
| 359 | session_cleanup_ntf_t ntf); |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 360 | int app_worker_cleanup_notify_custom (app_worker_t *app_wrk, session_t *s, |
| 361 | session_cleanup_ntf_t ntf, |
| 362 | void (*cleanup_cb) (session_t *s)); |
Florin Coras | 49568af | 2019-07-31 16:46:24 -0700 | [diff] [blame] | 363 | int app_worker_migrate_notify (app_worker_t * app_wrk, session_t * s, |
| 364 | session_handle_t new_sh); |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 365 | int app_worker_rx_notify (app_worker_t *app_wrk, session_t *s); |
Ryujiro Shibuya | d8f48e2 | 2020-01-22 12:11:42 +0000 | [diff] [blame] | 366 | int app_worker_session_fifo_tuning (app_worker_t * app_wrk, session_t * s, |
| 367 | svm_fifo_t * f, |
| 368 | session_ft_action_t act, u32 len); |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 369 | void app_worker_add_event (app_worker_t *app_wrk, session_t *s, |
| 370 | session_evt_type_t evt_type); |
| 371 | void app_worker_add_event_custom (app_worker_t *app_wrk, u32 thread_index, |
| 372 | session_event_t *evt); |
| 373 | int app_wrk_flush_wrk_events (app_worker_t *app_wrk, u32 thread_index); |
| 374 | void app_worker_del_all_events (app_worker_t *app_wrk); |
Florin Coras | 623eb56 | 2019-02-03 19:28:34 -0800 | [diff] [blame] | 375 | segment_manager_t *app_worker_get_listen_segment_manager (app_worker_t *, |
| 376 | session_t *); |
| 377 | segment_manager_t *app_worker_get_connect_segment_manager (app_worker_t *); |
Florin Coras | 2b81e3c | 2019-02-27 07:55:46 -0800 | [diff] [blame] | 378 | int app_worker_add_segment_notify (app_worker_t * app_wrk, |
| 379 | u64 segment_handle); |
| 380 | int app_worker_del_segment_notify (app_worker_t * app_wrk, |
| 381 | u64 segment_handle); |
Florin Coras | 623eb56 | 2019-02-03 19:28:34 -0800 | [diff] [blame] | 382 | u32 app_worker_n_listeners (app_worker_t * app); |
| 383 | session_t *app_worker_first_listener (app_worker_t * app, |
| 384 | u8 fib_proto, u8 transport_proto); |
Florin Coras | 20c2423 | 2021-11-22 21:19:01 -0800 | [diff] [blame] | 385 | void app_wrk_send_ctrl_evt_fd (app_worker_t *app_wrk, u8 evt_type, void *msg, |
| 386 | u32 msg_len, int fd); |
| 387 | void app_wrk_send_ctrl_evt (app_worker_t *app_wrk, u8 evt_type, void *msg, |
| 388 | u32 msg_len); |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 389 | u8 app_worker_mq_wrk_is_congested (app_worker_t *app_wrk, u32 thread_index); |
| 390 | void app_worker_set_mq_wrk_congested (app_worker_t *app_wrk, u32 thread_index); |
| 391 | void app_worker_unset_wrk_mq_congested (app_worker_t *app_wrk, |
| 392 | u32 thread_index); |
Florin Coras | 623eb56 | 2019-02-03 19:28:34 -0800 | [diff] [blame] | 393 | session_t *app_worker_proxy_listener (app_worker_t * app, u8 fib_proto, |
| 394 | u8 transport_proto); |
Florin Coras | c8e812f | 2020-05-14 05:32:18 +0000 | [diff] [blame] | 395 | void app_worker_del_detached_sm (app_worker_t * app_wrk, u32 sm_index); |
Florin Coras | 623eb56 | 2019-02-03 19:28:34 -0800 | [diff] [blame] | 396 | u8 *format_app_worker (u8 * s, va_list * args); |
| 397 | u8 *format_app_worker_listener (u8 * s, va_list * args); |
Nathan Skrzypczak | de6caf4 | 2019-10-09 14:41:48 +0200 | [diff] [blame] | 398 | u8 *format_crypto_engine (u8 * s, va_list * args); |
| 399 | u8 *format_crypto_context (u8 * s, va_list * args); |
Florin Coras | 623eb56 | 2019-02-03 19:28:34 -0800 | [diff] [blame] | 400 | void app_worker_format_connects (app_worker_t * app_wrk, int verbose); |
Filip Tehlar | 0028e6f | 2023-06-28 10:47:32 +0200 | [diff] [blame] | 401 | session_error_t vnet_app_worker_add_del (vnet_app_worker_add_del_args_t *a); |
Florin Coras | 371ca50 | 2018-02-21 12:07:41 -0800 | [diff] [blame] | 402 | |
Florin Coras | 371ca50 | 2018-02-21 12:07:41 -0800 | [diff] [blame] | 403 | uword unformat_application_proto (unformat_input_t * input, va_list * args); |
Florin Coras | f8f516a | 2018-02-08 15:10:09 -0800 | [diff] [blame] | 404 | |
Nathan Skrzypczak | 79f8953 | 2019-09-13 11:08:13 +0200 | [diff] [blame] | 405 | app_cert_key_pair_t *app_cert_key_pair_get (u32 index); |
| 406 | app_cert_key_pair_t *app_cert_key_pair_get_if_valid (u32 index); |
| 407 | app_cert_key_pair_t *app_cert_key_pair_get_default (); |
Florin Coras | 458089b | 2019-08-21 16:20:44 -0700 | [diff] [blame] | 408 | |
Florin Coras | 98078ab | 2021-08-12 18:12:09 -0700 | [diff] [blame] | 409 | void sapi_socket_close_w_handle (u32 api_handle); |
Florin Coras | 458089b | 2019-08-21 16:20:44 -0700 | [diff] [blame] | 410 | |
Florin Coras | 79ba25d | 2019-10-20 19:32:47 -0700 | [diff] [blame] | 411 | crypto_engine_type_t app_crypto_engine_type_add (void); |
| 412 | u8 app_crypto_engine_n_types (void); |
| 413 | |
Florin Coras | 0242d30 | 2022-12-22 15:03:44 -0800 | [diff] [blame] | 414 | static inline u8 |
| 415 | app_worker_application_is_builtin (app_worker_t *app_wrk) |
| 416 | { |
| 417 | return app_wrk->app_is_builtin; |
| 418 | } |
| 419 | |
Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame] | 420 | #endif /* SRC_VNET_SESSION_APPLICATION_H_ */ |
| 421 | |
| 422 | /* |
| 423 | * fd.io coding-style-patch-verification: ON |
| 424 | * |
| 425 | * Local Variables: |
| 426 | * eval: (c-set-style "gnu") |
| 427 | * End: |
| 428 | */ |