30
30
Check out README.md for more info.
31
31
*/
32
32
33
- class EthernetSSLClient : public Client
33
+ class EthernetSSLClient : public Client
34
34
{
35
35
public:
36
36
/* *
@@ -41,7 +41,7 @@ class EthernetSSLClient : public Client
41
41
checking the errors, you can do so with EthernetSSLClient::getWriteError(),
42
42
which will return one of these values.
43
43
*/
44
- enum Error
44
+ enum Error
45
45
{
46
46
SSL_OK = 0 ,
47
47
/* * The underlying client failed to connect, probably not an issue with SSL */
@@ -64,7 +64,7 @@ class EthernetSSLClient : public Client
64
64
Use these values when initializing EthernetSSLClient to set how many logs you
65
65
would like to see in the Serial monitor.
66
66
*/
67
- enum DebugLevel
67
+ enum DebugLevel
68
68
{
69
69
/* * No logging output */
70
70
SSL_NONE = 0 ,
@@ -209,9 +209,9 @@ class EthernetSSLClient : public Client
209
209
fails to become ready for writing data.
210
210
*/
211
211
size_t write (const uint8_t *buf, size_t size) override ;
212
-
212
+
213
213
/* * @see EthernetSSLClient::write(uint8_t*, size_t) */
214
- size_t write (uint8_t b) override
214
+ size_t write (uint8_t b) override
215
215
{
216
216
return write (&b, 1 );
217
217
}
@@ -262,10 +262,10 @@ class EthernetSSLClient : public Client
262
262
@brief Read a single byte, or -1 if none is available.
263
263
@see EthernetSSLClient::read(uint8_t*, size_t)
264
264
*/
265
- int read () override
265
+ int read () override
266
266
{
267
267
uint8_t read_val;
268
-
268
+
269
269
return read (&read_val, 1 ) > 0 ? read_val : -1 ;
270
270
};
271
271
@@ -358,7 +358,7 @@ class EthernetSSLClient : public Client
358
358
359
359
@returns The SessionCache template parameter.
360
360
*/
361
- size_t getSessionCount () const
361
+ size_t getSessionCount () const
362
362
{
363
363
return m_sessions.size ();
364
364
}
@@ -368,13 +368,13 @@ class EthernetSSLClient : public Client
368
368
369
369
@returns true if connected, false if not
370
370
*/
371
- operator bool ()
371
+ operator bool ()
372
372
{
373
373
return connected () > 0 ;
374
374
}
375
375
376
376
/* * @brief Returns a reference to the client object stored in this class. Take care not to break it. */
377
- Client& getClient ()
377
+ Client& getClient ()
378
378
{
379
379
return m_client;
380
380
}
@@ -383,7 +383,7 @@ class EthernetSSLClient : public Client
383
383
@brief Set the timeout when waiting for an SSL response.
384
384
@param t The timeout value, in milliseconds (defaults to 30 seconds if not set). Do not set to zero.
385
385
*/
386
- void setTimeout (unsigned int t)
386
+ void setTimeout (unsigned int t)
387
387
{
388
388
m_timeout = t;
389
389
}
@@ -392,33 +392,33 @@ class EthernetSSLClient : public Client
392
392
@brief Get the timeout when waiting for an SSL response.
393
393
@returns The timeout value in milliseconds.
394
394
*/
395
- unsigned int getTimeout () const
395
+ unsigned int getTimeout () const
396
396
{
397
397
return m_timeout;
398
398
}
399
-
399
+
400
400
/* *
401
- @brief Change the time used during x509 verification to a different value.
401
+ @brief Change the time used during x509 verification to a different value.
402
402
403
- This function directly calls br_x509_minimal_set_time to change the validation
404
- time used by the minimal verification engine. You can use this function if the default value
405
- of the compile time is causing issues. See https://bearssl.org/apidoc/bearssl__x509_8h.html#a7f3558b1999ce904084d578700b1002c
406
- for more information what this function does and how to use it.
403
+ This function directly calls br_x509_minimal_set_time to change the validation
404
+ time used by the minimal verification engine. You can use this function if the default value
405
+ of the compile time is causing issues. See https://bearssl.org/apidoc/bearssl__x509_8h.html#a7f3558b1999ce904084d578700b1002c
406
+ for more information what this function does and how to use it.
407
407
408
- @param days Days are counted in a proleptic Gregorian calendar since January 1st, 0 AD.
409
- @param seconds Seconds are counted since midnight, from 0 to 86400 (a count of 86400 is possible only if a leap second happened).
408
+ @param days Days are counted in a proleptic Gregorian calendar since January 1st, 0 AD.
409
+ @param seconds Seconds are counted since midnight, from 0 to 86400 (a count of 86400 is possible only if a leap second happened).
410
410
*/
411
-
411
+
412
412
void setVerificationTime (uint32_t days, uint32_t seconds);
413
413
414
414
private:
415
415
/* * @brief Returns an instance of m_client that is polymorphic and can be used by EthernetSSLClient */
416
- Client& get_arduino_client ()
416
+ Client& get_arduino_client ()
417
417
{
418
418
return m_client;
419
419
}
420
-
421
- const Client& get_arduino_client () const
420
+
421
+ const Client& get_arduino_client () const
422
422
{
423
423
return m_client;
424
424
}
@@ -448,12 +448,12 @@ class EthernetSSLClient : public Client
448
448
449
449
/* * @brief debugging print function, only prints if m_debug is true */
450
450
template <typename T>
451
- void m_print (const T str, const char * func_name, const DebugLevel level) const
451
+ void m_print (const T str, const char * func_name, const DebugLevel level) const
452
452
{
453
453
// check the current debug level and serial status
454
- if (level > m_debug || !Serial)
454
+ if (level > m_debug || !Serial)
455
455
return ;
456
-
456
+
457
457
// print prefix
458
458
m_print_prefix (func_name, level);
459
459
// print the message
@@ -462,19 +462,19 @@ class EthernetSSLClient : public Client
462
462
463
463
/* * @brief Prints a info message to serial, if info messages are enabled */
464
464
template <typename T>
465
- void m_info (const T str, const char * func_name) const
465
+ void m_info (const T str, const char * func_name) const
466
466
{
467
467
m_print (str, func_name, SSL_INFO);
468
468
}
469
469
470
470
template <typename T>
471
- void m_warn (const T str, const char * func_name) const
471
+ void m_warn (const T str, const char * func_name) const
472
472
{
473
473
m_print (str, func_name, SSL_WARN);
474
474
}
475
475
476
476
template <typename T>
477
- void m_error (const T str, const char * func_name) const
477
+ void m_error (const T str, const char * func_name) const
478
478
{
479
479
m_print (str, func_name, SSL_ERROR);
480
480
}
@@ -484,7 +484,7 @@ class EthernetSSLClient : public Client
484
484
// ============================================
485
485
// create a reference the client
486
486
Client& m_client;
487
-
487
+
488
488
// also store an array of SSLSessions, so we can resume communication with multiple websites
489
489
std::vector<SSLSession> m_sessions;
490
490
// as well as the maximmum number of sessions we can store
@@ -517,7 +517,7 @@ class EthernetSSLClient : public Client
517
517
unsigned char m_iobuf[2048 ];
518
518
// unsigned char m_iobuf[4096];
519
519
// ////
520
-
520
+
521
521
// store the index of where we are writing in the buffer
522
522
// so we can send our records all at once to prevent
523
523
// weird timing issues
0 commit comments