#pragma once #include "../../EHS.h" #include "../../Str.h" #include "TCP.h" #include "Request.h" #include "Response.h" typedef struct ssl_ctx_st SSL_CTX; typedef struct ssl_st SSL; namespace lwe { /// A class for handling the HTTP(S) TCP socket layer. class SSL : public TCP { private: SSL_CTX* ctx; ::SSL* sslHdl; public: ~SSL() override; SSL(); SSL(const AddrType type); SSL(TCP&& tcp) noexcept; SSL(const TCP& tcp); SSL(const SSL& ssl); SSL& operator=(const SSL& ssl); void Initialize() override; void Release() override; void Bind(const Str_8& address, unsigned short port) override; SSL* Accept() override; void Connect(const Str_8& address, const UInt_16 port) override; UInt_64 Send(const Byte* const buffer, const UInt_32 size) override; UInt_64 Receive(Byte* const buffer, const UInt_32 size) override; void UseCertificate(const Byte* data, const UInt_64 size); void UsePrivateKey(const Byte* data, const UInt_64 size); bool IsValid(); }; }