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: uIP device driver 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>uIP device driver 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> 20These functions are used by a network device driver for interacting with uIP. 21<p> 22 23<p> 24<table border="0" cellpadding="0" cellspacing="0"> 25<tr><td></td></tr> 26<tr><td colspan="2"><br><h2>Defines</h2></td></tr> 27<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00146.html#ga4360412ee9350fba725f98a137169fe">uip_input</a>()</td></tr> 28 29<tr><td class="mdescLeft"> </td><td class="mdescRight">Process an incoming packet. <a href="#ga4360412ee9350fba725f98a137169fe"></a><br></td></tr> 30<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00146.html#g1024f8a5fa65e82bf848b2e6590d9628">uip_periodic</a>(conn)</td></tr> 31 32<tr><td class="mdescLeft"> </td><td class="mdescRight">Periodic processing for a connection identified by its number. <a href="#g1024f8a5fa65e82bf848b2e6590d9628"></a><br></td></tr> 33<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gfd5ebb56a1bd1da9878aa886a2075e80"></a><!-- doxytag: member="uipdevfunc::uip_conn_active" ref="gfd5ebb56a1bd1da9878aa886a2075e80" args="(conn)" --> 34#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00146.html#gfd5ebb56a1bd1da9878aa886a2075e80">uip_conn_active</a>(conn) (<a class="el" href="a00150.html#gf703683056d2bfa5c81fa157dcb20fe2">uip_conns</a>[conn].tcpstateflags != UIP_CLOSED)</td></tr> 35 36<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00146.html#gbaf0bb2b6a4424b4eb69e45e457c2583">uip_periodic_conn</a>(conn)</td></tr> 37 38<tr><td class="mdescLeft"> </td><td class="mdescRight">Perform periodic processing for a connection identified by a pointer to its structure. <a href="#gbaf0bb2b6a4424b4eb69e45e457c2583"></a><br></td></tr> 39<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00146.html#gf20aaf4292cb0d2a1b10bc0a568b51fa">uip_poll_conn</a>(conn)</td></tr> 40 41<tr><td class="mdescLeft"> </td><td class="mdescRight">Reuqest that a particular connection should be polled. <a href="#gf20aaf4292cb0d2a1b10bc0a568b51fa"></a><br></td></tr> 42<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00146.html#g2c64c8c36bc84f9336f6a2184ea51883">uip_udp_periodic</a>(conn)</td></tr> 43 44<tr><td class="mdescLeft"> </td><td class="mdescRight">Periodic processing for a UDP connection identified by its number. <a href="#g2c64c8c36bc84f9336f6a2184ea51883"></a><br></td></tr> 45<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00146.html#gf5c2ad5acf3cc23b8262e9ba6a15136b">uip_udp_periodic_conn</a>(conn)</td></tr> 46 47<tr><td class="mdescLeft"> </td><td class="mdescRight">Periodic processing for a UDP connection identified by a pointer to its structure. <a href="#gf5c2ad5acf3cc23b8262e9ba6a15136b"></a><br></td></tr> 48<tr><td colspan="2"><br><h2>Variables</h2></td></tr> 49<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00146.html#gb81e78f890dbbee50c533a9734b74fd9">uip_buf</a> [UIP_BUFSIZE+2]</td></tr> 50 51<tr><td class="mdescLeft"> </td><td class="mdescRight">The uIP packet buffer. <a href="#gb81e78f890dbbee50c533a9734b74fd9"></a><br></td></tr> 52</table> 53<hr><h2>Define Documentation</h2> 54<a class="anchor" name="ga4360412ee9350fba725f98a137169fe"></a><!-- doxytag: member="uip.h::uip_input" ref="ga4360412ee9350fba725f98a137169fe" args="()" --><p> 55<table class="mdTable" cellpadding="2" cellspacing="0"> 56 <tr> 57 <td class="mdRow"> 58 <table cellpadding="0" cellspacing="0" border="0"> 59 <tr> 60 <td class="md" nowrap valign="top">#define uip_input </td> 61 <td class="md" valign="top">( </td> 62 </td> 63 <td class="mdname1" valign="top" nowrap> </td> 64 <td class="md" valign="top"> ) </td> 65 <td class="md" nowrap></td> 66 </tr> 67 </table> 68 </td> 69 </tr> 70</table> 71<table cellspacing="5" cellpadding="0" border="0"> 72 <tr> 73 <td> 74 75 </td> 76 <td> 77 78<p> 79Process an incoming packet. 80<p> 81This function should be called when the device driver has received a packet from the network. The packet from the device driver must be present in the uip_buf buffer, and the length of the packet should be placed in the uip_len variable.<p> 82When the function returns, there may be an outbound packet placed in the uip_buf packet buffer. If so, the uip_len variable is set to the length of the packet. If no packet is to be sent out, the uip_len variable is set to 0.<p> 83The usual way of calling the function is presented by the source code below. <div class="fragment"><pre class="fragment"> <a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> = devicedriver_poll(); 84 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 85 <a class="code" href="a00146.html#ga4360412ee9350fba725f98a137169fe">uip_input</a>(); 86 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 87 devicedriver_send(); 88 } 89 } 90</pre></div><p> 91<dl compact><dt><b>Note:</b></dt><dd>If you are writing a uIP device driver that needs ARP (Address Resolution Protocol), e.g., when running uIP over Ethernet, you will need to call the uIP ARP code before calling this function: <div class="fragment"><pre class="fragment"><span class="preprocessor"> #define BUF ((struct uip_eth_hdr *)&uip_buf[0])</span> 92<span class="preprocessor"></span> <a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> = ethernet_devicedrver_poll(); 93 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 94 <span class="keywordflow">if</span>(<a class="code" href="a00150.html#g24f52ac52d6e714cb04a5aa01be3bdd0">BUF</a>->type == <a class="code" href="a00148.html#g69a7a4951ff21b302267532c21ee78fc">HTONS</a>(<a class="code" href="a00152.html#g03d140db75de3d3cdfbbab1c4fed8d8d">UIP_ETHTYPE_IP</a>)) { 95 <a class="code" href="a00152.html#g737337d6a51e31b236c8233d024138a8">uip_arp_ipin</a>(); 96 <a class="code" href="a00146.html#ga4360412ee9350fba725f98a137169fe">uip_input</a>(); 97 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 98 <a class="code" href="a00152.html#g54b27e45df15e10a0eb1a3e3a91417d2">uip_arp_out</a>(); 99 ethernet_devicedriver_send(); 100 } 101 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="a00150.html#g24f52ac52d6e714cb04a5aa01be3bdd0">BUF</a>->type == <a class="code" href="a00148.html#g69a7a4951ff21b302267532c21ee78fc">HTONS</a>(<a class="code" href="a00152.html#g3e1562e8a6de32268e5df92a52152f91">UIP_ETHTYPE_ARP</a>)) { 102 <a class="code" href="a00152.html#g902c4a360134096224bc2655f623aa5f">uip_arp_arpin</a>(); 103 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 104 ethernet_devicedriver_send(); 105 } 106 } 107</pre></div> </dd></dl> 108<dl compact><dt><b>Examples: </b></dt><dd> 109<a class="el" href="a00042.html#a73">example-mainloop-with-arp.c</a>, and <a class="el" href="a00043.html#a93">example-mainloop-without-arp.c</a>.</dl> 110<p> 111Definition at line <a class="el" href="a00202.html#l00257">257</a> of file <a class="el" href="a00202.html">uip.h</a>. </td> 112 </tr> 113</table> 114<a class="anchor" name="g1024f8a5fa65e82bf848b2e6590d9628"></a><!-- doxytag: member="uip.h::uip_periodic" ref="g1024f8a5fa65e82bf848b2e6590d9628" args="(conn)" --><p> 115<table class="mdTable" cellpadding="2" cellspacing="0"> 116 <tr> 117 <td class="mdRow"> 118 <table cellpadding="0" cellspacing="0" border="0"> 119 <tr> 120 <td class="md" nowrap valign="top">#define uip_periodic </td> 121 <td class="md" valign="top">( </td> 122 <td class="md" nowrap valign="top">conn </td> 123 <td class="mdname1" valign="top" nowrap> </td> 124 <td class="md" valign="top"> ) </td> 125 <td class="md" nowrap></td> 126 </tr> 127 </table> 128 </td> 129 </tr> 130</table> 131<table cellspacing="5" cellpadding="0" border="0"> 132 <tr> 133 <td> 134 135 </td> 136 <td> 137 138<p> 139Periodic processing for a connection identified by its number. 140<p> 141This function does the necessary periodic processing (timers, polling) for a uIP TCP conneciton, and should be called when the periodic uIP timer goes off. It should be called for every connection, regardless of whether they are open of closed.<p> 142When the function returns, it may have an outbound packet waiting for service in the uIP packet buffer, and if so the uip_len variable is set to a value larger than zero. The device driver should be called to send out the packet.<p> 143The ususal way of calling the function is through a for() loop like this: <div class="fragment"><pre class="fragment"> <span class="keywordflow">for</span>(i = 0; i < <a class="code" href="a00153.html#gf5fe83be78b78b9e7d9e7f1e34ab1cc5">UIP_CONNS</a>; ++i) { 144 <a class="code" href="a00146.html#g1024f8a5fa65e82bf848b2e6590d9628">uip_periodic</a>(i); 145 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 146 devicedriver_send(); 147 } 148 } 149</pre></div><p> 150<dl compact><dt><b>Note:</b></dt><dd>If you are writing a uIP device driver that needs ARP (Address Resolution Protocol), e.g., when running uIP over Ethernet, you will need to call the <a class="el" href="a00152.html#g54b27e45df15e10a0eb1a3e3a91417d2">uip_arp_out()</a> function before calling the device driver: <div class="fragment"><pre class="fragment"> <span class="keywordflow">for</span>(i = 0; i < UIP_CONNS; ++i) { 151 <a class="code" href="a00146.html#g1024f8a5fa65e82bf848b2e6590d9628">uip_periodic</a>(i); 152 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 153 <a class="code" href="a00152.html#g54b27e45df15e10a0eb1a3e3a91417d2">uip_arp_out</a>(); 154 ethernet_devicedriver_send(); 155 } 156 } 157</pre></div></dd></dl> 158<dl compact><dt><b>Parameters:</b></dt><dd> 159 <table border="0" cellspacing="2" cellpadding="0"> 160 <tr><td valign="top"></td><td valign="top"><em>conn</em> </td><td>The number of the connection which is to be periodically polled. </td></tr> 161 </table> 162</dl> 163<dl compact><dt><b>Examples: </b></dt><dd> 164<a class="el" href="a00042.html#a80">example-mainloop-with-arp.c</a>, and <a class="el" href="a00043.html#a97">example-mainloop-without-arp.c</a>.</dl> 165<p> 166Definition at line <a class="el" href="a00202.html#l00301">301</a> of file <a class="el" href="a00202.html">uip.h</a>. </td> 167 </tr> 168</table> 169<a class="anchor" name="gbaf0bb2b6a4424b4eb69e45e457c2583"></a><!-- doxytag: member="uip.h::uip_periodic_conn" ref="gbaf0bb2b6a4424b4eb69e45e457c2583" args="(conn)" --><p> 170<table class="mdTable" cellpadding="2" cellspacing="0"> 171 <tr> 172 <td class="mdRow"> 173 <table cellpadding="0" cellspacing="0" border="0"> 174 <tr> 175 <td class="md" nowrap valign="top">#define uip_periodic_conn </td> 176 <td class="md" valign="top">( </td> 177 <td class="md" nowrap valign="top">conn </td> 178 <td class="mdname1" valign="top" nowrap> </td> 179 <td class="md" valign="top"> ) </td> 180 <td class="md" nowrap></td> 181 </tr> 182 </table> 183 </td> 184 </tr> 185</table> 186<table cellspacing="5" cellpadding="0" border="0"> 187 <tr> 188 <td> 189 190 </td> 191 <td> 192 193<p> 194Perform periodic processing for a connection identified by a pointer to its structure. 195<p> 196Same as <a class="el" href="a00146.html#g1024f8a5fa65e82bf848b2e6590d9628">uip_periodic()</a> but takes a pointer to the actual <a class="el" href="a00088.html">uip_conn</a> struct instead of an integer as its argument. This function can be used to force periodic processing of a specific connection.<p> 197<dl compact><dt><b>Parameters:</b></dt><dd> 198 <table border="0" cellspacing="2" cellpadding="0"> 199 <tr><td valign="top"></td><td valign="top"><em>conn</em> </td><td>A pointer to the <a class="el" href="a00088.html">uip_conn</a> struct for the connection to be processed. </td></tr> 200 </table> 201</dl> 202 203<p> 204Definition at line <a class="el" href="a00202.html#l00323">323</a> of file <a class="el" href="a00202.html">uip.h</a>. </td> 205 </tr> 206</table> 207<a class="anchor" name="gf20aaf4292cb0d2a1b10bc0a568b51fa"></a><!-- doxytag: member="uip.h::uip_poll_conn" ref="gf20aaf4292cb0d2a1b10bc0a568b51fa" args="(conn)" --><p> 208<table class="mdTable" cellpadding="2" cellspacing="0"> 209 <tr> 210 <td class="mdRow"> 211 <table cellpadding="0" cellspacing="0" border="0"> 212 <tr> 213 <td class="md" nowrap valign="top">#define uip_poll_conn </td> 214 <td class="md" valign="top">( </td> 215 <td class="md" nowrap valign="top">conn </td> 216 <td class="mdname1" valign="top" nowrap> </td> 217 <td class="md" valign="top"> ) </td> 218 <td class="md" nowrap></td> 219 </tr> 220 </table> 221 </td> 222 </tr> 223</table> 224<table cellspacing="5" cellpadding="0" border="0"> 225 <tr> 226 <td> 227 228 </td> 229 <td> 230 231<p> 232Reuqest that a particular connection should be polled. 233<p> 234Similar to <a class="el" href="a00146.html#gbaf0bb2b6a4424b4eb69e45e457c2583">uip_periodic_conn()</a> but does not perform any timer processing. The application is polled for new data.<p> 235<dl compact><dt><b>Parameters:</b></dt><dd> 236 <table border="0" cellspacing="2" cellpadding="0"> 237 <tr><td valign="top"></td><td valign="top"><em>conn</em> </td><td>A pointer to the <a class="el" href="a00088.html">uip_conn</a> struct for the connection to be processed. </td></tr> 238 </table> 239</dl> 240 241<p> 242Definition at line <a class="el" href="a00202.html#l00337">337</a> of file <a class="el" href="a00202.html">uip.h</a>. </td> 243 </tr> 244</table> 245<a class="anchor" name="g2c64c8c36bc84f9336f6a2184ea51883"></a><!-- doxytag: member="uip.h::uip_udp_periodic" ref="g2c64c8c36bc84f9336f6a2184ea51883" args="(conn)" --><p> 246<table class="mdTable" cellpadding="2" cellspacing="0"> 247 <tr> 248 <td class="mdRow"> 249 <table cellpadding="0" cellspacing="0" border="0"> 250 <tr> 251 <td class="md" nowrap valign="top">#define uip_udp_periodic </td> 252 <td class="md" valign="top">( </td> 253 <td class="md" nowrap valign="top">conn </td> 254 <td class="mdname1" valign="top" nowrap> </td> 255 <td class="md" valign="top"> ) </td> 256 <td class="md" nowrap></td> 257 </tr> 258 </table> 259 </td> 260 </tr> 261</table> 262<table cellspacing="5" cellpadding="0" border="0"> 263 <tr> 264 <td> 265 266 </td> 267 <td> 268 269<p> 270Periodic processing for a UDP connection identified by its number. 271<p> 272This function is essentially the same as <a class="el" href="a00146.html#g1024f8a5fa65e82bf848b2e6590d9628">uip_periodic()</a>, but for UDP connections. It is called in a similar fashion as the <a class="el" href="a00146.html#g1024f8a5fa65e82bf848b2e6590d9628">uip_periodic()</a> function: <div class="fragment"><pre class="fragment"> <span class="keywordflow">for</span>(i = 0; i < <a class="code" href="a00153.html#g196379ceb1219a99f4495e41ccc9bbfb">UIP_UDP_CONNS</a>; i++) { 273 <a class="code" href="a00146.html#g2c64c8c36bc84f9336f6a2184ea51883">uip_udp_periodic</a>(i); 274 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 275 devicedriver_send(); 276 } 277 } 278</pre></div><p> 279<dl compact><dt><b>Note:</b></dt><dd>As for the <a class="el" href="a00146.html#g1024f8a5fa65e82bf848b2e6590d9628">uip_periodic()</a> function, special care has to be taken when using uIP together with ARP and Ethernet: <div class="fragment"><pre class="fragment"> <span class="keywordflow">for</span>(i = 0; i < UIP_UDP_CONNS; i++) { 280 <a class="code" href="a00146.html#g2c64c8c36bc84f9336f6a2184ea51883">uip_udp_periodic</a>(i); 281 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> > 0) { 282 <a class="code" href="a00152.html#g54b27e45df15e10a0eb1a3e3a91417d2">uip_arp_out</a>(); 283 ethernet_devicedriver_send(); 284 } 285 } 286</pre></div></dd></dl> 287<dl compact><dt><b>Parameters:</b></dt><dd> 288 <table border="0" cellspacing="2" cellpadding="0"> 289 <tr><td valign="top"></td><td valign="top"><em>conn</em> </td><td>The number of the UDP connection to be processed. </td></tr> 290 </table> 291</dl> 292<dl compact><dt><b>Examples: </b></dt><dd> 293<a class="el" href="a00042.html#a82">example-mainloop-with-arp.c</a>, and <a class="el" href="a00043.html#a99">example-mainloop-without-arp.c</a>.</dl> 294<p> 295Definition at line <a class="el" href="a00202.html#l00373">373</a> of file <a class="el" href="a00202.html">uip.h</a>. </td> 296 </tr> 297</table> 298<a class="anchor" name="gf5c2ad5acf3cc23b8262e9ba6a15136b"></a><!-- doxytag: member="uip.h::uip_udp_periodic_conn" ref="gf5c2ad5acf3cc23b8262e9ba6a15136b" args="(conn)" --><p> 299<table class="mdTable" cellpadding="2" cellspacing="0"> 300 <tr> 301 <td class="mdRow"> 302 <table cellpadding="0" cellspacing="0" border="0"> 303 <tr> 304 <td class="md" nowrap valign="top">#define uip_udp_periodic_conn </td> 305 <td class="md" valign="top">( </td> 306 <td class="md" nowrap valign="top">conn </td> 307 <td class="mdname1" valign="top" nowrap> </td> 308 <td class="md" valign="top"> ) </td> 309 <td class="md" nowrap></td> 310 </tr> 311 </table> 312 </td> 313 </tr> 314</table> 315<table cellspacing="5" cellpadding="0" border="0"> 316 <tr> 317 <td> 318 319 </td> 320 <td> 321 322<p> 323Periodic processing for a UDP connection identified by a pointer to its structure. 324<p> 325Same as <a class="el" href="a00146.html#g2c64c8c36bc84f9336f6a2184ea51883">uip_udp_periodic()</a> but takes a pointer to the actual <a class="el" href="a00088.html">uip_conn</a> struct instead of an integer as its argument. This function can be used to force periodic processing of a specific connection.<p> 326<dl compact><dt><b>Parameters:</b></dt><dd> 327 <table border="0" cellspacing="2" cellpadding="0"> 328 <tr><td valign="top"></td><td valign="top"><em>conn</em> </td><td>A pointer to the <a class="el" href="a00095.html">uip_udp_conn</a> struct for the connection to be processed. </td></tr> 329 </table> 330</dl> 331 332<p> 333Definition at line <a class="el" href="a00202.html#l00390">390</a> of file <a class="el" href="a00202.html">uip.h</a>. </td> 334 </tr> 335</table> 336<hr><h2>Variable Documentation</h2> 337<a class="anchor" name="gb81e78f890dbbee50c533a9734b74fd9"></a><!-- doxytag: member="uip.h::uip_buf" ref="gb81e78f890dbbee50c533a9734b74fd9" args="[UIP_BUFSIZE+2]" --><p> 338<table class="mdTable" cellpadding="2" cellspacing="0"> 339 <tr> 340 <td class="mdRow"> 341 <table cellpadding="0" cellspacing="0" border="0"> 342 <tr> 343 <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> <a class="el" href="a00150.html#gb81e78f890dbbee50c533a9734b74fd9">uip_buf</a>[UIP_BUFSIZE+2] </td> 344 </tr> 345 </table> 346 </td> 347 </tr> 348</table> 349<table cellspacing="5" cellpadding="0" border="0"> 350 <tr> 351 <td> 352 353 </td> 354 <td> 355 356<p> 357The uIP packet buffer. 358<p> 359The uip_buf array is used to hold incoming and outgoing packets. The device driver should place incoming data into this buffer. When sending data, the device driver should read the link level headers and the TCP/IP headers from this buffer. The size of the link level headers is configured by the UIP_LLH_LEN define.<p> 360<dl compact><dt><b>Note:</b></dt><dd>The application data need not be placed in this buffer, so the device driver must read it from the place pointed to by the uip_appdata pointer as illustrated by the following example: <div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> 361 devicedriver_send(<span class="keywordtype">void</span>) 362 { 363 hwsend(&<a class="code" href="a00146.html#gb81e78f890dbbee50c533a9734b74fd9">uip_buf</a>[0], <a class="code" href="a00153.html#ge6f4a2453dbd8bc60e6a82774552366a">UIP_LLH_LEN</a>); 364 <span class="keywordflow">if</span>(<a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> <= <a class="code" href="a00153.html#ge6f4a2453dbd8bc60e6a82774552366a">UIP_LLH_LEN</a> + <a class="code" href="a00150.html#gee37386b2ab828787c05227eb109def7">UIP_TCPIP_HLEN</a>) { 365 hwsend(&<a class="code" href="a00146.html#gb81e78f890dbbee50c533a9734b74fd9">uip_buf</a>[<a class="code" href="a00153.html#ge6f4a2453dbd8bc60e6a82774552366a">UIP_LLH_LEN</a>], <a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> - UIP_LLH_LEN); 366 } <span class="keywordflow">else</span> { 367 hwsend(&<a class="code" href="a00146.html#gb81e78f890dbbee50c533a9734b74fd9">uip_buf</a>[<a class="code" href="a00153.html#ge6f4a2453dbd8bc60e6a82774552366a">UIP_LLH_LEN</a>], <a class="code" href="a00150.html#gee37386b2ab828787c05227eb109def7">UIP_TCPIP_HLEN</a>); 368 hwsend(<a class="code" href="a00150.html#g561b8eda32e059d4e7397f776268cc63">uip_appdata</a>, <a class="code" href="a00149.html#g12a33f0c09711167bdf3dd7d7cf8c5a1">uip_len</a> - <a class="code" href="a00150.html#gee37386b2ab828787c05227eb109def7">UIP_TCPIP_HLEN</a> - <a class="code" href="a00153.html#ge6f4a2453dbd8bc60e6a82774552366a">UIP_LLH_LEN</a>); 369 } 370 } 371</pre></div> </dd></dl> 372 373<p> 374Definition at line <a class="el" href="a00201.html#l00139">139</a> of file <a class="el" href="a00201.html">uip.c</a>. 375<p> 376Referenced by <a class="el" href="a00201.html#l00682">uip_process()</a>. </td> 377 </tr> 378</table> 379<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by 380<a href="http://www.doxygen.org/index.html"> 381<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address> 382</body> 383</html> 384