42 unsigned short oddbyte;
43 unsigned short answer;
45 if (!ptr)
return (
int)htons(0xffff);
57 *((
unsigned char *) &oddbyte) = *(
unsigned char *) ptr;
61 sum = (sum >> 16) + (sum & 0xffff);
63 answer = (
unsigned short) ~sum;
92 std::setw(45) << addr <<
" " << type <<
93 " " << std::setw(15) << pkt_str <<
" " << rtt <<
94 "ms " << hops <<
" hops");
virtual void Close()
Shutdown pinger helper and control channel.
int CheckSum(unsigned short *ptr, int size)
Calculate a packet checksum.
void Log(const Ip::Address &addr, const uint8_t type, const char *pkt_str, const int rtt, const int hops)
Log the packet.
#define debugs(SECTION, LEVEL, CONTENT)
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
int xclose(int fd)
POSIX close(2) equivalent.