ARP handler

ARP.fth handles ARP packets for Ethernet and DHCP.

$E1 equ ETHER_PORT      \ -- n
Port identifiers for Ethernet devices are in the range $E1..EF

create EtherBCastAddress        \ -- addr
Holds the Ethernet broadcast address FF-FF-FF-FF-FF-FF.

create EtherUnkAddress  \ --
Holds the Ethernet "unknown" address, all zeros.

: TurnEtherPacketRound  \ *eth_hdr --
Return the packet to the sender.

: HandleArpRequest      \ *pb ad *eth *arp --
Returns reply to an incoming ARP request.

: AddEtherRoute \ *etheraddr ipaddr --
Add an Ethernet route given a pointer to a 6 byte Ethernet address and an IP address.

: HandleArpReply        \ *pb *arp --
Handle an incoming ARP reply - so extract info.

: ArpForMe?     \ *arp -- flag ; nz=for me
Given the address of an incoming ARP payload, return true if the packet should be handled.

: EtherArpPacket        { *pb | ad ln *eth *arp -- }
Process an incoming ARP packet. The pbuf holds the received Ethernet packet. We use the incoming packet buffer for the reply.

create ProtoArpHdr      \ -- addr
Prototype ARP request header.

: SendArpRequest        \ ipaddr --
Formats and sends out an ARP request packet. This is always a broadcast.

: SendGratuitousArp     \ --
Send a "Gratuitous ARP Request".