diff --git a/include/frnetlib/SSLListener.h b/include/frnetlib/SSLListener.h index 1a428b6..d5c41da 100644 --- a/include/frnetlib/SSLListener.h +++ b/include/frnetlib/SSLListener.h @@ -81,6 +81,20 @@ namespace fr */ int32_t get_socket_descriptor() const override; + /*! + * Gets the ssl context + * + * @return The SSLContext + */ + const std::shared_ptr &get_ssl_context()const; + + /*! + * Gets the ssl context + * + * @return The SSLContext + */ + std::shared_ptr &get_ssl_context(); + private: mbedtls_net_context listen_fd; mbedtls_ssl_config conf; diff --git a/include/frnetlib/SSLSocket.h b/include/frnetlib/SSLSocket.h index 322d205..d619e11 100644 --- a/include/frnetlib/SSLSocket.h +++ b/include/frnetlib/SSLSocket.h @@ -126,6 +126,20 @@ namespace fr return is_blocking; } + /*! + * Gets the ssl context + * + * @return The SSLContext + */ + const std::shared_ptr &get_ssl_context()const; + + /*! + * Gets the ssl context + * + * @return The SSLContext + */ + std::shared_ptr &get_ssl_context(); + /*! * Checks to see if we're connected to a socket or not * @@ -151,4 +165,4 @@ namespace fr }; } -#endif //FRNETLIB_SSLSOCKET_H \ No newline at end of file +#endif //FRNETLIB_SSLSOCKET_H diff --git a/src/SSLListener.cpp b/src/SSLListener.cpp index 51796b0..f88d8e8 100644 --- a/src/SSLListener.cpp +++ b/src/SSLListener.cpp @@ -171,9 +171,19 @@ namespace fr } } + const std::shared_ptr &SSLListener::get_ssl_context()const + { + return ssl_context; + } + + std::shared_ptr &SSLListener::get_ssl_context() + { + return ssl_context; + } + bool SSLListener::connected() const { return listen_fd.fd > -1; } -} \ No newline at end of file +} diff --git a/src/SSLSocket.cpp b/src/SSLSocket.cpp index faf3890..5202299 100644 --- a/src/SSLSocket.cpp +++ b/src/SSLSocket.cpp @@ -284,9 +284,17 @@ namespace fr return -1; return ssl_socket_descriptor->fd; } + const std::shared_ptr &SSLSocket::get_ssl_context()const + { + return ssl_context; + } + std::shared_ptr &SSLSocket::get_ssl_context() + { + return ssl_context; + } bool SSLSocket::connected() const { return ssl_socket_descriptor && ssl_socket_descriptor->fd > -1; } -} \ No newline at end of file +}