BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
cc0f06d
Branches
Tags
master
mips_sys
fw
arp.h
implementation of ethernet and ARP (not completely working yet, hangs on received ARP request)
Stefan Schuermans
commited
cc0f06d
at 2012-03-17 01:03:19
arp.h
Blame
History
Raw
#ifndef ARP_H #define ARP_H #include "ethernet.h" /// header of an 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)); /// an ARP packet struct arp_packet { struct ethernet_header eth_hdr; struct arp_header arp_hdr; } __attribute__((packed)); /// initialize extern void arp_init(void); /// tick procedure - call every 200ms extern void arp_tick200(void); /** * @brief process a received ARP packet * @param[in] ptr pointer to data of packet * @param[in] sz size of packet */ extern 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 */ extern int arp_lookup(unsigned char ip[4], unsigned char mac[6]); #endif // #ifdef ARP_H