38#ifndef ARP_TICK_INTERVAL
39 #define ARP_TICK_INTERVAL 200
40#elif (ARP_TICK_INTERVAL < 10)
41 #error ARP_TICK_INTERVAL parameter is not valid
46 #define ARP_CACHE_SIZE 8
47#elif (ARP_CACHE_SIZE < 1)
48 #error ARP_CACHE_SIZE parameter is not valid
52#ifndef ARP_MAX_PENDING_PACKETS
53 #define ARP_MAX_PENDING_PACKETS 2
54#elif (ARP_MAX_PENDING_PACKETS < 1)
55 #error ARP_MAX_PENDING_PACKETS parameter is not valid
59#ifndef ARP_MAX_REQUESTS
60 #define ARP_MAX_REQUESTS 3
61#elif (ARP_MAX_REQUESTS < 1)
62 #error ARP_MAX_REQUESTS parameter is not valid
66#ifndef ARP_REQUEST_TIMEOUT
67 #define ARP_REQUEST_TIMEOUT 1000
68#elif (ARP_REQUEST_TIMEOUT < 100)
69 #error ARP_REQUEST_TIMEOUT parameter is not valid
74 #define ARP_MAX_PROBES 2
75#elif (ARP_MAX_PROBES < 1)
76 #error ARP_MAX_PROBES parameter is not valid
80#ifndef ARP_PROBE_TIMEOUT
81 #define ARP_PROBE_TIMEOUT 60000
82#elif (ARP_PROBE_TIMEOUT < 1000)
83 #error ARP_PROBE_TIMEOUT parameter is not valid
87#ifndef ARP_REACHABLE_TIME
88 #define ARP_REACHABLE_TIME 60000
89#elif (ARP_REACHABLE_TIME < 1000)
90 #error ARP_REACHABLE_TIME parameter is not valid
94#ifndef ARP_DELAY_FIRST_PROBE_TIME
95 #define ARP_DELAY_FIRST_PROBE_TIME 5000
96#elif (ARP_DELAY_FIRST_PROBE_TIME < 1000)
97 #error ARP_DELAY_FIRST_PROBE_TIME parameter is not valid
101#define ARP_HARDWARE_TYPE_ETH 0x0001
103#define ARP_PROTOCOL_TYPE_IPV4 0x0800
117 ARP_OPCODE_ARP_REQUEST = 1,
118 ARP_OPCODE_ARP_REPLY = 2
129 ARP_STATE_INCOMPLETE = 1,
130 ARP_STATE_REACHABLE = 2,
134 ARP_STATE_PERMANENT = 6
139#if defined(__CWCC__) || defined(_WIN32)
140 #pragma pack(push, 1)
163#if defined(__CWCC__) || defined(_WIN32)
201error_t arpInit(NetInterface *interface);
202error_t arpEnable(NetInterface *interface, bool_t enable);
205 const MacAddr *macAddr);
209error_t arpResolve(NetInterface *interface,
Ipv4Addr ipAddr, MacAddr *macAddr);
212 NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary);
214void arpTick(NetInterface *interface);
216void arpProcessPacket(NetInterface *interface, ArpPacket *arpPacket,
219void arpProcessRequest(NetInterface *interface, ArpPacket *arpRequest);
220void arpProcessReply(NetInterface *interface, ArpPacket *arpReply);
225 const MacAddr *destMacAddr);
228 Ipv4Addr targetIpAddr,
const MacAddr *targetMacAddr);
230void arpDumpPacket(
const ArpPacket *arpPacket);
ArpState
ARP cache entry states.
Definition arp.h:127
typedef __packed_struct
ARP packet.
Definition arp.h:149
ArpOpcode
ARP opcodes.
Definition arp.h:116
error_t
Error codes.
Definition error.h:43
uint32_t Ipv4Addr
IPv4 network address.
Definition ipv4.h:267
uint32_t systime_t
System time.
Definition os_port_none.h:90
ARP cache entry.
Definition arp.h:185
systime_t timestamp
Time stamp to manage entry lifetime.
Definition arp.h:189
Ipv4Addr ipAddr
Unicast IPv4 address.
Definition arp.h:187
MacAddr macAddr
Link layer address associated with the IPv4 address.
Definition arp.h:188
uint_t retransmitCount
Retransmission counter.
Definition arp.h:191
ArpState state
Reachability state.
Definition arp.h:186
systime_t timeout
Timeout value.
Definition arp.h:190
uint_t queueSize
Number of queued packets.
Definition arp.h:193
ARP queue item.
Definition arp.h:173
NetBuffer * buffer
Packet waiting for address resolution.
Definition arp.h:174
NetTxAncillary ancillary
Additional options.
Definition arp.h:176
size_t offset
Offset to the first byte of the packet.
Definition arp.h:175
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89