BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
c2b0401
Branches
Tags
master
mips_sys
fw
ip.h
added file headers
Stefan Schuermans
commited
c2b0401
at 2012-04-08 11:54:40
ip.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 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