/*
- * $Id: ICMP.h,v 1.1 2007/12/14 23:11:45 amosjeffries Exp $
- *
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels, Amos Jeffries
*
#ifndef _INCLUDE_ICMP_H
#define _INCLUDE_ICMP_H
-#include "config.h"
-#include "IPAddress.h"
+#include "ip/Address.h"
#define PINGER_PAYLOAD_SZ 8192
#define MAX_PAYLOAD 256 // WAS: SQUIDHOSTNAMELEN
#define MAX_PKT4_SZ (MAX_PAYLOAD + sizeof(struct timeval) + sizeof (char) + sizeof(struct icmphdr) + 1)
-#if USE_IPV6
#define MAX_PKT6_SZ (MAX_PAYLOAD + sizeof(struct timeval) + sizeof (char) + sizeof(struct icmp6_hdr) + 1)
-#endif
#if USE_ICMP
/* This is a line-data format struct. DO NOT alter. */
-struct pingerEchoData
-{
- IPAddress to;
+struct pingerEchoData {
+ Ip::Address to;
unsigned char opcode;
int psize;
char payload[PINGER_PAYLOAD_SZ];
};
/* This is a line-data format struct. DO NOT alter. */
-struct pingerReplyData
-{
- IPAddress from;
+struct pingerReplyData {
+ Ip::Address from;
unsigned char opcode;
int rtt;
int hops;
char payload[PINGER_PAYLOAD_SZ];
};
-struct icmpEchoData
-{
+struct icmpEchoData {
struct timeval tv;
unsigned char opcode;
char payload[MAX_PAYLOAD];
#endif /* USE_ICMP */
-
/**
* Implements the squid interface to access ICMP operations
*
* Content longer than MAX_PAYLOAD will be truncated.
\param len Length of the payload in bytes if any is to be sent or 0.
*/
- virtual void SendEcho(IPAddress &to, int opcode, const char *payload=NULL, int len=0) =0;
+ virtual void SendEcho(Ip::Address &to, int opcode, const char *payload=NULL, int len=0) =0;
/// Handle ICMP responses.
virtual void Recv(void) =0;
/**
* Translate TTL to a hop distance
- *
+ *
\param ttl negative : n > 33
\param ttl n(0...32) : 32 >= n >= 1
\param ttl n(33...62) : 32 >= n >= 1
int ipHops(int ttl);
/// Log the packet.
- void Log(const IPAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops);
+ void Log(const Ip::Address &addr, const uint8_t type, const char* pkt_str, const int rtt, const int hops);
/* no use wasting memory */
int icmp_sock;