<p>The main <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> class. Check out <aclass="el"href="_r_e_a_d_m_e_8md.html">README.md</a> for more info.
<trclass="memdesc:ae9a7509bc8a18f67e286547c19deb3c0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Initialize <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> with all of the prerequisites needed. <ahref="#ae9a7509bc8a18f67e286547c19deb3c0">More...</a><br/></td></tr>
<trclass="memdesc:a4a2172aedfcc483ba2a256ad12148630"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Connect over SSL to a host specified by an IP address. <ahref="#a4a2172aedfcc483ba2a256ad12148630">More...</a><br/></td></tr>
<trclass="memdesc:a91c63e35f31652c20faa5b9be95984bf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Connect over SSL to a host specified by a hostname. <ahref="#a91c63e35f31652c20faa5b9be95984bf">More...</a><br/></td></tr>
<trclass="memitem:a6b8ff53c10fe34aab1dc2561410f70bb"><tdclass="memItemLeft"align="right"valign="top">size_t </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client.html#a6b8ff53c10fe34aab1dc2561410f70bb">write</a> (uint8_t b) override</td></tr>
<trclass="memdesc:a6bcb7579ebc051c097acb794b95771a9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Write some bytes to the SSL connection. <ahref="#a6bcb7579ebc051c097acb794b95771a9">More...</a><br/></td></tr>
<trclass="memdesc:a5d13fd2f32ee2ea65a1f3820f758e77e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the number of bytes available to read from the data that has been received and decrypted. <ahref="#a5d13fd2f32ee2ea65a1f3820f758e77e">More...</a><br/></td></tr>
<trclass="memdesc:aedf2746cc35da596faf8322776c2118e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Read a single byte, or -1 if none is available. <ahref="#aedf2746cc35da596faf8322776c2118e">More...</a><br/></td></tr>
<trclass="memdesc:afd6d7ae798c05cf566b2eb5651dba795"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Read size bytes from the SSL client buffer, copying them into *buf, and return the number of bytes read. <ahref="#afd6d7ae798c05cf566b2eb5651dba795">More...</a><br/></td></tr>
<trclass="memdesc:a31742867b00bd8d130637af0935bacbd"><tdclass="mdescLeft"> </td><tdclass="mdescRight">View the first byte of the buffer, without removing it from the <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> Buffer. <ahref="#a31742867b00bd8d130637af0935bacbd">More...</a><br/></td></tr>
<trclass="memdesc:a2ee6a3134d07ca09cf61ee04d32c3d44"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Force writing the buffered bytes from <aclass="el"href="class_s_s_l_client.html#a6b8ff53c10fe34aab1dc2561410f70bb">SSLClient::write</a> to the network. <ahref="#a2ee6a3134d07ca09cf61ee04d32c3d44">More...</a><br/></td></tr>
<trclass="memdesc:ad30db47248d78df7c12dedfb27f06529"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Close the connection. <ahref="#ad30db47248d78df7c12dedfb27f06529">More...</a><br/></td></tr>
<trclass="memdesc:a25e4414ab0c9424d09592f9567a678dc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Check if the device is connected. <ahref="#a25e4414ab0c9424d09592f9567a678dc">More...</a><br/></td></tr>
<trclass="memdesc:a2d8bf9b891151bc5b0b865d70cf9c086"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets a session reference corresponding to a host and IP, or a reference to a empty session if none exist. <ahref="#a2d8bf9b891151bc5b0b865d70cf9c086">More...</a><br/></td></tr>
<trclass="memdesc:a5b626703a24089dbb0480a9b6ddf348c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Clear the session corresponding to a host and IP. <ahref="#a5b626703a24089dbb0480a9b6ddf348c">More...</a><br/></td></tr>
<trclass="memdesc:a2d71f00d6634092f50c5262ad25cdacd"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the maximum number of SSL sessions that can be stored at once. <ahref="#a2d71f00d6634092f50c5262ad25cdacd">More...</a><br/></td></tr>
<trclass="memdesc:a2d378fbb7b8f15a1691746572f9d95b1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Equivalent to <aclass="el"href="class_s_s_l_client.html#a25e4414ab0c9424d09592f9567a678dc"title="Check if the device is connected.">SSLClient::connected()</a>> 0. <ahref="#a2d378fbb7b8f15a1691746572f9d95b1">More...</a><br/></td></tr>
<trclass="memitem:a5f40f8f4d26d21e14276c3e8162b62b9"><tdclass="memItemLeft"align="right"valign="top">bool </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client.html#a5f40f8f4d26d21e14276c3e8162b62b9">operator==</a> (const C &rhs)</td></tr>
<trclass="memdesc:a5f40f8f4d26d21e14276c3e8162b62b9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns whether or not two <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> objects have the same underlying client object. <ahref="#a5f40f8f4d26d21e14276c3e8162b62b9">More...</a><br/></td></tr>
<trclass="memitem:adab82ba09345fa070712d3124af30e1b"><tdclass="memItemLeft"align="right"valign="top">bool </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client.html#adab82ba09345fa070712d3124af30e1b">operator!=</a> (const C &rhs)</td></tr>
<trclass="memdesc:adab82ba09345fa070712d3124af30e1b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns whether or not two <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> objects do not have the same underlying client object. <ahref="#adab82ba09345fa070712d3124af30e1b">More...</a><br/></td></tr>
<trclass="memdesc:a563c5f9829757075bf16742cffa4cf73"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the local port, if C::localPort exists. <ahref="#a563c5f9829757075bf16742cffa4cf73">More...</a><br/></td></tr>
<trclass="memdesc:af76a0df76834e0d0999dbf44c7c0a174"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the remote IP, if C::remoteIP exists. <ahref="#af76a0df76834e0d0999dbf44c7c0a174">More...</a><br/></td></tr>
<trclass="memdesc:afd0d4d2c98433d60897d8828d8047d41"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns a reference to the client object stored in this class. Take care not to break it. <ahref="#afd0d4d2c98433d60897d8828d8047d41">More...</a><br/></td></tr>
<trclass="inherit_header pub_methods_class_s_s_l_client_impl"><tdcolspan="2"onclick="javascript:toggleInherit('pub_methods_class_s_s_l_client_impl')"><imgsrc="closed.png"alt="-"/> Public Member Functions inherited from <aclass="el"href="class_s_s_l_client_impl.html">SSLClientImpl</a></td></tr>
<trclass="memdesc:a9c5001bdfa75ccc0d93cc60dd872b38a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns an instance of m_client that is polymorphic and can be used by <aclass="el"href="class_s_s_l_client_impl.html"title="Implementation code to be inherited by SSLClient.">SSLClientImpl</a>. <ahref="#a9c5001bdfa75ccc0d93cc60dd872b38a">More...</a><br/></td></tr>
<trclass="memdesc:a9e7769fed78825cf4723778f4b5aa3e9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns an instance of the session array that is on the stack. <ahref="#a9e7769fed78825cf4723778f4b5aa3e9">More...</a><br/></td></tr>
<trclass="inherit_header pro_methods_class_s_s_l_client_impl"><tdcolspan="2"onclick="javascript:toggleInherit('pro_methods_class_s_s_l_client_impl')"><imgsrc="closed.png"alt="-"/> Protected Member Functions inherited from <aclass="el"href="class_s_s_l_client_impl.html">SSLClientImpl</a></td></tr>
<trclass="memdesc:a9ee82ad492f2297bd7cd0835c0d4556f inherit pro_methods_class_s_s_l_client_impl"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Prints a debugging prefix to all logs, so we can attatch them to useful information. <ahref="class_s_s_l_client_impl.html#a9ee82ad492f2297bd7cd0835c0d4556f">More...</a><br/></td></tr>
<trclass="memitem:a6e701597178b81f10d0db671b81ab075 inherit pro_methods_class_s_s_l_client_impl"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client_impl.html#a6e701597178b81f10d0db671b81ab075">m_print_ssl_error</a> (const int ssl_error, const <aclass="el"href="_s_s_l_client_impl_8h.html#ab658e6d84759440dbf3c890446075395">DebugLevel</a> level) const</td></tr>
<trclass="memdesc:a6e701597178b81f10d0db671b81ab075 inherit pro_methods_class_s_s_l_client_impl"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Prints the string associated with a write error. <ahref="class_s_s_l_client_impl.html#a6e701597178b81f10d0db671b81ab075">More...</a><br/></td></tr>
<trclass="memdesc:a2cf492a714cf787e54a17bb47cda43ed inherit pro_methods_class_s_s_l_client_impl"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Print the text string associated with a BearSSL error code. <ahref="class_s_s_l_client_impl.html#a2cf492a714cf787e54a17bb47cda43ed">More...</a><br/></td></tr>
<trclass="memitem:a45a1967029784a2f0f3edc7f75a00117 inherit pro_methods_class_s_s_l_client_impl"><tdclass="memTemplParams"colspan="2">template<typename T ></td></tr>
<trclass="memdesc:a45a1967029784a2f0f3edc7f75a00117 inherit pro_methods_class_s_s_l_client_impl"><tdclass="mdescLeft"> </td><tdclass="mdescRight">debugging print function, only prints if m_debug is true <ahref="class_s_s_l_client_impl.html#a45a1967029784a2f0f3edc7f75a00117">More...</a><br/></td></tr>
<trclass="memitem:a3b4cb1e9e510955078b83c9f84c0e18c inherit pro_methods_class_s_s_l_client_impl"><tdclass="memTemplParams"colspan="2">template<typename T ></td></tr>
<trclass="memitem:a3b4cb1e9e510955078b83c9f84c0e18c inherit pro_methods_class_s_s_l_client_impl"><tdclass="memTemplItemLeft"align="right"valign="top">void </td><tdclass="memTemplItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client_impl.html#a3b4cb1e9e510955078b83c9f84c0e18c">m_info</a> (const T str, const char *func_name) const</td></tr>
<trclass="memdesc:a3b4cb1e9e510955078b83c9f84c0e18c inherit pro_methods_class_s_s_l_client_impl"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Prints a info message to serial, if info messages are enabled. <ahref="class_s_s_l_client_impl.html#a3b4cb1e9e510955078b83c9f84c0e18c">More...</a><br/></td></tr>
<trclass="memitem:a2bfb55bcde46d8d77a46bfe0f577bf3f inherit pro_methods_class_s_s_l_client_impl"><tdclass="memTemplParams"colspan="2">template<typename T ></td></tr>
<trclass="memitem:a2bfb55bcde46d8d77a46bfe0f577bf3f inherit pro_methods_class_s_s_l_client_impl"><tdclass="memTemplItemLeft"align="right"valign="top">void </td><tdclass="memTemplItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client_impl.html#a2bfb55bcde46d8d77a46bfe0f577bf3f">m_warn</a> (const T str, const char *func_name) const</td></tr>
<trclass="memitem:ada595ed8f11673a9180ef0b762949c83 inherit pro_methods_class_s_s_l_client_impl"><tdclass="memTemplParams"colspan="2">template<typename T ></td></tr>
<trclass="memitem:ada595ed8f11673a9180ef0b762949c83 inherit pro_methods_class_s_s_l_client_impl"><tdclass="memTemplItemLeft"align="right"valign="top">void </td><tdclass="memTemplItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client_impl.html#ada595ed8f11673a9180ef0b762949c83">m_error</a> (const T str, const char *func_name) const</td></tr>
<p>The main <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> class. Check out <aclass="el"href="_r_e_a_d_m_e_8md.html">README.md</a> for more info. </p>
<p>Initialize <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> with all of the prerequisites needed. </p>
<dlclass="section pre"><dt>Precondition</dt><dd>You will need to generate an array of trust_anchors (root certificates) based off of the domains you want to make SSL connections to. Check out the <aclass="el"href="_trust_anchors_8md.html">TrustAnchors.md</a> file for more info. </dd>
<tr><tdclass="paramname">client</td><td>The base network device to create an SSL socket on. This object will be copied and the copy will be stored in <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a>. </td></tr>
<tr><tdclass="paramname">trust_anchors</td><td>Trust anchors used in the verification of the SSL server certificate. Check out <aclass="el"href="_trust_anchors_8md.html">TrustAnchors.md</a> for more info. </td></tr>
<tr><tdclass="paramname">trust_anchors_num</td><td>The number of objects in the trust_anchors array. </td></tr>
<tr><tdclass="paramname">analog_pin</td><td>An analog pin to pull random bytes from, used in seeding the RNG. </td></tr>
<tr><tdclass="paramname">debug</td><td>The level of debug logging (use the <aclass="el"href="_s_s_l_client_impl_8h.html#ab658e6d84759440dbf3c890446075395"title="Level of verbosity used in logging for SSLClient.">DebugLevel</a> enum). </td></tr>
<tr><tdclass="paramname">mutual_auth_params</td><td>Configuration to use for mutual authentication, nullptr to disable mutual auth. (see <aclass="el"href="struct_s_s_l_client_parameters.html"title="This struct stores data required for SSLClient to use mutual authentication.">SSLClientParameters</a>). </td></tr>
<p>Same as <aclass="el"href="class_s_s_l_client.html#ae9a7509bc8a18f67e286547c19deb3c0"title="Initialize SSLClient with all of the prerequisites needed.">SSLClient::SSLClient(const C &, const br_x509_trust_anchor*, const size_t, const int, const DebugLevel)</a>, but can compile support for mutual authentication. </p>
<p>This function updates the state of the SSL engine (including writing any data, see <aclass="el"href="class_s_s_l_client.html#a6b8ff53c10fe34aab1dc2561410f70bb">SSLClient::write</a>) and as a result should be called periodically when expecting data. Additionally, since if there are no bytes and if <aclass="el"href="class_s_s_l_client.html#a25e4414ab0c9424d09592f9567a678dc"title="Check if the device is connected.">SSLClient::connected</a> is false this function returns zero (this same behavior is found in EthernetClient), it is prudent to ensure in your own code that the preconditions are met before checking this function to prevent an ambiguous result.</p>
<dlclass="section pre"><dt>Precondition</dt><dd><aclass="el"href="class_s_s_l_client.html#a25e4414ab0c9424d09592f9567a678dc"title="Check if the device is connected.">SSLClient::connected</a> must be true. (Call <aclass="el"href="class_s_s_l_client.html#a25e4414ab0c9424d09592f9567a678dc"title="Check if the device is connected.">SSLClient::connected</a> before this function)</dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>The number of bytes available (can be zero), or zero if any of the pre conditions aren't satisfied. </dd></dl>
<p>SSLClient::connect(host, port) should be preferred over this function, as verifying the domain name is a step in ensuring the certificate is legitimate, which is important to the security of the device. Additionally, SSL sessions cannot be resumed when using this function, which can drastically increase initial connect time.</p>
<p>This function initializes the socket by calling m_client::connect(IPAddress, uint16_t) with the parameters supplied, then once the socket is open, uses BearSSL to to complete a SSL handshake. Due to the design of the SSL standard, this function will probably take an extended period (1-4sec) to negotiate the handshake and finish the connection. This function runs until the SSL handshake succeeds or fails.</p>
<p>SSL requires the client to generate some random bits (to be later combined with some random bits from the server), so <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> uses the least significant bits from the analog pin supplied in the constructor. The random bits are generated from 16 consecutive analogReads, and given to BearSSL before the handshake starts.</p>
<p>The implementation for this function can be found in <aclass="el"href="class_s_s_l_client_impl.html#aa5c14ecf301c268306946c85825e565b">SSLClientImpl::connect_impl(IPAddress, uint16_t)</a>.</p>
<dlclass="section pre"><dt>Precondition</dt><dd>The underlying client object (passed in through the constructor) is in a non- error state, and must be able to access the IP. </dd>
<aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> can only have one connection at a time, so the client object must not already be connected. </dd>
There must be sufficient memory available on the device to verify the certificate (if the free memory drops below 8000 bytes during certain points in the connection, <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> will fail). </dd>
There must be a trust anchor given to the constructor that corresponds to the certificate provided by the IP address being connected to. For more information check out <aclass="el"href="_trust_anchors_8md.html">TrustAnchors.md</a> .</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">ip</td><td>The IP address to connect to </td></tr>
<tr><tdclass="paramname">port</td><td>the port to connect to </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>1 if success, 0 if failure </dd></dl>
<p>This function initializes the socket by calling m_client::connect(const char*, uint16_t) with the parameters supplied, then once the socket is open, uses BearSSL to complete a SSL handshake. This function runs until the SSL handshake succeeds or fails.</p>
<p>SSL requires the client to generate some random bits (to be later combined with some random bits from the server), so <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> uses the least significant bits from the analog pin supplied in the constructor. The random bits are generated from 16 consecutive analogReads, and given to BearSSL before the handshake starts.</p>
<p>This function will usually take around 4-10 seconds. If possible, this function also attempts to resume the SSL session if one is present matching the hostname string, which will reduce connection time to 100-500ms. To read more about this functionality, check out Session Caching in the README.</p>
<p>The implementation for this function can be found in <aclass="el"href="class_s_s_l_client_impl.html#ae6c947ad92979ab99364428004abbeba">SSLClientImpl::connect_impl(const char*, uint16_t)</a></p>
<dlclass="section pre"><dt>Precondition</dt><dd>The underlying client object (passed in through the constructor) is in a non- error state, and must be able to access the IP. </dd>
<aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> can only have one connection at a time, so the client object must not already be connected. </dd>
There must be sufficient memory available on the device to verify the certificate (if the free memory drops below 8000 bytes during certain points in the connection, <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> will fail). </dd>
There must be a trust anchor given to the constructor that corresponds to the certificate provided by the IP address being connected to. For more information check out <aclass="el"href="_trust_anchors_8md.html">TrustAnchors.md</a> .</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">host</td><td>The hostname as a null-terminated c-string ("www.google.com") </td></tr>
<tr><tdclass="paramname">port</td><td>The port to connect to on the host (443 for HTTPS) </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>1 of success, 0 if failure </dd></dl>
<p>Use this function to determine if <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> is still connected and a SSL connection is active. It should be noted that this function should be called before <aclass="el"href="class_s_s_l_client.html#a5d13fd2f32ee2ea65a1f3820f758e77e"title="Returns the number of bytes available to read from the data that has been received and decrypted.">SSLClient::available</a>– both functions send and receive data with the SSLClient::m_client device, however <aclass="el"href="class_s_s_l_client.html#a5d13fd2f32ee2ea65a1f3820f758e77e"title="Returns the number of bytes available to read from the data that has been received and decrypted.">SSLClient::available</a> has some delays built in to protect SSLClient::m_client from being polled too frequently, and <aclass="el"href="class_s_s_l_client.html#a25e4414ab0c9424d09592f9567a678dc"title="Check if the device is connected.">SSLClient::connected</a> contains logic to ensure that if the socket is dropped <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> will react accordingly.</p>
<p>The implementation for this function can be found in <aclass="el"href="class_s_s_l_client_impl.html#a957984fa392550a7df86f758e9b14bfb">SSLClientImpl::connected_impl</a>.</p>
<dlclass="section return"><dt>Returns</dt><dd>1 if connected, 0 if not </dd></dl>
<p>Force writing the buffered bytes from <aclass="el"href="class_s_s_l_client.html#a6b8ff53c10fe34aab1dc2561410f70bb">SSLClient::write</a> to the network. </p>
<p>This function is blocking until all bytes from the buffer are written. For an explanation of how writing with <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> works, please see <aclass="el"href="class_s_s_l_client.html#a6b8ff53c10fe34aab1dc2561410f70bb">SSLClient::write</a>. The implementation for this function can be found in SSLClientImpl::flush. </p>
<p>Returns an instance of m_client that is polymorphic and can be used by <aclass="el"href="class_s_s_l_client_impl.html"title="Implementation code to be inherited by SSLClient.">SSLClientImpl</a>. </p>
<p>If no session corresponding to the host and IP exist, then this function will cycle through sessions in a rotating order. This allows the session cache to continually store sessions, however it will also result in old sessions being cleared and returned. In general, it is a good idea to use a SessionCache size equal to the number of domains you plan on connecting to.</p>
<p>The implementation for this function can be found at <aclass="el"href="class_s_s_l_client_impl.html#ab4e38d4319ec504395d67d2ab21a639e">SSLClientImpl::get_session_impl</a>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">host</td><td>A hostname c string, or NULL if one is not available </td></tr>
<tr><tdclass="paramname">addr</td><td>An IP address </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A reference to an <aclass="el"href="class_s_s_l_session.html"title="This class stores values which allow SSLClient to save and resume SSL sessions.">SSLSession</a> object </dd></dl>
<p>Equivalent to <aclass="el"href="class_s_s_l_client.html#a25e4414ab0c9424d09592f9567a678dc"title="Check if the device is connected.">SSLClient::connected()</a>> 0. </p>
<p>Returns whether or not two <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> objects do not have the same underlying client object. </p>
<p>Returns whether or not two <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> objects have the same underlying client object. </p>
<p>View the first byte of the buffer, without removing it from the <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> Buffer. </p>
<p>The implementation for this function can be found in SSLClientImpl::peek </p><dlclass="section pre"><dt>Precondition</dt><dd><aclass="el"href="class_s_s_l_client.html#a5d13fd2f32ee2ea65a1f3820f758e77e"title="Returns the number of bytes available to read from the data that has been received and decrypted.">SSLClient::available</a> must be >0 </dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>The first byte received, or -1 if the preconditions are not satisfied (warning: do not use if your data may be -1, as the return value is ambiguous) </dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="class_s_s_l_client.html#afd6d7ae798c05cf566b2eb5651dba795"title="Read size bytes from the SSL client buffer, copying them into *buf, and return the number of bytes re...">SSLClient::read(uint8_t*, size_t)</a></dd></dl>
<p>This function checks if bytes are ready to be read by calling <aclass="el"href="class_s_s_l_client.html#a5d13fd2f32ee2ea65a1f3820f758e77e"title="Returns the number of bytes available to read from the data that has been received and decrypted.">SSLClient::available</a>, and if so copies size number of bytes from the IO buffer into the buf pointer. Data read using this function will not include any SSL or socket commands, as the Client and BearSSL will capture those and process them separately.</p>
<p>If you find that you are having a lot of timeout errors, <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> may be experiencing a buffer overflow. Checkout <aclass="el"href="_r_e_a_d_m_e_8md.html">README.md</a> for more information.</p>
<p>The implementation for this function can be found in <aclass="el"href="class_s_s_l_client_impl.html#a231b7b1bb2182cda1ed6e9d5ebf66afe">SSLClientImpl::read_impl(uint8_t*, size_t)</a></p>
<dlclass="section pre"><dt>Precondition</dt><dd><aclass="el"href="class_s_s_l_client.html#a5d13fd2f32ee2ea65a1f3820f758e77e"title="Returns the number of bytes available to read from the data that has been received and decrypted.">SSLClient::available</a> must be >0</dd></dl>
<p>Clear the session corresponding to a host and IP. </p>
<p>The implementation for this function can be found at <aclass="el"href="class_s_s_l_client_impl.html#a6baed094969874fb9d2bea3a00ecbee1">SSLClientImpl::remove_session_impl</a>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">host</td><td>A hostname c string, or NULL if one is not available </td></tr>
<tr><tdclass="paramname">addr</td><td>An IP address </td></tr>
<p>If the SSL session is still active, all incoming data is discarded and BearSSL will attempt to close the session gracefully (will write to the network), and then call m_client::stop. If the session is not active or an error was encountered previously, this function will simply call m_client::stop. The implementation for this function can be found in SSLClientImpl::peek. </p>
<p>Assuming all preconditions are met, this function writes data to the BearSSL IO buffer, BUT does not initially send the data. Instead, you must call <aclass="el"href="class_s_s_l_client.html#a5d13fd2f32ee2ea65a1f3820f758e77e"title="Returns the number of bytes available to read from the data that has been received and decrypted.">SSLClient::available</a> or <aclass="el"href="class_s_s_l_client.html#a2ee6a3134d07ca09cf61ee04d32c3d44"title="Force writing the buffered bytes from SSLClient::write to the network.">SSLClient::flush</a>, which will detect that the buffer is ready for writing, and will write the data to the network. Alternatively, if this function is requested to write a larger amount of data than SSLClientImpl::m_iobuf can handle, data will be written to the network in pages the size of SSLClientImpl::m_iobuf until all the data in buf is sent–attempting to keep all writes to the network grouped together. For information on why this is the case check out <aclass="el"href="_r_e_a_d_m_e_8md.html">README.md</a> .</p>
<p>The implementation for this function can be found in <aclass="el"href="class_s_s_l_client_impl.html#a807656f814f24cf6cd711e429b716c4d">SSLClientImpl::write_impl(const uint8_t*, size_t)</a></p>
<dlclass="section pre"><dt>Precondition</dt><dd>The socket and SSL layer must be connected, meaning <aclass="el"href="class_s_s_l_client.html#a25e4414ab0c9424d09592f9567a678dc"title="Check if the device is connected.">SSLClient::connected</a> must be true. </dd>
BearSSL must not be waiting for the recipt of user data (if it is, there is probably an error with how the protocol in implemented in your code).</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">buf</td><td>the pointer to a buffer of bytes to copy </td></tr>
<tr><tdclass="paramname">size</td><td>the number of bytes to copy from the buffer </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The number of bytes copied to the buffer (size), or zero if the BearSSL engine fails to become ready for writing data. </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>