realtek_ameba_mp_sdk/doc/api_doc/group__httpc.html
2020-07-31 22:16:12 +08:00

1115 lines
55 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.8.11"/>
<title>SDK4.0: HTTPC</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="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>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</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="projectalign" style="padding-left: 0.5em;">
<div id="projectname">SDK4.0
</div>
<div id="projectbrief">This document shows Ameba SDK 4.0 APIs</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- 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="#nested-classes">Data Structures</a> &#124;
<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">HTTPC<div class="ingroups"><a class="el" href="group__sdk.html">Ameba SDK</a> &raquo; <a class="el" href="group__network.html">Network</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>HTTP/HTTPS client functions.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structhttp__response.html">http_response</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The structure is the context used for HTTP response header parsing. <a href="structhttp__response.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structhttpc__conn.html">httpc_conn</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The structure is the context used for connection. <a href="structhttpc__conn.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga113b525ba4bbc9e93579948a6f845881"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga113b525ba4bbc9e93579948a6f845881">HTTPC_SECURE_NONE</a>&#160;&#160;&#160;0</td></tr>
<tr class="separator:ga113b525ba4bbc9e93579948a6f845881"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gace31be61f1552de26c02fdbee3576b29"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gace31be61f1552de26c02fdbee3576b29">HTTPC_SECURE_TLS</a>&#160;&#160;&#160;1</td></tr>
<tr class="separator:gace31be61f1552de26c02fdbee3576b29"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga634d5026e53d8cf0f3b1ef32b4608cdf"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga634d5026e53d8cf0f3b1ef32b4608cdf">HTTPC_DEBUG_OFF</a>&#160;&#160;&#160;0</td></tr>
<tr class="separator:ga634d5026e53d8cf0f3b1ef32b4608cdf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga233412b4d6523919de8a74f81c3c0e3c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga233412b4d6523919de8a74f81c3c0e3c">HTTPC_DEBUG_ON</a>&#160;&#160;&#160;1</td></tr>
<tr class="separator:ga233412b4d6523919de8a74f81c3c0e3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2de843d21f52e082d91c22505079aefa"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga2de843d21f52e082d91c22505079aefa">HTTPC_DEBUG_VERBOSE</a>&#160;&#160;&#160;2</td></tr>
<tr class="separator:ga2de843d21f52e082d91c22505079aefa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga96fad2a9b93073b67627993fd3d3133c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga96fad2a9b93073b67627993fd3d3133c">HTTPC_TLS_POLARSSL</a>&#160;&#160;&#160;0</td></tr>
<tr class="separator:ga96fad2a9b93073b67627993fd3d3133c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga32e2cc30bcbaa598c58d2d556b7cf0a7"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga32e2cc30bcbaa598c58d2d556b7cf0a7">HTTPC_TLS_MBEDTLS</a>&#160;&#160;&#160;1</td></tr>
<tr class="separator:ga32e2cc30bcbaa598c58d2d556b7cf0a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga9588b3030793be05e1346330e2828990"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga9588b3030793be05e1346330e2828990">httpc_conn_new</a> (uint8_t secure, char *client_cert, char *client_key, char *ca_certs)</td></tr>
<tr class="memdesc:ga9588b3030793be05e1346330e2828990"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to generate connection context for an HTTP/HTTPS client. <a href="#ga9588b3030793be05e1346330e2828990">More...</a><br /></td></tr>
<tr class="separator:ga9588b3030793be05e1346330e2828990"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3ef2d91d72af7b29c34b9ccd7633d606"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga3ef2d91d72af7b29c34b9ccd7633d606">httpc_conn_free</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn)</td></tr>
<tr class="memdesc:ga3ef2d91d72af7b29c34b9ccd7633d606"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to deallocate a connection context. <a href="#ga3ef2d91d72af7b29c34b9ccd7633d606">More...</a><br /></td></tr>
<tr class="separator:ga3ef2d91d72af7b29c34b9ccd7633d606"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9ac713ce7902c9a4e2d3d8ecd98bbb24"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga9ac713ce7902c9a4e2d3d8ecd98bbb24">httpc_conn_connect</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn, char *host, uint16_t port, uint32_t timeout)</td></tr>
<tr class="memdesc:ga9ac713ce7902c9a4e2d3d8ecd98bbb24"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to connect to a server. <a href="#ga9ac713ce7902c9a4e2d3d8ecd98bbb24">More...</a><br /></td></tr>
<tr class="separator:ga9ac713ce7902c9a4e2d3d8ecd98bbb24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab38acec7af38ef32e3fb5b453b02e7e5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gab38acec7af38ef32e3fb5b453b02e7e5">httpc_conn_close</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn)</td></tr>
<tr class="memdesc:gab38acec7af38ef32e3fb5b453b02e7e5"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to close connection from a server. <a href="#gab38acec7af38ef32e3fb5b453b02e7e5">More...</a><br /></td></tr>
<tr class="separator:gab38acec7af38ef32e3fb5b453b02e7e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaebfbea2404de35dfe139c84a63431420"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gaebfbea2404de35dfe139c84a63431420">httpc_conn_setup_user_password</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn, char *user, char *password)</td></tr>
<tr class="memdesc:gaebfbea2404de35dfe139c84a63431420"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to setup authorization for connection. <a href="#gaebfbea2404de35dfe139c84a63431420">More...</a><br /></td></tr>
<tr class="separator:gaebfbea2404de35dfe139c84a63431420"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab20f3a4f75881d051dc8f2950ce426a3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gab20f3a4f75881d051dc8f2950ce426a3">httpc_setup_debug</a> (uint8_t debug)</td></tr>
<tr class="memdesc:gab20f3a4f75881d051dc8f2950ce426a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to setup httpc debug. <a href="#gab20f3a4f75881d051dc8f2950ce426a3">More...</a><br /></td></tr>
<tr class="separator:gab20f3a4f75881d051dc8f2950ce426a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2a91dd4c3973149814fa3dbad64619d3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga2a91dd4c3973149814fa3dbad64619d3">httpc_free</a> (void *ptr)</td></tr>
<tr class="memdesc:ga2a91dd4c3973149814fa3dbad64619d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to free memory allocated by httpc API, such as <a class="el" href="group__httpc.html#gae908ff84ede541b3f2c5ab87f66fc768" title="This function is used to get a header field from HTTP header of connection context. ">httpc_response_get_header_field()</a>. <a href="#ga2a91dd4c3973149814fa3dbad64619d3">More...</a><br /></td></tr>
<tr class="separator:ga2a91dd4c3973149814fa3dbad64619d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa7370c608bdf4ff9e6bb021557cea0c2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gaa7370c608bdf4ff9e6bb021557cea0c2">httpc_conn_dump_header</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn)</td></tr>
<tr class="memdesc:gaa7370c608bdf4ff9e6bb021557cea0c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to dump the parsed HTTP header of response in connection context. <a href="#gaa7370c608bdf4ff9e6bb021557cea0c2">More...</a><br /></td></tr>
<tr class="separator:gaa7370c608bdf4ff9e6bb021557cea0c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab2df82e33b688fd99f300b12a8949613"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gab2df82e33b688fd99f300b12a8949613">httpc_request_write_header_start</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn, char *method, char *resource, char *content_type, size_t content_len)</td></tr>
<tr class="memdesc:gab2df82e33b688fd99f300b12a8949613"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to start a HTTP request in connection. <a href="#gab2df82e33b688fd99f300b12a8949613">More...</a><br /></td></tr>
<tr class="separator:gab2df82e33b688fd99f300b12a8949613"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae60fa22f56998399ccb2bbb56983fd2a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gae60fa22f56998399ccb2bbb56983fd2a">httpc_request_write_header</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn, char *name, char *value)</td></tr>
<tr class="memdesc:gae60fa22f56998399ccb2bbb56983fd2a"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to add an HTTP header field to HTTP request. <a href="#gae60fa22f56998399ccb2bbb56983fd2a">More...</a><br /></td></tr>
<tr class="separator:gae60fa22f56998399ccb2bbb56983fd2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga18dd661b7c6f7310ea224fba78602291"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga18dd661b7c6f7310ea224fba78602291">httpc_request_write_header_finish</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn)</td></tr>
<tr class="memdesc:ga18dd661b7c6f7310ea224fba78602291"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to write HTTP request header data to connection. <a href="#ga18dd661b7c6f7310ea224fba78602291">More...</a><br /></td></tr>
<tr class="separator:ga18dd661b7c6f7310ea224fba78602291"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab0b6ce1439f8741813637794fcf83380"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gab0b6ce1439f8741813637794fcf83380">httpc_request_write_data</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn, uint8_t *data, size_t data_len)</td></tr>
<tr class="memdesc:gab0b6ce1439f8741813637794fcf83380"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to write HTTP request body data to connection. <a href="#gab0b6ce1439f8741813637794fcf83380">More...</a><br /></td></tr>
<tr class="separator:gab0b6ce1439f8741813637794fcf83380"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae8b0dd05a72cd0cbc98f1a8448141ba4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gae8b0dd05a72cd0cbc98f1a8448141ba4">httpc_response_is_status</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn, char *status)</td></tr>
<tr class="memdesc:gae8b0dd05a72cd0cbc98f1a8448141ba4"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to check HTTP status of response in connection context. <a href="#gae8b0dd05a72cd0cbc98f1a8448141ba4">More...</a><br /></td></tr>
<tr class="separator:gae8b0dd05a72cd0cbc98f1a8448141ba4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac482492bb0f68625157c13194a549512"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gac482492bb0f68625157c13194a549512">httpc_response_read_header</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn)</td></tr>
<tr class="memdesc:gac482492bb0f68625157c13194a549512"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to read HTTP header from client socket descriptor and parse content to connection context. <a href="#gac482492bb0f68625157c13194a549512">More...</a><br /></td></tr>
<tr class="separator:gac482492bb0f68625157c13194a549512"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae3cb9644a42e5008eac86a7233b7fb1c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gae3cb9644a42e5008eac86a7233b7fb1c">httpc_response_read_data</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn, uint8_t *data, size_t data_len)</td></tr>
<tr class="memdesc:gae3cb9644a42e5008eac86a7233b7fb1c"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to read data from HTTP/HTTPS connection. <a href="#gae3cb9644a42e5008eac86a7233b7fb1c">More...</a><br /></td></tr>
<tr class="separator:gae3cb9644a42e5008eac86a7233b7fb1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae908ff84ede541b3f2c5ab87f66fc768"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gae908ff84ede541b3f2c5ab87f66fc768">httpc_response_get_header_field</a> (struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *conn, char *field, char **value)</td></tr>
<tr class="memdesc:gae908ff84ede541b3f2c5ab87f66fc768"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to get a header field from HTTP header of connection context. <a href="#gae908ff84ede541b3f2c5ab87f66fc768">More...</a><br /></td></tr>
<tr class="separator:gae908ff84ede541b3f2c5ab87f66fc768"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:gae03d1b90c2727670f2b8c66acea94084"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gae03d1b90c2727670f2b8c66acea94084">header</a></td></tr>
<tr class="separator:gae03d1b90c2727670f2b8c66acea94084"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad60e9f446c76025dc95318ee2631d56c"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gad60e9f446c76025dc95318ee2631d56c">header_len</a></td></tr>
<tr class="separator:gad60e9f446c76025dc95318ee2631d56c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa8b9d638c9f39cd46d6f67237f8615ae"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gaa8b9d638c9f39cd46d6f67237f8615ae">version</a></td></tr>
<tr class="separator:gaa8b9d638c9f39cd46d6f67237f8615ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4a192c1f443088208aa8c39b3b7d8cbd"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga4a192c1f443088208aa8c39b3b7d8cbd">version_len</a></td></tr>
<tr class="separator:ga4a192c1f443088208aa8c39b3b7d8cbd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5daa21eee463a93be2e25ad0b39cab77"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga5daa21eee463a93be2e25ad0b39cab77">status</a></td></tr>
<tr class="separator:ga5daa21eee463a93be2e25ad0b39cab77"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6b8fdf55f52ba31dfb700ac2a500f1c9"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga6b8fdf55f52ba31dfb700ac2a500f1c9">status_len</a></td></tr>
<tr class="separator:ga6b8fdf55f52ba31dfb700ac2a500f1c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae4ec598c4010f361bfd6b22cd127cca1"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gae4ec598c4010f361bfd6b22cd127cca1">content_type</a></td></tr>
<tr class="separator:gae4ec598c4010f361bfd6b22cd127cca1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga034b8afd7f1a03442248a6175ae7ffec"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga034b8afd7f1a03442248a6175ae7ffec">content_type_len</a></td></tr>
<tr class="separator:ga034b8afd7f1a03442248a6175ae7ffec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga53a9724e885c3ef860d1d41018071c9f"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga53a9724e885c3ef860d1d41018071c9f">content_len</a></td></tr>
<tr class="separator:ga53a9724e885c3ef860d1d41018071c9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5903d0b282fc5eae503de618f896b5e1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga5903d0b282fc5eae503de618f896b5e1">sock</a></td></tr>
<tr class="separator:ga5903d0b282fc5eae503de618f896b5e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa110ab24a38b8d75dd42afcf313e96f0"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structhttp__response.html">http_response</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gaa110ab24a38b8d75dd42afcf313e96f0">response</a></td></tr>
<tr class="separator:gaa110ab24a38b8d75dd42afcf313e96f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5419e62641a60710811bfb71146c42f1"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga5419e62641a60710811bfb71146c42f1">tls</a></td></tr>
<tr class="separator:ga5419e62641a60710811bfb71146c42f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad83da9b722657013fe8230ca18484128"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#gad83da9b722657013fe8230ca18484128">request_header</a></td></tr>
<tr class="separator:gad83da9b722657013fe8230ca18484128"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1c2046dcb30a629d6d9f45ff8f403f12"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga1c2046dcb30a629d6d9f45ff8f403f12">host</a></td></tr>
<tr class="separator:ga1c2046dcb30a629d6d9f45ff8f403f12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8e0798404bf2cf5dabb84c5ba9a4f236"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga8e0798404bf2cf5dabb84c5ba9a4f236">port</a></td></tr>
<tr class="separator:ga8e0798404bf2cf5dabb84c5ba9a4f236"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3c9a344c11b7b286d680c4977c517e7e"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpc.html#ga3c9a344c11b7b286d680c4977c517e7e">user_password</a></td></tr>
<tr class="separator:ga3c9a344c11b7b286d680c4977c517e7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>HTTP/HTTPS client functions. </p>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ga634d5026e53d8cf0f3b1ef32b4608cdf"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HTTPC_DEBUG_OFF&#160;&#160;&#160;0</td>
</tr>
</table>
</div><div class="memdoc">
<p>Disable httpc debug log </p>
</div>
</div>
<a class="anchor" id="ga233412b4d6523919de8a74f81c3c0e3c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HTTPC_DEBUG_ON&#160;&#160;&#160;1</td>
</tr>
</table>
</div><div class="memdoc">
<p>Enable httpc debug log </p>
</div>
</div>
<a class="anchor" id="ga2de843d21f52e082d91c22505079aefa"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HTTPC_DEBUG_VERBOSE&#160;&#160;&#160;2</td>
</tr>
</table>
</div><div class="memdoc">
<p>Enable httpc verbose debug log </p>
</div>
</div>
<a class="anchor" id="ga113b525ba4bbc9e93579948a6f845881"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HTTPC_SECURE_NONE&#160;&#160;&#160;0</td>
</tr>
</table>
</div><div class="memdoc">
<p>Running with HTTP client </p>
</div>
</div>
<a class="anchor" id="gace31be61f1552de26c02fdbee3576b29"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HTTPC_SECURE_TLS&#160;&#160;&#160;1</td>
</tr>
</table>
</div><div class="memdoc">
<p>Running with HTTPS client </p>
</div>
</div>
<a class="anchor" id="ga32e2cc30bcbaa598c58d2d556b7cf0a7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HTTPC_TLS_MBEDTLS&#160;&#160;&#160;1</td>
</tr>
</table>
</div><div class="memdoc">
<p>Use mbedTLS for TLS when HTTPS </p>
</div>
</div>
<a class="anchor" id="ga96fad2a9b93073b67627993fd3d3133c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HTTPC_TLS_POLARSSL&#160;&#160;&#160;0</td>
</tr>
</table>
</div><div class="memdoc">
<p>Use PolarSSL for TLS when HTTPS </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gab38acec7af38ef32e3fb5b453b02e7e5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void httpc_conn_close </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to close connection from a server. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
</div>
</div>
<a class="anchor" id="ga9ac713ce7902c9a4e2d3d8ecd98bbb24"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_conn_connect </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>timeout</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to connect to a server. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">host</td><td>string of server host name or IP </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">port</td><td>service port </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>connection timeout in seconds </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
<dd>
-1 : if error occurred </dd></dl>
</div>
</div>
<a class="anchor" id="gaa7370c608bdf4ff9e6bb021557cea0c2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void httpc_conn_dump_header </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to dump the parsed HTTP header of response in connection context. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
</div>
</div>
<a class="anchor" id="ga3ef2d91d72af7b29c34b9ccd7633d606"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void httpc_conn_free </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to deallocate a connection context. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
</div>
</div>
<a class="anchor" id="ga9588b3030793be05e1346330e2828990"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a>* httpc_conn_new </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>secure</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>client_cert</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>client_key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>ca_certs</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to generate connection context for an HTTP/HTTPS client. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">secure</td><td>security mode for HTTP or HTTPS. Must be HTTPD_SECURE_NONE, HTTPD_SECURE_TLS. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">client_cert</td><td>string of client certificate if required to be verified by server. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">client_key</td><td>string of client private key if required to be verified by server. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ca_certs</td><td>string including certificates in CA trusted chain if want to verify server certificate. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>pointer to the generated connection context </dd></dl>
</div>
</div>
<a class="anchor" id="gaebfbea2404de35dfe139c84a63431420"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_conn_setup_user_password </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>user</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>password</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to setup authorization for connection. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">user</td><td>string of user name for authorization </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">password</td><td>string of password for authorization </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
<dd>
-1 : if error occurred </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Must be used before <a class="el" href="group__httpc.html#ga9ac713ce7902c9a4e2d3d8ecd98bbb24" title="This function is used to connect to a server. ">httpc_conn_connect()</a> if basic authorization is used </dd></dl>
</div>
</div>
<a class="anchor" id="ga2a91dd4c3973149814fa3dbad64619d3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void httpc_free </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>ptr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to free memory allocated by httpc API, such as <a class="el" href="group__httpc.html#gae908ff84ede541b3f2c5ab87f66fc768" title="This function is used to get a header field from HTTP header of connection context. ">httpc_response_get_header_field()</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">ptr</td><td>pointer to memory to be deallocated </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
</div>
</div>
<a class="anchor" id="gab0b6ce1439f8741813637794fcf83380"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_request_write_data </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>data_len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to write HTTP request body data to connection. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>data to be written </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">data_len</td><td>data length </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>return value of lwip socket write() for HTTP and PolarSSL ssl_write() for HTTPS </dd></dl>
</div>
</div>
<a class="anchor" id="gae60fa22f56998399ccb2bbb56983fd2a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_request_write_header </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to add an HTTP header field to HTTP request. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>HTTP header field name string </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">value</td><td>HTTP header field value </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
<dd>
-1 : if error occurred </dd></dl>
</div>
</div>
<a class="anchor" id="ga18dd661b7c6f7310ea224fba78602291"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_request_write_header_finish </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to write HTTP request header data to connection. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>return value of lwip socket write() for HTTP and PolarSSL ssl_write() for HTTPS </dd></dl>
</div>
</div>
<a class="anchor" id="gab2df82e33b688fd99f300b12a8949613"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_request_write_header_start </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>method</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>resource</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>content_type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>content_len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to start a HTTP request in connection. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">method</td><td>string of HTTP method in HTTP request </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>string including path and query string to identify a resource </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">content_type</td><td>string of Content-Type header field written to HTTP request. No Content-Type in HTTP request if NULL. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">content_len</td><td>value of Content-Length header field written to HTTP request. No Content-Length in HTTP request if NULL. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
<dd>
-1 : if error occurred </dd></dl>
</div>
</div>
<a class="anchor" id="gae908ff84ede541b3f2c5ab87f66fc768"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_response_get_header_field </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>field</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to get a header field from HTTP header of connection context. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">field</td><td>header field string to search </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>search result stored in memory allocated </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 : if found </dd>
<dd>
-1 : if not found </dd></dl>
<dl class="section note"><dt>Note</dt><dd>The search result memory should be free by <a class="el" href="group__httpc.html#ga2a91dd4c3973149814fa3dbad64619d3" title="This function is used to free memory allocated by httpc API, such as httpc_response_get_header_field(...">httpc_free()</a>. </dd></dl>
</div>
</div>
<a class="anchor" id="gae8b0dd05a72cd0cbc98f1a8448141ba4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_response_is_status </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>status</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to check HTTP status of response in connection context. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">status</td><td>HTTP status string to compare with </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 : if different </dd>
<dd>
1 : if matched </dd></dl>
</div>
</div>
<a class="anchor" id="gae3cb9644a42e5008eac86a7233b7fb1c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_response_read_data </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>data_len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to read data from HTTP/HTTPS connection. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>buffer for data read </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">data_len</td><td>buffer length </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>return value of lwip socket read() for HTTP and PolarSSL ssl_read() for HTTPS </dd></dl>
</div>
</div>
<a class="anchor" id="gac482492bb0f68625157c13194a549512"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int httpc_response_read_header </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structhttpc__conn.html">httpc_conn</a> *&#160;</td>
<td class="paramname"><em>conn</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to read HTTP header from client socket descriptor and parse content to connection context. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
<dd>
-1 : if error occurred </dd></dl>
</div>
</div>
<a class="anchor" id="gab20f3a4f75881d051dc8f2950ce426a3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void httpc_setup_debug </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>debug</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to setup httpc debug. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">debug</td><td>flag to enable/disable httpc debug. Must be HTTPC_DEBUG_OFF, HTTPC_DEBUG_ON, HTTPC_DEBUG_VERBOSE. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="ga53a9724e885c3ef860d1d41018071c9f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t content_len</td>
</tr>
</table>
</div><div class="memdoc">
<p>Value of Content-Length header field parsed in HTTP header string </p>
</div>
</div>
<a class="anchor" id="gae4ec598c4010f361bfd6b22cd127cca1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t* content_type</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to Content-Type header field in the parsed HTTP header string </p>
</div>
</div>
<a class="anchor" id="ga034b8afd7f1a03442248a6175ae7ffec"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t content_type_len</td>
</tr>
</table>
</div><div class="memdoc">
<p>Content-Type header field data length </p>
</div>
</div>
<a class="anchor" id="gae03d1b90c2727670f2b8c66acea94084"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t* header</td>
</tr>
</table>
</div><div class="memdoc">
<p>HTTP header string parsed in HTTP response </p>
</div>
</div>
<a class="anchor" id="gad60e9f446c76025dc95318ee2631d56c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t header_len</td>
</tr>
</table>
</div><div class="memdoc">
<p>HTTP header string length </p>
</div>
</div>
<a class="anchor" id="ga1c2046dcb30a629d6d9f45ff8f403f12"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* host</td>
</tr>
</table>
</div><div class="memdoc">
<p>String of server host name or IP </p>
</div>
</div>
<a class="anchor" id="ga8e0798404bf2cf5dabb84c5ba9a4f236"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint16_t port</td>
</tr>
</table>
</div><div class="memdoc">
<p>Service port </p>
</div>
</div>
<a class="anchor" id="gad83da9b722657013fe8230ca18484128"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t* request_header</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to transmission buffer of HTTP request header </p>
</div>
</div>
<a class="anchor" id="gaa110ab24a38b8d75dd42afcf313e96f0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct <a class="el" href="structhttp__response.html">http_response</a> response</td>
</tr>
</table>
</div><div class="memdoc">
<p>Context for HTTP response </p>
</div>
</div>
<a class="anchor" id="ga5903d0b282fc5eae503de618f896b5e1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int sock</td>
</tr>
</table>
</div><div class="memdoc">
<p>Client socket descriptor for connection </p>
</div>
</div>
<a class="anchor" id="ga5daa21eee463a93be2e25ad0b39cab77"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t* status</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to HTTP status code in the parsed HTTP header string </p>
</div>
</div>
<a class="anchor" id="ga6b8fdf55f52ba31dfb700ac2a500f1c9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t status_len</td>
</tr>
</table>
</div><div class="memdoc">
<p>HTTP status code data length </p>
</div>
</div>
<a class="anchor" id="ga5419e62641a60710811bfb71146c42f1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* tls</td>
</tr>
</table>
</div><div class="memdoc">
<p>Context for TLS connection </p>
</div>
</div>
<a class="anchor" id="ga3c9a344c11b7b286d680c4977c517e7e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* user_password</td>
</tr>
</table>
</div><div class="memdoc">
<p>Base64 string for HTTP basic authorization </p>
</div>
</div>
<a class="anchor" id="gaa8b9d638c9f39cd46d6f67237f8615ae"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t* version</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to HTTP version in the parsed HTTP header string </p>
</div>
</div>
<a class="anchor" id="ga4a192c1f443088208aa8c39b3b7d8cbd"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t version_len</td>
</tr>
</table>
</div><div class="memdoc">
<p>HTTP version data length </p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>