#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);
/**