<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:a48239f60f1b4318cc112706fc40c6cea"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Static constants defining the possible errors encountered. <ahref="class_s_s_l_client.html#a48239f60f1b4318cc112706fc40c6cea">More...</a><br/></td></tr>
<trclass="memdesc:af632625f8d247f3885c81e1f05043ad1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Level of verbosity used in logging for <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a>. <ahref="class_s_s_l_client.html#af632625f8d247f3885c81e1f05043ad1">More...</a><br/></td></tr>
<trclass="memdesc:a68f026a625ca1ccd1aba87bb6e670376"><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="#a68f026a625ca1ccd1aba87bb6e670376">More...</a><br/></td></tr>
<trclass="memdesc:ab97c0745f65a6c6009ac938b3b9912c3"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Connect over SSL to a host specified by an IP address. <ahref="#ab97c0745f65a6c6009ac938b3b9912c3">More...</a><br/></td></tr>
<trclass="memdesc:a248a5152cc3c3e7666bf5443bfd57c90"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Connect over SSL to a host specified by a hostname. <ahref="#a248a5152cc3c3e7666bf5443bfd57c90">More...</a><br/></td></tr>
<trclass="memdesc:a03c7926938acd57cfc3b982edf725a86"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Write some bytes to the SSL connection. <ahref="#a03c7926938acd57cfc3b982edf725a86">More...</a><br/></td></tr>
<trclass="memitem:a7343a58457b4659f83b61cac1f442c3d"><tdclass="memItemLeft"align="right"valign="top">size_t </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client.html#a7343a58457b4659f83b61cac1f442c3d">write</a> (uint8_t b) override</td></tr>
<trclass="memdesc:a0e775669b4a040fbd3f281dcbcd2de78"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the number of bytes available to read from the data that has been received and decrypted. <ahref="#a0e775669b4a040fbd3f281dcbcd2de78">More...</a><br/></td></tr>
<trclass="memdesc:a4c5420541a06213133ae308a3bca1c95"><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="#a4c5420541a06213133ae308a3bca1c95">More...</a><br/></td></tr>
<trclass="memdesc:aef1b52f4ad9633126cb68739175920eb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Read a single byte, or -1 if none is available. <ahref="#aef1b52f4ad9633126cb68739175920eb">More...</a><br/></td></tr>
<trclass="memdesc:a0c0b6f2ad25701d1e45adb613d072d86"><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="#a0c0b6f2ad25701d1e45adb613d072d86">More...</a><br/></td></tr>
<trclass="memdesc:aaf2192a6621fdf2f89cc26a9a1584f8c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Force writing the buffered bytes from <aclass="el"href="class_s_s_l_client.html#a03c7926938acd57cfc3b982edf725a86"title="Write some bytes to the SSL connection.">SSLClient::write</a> to the network. <ahref="#aaf2192a6621fdf2f89cc26a9a1584f8c">More...</a><br/></td></tr>
<trclass="memdesc:ad8ed697371748e31e01c3f697bc36cbe"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Close the connection. <ahref="#ad8ed697371748e31e01c3f697bc36cbe">More...</a><br/></td></tr>
<trclass="memdesc:a5488f01ccfddfd9e41f54dfbda48bcae"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Check if the device is connected. <ahref="#a5488f01ccfddfd9e41f54dfbda48bcae">More...</a><br/></td></tr>
<trclass="memdesc:a9e7ce7f8a72d7cdc071be3fa7a4c8f29"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Add a client certificate and enable support for mutual auth. <ahref="#a9e7ce7f8a72d7cdc071be3fa7a4c8f29">More...</a><br/></td></tr>
<trclass="memdesc:a2bd012ef6f01df9694ba9fd0a3c227c3"><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="#a2bd012ef6f01df9694ba9fd0a3c227c3">More...</a><br/></td></tr>
<trclass="memdesc:ad5d9d8a4187a3f8918bf66af83e733c4"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Clear the session corresponding to a host and IP. <ahref="#ad5d9d8a4187a3f8918bf66af83e733c4">More...</a><br/></td></tr>
<trclass="memdesc:ae3f9e6f8e8a50e520c936239abecfd22"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the maximum number of SSL sessions that can be stored at once. <ahref="#ae3f9e6f8e8a50e520c936239abecfd22">More...</a><br/></td></tr>
<trclass="memdesc:a4192ee3562c4806d4a6829356ca2636b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Equivalent to <aclass="el"href="class_s_s_l_client.html#a5488f01ccfddfd9e41f54dfbda48bcae"title="Check if the device is connected.">SSLClient::connected()</a>> 0. <ahref="#a4192ee3562c4806d4a6829356ca2636b">More...</a><br/></td></tr>
<trclass="memdesc:a9a4e9c9877ab73cf7e82d6942cc7db21"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns a reference to the client object stored in this class. Take care not to break it. <ahref="#a9a4e9c9877ab73cf7e82d6942cc7db21">More...</a><br/></td></tr>
<trclass="memitem:a8da354f30537c1064d554921937a73ae"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="class_s_s_l_client.html#a8da354f30537c1064d554921937a73ae">setTimeout</a> (unsigned int t)</td></tr>
<trclass="memdesc:a8da354f30537c1064d554921937a73ae"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Set the timeout when waiting for an SSL response. <ahref="#a8da354f30537c1064d554921937a73ae">More...</a><br/></td></tr>
<trclass="memdesc:a2a178251978e0622f7e241da702ae498"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the timeout when waiting for an SSL response. <ahref="#a2a178251978e0622f7e241da702ae498">More...</a><br/></td></tr>
<divclass="textblock"><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>Level of verbosity used in logging for <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a>. </p>
<p>Use these values when initializing <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> to set how many logs you would like to see in the Serial monitor. </p>
<tr><tdclass="fieldname"><aid="af632625f8d247f3885c81e1f05043ad1a199742ec5c99c72d9cede1fda0f125c5"></a>SSL_ERROR </td><tdclass="fielddoc"><p>Only output errors that result in connection failure </p>
</td></tr>
<tr><tdclass="fieldname"><aid="af632625f8d247f3885c81e1f05043ad1a26f3e5f1481f3ea22ea4ab5370b0fa97"></a>SSL_WARN </td><tdclass="fielddoc"><p>Output errors and warnings (useful when just starting to develop) </p>
</td></tr>
<tr><tdclass="fieldname"><aid="af632625f8d247f3885c81e1f05043ad1a8d5f7561f9cc0a2f3e5f362b02f4a5b2"></a>SSL_INFO </td><tdclass="fielddoc"><p>Output errors, warnings, and internal information (very verbose) </p>
<p>Static constants defining the possible errors encountered. </p>
<p>If <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> encounters an error, it will generally output logs into the serial monitor. If you need a way of programmatically checking the errors, you can do so with SSLClient::getWriteError(), which will return one of these values. </p>
<tr><tdclass="fieldname"><aid="a48239f60f1b4318cc112706fc40c6ceaa7510402478ffbecd6e1aa3811b175cfd"></a>SSL_CLIENT_CONNECT_FAIL </td><tdclass="fielddoc"><p>The underlying client failed to connect, probably not an issue with SSL </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48239f60f1b4318cc112706fc40c6ceaa6a9cc2412a53b5981e937a41523eece5"></a>SSL_BR_CONNECT_FAIL </td><tdclass="fielddoc"><p>BearSSL failed to complete the SSL handshake, check logs for bear ssl error output </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48239f60f1b4318cc112706fc40c6ceaab8581e1172fbf15067d435706d3a03a8"></a>SSL_CLIENT_WRTIE_ERROR </td><tdclass="fielddoc"><p>The underlying client failed to write a payload, probably not an issue with SSL </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48239f60f1b4318cc112706fc40c6ceaa37bef298be71b84a57e59fadbfbd9016"></a>SSL_BR_WRITE_ERROR </td><tdclass="fielddoc"><p>An internal error occurred with BearSSL, check logs for diagnosis. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48239f60f1b4318cc112706fc40c6ceaaf66f8d5f6601f9e7607b78bf7a07fc84"></a>SSL_INTERNAL_ERROR </td><tdclass="fielddoc"><p>An internal error occurred with <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a>, and you probably need to submit an issue on Github. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48239f60f1b4318cc112706fc40c6ceaa0a4f8af0226cf29ede8f6fe4a9047b08"></a>SSL_OUT_OF_MEMORY </td><tdclass="fielddoc"><p><aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> detected that there was not enough memory (>8000 bytes) to continue. </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>
<p>This function updates the state of the SSL engine (including writing any data, see <aclass="el"href="class_s_s_l_client.html#a03c7926938acd57cfc3b982edf725a86"title="Write some bytes to the SSL connection.">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#a5488f01ccfddfd9e41f54dfbda48bcae"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#a5488f01ccfddfd9e41f54dfbda48bcae"title="Check if the device is connected.">SSLClient::connected</a> must be true. (Call <aclass="el"href="class_s_s_l_client.html#a5488f01ccfddfd9e41f54dfbda48bcae"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>
<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>
<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#a0e775669b4a040fbd3f281dcbcd2de78"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#a0e775669b4a040fbd3f281dcbcd2de78"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#a5488f01ccfddfd9e41f54dfbda48bcae"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 SSLClientImpl::connected_impl.</p>
<p>Force writing the buffered bytes from <aclass="el"href="class_s_s_l_client.html#a03c7926938acd57cfc3b982edf725a86"title="Write some bytes to the SSL connection.">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#a03c7926938acd57cfc3b982edf725a86"title="Write some bytes to the SSL connection.">SSLClient::write</a>. The implementation for this function can be found in SSLClientImpl::flush. </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>
<dlclass="section return"><dt>Returns</dt><dd>A pointer to the <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>, or NULL of none matched the criteria available </dd></dl>
<p>Equivalent to <aclass="el"href="class_s_s_l_client.html#a5488f01ccfddfd9e41f54dfbda48bcae"title="Check if the device is connected.">SSLClient::connected()</a>> 0. </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#a0e775669b4a040fbd3f281dcbcd2de78"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>
<p>This function checks if bytes are ready to be read by calling <aclass="el"href="class_s_s_l_client.html#a0e775669b4a040fbd3f281dcbcd2de78"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 SSLClientImpl::read_impl(uint8_t*, size_t)</p>
<dlclass="section pre"><dt>Precondition</dt><dd><aclass="el"href="class_s_s_l_client.html#a0e775669b4a040fbd3f281dcbcd2de78"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>Read a single byte, or -1 if none is available. </p>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="class_s_s_l_client.html#a4c5420541a06213133ae308a3bca1c95"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>Please ensure that the values in <code>params</code> are valid for the lifetime of <aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a>. You may want to make them global constants.</p>
<dlclass="section pre"><dt>Precondition</dt><dd><aclass="el"href="class_s_s_l_client.html"title="The main SSLClient class. Check out README.md for more info.">SSLClient</a> has not already started an SSL connection. </dd></dl>
<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#a0e775669b4a040fbd3f281dcbcd2de78"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#aaf2192a6621fdf2f89cc26a9a1584f8c"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 SSLClientImpl::write_impl(const uint8_t*, size_t)</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#a5488f01ccfddfd9e41f54dfbda48bcae"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>