-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathHTTPSConnection.hpp
More file actions
59 lines (46 loc) · 1.36 KB
/
HTTPSConnection.hpp
File metadata and controls
59 lines (46 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef SRC_HTTPSCONNECTION_HPP_
#define SRC_HTTPSCONNECTION_HPP_
#include <Arduino.h>
#include <string>
// Required for SSL
//#include "openssl/ssl.h"
//#undef read
#include <esp_tls.h>
// Required for sockets
#include "lwip/netdb.h"
#undef read
#include "lwip/sockets.h"
#include "HTTPSServerConstants.hpp"
#include "HTTPConnection.hpp"
#include "HTTPHeaders.hpp"
#include "HTTPHeader.hpp"
#include "ResourceResolver.hpp"
#include "ResolvedResource.hpp"
#include "ResourceNode.hpp"
#include "HTTPRequest.hpp"
#include "HTTPResponse.hpp"
namespace httpsserver {
/**
* \brief Connection class for an open TLS-enabled connection to an HTTPSServer
*/
class HTTPSConnection : public HTTPConnection {
public:
HTTPSConnection(ResourceResolver * resResolver);
virtual ~HTTPSConnection();
virtual int initialize(int serverSocketID,esp_tls_cfg_server_t * cfgSrv, HTTPHeaders *defaultHeaders);
virtual void closeConnection();
virtual bool isSecure();
protected:
friend class HTTPRequest;
friend class HTTPResponse;
virtual size_t readBytesToBuffer(byte* buffer, size_t length);
virtual size_t pendingByteCount();
virtual bool canReadData();
virtual size_t writeBuffer(byte* buffer, size_t length);
private:
// SSL context for this connection
esp_tls_t * _ssl;
esp_tls_cfg_server_t * _cfg;
};
} /* namespace httpsserver */
#endif /* SRC_HTTPSCONNECTION_HPP_ */