]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/net/https/HTTPSClient.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / net / https / HTTPSClient.h
1 #ifndef HTTPSCLIENT_H
2 #define HTTPSCLIENT_H
3
4 #include "Socket/Socket.h"
5 #include "Socket/Endpoint.h"
6 #include "axTLS/ssl/ssl.h"
7 #include "HTTPHeader.h"
8
9 /**
10 TCP socket connection
11 */
12 class HTTPSClient : public Socket, public Endpoint {
13     
14 public:
15     /** TCP socket connection
16     */
17     HTTPSClient();
18     
19     
20     virtual ~HTTPSClient();
21     
22     /** Connects this TCP socket to the server
23     \param host The host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS.
24     \param port The host's port to connect to.
25     \return 0 on success, -1 on failure.
26     */
27     int connect(const char* host);
28     
29     /** Check if the socket is connected
30     \return true if connected, false otherwise.
31     */
32     bool is_connected(void);
33     
34     // Returns the size of the body
35     HTTPHeader get(char *path);
36     
37     int read(char *data, int len);
38
39
40     void close();
41     
42 private:
43
44
45     int send(char* data, int length);
46     
47     uint8_t read_line();
48     HTTPHeader read_header();
49
50     bool _is_connected;
51     SSL_CTX _ssl_ctx;
52     SSL _ssl;
53     std::string _host;
54 };
55
56 #endif