BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
3b2902e
Branches
Tags
master
mips_sys
fw
arp.h
use implicit MAC/IP information in received IP packets
Stefan Schuermans
commited
3b2902e
at 2012-03-24 23:11:26
arp.h
Blame
History
Raw
#ifndef ARP_H #define ARP_H #include "ethernet.h" /// header of ARP packet struct arp_header { unsigned short hw_type; unsigned short proto_type; unsigned char hw_len; unsigned char proto_len; unsigned short op; unsigned char src_mac[6]; unsigned char src_ip[4]; unsigned char dest_mac[6]; unsigned char dest_ip[4]; } __attribute__((packed)); /// ARP packet struct arp_packet { struct ethernet_header eth_hdr; struct arp_header arp_hdr; } __attribute__((packed)); /// initialize void arp_init(void); /// tick procedure - call every 200ms void arp_tick200(void); /** * @brief process a received ARP packet * @param[in] ptr pointer to data of packet * @param[in] sz size of packet */ void arp_recv(void *ptr, unsigned int sz); /** * @brief look up the MAC for an IP address * @param[in] ip IP address to look up * @param[out] mac MAC address for this IP address * @return 0 in case of success, 1 if the MAC address is unknown */ int arp_lookup(unsigned char ip[4], unsigned char mac[6]); /** * @brief store the MAC for an IP address * @param[in] ip IP address to store MAC for * @param[out] mac MAC address for this IP address */ void arp_store(unsigned char ip[4], unsigned char mac[6]); #endif // #ifdef ARP_H