a00151.html 12 KB

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