From accd53ff6a06dc96b09e2498189b062037e4c3d7 Mon Sep 17 00:00:00 2001 From: Pengyu Lv Date: Tue, 7 Mar 2023 10:31:08 +0800 Subject: [PATCH] Add getter access to endpoint field in mbedtls_ssl_config Signed-off-by: Pengyu Lv --- include/mbedtls/ssl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index 912ad102e..4d8652525 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -1918,6 +1918,19 @@ int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl); */ void mbedtls_ssl_conf_endpoint(mbedtls_ssl_config *conf, int endpoint); +/** + * \brief Get the current endpoint type + * + * \param conf SSL configuration + * + * \return Endpoint type, either MBEDTLS_SSL_IS_CLIENT + * or MBEDTLS_SSL_IS_SERVER + */ +static inline int mbedtls_ssl_conf_get_endpoint(mbedtls_ssl_config *conf) +{ + return conf->MBEDTLS_PRIVATE(endpoint); +} + /** * \brief Set the transport type (TLS or DTLS). * Default: TLS