mm-iot-sdk/framework/doc/html/sslclient_8c.html
Morse Micro 4f4eb7fc7a Morse Micro MM-IoT-SDK release 2.9.7
This commit introduces version 2.9.7 of the Morse Micro MM-IoT-SDK
for ARM microcontroller base platforms.
2025-10-04 02:04:28 +10:00

420 lines
28 KiB
HTML

<!-- HTML header for doxygen 1.8.17-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Morse Micro IoT SDK: sslclient.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="favicon.svg" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Morse Micro IoT SDK
&#160;<span id="projectnumber">2.9.7</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('sslclient_8c.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">sslclient.c File Reference</div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >SSL Client example to demonstrate connecting to a HTTPS server, TLS handshake and retrieve data. </p>
<dl class="section note"><dt>Note</dt><dd>It is assumed that you have followed the steps in the <a class="el" href="GETTING_STARTED.html">Getting Started</a> guide and are therefore familiar with how to build, flash, and monitor an application using the MM-IoT-SDK framework.</dd></dl>
<p><a class="el" href="sslclient_8c.html">sslclient.c</a> is an example application that demonstrates how to use TLS to connect to a HTTPS server. In this example we attempt to connect to <a href="https://www.google.com/">https://www.google.com/</a> on the standard HTTPS port 443 and download the content (In this case the Google Search page).</p>
<h1><a class="anchor" id="SSLCLIENT_HOW_IT_WORKS"></a>
How it works</h1>
<p >In the function <a class="el" href="m2m__controller_8c.html#add3190cf715f513666f4be42874d91e2">app_init</a> we first initialize the Wi-Fi subsystem and wait for a connection to be established.</p>
<p >Once the connection is established we initialize the various TLS modules as follows: </p><div class="fragment"><div class="line">mbedtls_net_init(&amp;server_fd);</div>
<div class="line">mbedtls_ssl_init(&amp;ssl);</div>
<div class="line">mbedtls_ssl_config_init(&amp;conf);</div>
<div class="line">mbedtls_x509_crt_init(&amp;cacert);</div>
<div class="line">mbedtls_x509_crt_init(&amp;clicert);</div>
<div class="line">mbedtls_pk_init(&amp;pkey);</div>
<div class="line">mbedtls_ctr_drbg_init(&amp;ctr_drbg);</div>
<div class="line">mbedtls_entropy_init(&amp;entropy);</div>
</div><!-- fragment --><p >Once initialized we generate entropy with a call to: </p><div class="fragment"><div class="line">ret = mbedtls_ctr_drbg_seed(&amp;ctr_drbg, mbedtls_entropy_func, &amp;entropy,</div>
<div class="line"> (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *) pers, strlen(pers));</div>
</div><!-- fragment --><p >We then load and parse the CA Root certificate, Client certificate and client keys. These certificates and keys are stored in the file <a class="el" href="default__certs_8h_source.html">default_certs.h</a>. Test certificates have been used in this example, but you may generate and use your own certificates and keys. </p><div class="fragment"><div class="line">printf(<span class="stringliteral">&quot;Loading the CA root certificate ...&quot;</span>);</div>
<div class="line">ret = mbedtls_x509_crt_parse(&amp;cacert, (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *) mbedtls_test_cas_pem,</div>
<div class="line"> mbedtls_test_cas_pem_len);</div>
<div class="line"> </div>
<div class="line">printf(<span class="stringliteral">&quot;Loading the client cert...&quot;</span>);</div>
<div class="line">ret = mbedtls_x509_crt_parse(&amp;clicert, (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *) mbedtls_test_cli_crt,</div>
<div class="line"> mbedtls_test_cli_crt_len);</div>
<div class="line"> </div>
<div class="line">printf(<span class="stringliteral">&quot;Loading the client key...&quot;</span>);</div>
<div class="line">ret = mbedtls_pk_parse_key(&amp;pkey, (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *) mbedtls_test_cli_key,</div>
<div class="line"> mbedtls_test_cli_key_len, NULL, 0, mbedtls_ctr_drbg_random, &amp;ctr_drbg);</div>
</div><!-- fragment --><p >We now initialize the SSL context: </p><div class="fragment"><div class="line">mbedtls_ssl_config_defaults(&amp;conf, MBEDTLS_SSL_IS_CLIENT,</div>
<div class="line"> MBEDTLS_SSL_TRANSPORT_STREAM, MBEDTLS_SSL_PRESET_DEFAULT);</div>
<div class="line">mbedtls_ssl_conf_authmode(&amp;conf, MBEDTLS_SSL_VERIFY_OPTIONAL);</div>
<div class="line">mbedtls_ssl_conf_rng(&amp;conf, mbedtls_ctr_drbg_random, &amp;ctr_drbg);</div>
<div class="line">mbedtls_ssl_conf_ca_chain(&amp;conf, &amp;cacert, NULL);</div>
<div class="line">mbedtls_ssl_setup(&amp;ssl, &amp;conf);</div>
<div class="line">mbedtls_ssl_set_hostname(&amp;ssl, <span class="stringliteral">&quot;test.morsemicro.com&quot;</span>)) != 0)</div>
<div class="line">mbedtls_ssl_set_bio(&amp;ssl, &amp;server_fd, mbedtls_net_send, NULL, mbedtls_net_recv_timeout);</div>
</div><!-- fragment --><p> mbedtls_ssl_set_bio() passes the network read/write functions to mbedtls to use for reading and writing from the network. We use the blocking version of <code>recv()</code>.</p>
<p >Now that the SSL setup is done, we open a TCP/IP connection to the server: </p><div class="fragment"><div class="line">mbedtls_net_connect(&amp;server_fd, sslclient_server, sslclient_port, MBEDTLS_NET_PROTO_TCP);</div>
</div><!-- fragment --><p> The above call does a DNS lookup and then attempts to connect to the resolved IP's by one till it succeeds. For this to work we need a DNS server, which is why we need DHCP to be enabled so we can setup the DNS server using DHCP.</p>
<p >Once a connection is setup we perform the TLS handshake to start secure communications: </p><div class="fragment"><div class="line">ret = mbedtls_ssl_handshake(&amp;ssl);</div>
</div><!-- fragment --><p> It is possible to communicate in the clear before initiating a TLS handshake. This is commonly done in email clients using the <code>STARTTLS</code> protocol.</p>
<p >Once a handshake is completed, we can verify the server certificates using: </p><div class="fragment"><div class="line">ret = mbedtls_ssl_get_verify_result(&amp;ssl);</div>
</div><!-- fragment --><p> If the above call fails, it means the authenticity of the server could not be verified. However, TLS communications are still possible.</p>
<p >We can now write and read data securely using: </p><div class="fragment"><div class="line">ret = mbedtls_ssl_write(&amp;ssl, (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *) <a class="code hl_define" href="sslclient_8c.html#a7231a4e5ed0387b0e9875e16f560f4f0">GET_REQUEST</a>, <span class="keyword">sizeof</span>(<a class="code hl_define" href="sslclient_8c.html#a7231a4e5ed0387b0e9875e16f560f4f0">GET_REQUEST</a>) - 1);</div>
<div class="line">ret = mbedtls_ssl_read(&amp;ssl, <a class="code hl_variable" href="sslclient_8c.html#abdc8ea8147d82c962a7d88863ee32ee0">buf</a>, len);</div>
<div class="ttc" id="asslclient_8c_html_a7231a4e5ed0387b0e9875e16f560f4f0"><div class="ttname"><a href="sslclient_8c.html#a7231a4e5ed0387b0e9875e16f560f4f0">GET_REQUEST</a></div><div class="ttdeci">#define GET_REQUEST</div><div class="ttdoc">HTTPS get request string.</div><div class="ttdef"><b>Definition:</b> <a href="sslclient_8c_source.html#l00174">sslclient.c:174</a></div></div>
<div class="ttc" id="asslclient_8c_html_abdc8ea8147d82c962a7d88863ee32ee0"><div class="ttname"><a href="sslclient_8c.html#abdc8ea8147d82c962a7d88863ee32ee0">buf</a></div><div class="ttdeci">char buf[1408]</div><div class="ttdoc">Statically allocated buffer for HTTP GET request, just under 1 packet size.</div><div class="ttdef"><b>Definition:</b> <a href="sslclient_8c_source.html#l00177">sslclient.c:177</a></div></div>
</div><!-- fragment --><p >Once done, we can tear down the connection and free memory using: </p><div class="fragment"><div class="line">mbedtls_ssl_close_notify(&amp;ssl);</div>
<div class="line">mbedtls_net_free(&amp;server_fd);</div>
<div class="line">mbedtls_ssl_free(&amp;ssl);</div>
<div class="line">mbedtls_ssl_config_free(&amp;conf);</div>
<div class="line">mbedtls_ctr_drbg_free(&amp;ctr_drbg);</div>
<div class="line">mbedtls_entropy_free(&amp;entropy);</div>
</div><!-- fragment --><h1><a class="anchor" id="SSLCLIENT_CUSTOMIZE"></a>
Loading custom settings</h1>
<h2><a class="anchor" id="autotoc_md27"></a>
Using custom keys and certificates</h2>
<p >This example application contains embedded certificates and keys for ease of testing. However, you should generate and load your own certificates and keys for real world applications using the steps below.</p>
<h3><a class="anchor" id="autotoc_md28"></a>
Download the Root CA certificate</h3>
<p >This application needs a root CA certificate that you can download from a certificate authority such as <code>Verisign</code> or <code>Thawte</code>. Ensure you download the root certificate in <code>PEM</code> file format from the certifying authority and also ensure the encryption protocols required by the certificate are enabled in the <code>mbedtls_config.h</code> file for this application. Out of the box we support RSA x509 root certificates in <code>PEM</code> format.</p>
<dl class="section note"><dt>Note</dt><dd>Using an unsupported encryption protocol in the certificate and keys are will cause the application to fail while loading the certificates and keys.</dd></dl>
<h3><a class="anchor" id="autotoc_md29"></a>
Generate client certificate and keys</h3>
<p >Use the steps below to generate a set of client keys and a self signed client certificate.</p><ul>
<li>Generate the client keys and certificate using the commands below: <div class="fragment"><div class="line">openssl genrsa -out sslclient.key 2048</div>
<div class="line">openssl req -<span class="keyword">new</span> -x509 -days 365 -key sslclient.key -out sslclient.crt</div>
</div><!-- fragment --> Answer the prompts for information (email, country, organization, etc) as requested.</li>
</ul>
<h3><a class="anchor" id="autotoc_md30"></a>
Write the keys and certificates to the device</h3>
<ul>
<li>Enter the path for the root certificate you downloaded earlier under the key <code>sslclient.rootca</code> in the <code>config.hjson</code> file in this example folder.</li>
<li>Enter the path for the <code>sslclient.key</code> file above under the key <code>sslclient.clientkeys</code> in the <code>config.hjson</code> file in this example folder.</li>
<li>Enter the path for the <code>sslclient.crt</code> file above under the key <code>sslclient.clientcert</code> in the <code>config.hjson</code> file in this example folder.</li>
<li>Follow the instructions in <a class="el" href="group__MMCONFIG.html#MMCONFIG_PROGRAMMING">Programming the config store from a host PC</a> to load the certificates and keys in the <code>config.hjson</code> file to the device.</li>
</ul>
<p >See <a class="el" href="mm__app__common_8h.html#APP_COMMON_API">Application helper routines for Wireless LAN interface</a> for details of WLAN and IP stack configuration. Additional configuration options for this application can be found in the config.hjson file. </p>
<p class="definition">Definition in file <a class="el" href="sslclient_8c_source.html">sslclient.c</a>.</p>
</div><div class="textblock"><code>#include &lt;string.h&gt;</code><br />
<code>#include &quot;mmosal.h&quot;</code><br />
<code>#include &quot;mmwlan.h&quot;</code><br />
<code>#include &quot;mmconfig.h&quot;</code><br />
<code>#include &quot;mmipal.h&quot;</code><br />
<code>#include &quot;mbedtls/build_info.h&quot;</code><br />
<code>#include &quot;mbedtls/platform.h&quot;</code><br />
<code>#include &quot;mbedtls/net.h&quot;</code><br />
<code>#include &quot;mbedtls/ssl.h&quot;</code><br />
<code>#include &quot;mbedtls/entropy.h&quot;</code><br />
<code>#include &quot;mbedtls/ctr_drbg.h&quot;</code><br />
<code>#include &quot;mbedtls/debug.h&quot;</code><br />
<code>#include &quot;mm_app_common.h&quot;</code><br />
<code>#include &quot;default_certs.h&quot;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for sslclient.c:</div>
<div class="dyncontent">
<div class="center"><img src="sslclient_8c__incl.png" border="0" usemap="#asslclient_8c" alt=""/></div>
<map name="asslclient_8c" id="asslclient_8c">
<area shape="rect" title="SSL Client example to demonstrate connecting to a HTTPS server, TLS handshake and retrieve data." alt="" coords="993,5,1080,32"/>
<area shape="rect" title=" " alt="" coords="5,304,76,331"/>
<area shape="rect" href="mmosal_8h_source.html" title=" " alt="" coords="157,229,244,256"/>
<area shape="rect" href="mmwlan_8h_source.html" title=" " alt="" coords="355,80,446,107"/>
<area shape="rect" href="mmconfig_8h_source.html" title=" " alt="" coords="545,155,643,181"/>
<area shape="rect" href="mmipal_8h_source.html" title=" " alt="" coords="717,229,801,256"/>
<area shape="rect" title=" " alt="" coords="709,80,863,107"/>
<area shape="rect" title=" " alt="" coords="887,80,1034,107"/>
<area shape="rect" title=" " alt="" coords="1058,80,1170,107"/>
<area shape="rect" title=" " alt="" coords="1194,80,1303,107"/>
<area shape="rect" title=" " alt="" coords="1327,80,1466,107"/>
<area shape="rect" title=" " alt="" coords="1490,80,1634,107"/>
<area shape="rect" title=" " alt="" coords="1658,80,1789,107"/>
<area shape="rect" title=" " alt="" coords="1813,80,1967,107"/>
<area shape="rect" href="default__certs_8h_source.html" title=" " alt="" coords="1992,80,2111,107"/>
<area shape="rect" title=" " alt="" coords="638,304,721,331"/>
<area shape="rect" title=" " alt="" coords="397,304,468,331"/>
<area shape="rect" title=" " alt="" coords="101,304,167,331"/>
<area shape="rect" title=" " alt="" coords="303,304,373,331"/>
<area shape="rect" title=" " alt="" coords="192,304,279,331"/>
<area shape="rect" title=" " alt="" coords="289,155,363,181"/>
<area shape="rect" href="mmpkt_8h_source.html" title=" " alt="" coords="439,155,520,181"/>
<area shape="rect" title=" " alt="" coords="517,229,591,256"/>
</map>
</div>
</div>
<p><a href="sslclient_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a16b710f592bf8f7900666392adc444dc"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sslclient_8c.html#a16b710f592bf8f7900666392adc444dc">DEFAULT_PORT</a>&#160;&#160;&#160;&quot;443&quot;</td></tr>
<tr class="memdesc:a16b710f592bf8f7900666392adc444dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">HTTPS port number to connect to. <a href="sslclient_8c.html#a16b710f592bf8f7900666392adc444dc">More...</a><br /></td></tr>
<tr class="separator:a16b710f592bf8f7900666392adc444dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6445d726464369e3b587bb4b179797d5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sslclient_8c.html#a6445d726464369e3b587bb4b179797d5">DEFAULT_SERVER</a>&#160;&#160;&#160;&quot;www.google.com&quot;</td></tr>
<tr class="memdesc:a6445d726464369e3b587bb4b179797d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">HTTPS server to connect to. <a href="sslclient_8c.html#a6445d726464369e3b587bb4b179797d5">More...</a><br /></td></tr>
<tr class="separator:a6445d726464369e3b587bb4b179797d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7231a4e5ed0387b0e9875e16f560f4f0"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sslclient_8c.html#a7231a4e5ed0387b0e9875e16f560f4f0">GET_REQUEST</a>&#160;&#160;&#160;&quot;GET / HTTP/1.0\r\n\r\n&quot;</td></tr>
<tr class="memdesc:a7231a4e5ed0387b0e9875e16f560f4f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">HTTPS get request string. <a href="sslclient_8c.html#a7231a4e5ed0387b0e9875e16f560f4f0">More...</a><br /></td></tr>
<tr class="separator:a7231a4e5ed0387b0e9875e16f560f4f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a46b31e65b97d389b2c0f7d6e4953eba5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sslclient_8c.html#a46b31e65b97d389b2c0f7d6e4953eba5">my_debug</a> (void *ctx, int level, const char *file, int line, const char *str)</td></tr>
<tr class="memdesc:a46b31e65b97d389b2c0f7d6e4953eba5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Optional mbedtls debug callback handler. <a href="sslclient_8c.html#a46b31e65b97d389b2c0f7d6e4953eba5">More...</a><br /></td></tr>
<tr class="separator:a46b31e65b97d389b2c0f7d6e4953eba5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add3190cf715f513666f4be42874d91e2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sslclient_8c.html#add3190cf715f513666f4be42874d91e2">app_init</a> (void)</td></tr>
<tr class="memdesc:add3190cf715f513666f4be42874d91e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main entry point to the application. <a href="sslclient_8c.html#add3190cf715f513666f4be42874d91e2">More...</a><br /></td></tr>
<tr class="separator:add3190cf715f513666f4be42874d91e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:abdc8ea8147d82c962a7d88863ee32ee0"><td class="memItemLeft" align="right" valign="top">char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sslclient_8c.html#abdc8ea8147d82c962a7d88863ee32ee0">buf</a> [1408]</td></tr>
<tr class="memdesc:abdc8ea8147d82c962a7d88863ee32ee0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Statically allocated buffer for HTTP GET request, just under 1 packet size. <a href="sslclient_8c.html#abdc8ea8147d82c962a7d88863ee32ee0">More...</a><br /></td></tr>
<tr class="separator:abdc8ea8147d82c962a7d88863ee32ee0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a16b710f592bf8f7900666392adc444dc" name="a16b710f592bf8f7900666392adc444dc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a16b710f592bf8f7900666392adc444dc">&#9670;&nbsp;</a></span>DEFAULT_PORT</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DEFAULT_PORT&#160;&#160;&#160;&quot;443&quot;</td>
</tr>
</table>
</div><div class="memdoc">
<p>HTTPS port number to connect to. </p>
<p class="definition">Definition at line <a class="el" href="sslclient_8c_source.html#l00170">170</a> of file <a class="el" href="sslclient_8c_source.html">sslclient.c</a>.</p>
</div>
</div>
<a id="a6445d726464369e3b587bb4b179797d5" name="a6445d726464369e3b587bb4b179797d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6445d726464369e3b587bb4b179797d5">&#9670;&nbsp;</a></span>DEFAULT_SERVER</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DEFAULT_SERVER&#160;&#160;&#160;&quot;www.google.com&quot;</td>
</tr>
</table>
</div><div class="memdoc">
<p>HTTPS server to connect to. </p>
<p class="definition">Definition at line <a class="el" href="sslclient_8c_source.html#l00172">172</a> of file <a class="el" href="sslclient_8c_source.html">sslclient.c</a>.</p>
</div>
</div>
<a id="a7231a4e5ed0387b0e9875e16f560f4f0" name="a7231a4e5ed0387b0e9875e16f560f4f0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7231a4e5ed0387b0e9875e16f560f4f0">&#9670;&nbsp;</a></span>GET_REQUEST</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define GET_REQUEST&#160;&#160;&#160;&quot;GET / HTTP/1.0\r\n\r\n&quot;</td>
</tr>
</table>
</div><div class="memdoc">
<p>HTTPS get request string. </p>
<p class="definition">Definition at line <a class="el" href="sslclient_8c_source.html#l00174">174</a> of file <a class="el" href="sslclient_8c_source.html">sslclient.c</a>.</p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="add3190cf715f513666f4be42874d91e2" name="add3190cf715f513666f4be42874d91e2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#add3190cf715f513666f4be42874d91e2">&#9670;&nbsp;</a></span>app_init()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void app_init </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main entry point to the application. </p>
<p >This will be invoked in a thread once operating system and hardware initialization has completed. It may return, but it does not have to. </p>
<p class="definition">Definition at line <a class="el" href="sslclient_8c_source.html#l00201">201</a> of file <a class="el" href="sslclient_8c_source.html">sslclient.c</a>.</p>
</div>
</div>
<a id="a46b31e65b97d389b2c0f7d6e4953eba5" name="a46b31e65b97d389b2c0f7d6e4953eba5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a46b31e65b97d389b2c0f7d6e4953eba5">&#9670;&nbsp;</a></span>my_debug()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void my_debug </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>level</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>line</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>str</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Optional mbedtls debug callback handler. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td></td></tr>
<tr><td class="paramname">level</td><td></td></tr>
<tr><td class="paramname">file</td><td></td></tr>
<tr><td class="paramname">line</td><td></td></tr>
<tr><td class="paramname">str</td><td></td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="sslclient_8c_source.html#l00188">188</a> of file <a class="el" href="sslclient_8c_source.html">sslclient.c</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="abdc8ea8147d82c962a7d88863ee32ee0" name="abdc8ea8147d82c962a7d88863ee32ee0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abdc8ea8147d82c962a7d88863ee32ee0">&#9670;&nbsp;</a></span>buf</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char buf[1408]</td>
</tr>
</table>
</div><div class="memdoc">
<p>Statically allocated buffer for HTTP GET request, just under 1 packet size. </p>
<p class="definition">Definition at line <a class="el" href="sslclient_8c_source.html#l00177">177</a> of file <a class="el" href="sslclient_8c_source.html">sslclient.c</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.17-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_91b8f418cff946e8d8b598a9068417a8.html">examples</a></li><li class="navelem"><a class="el" href="dir_ce3747c650aef722ff1e3fe2fb88ac1c.html">sslclient</a></li><li class="navelem"><a class="el" href="dir_6bb299079a1a7d21b7029232ee54626a.html">src</a></li><li class="navelem"><a class="el" href="sslclient_8c.html">sslclient.c</a></li>
<li class="footer">Copyright 2021 Morse Micro </li>
</ul>
</div>
</body>
</html>