?lang_form?
?lang_select?
?lang_submit?
?lang_endform?
{HEADER END}
{FILE START}
library
?curdirlinks? - Rev 6
?prevdifflink? - Blame - ?getfile?
<!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>Procyon AVRlib: Network Stack (netstack.c)</title>
<link href="dox.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>Network Stack (netstack.c)<br>
<small>
[<a class="el" href="group__network.html">Network Library</a>]</small>
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "<a class="code" href="netstack_8h.html">net/netstack.h</a>"</span>
</pre></div> <dl compact><dt><b>Description</b></dt><dd>This library co-ordinates the various pieces of a typical IP network stack into one unit. Included are handling for ARP, ICMP, and IP packets. UDP and TCP packets are processed and passed to the user.</dd></dl>
This is an example of how to use the various network libraries, and is meant to be useful out-of-the-box for most users. However, some users may find it restrictive and write their own handlers instead. This stack implementation is by no means the only way to use the various network libraries.<p>
<dl compact><dt><b>Note:</b></dt><dd>This is NOT a full-blown TCP/IP stack. It merely handles lower level stack functions so that UDP and TCP packets can be sent and received easily. End-to-end TCP functionality may be added in a future version. Until then, I can recommend using other embedded TCP/IP stacks like Adam Dunkel's uIP. </dd></dl>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__netstack.html#ga6">NETSTACK_BUFFERSIZE</a> (576+ETH_HEADER_LEN)</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__netstack.html#ga0">netstackInit</a> (uint32_t ipaddress, uint32_t netmask, uint32_t gatewayip)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga1" doxytag="netstack::netstackGetBuffer"></a>
u08 * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__netstack.html#ga1">netstackGetBuffer</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">netstackGetBuffer returns a pointer to the common receive/process/transmit buffer. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__netstack.html#ga2">netstackService</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__netstack.html#ga3">netstackIPProcess</a> (unsigned int len, ip_hdr *packet)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__netstack.html#ga4">netstackUDPIPProcess</a> (unsigned int len, udpip_hdr *packet) __attribute__((weak))</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__netstack.html#ga5">netstackTCPIPProcess</a> (unsigned int len, tcpip_hdr *packet) __attribute__((weak))</td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="ga6" doxytag="netstack.h::NETSTACK_BUFFERSIZE"></a><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 NETSTACK_BUFFERSIZE (576+ETH_HEADER_LEN) </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
NET_BUFFERSIZE is the common receive/process/transmit buffer.<ul>
<li>You may override the default NET_BUFFERSIZE by defining an alternate value in <a class="el" href="global_8h.html">global.h</a>.</li><li>Network packets larger than NET_BUFFERSIZE will not be accepted. </li></ul>
<p>
Definition at line <a class="el" href="netstack_8h-source.html#l00053">53</a> of file <a class="el" href="netstack_8h-source.html">netstack.h</a>. </td>
</tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ga0" doxytag="netstack.h::netstackInit"></a><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 netstackInit </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">uint32_t </td>
<td class="mdname" nowrap> <em>ipaddress</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>uint32_t </td>
<td class="mdname" nowrap> <em>netmask</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>uint32_t </td>
<td class="mdname" nowrap> <em>gatewayip</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
netstackInit prepares the network interface for use and should be called once at the beginning of the user program. <dl compact><dt><b>Note:</b></dt><dd>Use ipSetAddress() to change network parameters in mid-run. </dd></dl>
<p>
Definition at line <a class="el" href="netstack_8c-source.html#l00022">22</a> of file <a class="el" href="netstack_8c-source.html">netstack.c</a>. </td>
</tr>
</table>
<a class="anchor" name="ga3" doxytag="netstack.h::netstackIPProcess"></a><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 netstackIPProcess </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">unsigned int </td>
<td class="mdname" nowrap> <em>len</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>ip_hdr * </td>
<td class="mdname" nowrap> <em>packet</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
netstackIPProcess handles distribution of IP received packets.
<p>
Definition at line <a class="el" href="netstack_8c-source.html#l00091">91</a> of file <a class="el" href="netstack_8c-source.html">netstack.c</a>. </td>
</tr>
</table>
<a class="anchor" name="ga2" doxytag="netstack.h::netstackService"></a><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">int netstackService </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </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>
netstackService should be called in the main loop of the user program. The function will process one received network packet per call. The return value is the length of the packet processed, or zero if no packet was processed.
<p>
Definition at line <a class="el" href="netstack_8c-source.html#l00046">46</a> of file <a class="el" href="netstack_8c-source.html">netstack.c</a>. </td>
</tr>
</table>
<a class="anchor" name="ga5" doxytag="netstack.h::netstackTCPIPProcess"></a><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 netstackTCPIPProcess </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">unsigned int </td>
<td class="mdname" nowrap> <em>len</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>tcpip_hdr * </td>
<td class="mdname" nowrap> <em>packet</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
This weakly-defined function is the default handler for incoming TCP/IP packets. Users should define this same function in user code (same name and arguments) to override this default handler and get access to the received packets.
<p>
Definition at line <a class="el" href="netstack_8c-source.html#l00138">138</a> of file <a class="el" href="netstack_8c-source.html">netstack.c</a>. </td>
</tr>
</table>
<a class="anchor" name="ga4" doxytag="netstack.h::netstackUDPIPProcess"></a><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 netstackUDPIPProcess </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">unsigned int </td>
<td class="mdname" nowrap> <em>len</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>udpip_hdr * </td>
<td class="mdname" nowrap> <em>packet</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
This weakly-defined function is the default handler for incoming UDP/IP packets. Users should define this same function in user code (same name and arguments) to override this default handler and get access to the received packets.
<p>
Definition at line <a class="el" href="netstack_8c-source.html#l00131">131</a> of file <a class="el" href="netstack_8c-source.html">netstack.c</a>. </td>
</tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:10 2006 for Procyon AVRlib by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|
{FILE END}
{FOOTER START}
Powered by WebSVN v2.8.3