00001 /*! \file netstack.h \brief Network Stack. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'netstack.h' 00005 // Title : Network Stack 00006 // Author : Pascal Stang 00007 // Created : 6/28/2005 00008 // Revised : 7/3/2005 00009 // Version : 0.1 00010 // Target MCU : Atmel AVR series 00011 // Editor Tabs : 4 00012 // 00013 /// \ingroup network 00014 /// \defgroup netstack Network Stack (netstack.c) 00015 /// \code #include "net/netstack.h" \endcode 00016 /// \par Description 00017 /// This library co-ordinates the various pieces of a typical IP network 00018 /// stack into one unit. Included are handling for ARP, ICMP, and IP 00019 /// packets. UDP and TCP packets are processed and passed to the user. 00020 /// 00021 /// \note This is an example of how to use the various network libraries, and 00022 /// is meant to be useful out-of-the-box for most users. However, some 00023 /// users may find it restrictive and write their own handlers instead. 00024 /// 00025 /// \note This is NOT a full-blown TCP/IP stack. It merely handles lower 00026 /// level stack functions so that UDP and TCP packets can be sent 00027 /// and received easily. End-to-end TCP functionality may be added 00028 /// in a future version. Until then, I can recommend using other embedded 00029 /// TCP/IP stacks like Adam Dunkel's uIP. 00030 // 00031 // This code is distributed under the GNU Public License 00032 // which can be found at http://www.gnu.org/licenses/gpl.txt 00033 //***************************************************************************** 00034 //@{ 00035 00036 #ifndef NETSTACK_H 00037 #define NETSTACK_H 00038 00039 #include "net.h" 00040 #include "arp.h" 00041 #include "icmp.h" 00042 #include "ip.h" 00043 #include "nic.h" 00044 00045 //#define NETSTACK_DEBUG 00046 00047 /// NET_BUFFERSIZE is the common receive/process/transmit buffer 00048 /// Network packets larger than NET_BUFFERSIZE will not be accepted. 00049 #define NET_BUFFERSIZE 500 00050 00051 /// netstackService should be called in the main loop of the user program. 00052 /// The function will process one received network packet per call. 00053 void netstackService(void); 00054 00055 /// netstackIPProcess handles distribution of IP received packets. 00056 /// 00057 void netstackIPProcess(unsigned int len, ip_hdr* packet); 00058 00059 /// Replace this weakly-defined function with a user function that accepts UDP/IP packets. 00060 /// 00061 void netstackUDPIPProcess(unsigned int len, udpip_hdr* packet) __attribute__ ((weak)); 00062 00063 /// Replace this weakly-defined function with a user function that accepts TCP/IP packets. 00064 /// 00065 void netstackTCPIPProcess(unsigned int len, tcpip_hdr* packet) __attribute__ ((weak)); 00066 00067 #endif 00068 //@}