Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | <!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>Procyon AVRlib: net/netstack.h Source File</title> |
||
4 | <link href="dox.css" rel="stylesheet" type="text/css"> |
||
5 | </head><body> |
||
6 | <!-- Generated by Doxygen 1.4.2 --> |
||
7 | <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> |
||
8 | <div class="nav"> |
||
9 | <a class="el" href="dir_000001.html">net</a></div> |
||
10 | <h1>netstack.h</h1><a href="netstack_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file netstack.h \brief Network Stack. */</span> |
||
11 | 00002 <span class="comment">//*****************************************************************************</span> |
||
12 | 00003 <span class="comment">//</span> |
||
13 | 00004 <span class="comment">// File Name : 'netstack.h'</span> |
||
14 | 00005 <span class="comment">// Title : Network Stack</span> |
||
15 | 00006 <span class="comment">// Author : Pascal Stang</span> |
||
16 | 00007 <span class="comment">// Created : 6/28/2005</span> |
||
17 | 00008 <span class="comment">// Revised : 9/20/2005</span> |
||
18 | 00009 <span class="comment">// Version : 0.3</span> |
||
19 | 00010 <span class="comment">// Target MCU : Atmel AVR series</span> |
||
20 | 00011 <span class="comment">// Editor Tabs : 4</span> |
||
21 | 00012 <span class="comment">//</span><span class="comment"></span> |
||
22 | 00013 <span class="comment">/// \ingroup network</span> |
||
23 | 00014 <span class="comment">/// \defgroup netstack Network Stack (netstack.c)</span> |
||
24 | 00015 <span class="comment">/// \code #include "net/netstack.h" \endcode</span> |
||
25 | 00016 <span class="comment">/// \par Description</span> |
||
26 | 00017 <span class="comment">/// This library co-ordinates the various pieces of a typical IP network</span> |
||
27 | 00018 <span class="comment">/// stack into one unit. Included are handling for ARP, ICMP, and IP</span> |
||
28 | 00019 <span class="comment">/// packets. UDP and TCP packets are processed and passed to the user.</span> |
||
29 | 00020 <span class="comment">///</span> |
||
30 | 00021 <span class="comment">/// This is an example of how to use the various network libraries, and</span> |
||
31 | 00022 <span class="comment">/// is meant to be useful out-of-the-box for most users. However, some</span> |
||
32 | 00023 <span class="comment">/// users may find it restrictive and write their own handlers instead.</span> |
||
33 | 00024 <span class="comment">/// This stack implementation is by no means the only way to use the various</span> |
||
34 | 00025 <span class="comment">/// network libraries.</span> |
||
35 | 00026 <span class="comment">///</span> |
||
36 | 00027 <span class="comment">/// \note This is NOT a full-blown TCP/IP stack. It merely handles lower</span> |
||
37 | 00028 <span class="comment">/// level stack functions so that UDP and TCP packets can be sent</span> |
||
38 | 00029 <span class="comment">/// and received easily. End-to-end TCP functionality may be added</span> |
||
39 | 00030 <span class="comment">/// in a future version. Until then, I can recommend using other embedded</span> |
||
40 | 00031 <span class="comment">/// TCP/IP stacks like Adam Dunkel's uIP.</span> |
||
41 | 00032 <span class="comment"></span><span class="comment">//</span> |
||
42 | 00033 <span class="comment">// This code is distributed under the GNU Public License</span> |
||
43 | 00034 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span> |
||
44 | 00035 <span class="comment">//*****************************************************************************</span><span class="comment"></span> |
||
45 | 00036 <span class="comment">//@{</span> |
||
46 | 00037 <span class="comment"></span> |
||
47 | 00038 <span class="preprocessor">#ifndef NETSTACK_H</span> |
||
48 | 00039 <span class="preprocessor"></span><span class="preprocessor">#define NETSTACK_H</span> |
||
49 | 00040 <span class="preprocessor"></span> |
||
50 | 00041 <span class="preprocessor">#include "<a class="code" href="net_8h.html">net.h</a>"</span> |
||
51 | 00042 <span class="preprocessor">#include "<a class="code" href="arp_8h.html">arp.h</a>"</span> |
||
52 | 00043 <span class="preprocessor">#include "<a class="code" href="icmp_8h.html">icmp.h</a>"</span> |
||
53 | 00044 <span class="preprocessor">#include "<a class="code" href="ip_8h.html">ip.h</a>"</span> |
||
54 | 00045 <span class="preprocessor">#include "<a class="code" href="nic_8h.html">nic.h</a>"</span> |
||
55 | 00046 |
||
56 | 00047 <span class="comment">//#define NETSTACK_DEBUG</span> |
||
57 | 00048 <span class="comment"></span> |
||
58 | 00049 <span class="comment">/// NET_BUFFERSIZE is the common receive/process/transmit buffer.</span> |
||
59 | 00050 <span class="comment">/// - You may override the default NET_BUFFERSIZE by defining an alternate value in global.h.</span> |
||
60 | 00051 <span class="comment">/// - Network packets larger than NET_BUFFERSIZE will not be accepted.</span> |
||
61 | 00052 <span class="comment"></span><span class="preprocessor">#ifndef NETSTACK_BUFFERSIZE</span> |
||
62 | <a name="l00053"></a><a class="code" href="group__netstack.html#ga6">00053</a> <span class="preprocessor"></span><span class="preprocessor">#define NETSTACK_BUFFERSIZE (576+ETH_HEADER_LEN)</span> |
||
63 | 00054 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
||
64 | 00055 <span class="preprocessor"></span><span class="comment"></span> |
||
65 | 00056 <span class="comment">/// netstackInit prepares the network interface for use and should be called</span> |
||
66 | 00057 <span class="comment">/// once at the beginning of the user program.</span> |
||
67 | 00058 <span class="comment">/// \note Use ipSetAddress() to change network parameters in mid-run.</span> |
||
68 | 00059 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__netstack.html#ga0">netstackInit</a>(uint32_t ipaddress, uint32_t netmask, uint32_t gatewayip); |
||
69 | 00060 <span class="comment"></span> |
||
70 | 00061 <span class="comment">/// netstackGetBuffer returns a pointer to the common receive/process/transmit buffer.</span> |
||
71 | 00062 <span class="comment"></span>u08* <a class="code" href="group__netstack.html#ga1">netstackGetBuffer</a>(<span class="keywordtype">void</span>); |
||
72 | 00063 <span class="comment"></span> |
||
73 | 00064 <span class="comment">/// netstackService should be called in the main loop of the user program.</span> |
||
74 | 00065 <span class="comment">/// The function will process one received network packet per call.</span> |
||
75 | 00066 <span class="comment">/// The return value is the length of the packet processed, or zero if no</span> |
||
76 | 00067 <span class="comment">/// packet was processed.</span> |
||
77 | 00068 <span class="comment"></span><span class="keywordtype">int</span> <a class="code" href="group__netstack.html#ga2">netstackService</a>(<span class="keywordtype">void</span>); |
||
78 | 00069 <span class="comment"></span> |
||
79 | 00070 <span class="comment">/// netstackIPProcess handles distribution of IP received packets.</span> |
||
80 | 00071 <span class="comment">///</span> |
||
81 | 00072 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__netstack.html#ga3">netstackIPProcess</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len, ip_hdr* packet); |
||
82 | 00073 <span class="comment"></span> |
||
83 | 00074 <span class="comment">/// This weakly-defined function is the default handler for incoming UDP/IP packets.</span> |
||
84 | 00075 <span class="comment">/// Users should define this same function in user code (same name and arguments) to</span> |
||
85 | 00076 <span class="comment">/// override this default handler and get access to the received packets.</span> |
||
86 | 00077 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__netstack.html#ga4">netstackUDPIPProcess</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len, udpip_hdr* packet) __attribute__ ((weak)); |
||
87 | 00078 <span class="comment"></span> |
||
88 | 00079 <span class="comment">/// This weakly-defined function is the default handler for incoming TCP/IP packets.</span> |
||
89 | 00080 <span class="comment">/// Users should define this same function in user code (same name and arguments) to</span> |
||
90 | 00081 <span class="comment">/// override this default handler and get access to the received packets.</span> |
||
91 | 00082 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__netstack.html#ga5">netstackTCPIPProcess</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len, tcpip_hdr* packet) __attribute__ ((weak)); |
||
92 | 00083 |
||
93 | 00084 <span class="preprocessor">#endif</span> |
||
94 | 00085 <span class="preprocessor"></span><span class="comment">//@}</span> |
||
95 | </span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by |
||
96 | <a href="http://www.doxygen.org/index.html"> |
||
97 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address> |
||
98 | </body> |
||
99 | </html> |
Powered by WebSVN v2.8.3