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.

Committer:
Benoit
Date:
Sun Jun 26 09:56:31 2011 +0000
Revision:
7:8e12f7357b9f
Parent:
5:3cd83fcb1467
Added IPv4 global broadcast address to processed frames inside IPv4 layer.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Benoit 5:3cd83fcb1467 1 /*$Id:
Benoit 5:3cd83fcb1467 2 * ARP.h 29 2011-06-11 14:53:08Z benoit $ $AUTHOR: BENOIT $ $Date: 2011-06-11
Benoit 5:3cd83fcb1467 3 * 16:53:08 +0200 (sam., 11 juin 2011) $ $Rev: 29 $
Benoit 0:19f5f51584de 4 */
Benoit 0:19f5f51584de 5 #ifndef __ARP_H__
Benoit 5:3cd83fcb1467 6 #define __ARP_H__
Benoit 0:19f5f51584de 7
Benoit 0:19f5f51584de 8 #include "IPv4.h"
Benoit 0:19f5f51584de 9 #include "Ethernet.h"
Benoit 0:19f5f51584de 10
Benoit 5:3cd83fcb1467 11 #define ARP_HW_TYPE_ENET 0x0001
Benoit 0:19f5f51584de 12
Benoit 5:3cd83fcb1467 13 #define ARP_OPERATION_REQUEST 0x0001
Benoit 5:3cd83fcb1467 14 #define ARP_OPERATION_REPLY 0x0002
Benoit 0:19f5f51584de 15
Benoit 5:3cd83fcb1467 16 typedef uint16_t ARP_Type_t;
Benoit 5:3cd83fcb1467 17 typedef uint16_t ARP_Protocol_t;
Benoit 5:3cd83fcb1467 18 typedef uint16_t ARP_Operation_t;
Benoit 0:19f5f51584de 19
Benoit 0:19f5f51584de 20 #pragma push
Benoit 0:19f5f51584de 21 #pragma pack(1)
Benoit 0:19f5f51584de 22 struct ARP_Header
Benoit 0:19f5f51584de 23 {
Benoit 5:3cd83fcb1467 24 ARP_Type_t type;
Benoit 5:3cd83fcb1467 25 ARP_Protocol_t protocol;
Benoit 5:3cd83fcb1467 26 uint8_t hardAddrLen;
Benoit 5:3cd83fcb1467 27 uint8_t protoAddrLen;
Benoit 5:3cd83fcb1467 28 ARP_Operation_t operation;
Benoit 0:19f5f51584de 29 };
Benoit 0:19f5f51584de 30 #pragma pop
Benoit 5:3cd83fcb1467 31 typedef struct ARP_Header ARP_Header_t;
Benoit 0:19f5f51584de 32
Benoit 0:19f5f51584de 33 #pragma push
Benoit 0:19f5f51584de 34 #pragma pack(1)
Benoit 0:19f5f51584de 35 struct ARP_IPv4Data
Benoit 0:19f5f51584de 36 {
Benoit 5:3cd83fcb1467 37 Ethernet_Addr_t hwSource;
Benoit 5:3cd83fcb1467 38 IPv4_Addr_t ipSource;
Benoit 5:3cd83fcb1467 39 Ethernet_Addr_t hwDest;
Benoit 5:3cd83fcb1467 40 IPv4_Addr_t ipDest;
Benoit 0:19f5f51584de 41 };
Benoit 0:19f5f51584de 42 #pragma pop
Benoit 0:19f5f51584de 43 typedef struct ARP_IPv4Data ARP_IPv4Data_t;
Benoit 0:19f5f51584de 44
Benoit 5:3cd83fcb1467 45 extern Protocol_Handler_t arp;
Benoit 0:19f5f51584de 46
Benoit 5:3cd83fcb1467 47 int32_t ARP_ResolveIPv4Address(NetIF_t *netIF, IPv4_Addr_t address, Ethernet_Addr_t *ethernetAddr);
Benoit 5:3cd83fcb1467 48 int32_t ARP_AddStaticEntry(NetIF_t *netIF, IPv4_Addr_t address, const Ethernet_Addr_t *ethernetAddr);
Benoit 5:3cd83fcb1467 49 int32_t ARP_RemoveEntry(const NetIF_t *netIF, IPv4_Addr_t address);
Benoit 5:3cd83fcb1467 50 void ARP_FlushCache(Bool_t flushStaticEntries);
Benoit 5:3cd83fcb1467 51 void ARP_Timer(void);
Benoit 5:3cd83fcb1467 52 void ARP_DisplayCache(void);
Benoit 5:3cd83fcb1467 53 void ARP_DumpHeader(const char *prefix, ARP_Header_t *arpHeader);
Benoit 0:19f5f51584de 54 #endif /* __ARP_H__ */