Rewrite from scratch a TCP/IP stack for mbed. So far the following parts are usable: Drivers: - EMAC driver (from CMSIS 2.0) Protocols: - Ethernet protocol - ARP over ethernet for IPv4 - IPv4 over Ethernet - ICMPv4 over IPv4 - UDPv4 over IPv4 APIs: - Sockets for UDPv4 The structure of this stack is designed to be very modular. Each protocol can register one or more protocol to handle its payload, and in each protocol, an API can be hooked (like Sockets for example). This is an early release.
ARP.h
00001 /*$Id: 00002 * ARP.h 29 2011-06-11 14:53:08Z benoit $ $AUTHOR: BENOIT $ $Date: 2011-06-11 00003 * 16:53:08 +0200 (sam., 11 juin 2011) $ $Rev: 29 $ 00004 */ 00005 #ifndef __ARP_H__ 00006 #define __ARP_H__ 00007 00008 #include "IPv4.h" 00009 #include "Ethernet.h" 00010 00011 #define ARP_HW_TYPE_ENET 0x0001 00012 00013 #define ARP_OPERATION_REQUEST 0x0001 00014 #define ARP_OPERATION_REPLY 0x0002 00015 00016 typedef uint16_t ARP_Type_t; 00017 typedef uint16_t ARP_Protocol_t; 00018 typedef uint16_t ARP_Operation_t; 00019 00020 #pragma push 00021 #pragma pack(1) 00022 struct ARP_Header 00023 { 00024 ARP_Type_t type; 00025 ARP_Protocol_t protocol; 00026 uint8_t hardAddrLen; 00027 uint8_t protoAddrLen; 00028 ARP_Operation_t operation; 00029 }; 00030 #pragma pop 00031 typedef struct ARP_Header ARP_Header_t; 00032 00033 #pragma push 00034 #pragma pack(1) 00035 struct ARP_IPv4Data 00036 { 00037 Ethernet_Addr_t hwSource; 00038 IPv4_Addr_t ipSource; 00039 Ethernet_Addr_t hwDest; 00040 IPv4_Addr_t ipDest; 00041 }; 00042 #pragma pop 00043 typedef struct ARP_IPv4Data ARP_IPv4Data_t; 00044 00045 extern Protocol_Handler_t arp; 00046 00047 int32_t ARP_ResolveIPv4Address(NetIF_t *netIF, IPv4_Addr_t address, Ethernet_Addr_t *ethernetAddr); 00048 int32_t ARP_AddStaticEntry(NetIF_t *netIF, IPv4_Addr_t address, const Ethernet_Addr_t *ethernetAddr); 00049 int32_t ARP_RemoveEntry(const NetIF_t *netIF, IPv4_Addr_t address); 00050 void ARP_FlushCache(Bool_t flushStaticEntries); 00051 void ARP_Timer(void); 00052 void ARP_DisplayCache(void); 00053 void ARP_DumpHeader(const char *prefix, ARP_Header_t *arpHeader); 00054 #endif /* __ARP_H__ */
Generated on Wed Jul 13 2022 06:09:33 by 1.7.2