Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
SslSessionId.h
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/anakod/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * SslSessionId.h
8  *
9  ****/
10 
11 #ifndef _SMING_CORE_NETWORK_SSL_SSL_SESSION_ID_H_
12 #define _SMING_CORE_NETWORK_SSL_SSL_SESSION_ID_H_
13 
14 #include "ssl/ssl.h"
15 #include "WString.h"
16 
20 {
21 public:
23  const uint8_t* getValue()
24  {
25  return this ? reinterpret_cast<const uint8_t*>(value.c_str()) : nullptr;
26  }
27 
29  unsigned getLength()
30  {
31  return this ? value.length() : 0;
32  }
33 
34  bool isValid()
35  {
36  return getLength() != 0;
37  }
38 
39  bool assign(const uint8_t* newValue, unsigned newLength)
40  {
41  if(!value.setLength(newLength)) {
42  return false;
43  }
44  memcpy(value.begin(), newValue, newLength);
45  return true;
46  }
47 
48 private:
49  String value;
50 };
51 
52 #endif /* _SMING_CORE_NETWORK_SSL_SSL_SESSION_ID_H_ */
bool setLength(unsigned int length)
set the string length accordingly, expanding if necessary
The string class.
Definition: WString.h:104
unsigned getLength()
May be called even when object is null.
Definition: SslSessionId.h:29
const uint8_t * getValue()
May be called even when object is null.
Definition: SslSessionId.h:23
Manages buffer to store SSL Session ID.
Definition: SslSessionId.h:19