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

329 lines
15 KiB
HTML
Raw Normal View History

<!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: uIP configuration functions</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>uIP configuration functions<br>
<small>
[<a class="el" href="a00150.html">The uIP TCP/IP stack</a>]</small>
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
The uIP configuration functions are used for setting run-time parameters in uIP such as IP addresses.
<p>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00144.html#g12b467f314489259dd718228d0827a51">uip_sethostaddr</a>(addr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the IP address of this host. <a href="#g12b467f314489259dd718228d0827a51"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00144.html#g20bc87e5c063c3f4b01547be6e5a0148">uip_gethostaddr</a>(addr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the IP address of this host. <a href="#g20bc87e5c063c3f4b01547be6e5a0148"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00144.html#g41d37ea1e3bd24f7b51e9409aceaaa80">uip_setdraddr</a>(addr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the default router's IP address. <a href="#g41d37ea1e3bd24f7b51e9409aceaaa80"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00144.html#geb79c914cf137e6d27fd7583e5a66679">uip_setnetmask</a>(addr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the netmask. <a href="#geb79c914cf137e6d27fd7583e5a66679"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00144.html#gd8e8bc9bc0e2ea4a24a8a024fd3a7f7c">uip_getdraddr</a>(addr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the default router's IP address. <a href="#gd8e8bc9bc0e2ea4a24a8a024fd3a7f7c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00144.html#g5323320b7316647042016f17c4e881be">uip_getnetmask</a>(addr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the netmask. <a href="#g5323320b7316647042016f17c4e881be"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00144.html#g30e827f33eacff55ecb4d8fb5a11d5d1">uip_setethaddr</a>(eaddr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Specifiy the Ethernet MAC address. <a href="#g30e827f33eacff55ecb4d8fb5a11d5d1"></a><br></td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="gd8e8bc9bc0e2ea4a24a8a024fd3a7f7c"></a><!-- doxytag: member="uip.h::uip_getdraddr" ref="gd8e8bc9bc0e2ea4a24a8a024fd3a7f7c" args="(addr)" --><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">#define uip_getdraddr </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">addr&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>
Get the default router's IP address.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>addr</em>&nbsp;</td><td>A pointer to a uip_ipaddr_t variable that will be filled in with the IP address of the default router. </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a00202.html#l00161">161</a> of file <a class="el" href="a00202.html">uip.h</a>. </td>
</tr>
</table>
<a class="anchor" name="g20bc87e5c063c3f4b01547be6e5a0148"></a><!-- doxytag: member="uip.h::uip_gethostaddr" ref="g20bc87e5c063c3f4b01547be6e5a0148" args="(addr)" --><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">#define uip_gethostaddr </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">addr&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>
Get the IP address of this host.
<p>
The IP address is represented as a 4-byte array where the first octet of the IP address is put in the first member of the 4-byte array.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> hostaddr;
<a class="code" href="a00144.html#g20bc87e5c063c3f4b01547be6e5a0148">uip_gethostaddr</a>(&amp;hostaddr);
</pre></div> <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>addr</em>&nbsp;</td><td>A pointer to a uip_ipaddr_t variable that will be filled in with the currently configured IP address. </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a00202.html#l00126">126</a> of file <a class="el" href="a00202.html">uip.h</a>. </td>
</tr>
</table>
<a class="anchor" name="g5323320b7316647042016f17c4e881be"></a><!-- doxytag: member="uip.h::uip_getnetmask" ref="g5323320b7316647042016f17c4e881be" args="(addr)" --><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">#define uip_getnetmask </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">addr&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>
Get the netmask.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>addr</em>&nbsp;</td><td>A pointer to a uip_ipaddr_t variable that will be filled in with the value of the netmask. </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a00202.html#l00171">171</a> of file <a class="el" href="a00202.html">uip.h</a>. </td>
</tr>
</table>
<a class="anchor" name="g41d37ea1e3bd24f7b51e9409aceaaa80"></a><!-- doxytag: member="uip.h::uip_setdraddr" ref="g41d37ea1e3bd24f7b51e9409aceaaa80" args="(addr)" --><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">#define uip_setdraddr </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">addr&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>
Set the default router's IP address.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>addr</em>&nbsp;</td><td>A pointer to a uip_ipaddr_t variable containing the IP address of the default router.</td></tr>
</table>
</dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr()</a> </dd></dl>
<p>
Definition at line <a class="el" href="a00202.html#l00138">138</a> of file <a class="el" href="a00202.html">uip.h</a>. </td>
</tr>
</table>
<a class="anchor" name="g30e827f33eacff55ecb4d8fb5a11d5d1"></a><!-- doxytag: member="uip_arp.h::uip_setethaddr" ref="g30e827f33eacff55ecb4d8fb5a11d5d1" args="(eaddr)" --><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">#define uip_setethaddr </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">eaddr&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>
Specifiy the Ethernet MAC address.
<p>
The ARP code needs to know the MAC address of the Ethernet card in order to be able to respond to ARP queries and to generate working Ethernet headers.<p>
<dl compact><dt><b>Note:</b></dt><dd>This macro only specifies the Ethernet MAC address to the ARP code. It cannot be used to change the MAC address of the Ethernet card.</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>eaddr</em>&nbsp;</td><td>A pointer to a struct <a class="el" href="a00089.html">uip_eth_addr</a> containing the Ethernet MAC address of the Ethernet card. </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a00205.html#l00134">134</a> of file <a class="el" href="a00205.html">uip_arp.h</a>. </td>
</tr>
</table>
<a class="anchor" name="g12b467f314489259dd718228d0827a51"></a><!-- doxytag: member="uip.h::uip_sethostaddr" ref="g12b467f314489259dd718228d0827a51" args="(addr)" --><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">#define uip_sethostaddr </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">addr&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>
Set the IP address of this host.
<p>
The IP address is represented as a 4-byte array where the first octet of the IP address is put in the first member of the 4-byte array.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> addr;
<a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;addr, 192,168,1,2);
<a class="code" href="a00144.html#g12b467f314489259dd718228d0827a51">uip_sethostaddr</a>(&amp;addr);
</pre></div> <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>addr</em>&nbsp;</td><td>A pointer to an IP address of type uip_ipaddr_t;</td></tr>
</table>
</dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr()</a> </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00048.html#a42">dhcpc.c</a>, <a class="el" href="a00042.html#a66">example-mainloop-with-arp.c</a>, and <a class="el" href="a00043.html#a90">example-mainloop-without-arp.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00202.html#l00106">106</a> of file <a class="el" href="a00202.html">uip.h</a>. </td>
</tr>
</table>
<a class="anchor" name="geb79c914cf137e6d27fd7583e5a66679"></a><!-- doxytag: member="uip.h::uip_setnetmask" ref="geb79c914cf137e6d27fd7583e5a66679" args="(addr)" --><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">#define uip_setnetmask </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">addr&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>
Set the netmask.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>addr</em>&nbsp;</td><td>A pointer to a uip_ipaddr_t variable containing the IP address of the netmask.</td></tr>
</table>
</dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr()</a> </dd></dl>
<p>
Definition at line <a class="el" href="a00202.html#l00150">150</a> of file <a class="el" href="a00202.html">uip.h</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>