📄 a00148.html
字号:
<p>Definition at line <a class="el" href="a00202.html#l00911">911</a> of file <a class="el" href="a00202.html">uip.h</a>.<p>Referenced by <a class="el" href="a00204.html#l00278">uip_arp_arpin()</a>, <a class="el" href="a00204.html#l00354">uip_arp_out()</a>, and <a class="el" href="a00201.html#l00682">uip_process()</a>. </td> </tr></table><a class="anchor" name="g769512993b7b27271909d6daa4748b60"></a><!-- doxytag: member="uip.h::uip_ipaddr_copy" ref="g769512993b7b27271909d6daa4748b60" args="(dest, src)" --><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_ipaddr_copy </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">dest, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>src </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Copy an IP address to another IP address. <p>Copies an IP address from one place to another.<p>Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr1, ipaddr2; <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&ipaddr1, 192,16,1,2); <a class="code" href="a00148.html#g769512993b7b27271909d6daa4748b60">uip_ipaddr_copy</a>(&ipaddr2, &ipaddr1);</pre></div><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>dest</em> </td><td>The destination for the copy. </td></tr> <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>The source from where to copy. </td></tr> </table></dl><dl compact><dt><b>Examples: </b></dt><dd><a class="el" href="a00038.html#a187">smtp.c</a>.</dl><p>Definition at line <a class="el" href="a00202.html#l00882">882</a> of file <a class="el" href="a00202.html">uip.h</a>.<p>Referenced by <a class="el" href="a00174.html#l00216">smtp_configure()</a>, <a class="el" href="a00204.html#l00354">uip_arp_out()</a>, and <a class="el" href="a00201.html#l00682">uip_process()</a>. </td> </tr></table><a class="anchor" name="g969d7fff37a979737da045e0d538a9bd"></a><!-- doxytag: member="uip.h::uip_ipaddr_mask" ref="g969d7fff37a979737da045e0d538a9bd" args="(dest, src, mask)" --><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_ipaddr_mask </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">dest, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>src, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>mask </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Mask out the network part of an IP address. <p>Masks out the network part of an IP address, given the address and the netmask.<p>Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr1, ipaddr2, netmask; <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&ipaddr1, 192,16,1,2); <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&netmask, 255,255,255,0); <a class="code" href="a00148.html#g969d7fff37a979737da045e0d538a9bd">uip_ipaddr_mask</a>(&ipaddr2, &ipaddr1, &netmask);</pre></div><p>In the example above, the variable "ipaddr2" will contain the IP address 192.168.1.0.<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>dest</em> </td><td>Where the result is to be placed. </td></tr> <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>The IP address. </td></tr> <tr><td valign="top"></td><td valign="top"><em>mask</em> </td><td>The netmask. </td></tr> </table></dl><p>Definition at line <a class="el" href="a00202.html#l00972">972</a> of file <a class="el" href="a00202.html">uip.h</a>. </td> </tr></table><a class="anchor" name="g6b16e0bac41821c1fbe0c267071642f0"></a><!-- doxytag: member="uip.h::uip_ipaddr_maskcmp" ref="g6b16e0bac41821c1fbe0c267071642f0" args="(addr1, addr2, mask)" --><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_ipaddr_maskcmp </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">addr1, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>addr2, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>mask </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Compare two IP addresses with netmasks. <p>Compares two IP addresses with netmasks. The masks are used to mask out the bits that are to be compared.<p>Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr1, ipaddr2, mask; <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&mask, 255,255,255,0); <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&ipaddr1, 192,16,1,2); <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&ipaddr2, 192,16,1,3); <span class="keywordflow">if</span>(<a class="code" href="a00148.html#g6b16e0bac41821c1fbe0c267071642f0">uip_ipaddr_maskcmp</a>(&ipaddr1, &ipaddr2, &mask)) { printf(<span class="stringliteral">"They are the same"</span>); }</pre></div><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>addr1</em> </td><td>The first IP address. </td></tr> <tr><td valign="top"></td><td valign="top"><em>addr2</em> </td><td>The second IP address. </td></tr> <tr><td valign="top"></td><td valign="top"><em>mask</em> </td><td>The netmask. </td></tr> </table></dl><p>Definition at line <a class="el" href="a00202.html#l00941">941</a> of file <a class="el" href="a00202.html">uip.h</a>.<p>Referenced by <a class="el" href="a00204.html#l00354">uip_arp_out()</a>. </td> </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="ga22b04cac8cf283ca12f028578bebc06"></a><!-- doxytag: member="uip.h::htons" ref="ga22b04cac8cf283ca12f028578bebc06" args="(u16_t val)" --><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"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> htons </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> </td> <td class="mdname1" valign="top" nowrap> <em>val</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Convert 16-bit quantity from host byte order to network byte order. <p>This function is primarily used for converting variables from host byte order to network byte order. For converting constants to network byte order, use the <a class="el" href="a00148.html#g69a7a4951ff21b302267532c21ee78fc">HTONS()</a> macro instead. <dl compact><dt><b>Examples: </b></dt><dd><a class="el" href="a00042.html#a70">example-mainloop-with-arp.c</a>, <a class="el" href="a00046.html#a137">resolv.c</a>, and <a class="el" href="a00040.html#a274">webclient.c</a>.</dl><p>Definition at line <a class="el" href="a00201.html#l01882">1882</a> of file <a class="el" href="a00201.html">uip.c</a>.<p>References <a class="el" href="a00202.html#l01070">HTONS</a>.<p>Referenced by <a class="el" href="a00201.html#l00311">uip_chksum()</a>, <a class="el" href="a00201.html#l00407">uip_connect()</a>, <a class="el" href="a00201.html#l00318">uip_ipchksum()</a>, <a class="el" href="a00201.html#l00473">uip_udp_new()</a>, and <a class="el" href="a00180.html#l00140">webclient_get()</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 <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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -