BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
902aa40
Branches
Tags
master
mips_sys
fw
arp.h
replace email address in headers with blinkenarea address
Stefan Schuermans
commited
902aa40
at 2012-05-21 17:42:50
arp.h
Blame
History
Raw
/* MIPS I system * Copyright 2011-2012 Stefan Schuermans <stefan@blinkenarea.org> * Copyleft GNU public license V2 or later * http://www.gnu.org/copyleft/gpl.html */ #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