More work on SSL support.
You can now accept SSL connections using SSLListeners, and then send/receive data through the associated SSLSocket. HttpSocket's now support both HTTP and HTTPS, using templates: fr::HttpSocket<fr::SSLSocket> https_socket; fr::HttpSocket<fr::TcpSocket> http_socket;
This commit is contained in:
+6
-10
@@ -5,7 +5,7 @@
|
||||
#ifndef FRNETLIB_SSL_SOCKET_H
|
||||
#define FRNETLIB_SSL_SOCKET_H
|
||||
|
||||
//#define SSL_ENABLED
|
||||
#define SSL_ENABLED
|
||||
|
||||
#ifdef SSL_ENABLED
|
||||
|
||||
@@ -94,13 +94,6 @@ namespace fr
|
||||
*/
|
||||
Status receive_raw(void *data, size_t data_size, size_t &received) override;
|
||||
|
||||
/*!
|
||||
* Sets the socket file descriptor.
|
||||
*
|
||||
* @param descriptor The socket descriptor.
|
||||
*/
|
||||
void set_descriptor(int descriptor) override;
|
||||
|
||||
/*!
|
||||
* Close the connection.
|
||||
*/
|
||||
@@ -115,11 +108,14 @@ namespace fr
|
||||
*/
|
||||
Socket::Status connect(const std::string &address, const std::string &port) override;
|
||||
|
||||
void set_ssl_context(std::unique_ptr<mbedtls_ssl_context> context);
|
||||
void set_net_context(std::unique_ptr<mbedtls_net_context> context);
|
||||
|
||||
private:
|
||||
mbedtls_net_context ssl_socket_descriptor;
|
||||
std::unique_ptr<mbedtls_net_context> ssl_socket_descriptor;
|
||||
mbedtls_entropy_context entropy;
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
mbedtls_ssl_context ssl;
|
||||
std::unique_ptr<mbedtls_ssl_context> ssl;
|
||||
mbedtls_ssl_config conf;
|
||||
mbedtls_x509_crt cacert;
|
||||
uint32_t flags;
|
||||
|
||||
Reference in New Issue
Block a user