BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
2a4b80d
Branches
Tags
master
mips_sys
fw
ip.h
handle padding to minimum ethernet frame size (TX) in HW
Stefan Schuermans
commited
2a4b80d
at 2012-03-24 16:42:53
ip.h
Blame
History
Raw
#ifndef IP_H #define IP_H #include "ethernet.h" /// header of IP packet struct ip_header { unsigned char ver__hdr_len; unsigned char tos; unsigned short total_len; unsigned short id; unsigned short frag_ofs; unsigned char ttl; unsigned char proto; unsigned short hdr_chk; unsigned char src[4]; unsigned char dest[4]; } __attribute__((packed)); /// IP packet struct ip_packet { struct ethernet_header eth_hdr; struct ip_header ip_hdr; } __attribute__((packed)); /// initialize void ip_init(void); /// tick procedure - call every 200ms void ip_tick200(void); /** * @brief process a received IP packet * @param[in] ptr pointer to data of packet * @param[in] sz size of packet */ void ip_recv(void *ptr, unsigned int sz); /** * @brief send an IP packet * @param[in] ptr pointer to data of packet * @param[in] sz size of packet * * ptr must point to a ip_packet * with ip_hdr.proto and ip_hdr.dest already initialized */ void ip_send(void *ptr, unsigned int sz); /** * @brief a MAC address was discovered * @param[in] ip the IP address the MAC was discovered for * @param[in] mac the MAC address corresponding to the IP address * * called by ARP to notify IP */ void ip_got_mac(unsigned char ip[4], unsigned char mac[6]); #endif // #ifdef IP_H