|
29 | 29 | class WiFiSSLClient : public WiFiClient {
|
30 | 30 |
|
31 | 31 | public:
|
| 32 | + /** |
| 33 | + * Initializes objects of the `WiFiSSLClient` class. |
| 34 | + */ |
32 | 35 | WiFiSSLClient();
|
33 | 36 | ~WiFiSSLClient();
|
| 37 | + |
| 38 | + /** |
| 39 | + * Establishes a secure SSL connection to a specified IP address and port. |
| 40 | + * It takes an `IPAddress` object representing the IP address of the server |
| 41 | + * and a `uint16_t` port number as parameters. |
| 42 | + */ |
34 | 43 | virtual int connect(IPAddress ip, uint16_t port);
|
| 44 | + |
| 45 | + /** |
| 46 | + * Establishes a secure SSL connection to a specified host (domain name) and port. |
| 47 | + */ |
35 | 48 | virtual int connect(const char* host, uint16_t port);
|
| 49 | + |
| 50 | + /** |
| 51 | + * Sets the Certificate Authority (CA) certificate for establishing secure SSL connections. |
| 52 | + */ |
36 | 53 | void setCACert(const char* root_ca);
|
| 54 | + |
| 55 | + /** |
| 56 | + * Sets the ECC (Elliptic Curve Cryptography) key slot and |
| 57 | + * certificate for establishing secure SSL connections. |
| 58 | + * `int ecc508KeySlot` specifies the ECC key slot to be used for the SSL connection. |
| 59 | + * `const byte cert[]` is a pointer to the certificate data in the form of an array of bytes. |
| 60 | + * `int certLength` specifies the length of the certificate data array. |
| 61 | + */ |
37 | 62 | void setEccSlot(int ecc508KeySlot, const byte cert[], int certLength);
|
| 63 | + |
| 64 | + /** |
| 65 | + * Allows writing a single byte of data to the SSL connection. |
| 66 | + * The `uint8_t` parameter represents the byte of data to be written. |
| 67 | + */ |
38 | 68 | virtual size_t write(uint8_t);
|
| 69 | + |
| 70 | + /** |
| 71 | + * Allows writing a buffer of data to the SSL connection. |
| 72 | + */ |
39 | 73 | virtual size_t write(const uint8_t *buf, size_t size);
|
| 74 | + |
| 75 | + /** |
| 76 | + * Checks the number of bytes available for reading from the SSL connection. |
| 77 | + * It returns the number of bytes available to read from the SSL connection without blocking. |
| 78 | + */ |
40 | 79 | virtual int available();
|
| 80 | + |
| 81 | + /** |
| 82 | + * Reads a single byte of data from the SSL connection. |
| 83 | + */ |
41 | 84 | virtual int read();
|
| 85 | + |
| 86 | + /** |
| 87 | + * Reads a buffer of data from the SSL connection. |
| 88 | + */ |
42 | 89 | virtual int read(uint8_t *buf, size_t size);
|
| 90 | + |
| 91 | + /** |
| 92 | + * Peeks at the next byte of incoming data without removing it |
| 93 | + * from the internal buffer of the SSL connection. |
| 94 | + */ |
43 | 95 | virtual int peek();
|
| 96 | + |
| 97 | + /** |
| 98 | + * Flushes any pending data in the SSL connection. |
| 99 | + * When called, this function ensures that any buffered outgoing data is |
| 100 | + * sent over the SSL connection immediately. |
| 101 | + */ |
44 | 102 | virtual void flush();
|
| 103 | + |
| 104 | + /** |
| 105 | + * Closes the SSL connection. |
| 106 | + * When called, this function will terminate the SSL connection and |
| 107 | + * release any associated resources. |
| 108 | + */ |
45 | 109 | virtual void stop();
|
| 110 | + |
46 | 111 | virtual uint8_t connected();
|
47 | 112 | virtual operator bool() {
|
48 | 113 | return _sock != -1;
|
|
0 commit comments