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.
Diff: NetIF.h
- Revision:
- 5:3cd83fcb1467
- Parent:
- 2:3d1c0fbd10e6
--- a/NetIF.h Sun Jun 12 20:24:23 2011 +0000 +++ b/NetIF.h Mon Jun 13 13:13:59 2011 +0000 @@ -10,8 +10,8 @@ * */ -#ifndef __NETIF_H__ -#define __NETIF_H__ +#ifndef __NETIF_H__ +#define __NETIF_H__ #include "mbedNet.h" @@ -30,7 +30,6 @@ typedef uint8_t *(*enet_drv_get_tx_buffer_t)(void); - enum Protocol_ID { Protocol_ID_Ethernet = 0, @@ -44,7 +43,7 @@ typedef enum Protocol_ID Protocol_ID_t; -struct Packet +struct NetPacket { int8_t depth; uint8_t *headerPtrTable[NET_ENCAPSULATION_MAX_DEPTH]; @@ -53,7 +52,7 @@ uint8_t *data; int32_t length; }; -typedef struct Packet Packet_t; +typedef struct NetPacket NetPacket_t; enum API_ID @@ -68,13 +67,13 @@ { API_ID_t apiID; void (*InitAPI)(void); - int32_t (*Hook)(NetIF_t *netIF, Protocol_ID_t protocolID, Packet_t *packet); + int32_t (*Hook)(NetIF_t *netIF, Protocol_ID_t protocolID, NetPacket_t *packet); }; typedef struct Net_API Net_API_t; typedef int32_t (*Protocol_RegisterFunction_t)(Protocol_Handler_t *); -typedef void (*Protocol_HandlerFunction_t)(NetIF_t *, Packet_t *); +typedef void (*Protocol_HandlerFunction_t)(NetIF_t *, NetPacket_t *); typedef void (*Protocol_InitFunction_t)(void); typedef int32_t (*API_RegisterFunction_t)(Net_API_t *); typedef void (*PeriodicFunction_t)(void); @@ -141,7 +140,7 @@ int32_t NetIF_SendIPv4Packet(IPv4_Header_t *ipv4Header); int32_t NetIF_Up(NetIF_t *netIF); int32_t NetIF_Down(NetIF_t *netIF); -void NetIF_ProtoPop(Packet_t *packet); -void NetIF_ProtoPush(Packet_t *packet, int32_t headerSize, Protocol_ID_t protocol); +void NetIF_ProtoPop(NetPacket_t *packet); +void NetIF_ProtoPush(NetPacket_t *packet, int32_t headerSize, Protocol_ID_t protocol); #endif /* __NETIF_H__ */