]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/net/https/HTTPSClient.h
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[max/tmk_keyboard.git] / tmk_core / 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