
/* Typy ICMP paketu */
#ifndef ICMP_ECHOREPLY
#define ICMP_ECHOREPLY 0
#endif

#ifndef ICMP_ECHO
#define ICMP_ECHO 8
#endif

#ifndef ICMP_TIME_EXCEEDED
#define ICMP_TIME_EXCEEDED 11
#endif

#ifndef ICMP_DEST_UNREACH
#define ICMP_DEST_UNREACH 3
#endif

/* Podtypy ICMP paketu: */
#ifndef ICMP_EXC_TTL
#define ICMP_EXC_TTL 0
#endif

#ifndef ICMP_PORT_UNREACH
#define ICMP_PORT_UNREACH 3
#endif

using namespace std;

struct icmphdr
{
  unsigned char type;
  unsigned char code;
  unsigned short int checksum;
  union
  {
	struct
	{
	  unsigned short int id;
	  unsigned short int sequence;
	} echo;
 } un;
};

typedef struct iphdr
{
	unsigned int ihl : 4;
	unsigned int version : 4;
	unsigned char tos;
	unsigned short int tot_len;
	unsigned short int id;
	unsigned short int frag_off;
	unsigned char ttl;
	unsigned char protocol;
	unsigned short int check;
	unsigned long int saddr;
	unsigned long int daddr;
} iph;

typedef struct paket
{
	char data[1500];
	int len;
} paket;

typedef struct myUDP	// muj vlastni protokol postaveny na UDP
{
  unsigned char operation;
  unsigned char flags;
  unsigned short int id;
} myUDP;

typedef struct send_packet    // struktura pro odeslani paketu
{
	char data[1500];
	unsigned char operation;
	unsigned char flags;
	unsigned short int id;
	int len;
} send_packet;
