X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Ftls%2Ftls.h;h=d950fe8262979e9aaecc23ec9097801c1a8cc442;hb=59f71132e;hp=f67f307550b4c4033352c3adcd6226525d5b318d;hpb=970a0b87bb7d7d9c16acbe9ea207a7d4c81bfaee;p=vpp.git diff --git a/src/vnet/tls/tls.h b/src/vnet/tls/tls.h index f67f307550b..d950fe82629 100644 --- a/src/vnet/tls/tls.h +++ b/src/vnet/tls/tls.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Cisco and/or its affiliates. + * Copyright (c) 2018-2019 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -13,8 +13,9 @@ * limitations under the License. */ - #include +#include +#include #include #ifndef SRC_VNET_TLS_TLS_H_ @@ -36,18 +37,23 @@ #endif /* *INDENT-OFF* */ -typedef CLIB_PACKED (struct tls_cxt_id_ +typedef struct tls_cxt_id_ { - u32 parent_app_index; - session_handle_t app_session_handle; + union { + session_handle_t app_session_handle; + u32 parent_app_api_ctx; + }; session_handle_t tls_session_handle; + u32 parent_app_wrk_index; + u32 ssl_ctx; u32 listener_ctx_index; u8 tcp_is_ip4; u8 tls_engine_id; -}) tls_ctx_id_t; +} tls_ctx_id_t; /* *INDENT-ON* */ -STATIC_ASSERT (sizeof (tls_ctx_id_t) <= 42, "ctx id must be less than 42"); +STATIC_ASSERT (sizeof (tls_ctx_id_t) <= TRANSPORT_CONN_ID_LEN, + "ctx id must be less than TRANSPORT_CONN_ID_LEN"); typedef struct tls_ctx_ { @@ -56,20 +62,25 @@ typedef struct tls_ctx_ transport_connection_t connection; tls_ctx_id_t c_tls_ctx_id; }; -#define parent_app_index c_tls_ctx_id.parent_app_index +#define parent_app_wrk_index c_tls_ctx_id.parent_app_wrk_index #define app_session_handle c_tls_ctx_id.app_session_handle #define tls_session_handle c_tls_ctx_id.tls_session_handle #define listener_ctx_index c_tls_ctx_id.listener_ctx_index #define tcp_is_ip4 c_tls_ctx_id.tcp_is_ip4 #define tls_ctx_engine c_tls_ctx_id.tls_engine_id +#define tls_ssl_ctx c_tls_ctx_id.ssl_ctx #define tls_ctx_handle c_c_index /* Temporary storage for session open opaque. Overwritten once * underlying tcp connection is established */ -#define parent_app_api_context c_s_index +#define parent_app_api_context c_tls_ctx_id.parent_app_api_ctx u8 is_passive_close; u8 resume; + u8 app_closed; + u8 no_app_session; u8 *srv_hostname; + u32 evt_index; + u32 ckpair_index; } tls_ctx_t; typedef struct tls_main_ @@ -86,6 +97,8 @@ typedef struct tls_main_ */ u8 use_test_cert_in_ca; char *ca_cert_path; + u64 first_seg_size; + u32 fifo_size; } tls_main_t; typedef struct tls_engine_vft_ @@ -96,27 +109,29 @@ typedef struct tls_engine_vft_ tls_ctx_t *(*ctx_get_w_thread) (u32 ctx_index, u8 thread_index); int (*ctx_init_client) (tls_ctx_t * ctx); int (*ctx_init_server) (tls_ctx_t * ctx); - int (*ctx_read) (tls_ctx_t * ctx, stream_session_t * tls_session); - int (*ctx_write) (tls_ctx_t * ctx, stream_session_t * app_session); + int (*ctx_read) (tls_ctx_t * ctx, session_t * tls_session); + int (*ctx_write) (tls_ctx_t * ctx, session_t * app_session, + transport_send_params_t * sp); u8 (*ctx_handshake_is_over) (tls_ctx_t * ctx); + int (*ctx_start_listen) (tls_ctx_t * ctx); + int (*ctx_stop_listen) (tls_ctx_t * ctx); + int (*ctx_transport_close) (tls_ctx_t * ctx); + int (*ctx_app_close) (tls_ctx_t * ctx); } tls_engine_vft_t; -typedef enum tls_engine_type_ -{ - TLS_ENGINE_NONE, - TLS_ENGINE_MBEDTLS, - TLS_ENGINE_OPENSSL, - TLS_N_ENGINES -} tls_engine_type_t; - tls_main_t *vnet_tls_get_main (void); void tls_register_engine (const tls_engine_vft_t * vft, - tls_engine_type_t type); -int tls_add_vpp_q_evt (svm_fifo_t * f, u8 evt_type); + crypto_engine_type_t type); +int tls_add_vpp_q_rx_evt (session_t * s); +int tls_add_vpp_q_tx_evt (session_t * s); +int tls_add_vpp_q_builtin_tx_evt (session_t * s); +int tls_add_vpp_q_builtin_rx_evt (session_t * s); int tls_notify_app_accept (tls_ctx_t * ctx); -int tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed); -void tls_notify_app_enqueue (tls_ctx_t * ctx, stream_session_t * app_session); +int tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err); +void tls_notify_app_enqueue (tls_ctx_t * ctx, session_t * app_session); +void tls_disconnect_transport (tls_ctx_t * ctx); #endif /* SRC_VNET_TLS_TLS_H_ */ + /* * fd.io coding-style-patch-verification: ON *