Add getters for SSLListener's and SSLSocket's SSLContext member

This commit is contained in:
rexy712 2021-06-25 10:52:12 -07:00
parent 1ae3523fe2
commit 5215d5aca0
4 changed files with 49 additions and 3 deletions

View File

@ -81,6 +81,20 @@ namespace fr
*/
int32_t get_socket_descriptor() const override;
/*!
* Gets the ssl context
*
* @return The SSLContext
*/
const std::shared_ptr<SSLContext> &get_ssl_context()const;
/*!
* Gets the ssl context
*
* @return The SSLContext
*/
std::shared_ptr<SSLContext> &get_ssl_context();
private:
mbedtls_net_context listen_fd;
mbedtls_ssl_config conf;

View File

@ -126,6 +126,20 @@ namespace fr
return is_blocking;
}
/*!
* Gets the ssl context
*
* @return The SSLContext
*/
const std::shared_ptr<SSLContext> &get_ssl_context()const;
/*!
* Gets the ssl context
*
* @return The SSLContext
*/
std::shared_ptr<SSLContext> &get_ssl_context();
/*!
* Checks to see if we're connected to a socket or not
*

View File

@ -171,6 +171,16 @@ namespace fr
}
}
const std::shared_ptr<SSLContext> &SSLListener::get_ssl_context()const
{
return ssl_context;
}
std::shared_ptr<SSLContext> &SSLListener::get_ssl_context()
{
return ssl_context;
}
bool SSLListener::connected() const
{
return listen_fd.fd > -1;

View File

@ -284,6 +284,14 @@ namespace fr
return -1;
return ssl_socket_descriptor->fd;
}
const std::shared_ptr<SSLContext> &SSLSocket::get_ssl_context()const
{
return ssl_context;
}
std::shared_ptr<SSLContext> &SSLSocket::get_ssl_context()
{
return ssl_context;
}
bool SSLSocket::connected() const
{