smart-green-house/rtt-uart-nb/rt-thread/components/net/uip/doc/html/a00151.html

222 lines
12 KiB
HTML
Raw Normal View History

2023-10-28 18:00:47 +08:00
<!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: Architecture specific uIP 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>Architecture specific uIP 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 functions in the architecture specific module implement the IP check sum and 32-bit additions.
<p>
The IP checksum calculation is the most computationally expensive operation in the TCP/IP stack and it therefore pays off to implement this in efficient assembler. The purpose of the uip-arch module is to let the checksum functions to be implemented in architecture specific assembler.
<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="a00137.html">uip_arch.h</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Declarations of architecture specific functions. <br></td></tr>
<p>
<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="a00151.html#g6832e4d2d046536b6472f7ac92340f68">uip_add32</a> (<a class="el" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> *op32, <a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> op16)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Carry out a 32-bit addition. <a href="#g6832e4d2d046536b6472f7ac92340f68"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00151.html#gb6683dd83fe1c8de9a24086d4b69e907">uip_chksum</a> (<a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> *buf, <a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> len)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Calculate the Internet checksum over a buffer. <a href="#gb6683dd83fe1c8de9a24086d4b69e907"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00151.html#g2addf34c7d457c1a7899a7e2171ef1e9">uip_ipchksum</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Calculate the IP header checksum of the packet header in uip_buf. <a href="#g2addf34c7d457c1a7899a7e2171ef1e9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00151.html#g85b65e38aa74eba18979156f97a94a87">uip_tcpchksum</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Calculate the TCP checksum of the packet in uip_buf and uip_appdata. <a href="#g85b65e38aa74eba18979156f97a94a87"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g2a0cf5d86c58fab216414ce59bf1fea1"></a><!-- doxytag: member="uiparch::uip_acc32" ref="g2a0cf5d86c58fab216414ce59bf1fea1" args="[4]" -->
<a class="el" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00151.html#g2a0cf5d86c58fab216414ce59bf1fea1">uip_acc32</a> [4]</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">4-byte array used for the 32-bit sequence number calculations. <br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g6832e4d2d046536b6472f7ac92340f68"></a><!-- doxytag: member="uip_arch.h::uip_add32" ref="g6832e4d2d046536b6472f7ac92340f68" args="(u8_t *op32, u16_t op16)" --><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 uip_add32 </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>op32</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>op16</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>
Carry out a 32-bit addition.
<p>
Because not all architectures for which uIP is intended has native 32-bit arithmetic, uIP uses an external C function for doing the required 32-bit additions in the TCP protocol processing. This function should add the two arguments and place the result in the global variable uip_acc32.<p>
<dl compact><dt><b>Note:</b></dt><dd>The 32-bit integer pointed to by the op32 parameter and the result in the uip_acc32 variable are in network byte order (big endian).</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>op32</em>&nbsp;</td><td>A pointer to a 4-byte array representing a 32-bit integer in network byte order (big endian).</td></tr>
<tr><td valign="top"></td><td valign="top"><em>op16</em>&nbsp;</td><td>A 16-bit integer in host byte order. </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a00201.html#l00249">249</a> of file <a class="el" href="a00201.html">uip.c</a>.
<p>
Referenced by <a class="el" href="a00199.html#l00049">uip_split_output()</a>. </td>
</tr>
</table>
<a class="anchor" name="gb6683dd83fe1c8de9a24086d4b69e907"></a><!-- doxytag: member="uip_arch.h::uip_chksum" ref="gb6683dd83fe1c8de9a24086d4b69e907" args="(u16_t *buf, 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"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> uip_chksum </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>buf</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>
Calculate the Internet checksum over a buffer.
<p>
The Internet checksum is the one's complement of the one's complement sum of all 16-bit words in the buffer.<p>
See RFC1071.<p>
<dl compact><dt><b>Note:</b></dt><dd>This function is not called in the current version of uIP, but future versions might make use of it.</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>buf</em>&nbsp;</td><td>A pointer to the buffer over which the checksum is to be computed.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>len</em>&nbsp;</td><td>The length of the buffer over which the checksum is to be computed.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The Internet checksum of the buffer. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="g2addf34c7d457c1a7899a7e2171ef1e9"></a><!-- doxytag: member="uip_arch.h::uip_ipchksum" ref="g2addf34c7d457c1a7899a7e2171ef1e9" 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"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> uip_ipchksum </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>
Calculate the IP header checksum of the packet header in uip_buf.
<p>
The IP header checksum is the Internet checksum of the 20 bytes of the IP header.<p>
<dl compact><dt><b>Returns:</b></dt><dd>The IP header checksum of the IP header in the uip_buf buffer. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="g85b65e38aa74eba18979156f97a94a87"></a><!-- doxytag: member="uip_arch.h::uip_tcpchksum" ref="g85b65e38aa74eba18979156f97a94a87" 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"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> uip_tcpchksum </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>
Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
<p>
The TCP checksum is the Internet checksum of data contents of the TCP segment, and a pseudo-header as defined in RFC793.<p>
<dl compact><dt><b>Note:</b></dt><dd>The uip_appdata pointer that points to the packet data may point anywhere in memory, so it is not possible to simply calculate the Internet checksum of the contents of the uip_buf buffer.</dd></dl>
<dl compact><dt><b>Returns:</b></dt><dd>The TCP checksum of the TCP segment in uip_buf and pointed to by uip_appdata. </dd></dl>
</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>