rt-thread-official/components/net/uip/doc/html/a00163.html

534 lines
33 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>uIP 1.0: Web client</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul></div>
<h1>Web client<br>
<small>
[<a class="el" href="a00143.html">Applications</a>]</small>
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
This example shows a HTTP client that is able to download web pages and files from web servers.
<p>
It requires a number of callback functions to be implemented by the module that utilizes the code: <a class="el" href="a00163.html#gc4b119801e50cc1824498a1cdf9adc37">webclient_datahandler()</a>, <a class="el" href="a00163.html#g6b942c1ef22f8cd1a726ef3364c9fbea">webclient_connected()</a>, <a class="el" href="a00163.html#g23705efb9077187881f094fc9be13bde">webclient_timedout()</a>, <a class="el" href="a00163.html#gf11d9915ec12a8cdd9fdcbb5e8fcd5c7">webclient_aborted()</a>, <a class="el" href="a00163.html#gf8f12c820cc08da32aa62898bfc02db3">webclient_closed()</a>.
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Files</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00111.html">webclient.h</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Header file for the HTTP client. <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00110.html">webclient.c</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Implementation of the HTTP client. <br></td></tr>
<p>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00097.html">webclient_state</a></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g5a5bfd7e9060903893481db90645187b"></a><!-- doxytag: member="webclient::WEBCLIENT_CONF_MAX_URLLEN" ref="g5a5bfd7e9060903893481db90645187b" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g5a5bfd7e9060903893481db90645187b">WEBCLIENT_CONF_MAX_URLLEN</a>&nbsp;&nbsp;&nbsp;100</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ge28f6cb60e86088d8886d0f804b4f37c"></a><!-- doxytag: member="webclient::UIP_APPCALL" ref="ge28f6cb60e86088d8886d0f804b4f37c" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#ge28f6cb60e86088d8886d0f804b4f37c">UIP_APPCALL</a>&nbsp;&nbsp;&nbsp;webclient_appcall</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g31be289fd8ec3fe09b0088165d13976d"></a><!-- doxytag: member="webclient::WEBCLIENT_TIMEOUT" ref="g31be289fd8ec3fe09b0088165d13976d" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g31be289fd8ec3fe09b0088165d13976d">WEBCLIENT_TIMEOUT</a>&nbsp;&nbsp;&nbsp;100</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g8714af98a550f10dc814db92b08d1b0d"></a><!-- doxytag: member="webclient::WEBCLIENT_STATE_STATUSLINE" ref="g8714af98a550f10dc814db92b08d1b0d" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g8714af98a550f10dc814db92b08d1b0d">WEBCLIENT_STATE_STATUSLINE</a>&nbsp;&nbsp;&nbsp;0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gc4357cec23abca29d2bb885803625a6a"></a><!-- doxytag: member="webclient::WEBCLIENT_STATE_HEADERS" ref="gc4357cec23abca29d2bb885803625a6a" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#gc4357cec23abca29d2bb885803625a6a">WEBCLIENT_STATE_HEADERS</a>&nbsp;&nbsp;&nbsp;1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g4d457c50e6f2cef57167c3804ce8bf7c"></a><!-- doxytag: member="webclient::WEBCLIENT_STATE_DATA" ref="g4d457c50e6f2cef57167c3804ce8bf7c" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g4d457c50e6f2cef57167c3804ce8bf7c">WEBCLIENT_STATE_DATA</a>&nbsp;&nbsp;&nbsp;2</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g863c94b0ed4a76997e53a3ccd5d0b6c3"></a><!-- doxytag: member="webclient::WEBCLIENT_STATE_CLOSE" ref="g863c94b0ed4a76997e53a3ccd5d0b6c3" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g863c94b0ed4a76997e53a3ccd5d0b6c3">WEBCLIENT_STATE_CLOSE</a>&nbsp;&nbsp;&nbsp;3</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g40fb1fb2d990ce04ae9bbee275627c03"></a><!-- doxytag: member="webclient::HTTPFLAG_NONE" ref="g40fb1fb2d990ce04ae9bbee275627c03" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g40fb1fb2d990ce04ae9bbee275627c03">HTTPFLAG_NONE</a>&nbsp;&nbsp;&nbsp;0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gda99954e0f6905091885934e86c278cc"></a><!-- doxytag: member="webclient::HTTPFLAG_OK" ref="gda99954e0f6905091885934e86c278cc" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#gda99954e0f6905091885934e86c278cc">HTTPFLAG_OK</a>&nbsp;&nbsp;&nbsp;1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gd895686859ae7d178d31be04eb0a1a97"></a><!-- doxytag: member="webclient::HTTPFLAG_MOVED" ref="gd895686859ae7d178d31be04eb0a1a97" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#gd895686859ae7d178d31be04eb0a1a97">HTTPFLAG_MOVED</a>&nbsp;&nbsp;&nbsp;2</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g38af81a4c9884ce89803fc3e52383112"></a><!-- doxytag: member="webclient::HTTPFLAG_ERROR" ref="g38af81a4c9884ce89803fc3e52383112" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g38af81a4c9884ce89803fc3e52383112">HTTPFLAG_ERROR</a>&nbsp;&nbsp;&nbsp;3</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g3212e70c55244608ac16316888c354f0"></a><!-- doxytag: member="webclient::ISO_nl" ref="g3212e70c55244608ac16316888c354f0" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g3212e70c55244608ac16316888c354f0">ISO_nl</a>&nbsp;&nbsp;&nbsp;0x0a</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g6cda47c85ce1b58b501b44ac9cccc50e"></a><!-- doxytag: member="webclient::ISO_cr" ref="g6cda47c85ce1b58b501b44ac9cccc50e" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g6cda47c85ce1b58b501b44ac9cccc50e">ISO_cr</a>&nbsp;&nbsp;&nbsp;0x0d</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g71e1b022f7b7fa3a154f19372b239935"></a><!-- doxytag: member="webclient::ISO_space" ref="g71e1b022f7b7fa3a154f19372b239935" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g71e1b022f7b7fa3a154f19372b239935">ISO_space</a>&nbsp;&nbsp;&nbsp;0x20</td></tr>
<tr><td colspan="2"><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gdc5aec3587b2c55b714a6c2f37b56cba"></a><!-- doxytag: member="webclient::uip_tcp_appstate_t" ref="gdc5aec3587b2c55b714a6c2f37b56cba" args="" -->
typedef <a class="el" href="a00097.html">webclient_state</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#gdc5aec3587b2c55b714a6c2f37b56cba">uip_tcp_appstate_t</a></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#gc4b119801e50cc1824498a1cdf9adc37">webclient_datahandler</a> (char *data, <a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> len)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Callback function that is called from the webclient code when HTTP data has been received. <a href="#gc4b119801e50cc1824498a1cdf9adc37"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g6b942c1ef22f8cd1a726ef3364c9fbea">webclient_connected</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Callback function that is called from the webclient code when the HTTP connection has been connected to the web server. <a href="#g6b942c1ef22f8cd1a726ef3364c9fbea"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g23705efb9077187881f094fc9be13bde">webclient_timedout</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Callback function that is called from the webclient code if the HTTP connection to the web server has timed out. <a href="#g23705efb9077187881f094fc9be13bde"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#gf11d9915ec12a8cdd9fdcbb5e8fcd5c7">webclient_aborted</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Callback function that is called from the webclient code if the HTTP connection to the web server has been aborted by the web server. <a href="#gf11d9915ec12a8cdd9fdcbb5e8fcd5c7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#gf8f12c820cc08da32aa62898bfc02db3">webclient_closed</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Callback function that is called from the webclient code when the HTTP connection to the web server has been closed. <a href="#gf8f12c820cc08da32aa62898bfc02db3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g3caacabb2fe1c71921e1a471719ccbd2"></a><!-- doxytag: member="webclient::webclient_init" ref="g3caacabb2fe1c71921e1a471719ccbd2" args="(void)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g3caacabb2fe1c71921e1a471719ccbd2">webclient_init</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize the webclient module. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#gf9385ef9ecc74c7d53ff2f15e62bfde3">webclient_get</a> (char *host, <a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> port, char *file)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Open an HTTP connection to a web server and ask for a file using the GET method. <a href="#gf9385ef9ecc74c7d53ff2f15e62bfde3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g1d34be506a61db90dd7829117efdf8cf"></a><!-- doxytag: member="webclient::webclient_close" ref="g1d34be506a61db90dd7829117efdf8cf" args="(void)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g1d34be506a61db90dd7829117efdf8cf">webclient_close</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Close the currently open HTTP connection. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g9e6d2864f390a4ba1ac60dc65e2b9815"></a><!-- doxytag: member="webclient::webclient_appcall" ref="g9e6d2864f390a4ba1ac60dc65e2b9815" args="(void)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g9e6d2864f390a4ba1ac60dc65e2b9815">webclient_appcall</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g4433d3af16ea083a81576d0f18ba57c9">webclient_mimetype</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Obtain the MIME type of the current HTTP data stream. <a href="#g4433d3af16ea083a81576d0f18ba57c9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g41e616d3fcc17e0aabfe8ab45ef0d30f">webclient_filename</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Obtain the filename of the current HTTP data stream. <a href="#g41e616d3fcc17e0aabfe8ab45ef0d30f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g0e0ea5f24b77f124ba33bcbc7ede5bfb">webclient_hostname</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Obtain the hostname of the current HTTP data stream. <a href="#g0e0ea5f24b77f124ba33bcbc7ede5bfb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned short&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00163.html#g2a939aa4fcffabbce1dc1f784a7e0ad3">webclient_port</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Obtain the port number of the current HTTP data stream. <a href="#g2a939aa4fcffabbce1dc1f784a7e0ad3"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="gf11d9915ec12a8cdd9fdcbb5e8fcd5c7"></a><!-- doxytag: member="webclient.h::webclient_aborted" ref="gf11d9915ec12a8cdd9fdcbb5e8fcd5c7" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void webclient_aborted </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Callback function that is called from the webclient code if the HTTP connection to the web server has been aborted by the web server.
<p>
This function must be implemented by the module that uses the webclient code. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a286">webclient.c</a>, and <a class="el" href="a00041.html#a321">webclient.h</a>.</dl>
<p>
Referenced by <a class="el" href="a00180.html#l00378">webclient_appcall()</a>. </td>
</tr>
</table>
<a class="anchor" name="gf8f12c820cc08da32aa62898bfc02db3"></a><!-- doxytag: member="webclient.h::webclient_closed" ref="gf8f12c820cc08da32aa62898bfc02db3" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void webclient_closed </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Callback function that is called from the webclient code when the HTTP connection to the web server has been closed.
<p>
This function must be implemented by the module that uses the webclient code. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a296">webclient.c</a>, and <a class="el" href="a00041.html#a322">webclient.h</a>.</dl>
<p>
Referenced by <a class="el" href="a00180.html#l00378">webclient_appcall()</a>. </td>
</tr>
</table>
<a class="anchor" name="g6b942c1ef22f8cd1a726ef3364c9fbea"></a><!-- doxytag: member="webclient.h::webclient_connected" ref="g6b942c1ef22f8cd1a726ef3364c9fbea" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void webclient_connected </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Callback function that is called from the webclient code when the HTTP connection has been connected to the web server.
<p>
This function must be implemented by the module that uses the webclient code. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a295">webclient.c</a>, and <a class="el" href="a00041.html#a319">webclient.h</a>.</dl>
<p>
Referenced by <a class="el" href="a00180.html#l00378">webclient_appcall()</a>. </td>
</tr>
</table>
<a class="anchor" name="gc4b119801e50cc1824498a1cdf9adc37"></a><!-- doxytag: member="webclient.h::webclient_datahandler" ref="gc4b119801e50cc1824498a1cdf9adc37" args="(char *data, u16_t len)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void webclient_datahandler </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">char *&nbsp;</td>
<td class="mdname" nowrap> <em>data</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a>&nbsp;</td>
<td class="mdname" nowrap> <em>len</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Callback function that is called from the webclient code when HTTP data has been received.
<p>
This function must be implemented by the module that uses the webclient code. The function is called from the webclient module when HTTP data has been received. The function is not called when HTTP headers are received, only for the actual data.<p>
<dl compact><dt><b>Note:</b></dt><dd>This function is called many times, repetedly, when data is being received, and not once when all data has been received.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>A pointer to the data that has been received. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>len</em>&nbsp;</td><td>The length of the data that has been received. </td></tr>
</table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a291">webclient.c</a>, and <a class="el" href="a00041.html#a318">webclient.h</a>.</dl>
<p>
Referenced by <a class="el" href="a00180.html#l00378">webclient_appcall()</a>. </td>
</tr>
</table>
<a class="anchor" name="g41e616d3fcc17e0aabfe8ab45ef0d30f"></a><!-- doxytag: member="webclient.h::webclient_filename" ref="g41e616d3fcc17e0aabfe8ab45ef0d30f" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">char * webclient_filename </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Obtain the filename of the current HTTP data stream.
<p>
The filename of an HTTP request may be changed by the web server, and may therefore not be the same as when the original GET request was made with <a class="el" href="a00163.html#gf9385ef9ecc74c7d53ff2f15e62bfde3">webclient_get()</a>. This function is used for obtaining the current filename.<p>
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to the current filename. </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a254">webclient.c</a>, and <a class="el" href="a00041.html#a328">webclient.h</a>.</dl>
<p>
Definition at line <a class="el" href="a00180.html#l00093">93</a> of file <a class="el" href="a00180.html">webclient.c</a>.
<p>
References <a class="el" href="a00181.html#l00062">webclient_state::file</a>. </td>
</tr>
</table>
<a class="anchor" name="gf9385ef9ecc74c7d53ff2f15e62bfde3"></a><!-- doxytag: member="webclient.h::webclient_get" ref="gf9385ef9ecc74c7d53ff2f15e62bfde3" args="(char *host, u16_t port, char *file)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">unsigned char webclient_get </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">char *&nbsp;</td>
<td class="mdname" nowrap> <em>host</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a>&nbsp;</td>
<td class="mdname" nowrap> <em>port</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>char *&nbsp;</td>
<td class="mdname" nowrap> <em>file</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Open an HTTP connection to a web server and ask for a file using the GET method.
<p>
This function opens an HTTP connection to the specified web server and requests the specified file using the GET method. When the HTTP connection has been connected, the <a class="el" href="a00163.html#g6b942c1ef22f8cd1a726ef3364c9fbea">webclient_connected()</a> callback function is called and when the HTTP data arrives the <a class="el" href="a00163.html#gc4b119801e50cc1824498a1cdf9adc37">webclient_datahandler()</a> callback function is called.<p>
The callback function <a class="el" href="a00163.html#g23705efb9077187881f094fc9be13bde">webclient_timedout()</a> is called if the web server could not be contacted, and the <a class="el" href="a00163.html#gf11d9915ec12a8cdd9fdcbb5e8fcd5c7">webclient_aborted()</a> callback function is called if the HTTP connection is aborted by the web server.<p>
When the HTTP request has been completed and the HTTP connection is closed, the <a class="el" href="a00163.html#gf8f12c820cc08da32aa62898bfc02db3">webclient_closed()</a> callback function will be called.<p>
<dl compact><dt><b>Note:</b></dt><dd>If the function is passed a host name, it must already be in the resolver cache in order for the function to connect to the web server. It is therefore up to the calling module to implement the resolver calls and the signal handler used for reporting a resolv query answer.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em>&nbsp;</td><td>A pointer to a string containing either a host name or a numerical IP address in dotted decimal notation (e.g., 192.168.23.1).</td></tr>
<tr><td valign="top"></td><td valign="top"><em>port</em>&nbsp;</td><td>The port number to which to connect, in host byte order.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>file</em>&nbsp;</td><td>A pointer to the name of the file to get.</td></tr>
</table>
</dl>
<dl compact><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>0</em>&nbsp;</td><td>if the host name could not be found in the cache, or if a TCP connection could not be created.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>1</em>&nbsp;</td><td>if the connection was initiated. </td></tr>
</table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a268">webclient.c</a>, and <a class="el" href="a00041.html#a324">webclient.h</a>.</dl>
<p>
Definition at line <a class="el" href="a00180.html#l00140">140</a> of file <a class="el" href="a00180.html">webclient.c</a>.
<p>
References <a class="el" href="a00181.html#l00062">webclient_state::file</a>, <a class="el" href="a00181.html#l00061">webclient_state::host</a>, <a class="el" href="a00201.html#l01882">htons()</a>, <a class="el" href="a00172.html#l00069">NULL</a>, <a class="el" href="a00181.html#l00060">webclient_state::port</a>, <a class="el" href="a00172.html#l00396">resolv_lookup()</a>, and <a class="el" href="a00201.html#l00407">uip_connect()</a>.
<p>
Referenced by <a class="el" href="a00180.html#l00378">webclient_appcall()</a>. </td>
</tr>
</table>
<a class="anchor" name="g0e0ea5f24b77f124ba33bcbc7ede5bfb"></a><!-- doxytag: member="webclient.h::webclient_hostname" ref="g0e0ea5f24b77f124ba33bcbc7ede5bfb" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">char * webclient_hostname </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Obtain the hostname of the current HTTP data stream.
<p>
The hostname of the web server of an HTTP request may be changed by the web server, and may therefore not be the same as when the original GET request was made with <a class="el" href="a00163.html#gf9385ef9ecc74c7d53ff2f15e62bfde3">webclient_get()</a>. This function is used for obtaining the current hostname.<p>
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to the current hostname. </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a256">webclient.c</a>, and <a class="el" href="a00041.html#a329">webclient.h</a>.</dl>
<p>
Definition at line <a class="el" href="a00180.html#l00099">99</a> of file <a class="el" href="a00180.html">webclient.c</a>.
<p>
References <a class="el" href="a00181.html#l00061">webclient_state::host</a>. </td>
</tr>
</table>
<a class="anchor" name="g4433d3af16ea083a81576d0f18ba57c9"></a><!-- doxytag: member="webclient.h::webclient_mimetype" ref="g4433d3af16ea083a81576d0f18ba57c9" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">char * webclient_mimetype </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Obtain the MIME type of the current HTTP data stream.
<p>
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to a string contaning the MIME type. The string may be empty if no MIME type was reported by the web server. </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a252">webclient.c</a>, and <a class="el" href="a00041.html#a327">webclient.h</a>.</dl>
<p>
Definition at line <a class="el" href="a00180.html#l00087">87</a> of file <a class="el" href="a00180.html">webclient.c</a>.
<p>
References <a class="el" href="a00181.html#l00069">webclient_state::mimetype</a>. </td>
</tr>
</table>
<a class="anchor" name="g2a939aa4fcffabbce1dc1f784a7e0ad3"></a><!-- doxytag: member="webclient.h::webclient_port" ref="g2a939aa4fcffabbce1dc1f784a7e0ad3" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">unsigned short webclient_port </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Obtain the port number of the current HTTP data stream.
<p>
The port number of an HTTP request may be changed by the web server, and may therefore not be the same as when the original GET request was made with <a class="el" href="a00163.html#gf9385ef9ecc74c7d53ff2f15e62bfde3">webclient_get()</a>. This function is used for obtaining the current port number.<p>
<dl compact><dt><b>Returns:</b></dt><dd>The port number of the current HTTP data stream, in host byte order. </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a258">webclient.c</a>, and <a class="el" href="a00041.html#a330">webclient.h</a>.</dl>
<p>
Definition at line <a class="el" href="a00180.html#l00105">105</a> of file <a class="el" href="a00180.html">webclient.c</a>.
<p>
References <a class="el" href="a00181.html#l00060">webclient_state::port</a>. </td>
</tr>
</table>
<a class="anchor" name="g23705efb9077187881f094fc9be13bde"></a><!-- doxytag: member="webclient.h::webclient_timedout" ref="g23705efb9077187881f094fc9be13bde" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void webclient_timedout </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Callback function that is called from the webclient code if the HTTP connection to the web server has timed out.
<p>
This function must be implemented by the module that uses the webclient code. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00040.html#a299">webclient.c</a>, and <a class="el" href="a00041.html#a320">webclient.h</a>.</dl>
<p>
Referenced by <a class="el" href="a00180.html#l00378">webclient_appcall()</a>. </td>
</tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
</body>
</html>