/* flaneth - flash and ethernet
   Copyright (C) 2007-2012 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
   a BlinkenArea project - http://www.blinkenarea.org/ */

#ifndef INC_icmp
#define INC_icmp

#include "ethernet.h"
#include "ip.h"

// header of an ICMP packet
struct IcmpHeader {
  unsigned char Type;
  unsigned char Code;
  unsigned int Chk;
};

// an ICMP packet
struct IcmpPacket {
  struct EthernetHeader EthHdr;
  struct IpHeader IpHdr;
  struct IcmpHeader IcmpHdr;
};

// header of an ICMP echo request/reply packet
struct IcmpEchoHeader {
  unsigned int Id;
  unsigned int Seq;
};

// an ICMP echo request/reply packet
struct IcmpEchoPacket {
  struct EthernetHeader EthHdr;
  struct IpHeader IpHdr;
  struct IcmpHeader IcmpHdr;
  struct IcmpEchoHeader EchoHdr;
};

// process a received ICMP packet
extern void IcmpRecv(unsigned char *pData, unsigned short Length);

#endif // #ifdef INC_icmp
