1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 3<title>uIP 1.0: Architecture specific uIP functions</title> 4<link href="doxygen.css" rel="stylesheet" type="text/css"> 5<link href="tabs.css" rel="stylesheet" type="text/css"> 6</head><body> 7<!-- Generated by Doxygen 1.4.6 --> 8<div class="tabs"> 9 <ul> 10 <li><a href="main.html"><span>Main Page</span></a></li> 11 <li><a href="modules.html"><span>Modules</span></a></li> 12 <li><a href="classes.html"><span>Data Structures</span></a></li> 13 <li><a href="files.html"><span>Files</span></a></li> 14 <li><a href="examples.html"><span>Examples</span></a></li> 15 </ul></div> 16<h1>Architecture specific uIP functions<br> 17<small> 18[<a class="el" href="a00150.html">The uIP TCP/IP stack</a>]</small> 19</h1><hr><a name="_details"></a><h2>Detailed Description</h2> 20The functions in the architecture specific module implement the IP check sum and 32-bit additions. 21<p> 22The 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. 23<p> 24<table border="0" cellpadding="0" cellspacing="0"> 25<tr><td></td></tr> 26<tr><td colspan="2"><br><h2>Files</h2></td></tr> 27<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><a class="el" href="a00137.html">uip_arch.h</a></td></tr> 28 29<tr><td class="mdescLeft"> </td><td class="mdescRight">Declarations of architecture specific functions. <br></td></tr> 30 31<p> 32<tr><td colspan="2"><br><h2>Functions</h2></td></tr> 33<tr><td class="memItemLeft" nowrap align="right" valign="top">void </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> 34 35<tr><td class="mdescLeft"> </td><td class="mdescRight">Carry out a 32-bit addition. <a href="#g6832e4d2d046536b6472f7ac92340f68"></a><br></td></tr> 36<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> </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> 37 38<tr><td class="mdescLeft"> </td><td class="mdescRight">Calculate the Internet checksum over a buffer. <a href="#gb6683dd83fe1c8de9a24086d4b69e907"></a><br></td></tr> 39<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00151.html#g2addf34c7d457c1a7899a7e2171ef1e9">uip_ipchksum</a> (void)</td></tr> 40 41<tr><td class="mdescLeft"> </td><td class="mdescRight">Calculate the IP header checksum of the packet header in uip_buf. <a href="#g2addf34c7d457c1a7899a7e2171ef1e9"></a><br></td></tr> 42<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00151.html#g85b65e38aa74eba18979156f97a94a87">uip_tcpchksum</a> (void)</td></tr> 43 44<tr><td class="mdescLeft"> </td><td class="mdescRight">Calculate the TCP checksum of the packet in uip_buf and uip_appdata. <a href="#g85b65e38aa74eba18979156f97a94a87"></a><br></td></tr> 45<tr><td colspan="2"><br><h2>Variables</h2></td></tr> 46<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g2a0cf5d86c58fab216414ce59bf1fea1"></a><!-- doxytag: member="uiparch::uip_acc32" ref="g2a0cf5d86c58fab216414ce59bf1fea1" args="[4]" --> 47<a class="el" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00151.html#g2a0cf5d86c58fab216414ce59bf1fea1">uip_acc32</a> [4]</td></tr> 48 49<tr><td class="mdescLeft"> </td><td class="mdescRight">4-byte array used for the 32-bit sequence number calculations. <br></td></tr> 50</table> 51<hr><h2>Function Documentation</h2> 52<a class="anchor" name="g6832e4d2d046536b6472f7ac92340f68"></a><!-- doxytag: member="uip_arch.h::uip_add32" ref="g6832e4d2d046536b6472f7ac92340f68" args="(u8_t *op32, u16_t op16)" --><p> 53<table class="mdTable" cellpadding="2" cellspacing="0"> 54 <tr> 55 <td class="mdRow"> 56 <table cellpadding="0" cellspacing="0" border="0"> 57 <tr> 58 <td class="md" nowrap valign="top">void uip_add32 </td> 59 <td class="md" valign="top">( </td> 60 <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> * </td> 61 <td class="mdname" nowrap> <em>op32</em>, </td> 62 </tr> 63 <tr> 64 <td class="md" nowrap align="right"></td> 65 <td class="md"></td> 66 <td class="md" nowrap><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> </td> 67 <td class="mdname" nowrap> <em>op16</em></td> 68 </tr> 69 <tr> 70 <td class="md"></td> 71 <td class="md">) </td> 72 <td class="md" colspan="2"></td> 73 </tr> 74 </table> 75 </td> 76 </tr> 77</table> 78<table cellspacing="5" cellpadding="0" border="0"> 79 <tr> 80 <td> 81 82 </td> 83 <td> 84 85<p> 86Carry out a 32-bit addition. 87<p> 88Because 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> 89<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> 90<dl compact><dt><b>Parameters:</b></dt><dd> 91 <table border="0" cellspacing="2" cellpadding="0"> 92 <tr><td valign="top"></td><td valign="top"><em>op32</em> </td><td>A pointer to a 4-byte array representing a 32-bit integer in network byte order (big endian).</td></tr> 93 <tr><td valign="top"></td><td valign="top"><em>op16</em> </td><td>A 16-bit integer in host byte order. </td></tr> 94 </table> 95</dl> 96 97<p> 98Definition at line <a class="el" href="a00201.html#l00249">249</a> of file <a class="el" href="a00201.html">uip.c</a>. 99<p> 100Referenced by <a class="el" href="a00199.html#l00049">uip_split_output()</a>. </td> 101 </tr> 102</table> 103<a class="anchor" name="gb6683dd83fe1c8de9a24086d4b69e907"></a><!-- doxytag: member="uip_arch.h::uip_chksum" ref="gb6683dd83fe1c8de9a24086d4b69e907" args="(u16_t *buf, u16_t len)" --><p> 104<table class="mdTable" cellpadding="2" cellspacing="0"> 105 <tr> 106 <td class="mdRow"> 107 <table cellpadding="0" cellspacing="0" border="0"> 108 <tr> 109 <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> uip_chksum </td> 110 <td class="md" valign="top">( </td> 111 <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> * </td> 112 <td class="mdname" nowrap> <em>buf</em>, </td> 113 </tr> 114 <tr> 115 <td class="md" nowrap align="right"></td> 116 <td class="md"></td> 117 <td class="md" nowrap><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> </td> 118 <td class="mdname" nowrap> <em>len</em></td> 119 </tr> 120 <tr> 121 <td class="md"></td> 122 <td class="md">) </td> 123 <td class="md" colspan="2"></td> 124 </tr> 125 </table> 126 </td> 127 </tr> 128</table> 129<table cellspacing="5" cellpadding="0" border="0"> 130 <tr> 131 <td> 132 133 </td> 134 <td> 135 136<p> 137Calculate the Internet checksum over a buffer. 138<p> 139The Internet checksum is the one's complement of the one's complement sum of all 16-bit words in the buffer.<p> 140See RFC1071.<p> 141<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> 142<dl compact><dt><b>Parameters:</b></dt><dd> 143 <table border="0" cellspacing="2" cellpadding="0"> 144 <tr><td valign="top"></td><td valign="top"><em>buf</em> </td><td>A pointer to the buffer over which the checksum is to be computed.</td></tr> 145 <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>The length of the buffer over which the checksum is to be computed.</td></tr> 146 </table> 147</dl> 148<dl compact><dt><b>Returns:</b></dt><dd>The Internet checksum of the buffer. </dd></dl> 149 </td> 150 </tr> 151</table> 152<a class="anchor" name="g2addf34c7d457c1a7899a7e2171ef1e9"></a><!-- doxytag: member="uip_arch.h::uip_ipchksum" ref="g2addf34c7d457c1a7899a7e2171ef1e9" args="(void)" --><p> 153<table class="mdTable" cellpadding="2" cellspacing="0"> 154 <tr> 155 <td class="mdRow"> 156 <table cellpadding="0" cellspacing="0" border="0"> 157 <tr> 158 <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> uip_ipchksum </td> 159 <td class="md" valign="top">( </td> 160 <td class="md" nowrap valign="top">void </td> 161 <td class="mdname1" valign="top" nowrap> </td> 162 <td class="md" valign="top"> ) </td> 163 <td class="md" nowrap></td> 164 </tr> 165 </table> 166 </td> 167 </tr> 168</table> 169<table cellspacing="5" cellpadding="0" border="0"> 170 <tr> 171 <td> 172 173 </td> 174 <td> 175 176<p> 177Calculate the IP header checksum of the packet header in uip_buf. 178<p> 179The IP header checksum is the Internet checksum of the 20 bytes of the IP header.<p> 180<dl compact><dt><b>Returns:</b></dt><dd>The IP header checksum of the IP header in the uip_buf buffer. </dd></dl> 181 </td> 182 </tr> 183</table> 184<a class="anchor" name="g85b65e38aa74eba18979156f97a94a87"></a><!-- doxytag: member="uip_arch.h::uip_tcpchksum" ref="g85b65e38aa74eba18979156f97a94a87" args="(void)" --><p> 185<table class="mdTable" cellpadding="2" cellspacing="0"> 186 <tr> 187 <td class="mdRow"> 188 <table cellpadding="0" cellspacing="0" border="0"> 189 <tr> 190 <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> uip_tcpchksum </td> 191 <td class="md" valign="top">( </td> 192 <td class="md" nowrap valign="top">void </td> 193 <td class="mdname1" valign="top" nowrap> </td> 194 <td class="md" valign="top"> ) </td> 195 <td class="md" nowrap></td> 196 </tr> 197 </table> 198 </td> 199 </tr> 200</table> 201<table cellspacing="5" cellpadding="0" border="0"> 202 <tr> 203 <td> 204 205 </td> 206 <td> 207 208<p> 209Calculate the TCP checksum of the packet in uip_buf and uip_appdata. 210<p> 211The TCP checksum is the Internet checksum of data contents of the TCP segment, and a pseudo-header as defined in RFC793.<p> 212<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> 213<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> 214 </td> 215 </tr> 216</table> 217<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by 218<a href="http://www.doxygen.org/index.html"> 219<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address> 220</body> 221</html> 222