12Oct2012MbedLab
Fork of EthernetNetIf by
Diff: LPC2368/lwip/include/netif/etharp.h
- Revision:
- 5:bc7df6da7589
- Parent:
- 0:422060928e37
- Child:
- 6:22ce63eddd2b
diff -r 9cec8b1dcf09 -r bc7df6da7589 LPC2368/lwip/include/netif/etharp.h --- a/LPC2368/lwip/include/netif/etharp.h Fri Jul 09 14:34:26 2010 +0000 +++ b/LPC2368/lwip/include/netif/etharp.h Thu Aug 05 15:09:22 2010 +0000 @@ -68,7 +68,7 @@ # include "arch/bpstruct.h" #endif PACK_STRUCT_BEGIN -/** Ethernet header */ +/* Ethernet header */ struct eth_hdr { #if ETH_PAD_SIZE PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]); @@ -90,7 +90,7 @@ # include "arch/bpstruct.h" #endif PACK_STRUCT_BEGIN -/** VLAN header inserted between ethernet header and payload +/* VLAN header inserted between ethernet header and payload * if 'type' in ethernet header is ETHTYPE_VLAN. * See IEEE802.Q */ struct eth_vlan_hdr { @@ -111,11 +111,12 @@ # include "arch/bpstruct.h" #endif PACK_STRUCT_BEGIN -/** the ARP message, see RFC 826 ("Packet format") */ +/* the ARP message, see RFC 826 ("Packet format") */ struct etharp_hdr { PACK_STRUCT_FIELD(u16_t hwtype); PACK_STRUCT_FIELD(u16_t proto); - PACK_STRUCT_FIELD(u16_t _hwlen_protolen); + PACK_STRUCT_FIELD(u8_t hwlen); + PACK_STRUCT_FIELD(u8_t protolen); PACK_STRUCT_FIELD(u16_t opcode); PACK_STRUCT_FIELD(struct eth_addr shwaddr); PACK_STRUCT_FIELD(struct ip_addr2 sipaddr); @@ -130,7 +131,7 @@ #define SIZEOF_ETHARP_HDR 28 #define SIZEOF_ETHARP_PACKET (SIZEOF_ETH_HDR + SIZEOF_ETHARP_HDR) -/** 5 seconds period */ +/* 5 seconds period */ #define ARP_TMR_INTERVAL 5000 #define ETHTYPE_ARP 0x0806 @@ -139,14 +140,36 @@ #define ETHTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */ #define ETHTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */ +/* MEMCPY-like macro to copy to/from struct eth_addr's that are local variables + * or known to be 32-bit aligned within the protocol header. */ +#ifndef ETHADDR32_COPY +#define ETHADDR32_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN) +#endif + +/* MEMCPY-like macro to copy to/from struct eth_addr's that are no local + * variables and known to be 16-bit aligned within the protocol header. */ +#ifndef ETHADDR16_COPY +#define ETHADDR16_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN) +#endif + #if LWIP_ARP /* don't build if not configured for use in lwipopts.h */ -/** ARP message types (opcodes) */ +/* ARP message types (opcodes) */ #define ARP_REQUEST 1 #define ARP_REPLY 2 +/* Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type) + * to a filter function that returns the correct netif when using multiple + * netifs on one hardware interface where the netif's low-level receive + * routine cannot decide for the correct netif (e.g. when mapping multiple + * IP addresses to one hardware interface). + */ +#ifndef LWIP_ARP_FILTER_NETIF +#define LWIP_ARP_FILTER_NETIF 0 +#endif + #if ARP_QUEUEING -/** struct for queueing outgoing packets for unknown address +/* struct for queueing outgoing packets for unknown address * defined here to be accessed by memp.h */ struct etharp_q_entry { @@ -162,12 +185,17 @@ err_t etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr); err_t etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q); err_t etharp_request(struct netif *netif, ip_addr_t *ipaddr); -/** For Ethernet network interfaces, we might want to send "gratuitous ARP"; +/* For Ethernet network interfaces, we might want to send "gratuitous ARP"; * this is an ARP packet sent by a node in order to spontaneously cause other * nodes to update an entry in their ARP cache. * From RFC 3220 "IP Mobility Support for IPv4" section 4.6. */ #define etharp_gratuitous(netif) etharp_request((netif), &(netif)->ip_addr) +#if ETHARP_SUPPORT_STATIC_ENTRIES +err_t etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr); +err_t etharp_remove_static_entry(ip_addr_t *ipaddr); +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ + #if LWIP_AUTOIP err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr, const struct eth_addr *ethdst_addr, @@ -176,7 +204,6 @@ const u16_t opcode); #endif /* LWIP_AUTOIP */ - #endif /* LWIP_ARP */ err_t ethernet_input(struct pbuf *p, struct netif *netif);