BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
c2b0401
Branches
Tags
master
mips_sys
fw
arp.h
added file headers
Stefan Schuermans
commited
c2b0401
at 2012-04-08 11:54:40
arp.h
Blame
History
Raw
/* MIPS I system * Copyright 2011-2012 Stefan Schuermans <stefan@schuermans.info> * 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