EHS
Loading...
Searching...
No Matches
SSL.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Str.h"
5#include "TCP.h"
6#include "Request.h"
7#include "Response.h"
8
9typedef struct ssl_ctx_st SSL_CTX;
10typedef struct ssl_st SSL;
11
12namespace ehs
13{
15 class EHS_LIB_IO SSL : public TCP
16 {
17 private:
18 SSL_CTX* ctx;
19 ::SSL* sslHdl;
20
21 public:
22 ~SSL() override;
23
24 SSL();
25
26 SSL(const IP type);
27
28 SSL(TCP&& tcp) noexcept;
29
30 SSL(const TCP& tcp);
31
32 SSL(const SSL& ssl);
33
34 SSL& operator=(const SSL& ssl);
35
36 void Initialize() override;
37
38 void Release() override;
39
40 void Bind(const Str_8& address, unsigned short port) override;
41
42 SSL* Accept() override;
43
44 void Connect(const Str_8& address, const UInt_16 port) override;
45
46 UInt_64 Send(const Byte* const buffer, const UInt_32 size) override;
47
48 UInt_64 Receive(Byte* const buffer, const UInt_32 size) override;
49
50 void UseCertificate(const Byte* data, const UInt_64 size);
51
52 void UsePrivateKey(const Byte* data, const UInt_64 size);
53
54 bool IsValid();
55 };
56}
struct ssl_ctx_st SSL_CTX
Definition SSL.h:9
struct ssl_st SSL
Definition SSL.h:10
void Initialize() override
Explicitly initialize the socket.
Definition SSL.cpp:66
void Bind(const Str_8 &address, unsigned short port) override
Definition SSL.cpp:100
void Release() override
Explicitly release resources before it falls off the stack.
Definition SSL.cpp:76
UInt_64 Send(const Byte *const buffer, const UInt_32 size) override
Definition SSL.cpp:154
void UsePrivateKey(const Byte *data, const UInt_64 size)
Definition SSL.cpp:200
bool IsValid()
Definition SSL.cpp:218
SSL * Accept() override
Definition SSL.cpp:115
UInt_64 Receive(Byte *const buffer, const UInt_32 size) override
Definition SSL.cpp:168
void Connect(const Str_8 &address, const UInt_16 port) override
Definition SSL.cpp:140
SSL & operator=(const SSL &ssl)
Definition SSL.cpp:53
void UseCertificate(const Byte *data, const UInt_64 size)
Definition SSL.cpp:182
SSL()
Definition SSL.cpp:27
TCP()
Default members initialization.
Definition TCP_BSD.cpp:28
Definition Anchor.h:6
unsigned int UInt_32
Definition Types.h:49
IP
Definition Socket.h:29
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1902
unsigned char Byte
Definition Types.h:39
unsigned short UInt_16
Definition Types.h:46