<ahref="_s_s_l_client_8h.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="comment">/* Copyright 2019 OSU OPEnS Lab</span></div><divclass="line"><aname="l00002"></a><spanclass="lineno"> 2</span> <spanclass="comment"> *</span></div><divclass="line"><aname="l00003"></a><spanclass="lineno"> 3</span> <spanclass="comment"> * Permission is hereby granted, free of charge, to any person obtaining a copy of this</span></div><divclass="line"><aname="l00004"></a><spanclass="lineno"> 4</span> <spanclass="comment"> * software and associated documentation files (the "Software"), to deal in the Software</span></div><divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * without restriction, including without limitation the rights to use, copy, modify,</span></div><divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to</span></div><divclass="line"><aname="l00007"></a><spanclass="lineno"> 7</span> <spanclass="comment"> * permit persons to whom the Software is furnished to do so, subject to the following</span></div><divclass="line"><aname="l00008"></a><spanclass="lineno"> 8</span> <spanclass="comment"> * conditions:</span></div><divclass="line"><aname="l00009"></a><spanclass="lineno"> 9</span> <spanclass="comment"> *</span></div><divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment"> * The above copyright notice and this permission notice shall be included in all</span></div><divclass="line"><aname="l00011"></a><spanclass="lineno"> 11</span> <spanclass="comment"> * copies or substantial portions of the Software.</span></div><divclass="line"><aname="l00012"></a><spanclass="lineno"> 12</span> <spanclass="comment"> *</span></div><divclass="line"><aname="l00013"></a><spanclass="lineno"> 13</span> <spanclass="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,</span></div><divclass="line"><aname="l00014"></a><spanclass="lineno"> 14</span> <spanclass="comment"> * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A</span></div><divclass="line"><aname="l00015"></a><spanclass="lineno"> 15</span> <spanclass="comment"> * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT</span></div><divclass="line"><aname="l00016"></a><spanclass="lineno"> 16</span> <spanclass="comment"> * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION</span></div><divclass="line"><aname="l00017"></a><spanclass="lineno"> 17</span> <spanclass="comment"> * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE</span></div><divclass="line"><aname="l00018"></a><spanclass="lineno"> 18</span> <spanclass="comment"> * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span></div><divclass="line"><aname="l00019"></a><spanclass="lineno"> 19</span> <spanclass="comment"> */</span></div><divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> </div><divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="preprocessor">#include <type_traits></span></div><divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="preprocessor">#include "Client.h"</span></div><divclass="line"><aname="l00023"></a><spanclass="lineno"> 23</span> <spanclass="preprocessor">#include "<aclass="code"href="_s_s_l_client_impl_8h.html">SSLClientImpl.h</a>"</span></div><divclass="line"><aname="l00024"></a><spanclass="lineno"> 24</span> <spanclass="preprocessor">#include "<aclass="code"href="_s_s_l_session_8h
<divclass="ttc"id="class_s_s_l_client_html_af76a0df76834e0d0999dbf44c7c0a174"><divclass="ttname"><ahref="class_s_s_l_client.html#af76a0df76834e0d0999dbf44c7c0a174">SSLClient::remoteIP</a></div><divclass="ttdeci">IPAddress remoteIP() override</div><divclass="ttdoc">Returns the remote IP, if C::remoteIP exists. Else return INADDR_NONE.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:342</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a6b8ff53c10fe34aab1dc2561410f70bb"><divclass="ttname"><ahref="class_s_s_l_client.html#a6b8ff53c10fe34aab1dc2561410f70bb">SSLClient::write</a></div><divclass="ttdeci">size_t write(uint8_t b) override</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:165</div></div>
<divclass="ttc"id="class_s_s_l_client_impl_html_ab4e38d4319ec504395d67d2ab21a639e"><divclass="ttname"><ahref="class_s_s_l_client_impl.html#ab4e38d4319ec504395d67d2ab21a639e">SSLClientImpl::get_session_impl</a></div><divclass="ttdeci">SSLSession & get_session_impl(const char *host, const IPAddress &addr)</div><divclass="ttdef"><b>Definition:</b> SSLClientImpl.cpp:276</div></div>
<divclass="ttc"id="class_s_s_l_session_html"><divclass="ttname"><ahref="class_s_s_l_session.html">SSLSession</a></div><divclass="ttdoc">This class stores values which allow SSLClient to save and resume SSL sessions.</div><divclass="ttdef"><b>Definition:</b> SSLSession.h:52</div></div>
<divclass="ttc"id="class_s_s_l_client_html_adab82ba09345fa070712d3124af30e1b"><divclass="ttname"><ahref="class_s_s_l_client.html#adab82ba09345fa070712d3124af30e1b">SSLClient::operator!=</a></div><divclass="ttdeci">bool operator!=(const C &rhs)</div><divclass="ttdoc">Returns whether or not two SSLClient objects do not have the same underlying client object.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:332</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a5d13fd2f32ee2ea65a1f3820f758e77e"><divclass="ttname"><ahref="class_s_s_l_client.html#a5d13fd2f32ee2ea65a1f3820f758e77e">SSLClient::available</a></div><divclass="ttdeci">int available() override</div><divclass="ttdoc">Returns the number of bytes available to read from the data that has been received and decrypted.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:209</div></div>
<divclass="ttc"id="class_s_s_l_client_html_afd0d4d2c98433d60897d8828d8047d41"><divclass="ttname"><ahref="class_s_s_l_client.html#afd0d4d2c98433d60897d8828d8047d41">SSLClient::getClient</a></div><divclass="ttdeci">C & getClient()</div><divclass="ttdoc">Returns a reference to the client object stored in this class. Take care not to break it.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:359</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a2ee6a3134d07ca09cf61ee04d32c3d44"><divclass="ttname"><ahref="class_s_s_l_client.html#a2ee6a3134d07ca09cf61ee04d32c3d44">SSLClient::flush</a></div><divclass="ttdeci">void flush() override</div><divclass="ttdoc">Force writing the buffered bytes from SSLClient::write to the network.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:256</div></div>
<divclass="ttc"id="class_s_s_l_client_html"><divclass="ttname"><ahref="class_s_s_l_client.html">SSLClient</a></div><divclass="ttdoc">The main SSLClient class. Check out README.md for more info.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:35</div></div>
<divclass="ttc"id="class_s_s_l_client_html_ad30db47248d78df7c12dedfb27f06529"><divclass="ttname"><ahref="class_s_s_l_client.html#ad30db47248d78df7c12dedfb27f06529">SSLClient::stop</a></div><divclass="ttdeci">void stop() override</div><divclass="ttdoc">Close the connection.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:266</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a6bcb7579ebc051c097acb794b95771a9"><divclass="ttname"><ahref="class_s_s_l_client.html#a6bcb7579ebc051c097acb794b95771a9">SSLClient::write</a></div><divclass="ttdeci">size_t write(const uint8_t *buf, size_t size) override</div><divclass="ttdoc">Write some bytes to the SSL connection.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:189</div></div>
<divclass="ttc"id="class_s_s_l_client_html_ae9a7509bc8a18f67e286547c19deb3c0"><divclass="ttname"><ahref="class_s_s_l_client.html#ae9a7509bc8a18f67e286547c19deb3c0">SSLClient::SSLClient</a></div><divclass="ttdeci">SSLClient(const C &client, const br_x509_trust_anchor *trust_anchors, const size_t trust_anchors_num, const int analog_pin, const DebugLevel debug=SSL_WARN)</div><divclass="ttdoc">Initialize SSLClient with all of the prerequisites needed.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:71</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a31742867b00bd8d130637af0935bacbd"><divclass="ttname"><ahref="class_s_s_l_client.html#a31742867b00bd8d130637af0935bacbd">SSLClient::peek</a></div><divclass="ttdeci">int peek() override</div><divclass="ttdoc">View the first byte of the buffer, without removing it from the SSLClient Buffer.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:247</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a5f40f8f4d26d21e14276c3e8162b62b9"><divclass="ttname"><ahref="class_s_s_l_client.html#a5f40f8f4d26d21e14276c3e8162b62b9">SSLClient::operator==</a></div><divclass="ttdeci">bool operator==(const C &rhs)</div><divclass="ttdoc">Returns whether or not two SSLClient objects have the same underlying client object.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:330</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a9e7769fed78825cf4723778f4b5aa3e9"><divclass="ttname"><ahref="class_s_s_l_client.html#a9e7769fed78825cf4723778f4b5aa3e9">SSLClient::get_session_array</a></div><divclass="ttdeci">SSLSession * get_session_array() override</div><divclass="ttdoc">Returns an instance of the session array that is on the stack.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:366</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a9c5001bdfa75ccc0d93cc60dd872b38a"><divclass="ttname"><ahref="class_s_s_l_client.html#a9c5001bdfa75ccc0d93cc60dd872b38a">SSLClient::get_arduino_client</a></div><divclass="ttdeci">Client & get_arduino_client() override</div><divclass="ttdoc">Returns an instance of m_client that is polymorphic and can be used by SSLClientImpl.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:363</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a563c5f9829757075bf16742cffa4cf73"><divclass="ttname"><ahref="class_s_s_l_client.html#a563c5f9829757075bf16742cffa4cf73">SSLClient::localPort</a></div><divclass="ttdeci">uint16_t localPort() override</div><divclass="ttdoc">Returns the local port, C::localPort exists. Else return 0.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:334</div></div>
<divclass="ttc"id="class_s_s_l_client_html_aedf2746cc35da596faf8322776c2118e"><divclass="ttname"><ahref="class_s_s_l_client.html#aedf2746cc35da596faf8322776c2118e">SSLClient::read</a></div><divclass="ttdeci">int read() override</div><divclass="ttdoc">Read a single byte, or -1 if none is available.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:215</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a25e4414ab0c9424d09592f9567a678dc"><divclass="ttname"><ahref="class_s_s_l_client.html#a25e4414ab0c9424d09592f9567a678dc">SSLClient::connected</a></div><divclass="ttdeci">uint8_t connected() override</div><divclass="ttdoc">Check if the device is connected.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:280</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a353c875d17a85dbb7bfe10de155f3b52"><divclass="ttname"><ahref="class_s_s_l_client.html#a353c875d17a85dbb7bfe10de155f3b52">SSLClient::get_arduino_client</a></div><divclass="ttdeci">const Client & get_arduino_client() const override</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:364</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a91c63e35f31652c20faa5b9be95984bf"><divclass="ttname"><ahref="class_s_s_l_client.html#a91c63e35f31652c20faa5b9be95984bf">SSLClient::connect</a></div><divclass="ttdeci">int connect(const char *host, uint16_t port) override</div><divclass="ttdoc">Connect over SSL to a host specified by a hostname.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:162</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a2d71f00d6634092f50c5262ad25cdacd"><divclass="ttname"><ahref="class_s_s_l_client.html#a2d71f00d6634092f50c5262ad25cdacd">SSLClient::getSessionCount</a></div><divclass="ttdeci">size_t getSessionCount() const override</div><divclass="ttdoc">Get the maximum number of SSL sessions that can be stored at once.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:317</div></div>
<divclass="ttc"id="class_s_s_l_client_impl_html"><divclass="ttname"><ahref="class_s_s_l_client_impl.html">SSLClientImpl</a></div><divclass="ttdoc">Implementation code to be inherited by SSLClient.</div><divclass="ttdef"><b>Definition:</b> SSLClientImpl.h:71</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a5b626703a24089dbb0480a9b6ddf348c"><divclass="ttname"><ahref="class_s_s_l_client.html#a5b626703a24089dbb0480a9b6ddf348c">SSLClient::removeSession</a></div><divclass="ttdeci">void removeSession(const char *host, const IPAddress &addr)</div><divclass="ttdoc">Clear the session corresponding to a host and IP.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:310</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a2d8bf9b891151bc5b0b865d70cf9c086"><divclass="ttname"><ahref="class_s_s_l_client.html#a2d8bf9b891151bc5b0b865d70cf9c086">SSLClient::getSession</a></div><divclass="ttdeci">SSLSession & getSession(const char *host, const IPAddress &addr)</div><divclass="ttdoc">Gets a session reference corresponding to a host and IP, or a reference to a empty session if none ex...</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:300</div></div>
<divclass="ttc"id="_s_s_l_client_impl_8h_html_ab658e6d84759440dbf3c890446075395"><divclass="ttname"><ahref="_s_s_l_client_impl_8h.html#ab658e6d84759440dbf3c890446075395">DebugLevel</a></div><divclass="ttdeci">DebugLevel</div><divclass="ttdoc">Level of verbosity used in logging for SSLClient.</div><divclass="ttdef"><b>Definition:</b> SSLClientImpl.h:59</div></div>
<divclass="ttc"id="class_s_s_l_client_html_afd6d7ae798c05cf566b2eb5651dba795"><divclass="ttname"><ahref="class_s_s_l_client.html#afd6d7ae798c05cf566b2eb5651dba795">SSLClient::read</a></div><divclass="ttdeci">int read(uint8_t *buf, size_t size) override</div><divclass="ttdoc">Read size bytes from the SSL client buffer, copying them into *buf, and return the number of bytes re...</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:237</div></div>
<divclass="ttc"id="class_s_s_l_client_html_a4a2172aedfcc483ba2a256ad12148630"><divclass="ttname"><ahref="class_s_s_l_client.html#a4a2172aedfcc483ba2a256ad12148630">SSLClient::connect</a></div><divclass="ttdeci">int connect(IPAddress ip, uint16_t port) override</div><divclass="ttdoc">Connect over SSL to a host specified by an IP address.</div><divclass="ttdef"><b>Definition:</b> SSLClient.h:124</div></div>