Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

/opentcp/include/inet/arp.h

Go to the documentation of this file.
00001 /*
00002  *Copyright (c) 2000-2002 Viola Systems Ltd.
00003  *All rights reserved.
00004  *
00005  *Redistribution and use in source and binary forms, with or without 
00006  *modification, are permitted provided that the following conditions 
00007  *are met:
00008  *
00009  *1. Redistributions of source code must retain the above copyright 
00010  *notice, this list of conditions and the following disclaimer.
00011  *
00012  *2. Redistributions in binary form must reproduce the above copyright 
00013  *notice, this list of conditions and the following disclaimer in the 
00014  *documentation and/or other materials provided with the distribution.
00015  *
00016  *3. The end-user documentation included with the redistribution, if 
00017  *any, must include the following acknowledgment:
00018  *      "This product includes software developed by Viola 
00019  *      Systems (http://www.violasystems.com/)."
00020  *
00021  *Alternately, this acknowledgment may appear in the software itself, 
00022  *if and wherever such third-party acknowledgments normally appear.
00023  *
00024  *4. The names "OpenTCP" and "Viola Systems" must not be used to 
00025  *endorse or promote products derived from this software without prior 
00026  *written permission. For written permission, please contact 
00027  *opentcp@opentcp.org.
00028  *
00029  *5. Products derived from this software may not be called "OpenTCP", 
00030  *nor may "OpenTCP" appear in their name, without prior written 
00031  *permission of the Viola Systems Ltd.
00032  *
00033  *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 
00034  *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
00035  *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
00036  *IN NO EVENT SHALL VIOLA SYSTEMS LTD. OR ITS CONTRIBUTORS BE LIABLE 
00037  *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00038  *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00039  *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
00040  *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
00041  *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00042  *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
00043  *EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00044  *====================================================================
00045  *
00046  *OpenTCP is the unified open source TCP/IP stack available on a series 
00047  *of 8/16-bit microcontrollers, please see <http://www.opentcp.org>.
00048  *
00049  *For more information on how to network-enable your devices, or how to 
00050  *obtain commercial technical support for OpenTCP, please see 
00051  *<http://www.violasystems.com/>.
00052  */
00053 
00063 #ifndef INCLUDE_ARP_H
00064 #define INCLUDE_ARP_H
00065 
00066 #include <inet/datatypes.h>
00067 #include <inet/system.h>
00068 #include <inet/ethernet.h>
00069 #include <inet/ip.h>
00070 
00071 /* User Allowed to modify       */
00072 
00073 
00074 #define MAXHWALEN               6               
00075 #define MAXPRALEN               4               
00091 #define ARP_TSIZE               10      
00092 
00102 #define ARP_TIMEOUT             60
00103 
00117 #define ARP_RESEND              2       
00118 
00126 #define ARP_MAXRETRY    5               
00129 /* System constants, don't modify       */
00130 
00131 #define AR_HARDWARE             0x0001  /* Ethernet hardware type code          */
00132 #define ARP_ETHCODE             0x0806  /* ARP over Ethernet                            */
00133 
00134 #define ARP_REQUEST             1               /* ARP Request to resolve address       */
00135 #define ARP_REPLY               2               /* Reply to resolve request                     */
00136 
00137 #define ARP_MANG_TOUT   1               /* Interval between ARP cache mngmt. */
00138 
00146 struct arp_entry
00147 {
00157         UINT8   state;
00158         
00167         UINT8   type;                           
00168         UINT8   retries;                        
00172         UINT8   ttl;                            
00175         UINT8   hwadr[MAXHWALEN];       
00179         UINT32  pradr;                          
00181 };
00182 
00183 /* Arp Entry States     */
00184 
00185 #define ARP_FREE                0               
00186 #define ARP_RESERVED    1               
00187 #define ARP_PENDING             2               
00188 #define ARP_RESOLVED    3               
00189 #define ARP_REFRESHING  4               
00193 /* Arp Entry Types      */
00194 
00195 #define ARP_FIXED_IP    0               
00196 #define ARP_TEMP_IP             1               
00200 /* ARP Functions        */
00201 void arp_init(void);
00202 struct arp_entry* arpfind(LWORD, struct netif*, UINT8);
00203 INT8 arp_alloc(UINT8);
00204 void arp_send_req(UINT8);
00205 struct arp_entry* arp_find (LWORD , struct netif *, UINT8 );
00206 void arp_manage(void);
00207 BYTE is_subnet(LWORD, struct netif*);
00208 BYTE process_arp(struct ethernet_frame*);
00209 void arp_send_response(void);
00210 void arp_get_response(void);
00211 void arp_send_request(void);
00212 INT8 arp_add(UINT32, UINT8*, UINT8);
00213 
00214 #endif
00215 

Generated on Sun Aug 3 20:32:59 2003 for OpenTCP by doxygen1.2.18