Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
741236e576 | ||
|
|
9fca2a141b | ||
|
|
9ee22bd46a | ||
|
|
f55397336b | ||
|
|
82722a31fe | ||
|
|
4aad0b2c14 | ||
|
|
fb5f5779cc | ||
|
|
a0252f6e79 | ||
|
|
3dee903b41 | ||
|
|
7e55f0b073 | ||
|
|
8daad08e1d | ||
|
|
b7343ed256 |
@@ -1,3 +1,11 @@
|
||||
2013-10-10 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.6
|
||||
* Fix loop issue after 65536 pings (reported by Peter Folk and GBert, #12)
|
||||
* Minimum ping data size is now 0
|
||||
* Removed setsockopt IPV6_CHECKSUM, which shouldn't be set and breaks
|
||||
compiling on Solaris (reported by Juergen Arndt)
|
||||
* Fix wrong min RTT value with -Q option (reported by Alexander Ivanov, #51)
|
||||
|
||||
2013-05-22 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.5
|
||||
* Fix sprint_tm buffer size crash (reported by Japheth Cleaver)
|
||||
|
||||
@@ -9,7 +9,11 @@ Current maintainer:
|
||||
David Schweikert <david@schweikert.ch>
|
||||
|
||||
Website:
|
||||
http://www.fping.org/
|
||||
http://fping.org/
|
||||
|
||||
Mailing-list:
|
||||
https://groups.google.com/group/fping-users
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
@@ -27,6 +31,7 @@ If you want to install fping from source, proceed as follows:
|
||||
4. Have a look at the fping(8) manual for usage help
|
||||
(fping -h will also give a minimal help output)
|
||||
|
||||
|
||||
IPv6 support
|
||||
------------
|
||||
You can can compile fping with support for IPv6 addresses. A separate binary
|
||||
@@ -38,6 +43,7 @@ is used for that, called fping6. To build it, use ./configure --enable-ipv6
|
||||
# make install
|
||||
# sudo setcap cap_net_raw+ep /usr/local/bin/fping*
|
||||
|
||||
|
||||
Credits
|
||||
-------
|
||||
Original author: Roland Schemers (schemers@stanford.edu)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
dnl Minimum Autoconf version required.
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
AC_INIT([fping],[3.4])
|
||||
AC_INIT([fping],[3.6])
|
||||
|
||||
dnl make ipv4 and ipv6 options
|
||||
AC_ARG_ENABLE([ipv4],
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ endif
|
||||
|
||||
sbin_PROGRAMS = ${prog}
|
||||
|
||||
fping_SOURCES = fping.c options.h
|
||||
fping_SOURCES = fping.c options.h seqmap.h seqmap.c
|
||||
fping_DEPENDENCIES = ../config.h
|
||||
fping6_SOURCES = fping.c options.h
|
||||
fping6_SOURCES = fping.c options.h seqmap.h seqmap.c
|
||||
fping6_DEPENDENCIES = ../config.h
|
||||
fping6_CFLAGS = $(AM_CFLAGS) -DIPV6
|
||||
|
||||
+47
-69
@@ -58,6 +58,7 @@ extern "C"
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "seqmap.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@@ -114,16 +115,7 @@ extern int h_errno;
|
||||
|
||||
/*** Ping packet defines ***/
|
||||
|
||||
/* data added after ICMP header for our nefarious purposes */
|
||||
|
||||
typedef struct ping_data
|
||||
{
|
||||
int ping_count; /* counts up to -c count or 1 */
|
||||
struct timeval ping_ts; /* time sent */
|
||||
|
||||
} PING_DATA;
|
||||
|
||||
#define MIN_PING_DATA sizeof( PING_DATA )
|
||||
#define MIN_PING_DATA 0
|
||||
#define MAX_IP_PACKET 65536 /* (theoretical) max IP packet size */
|
||||
#define SIZE_IP_HDR 20
|
||||
#ifndef IPV6
|
||||
@@ -286,13 +278,12 @@ struct in6_addr src_addr;
|
||||
|
||||
/* global stats */
|
||||
long max_reply = 0;
|
||||
long min_reply = 1000000;
|
||||
long min_reply = 0;
|
||||
int total_replies = 0;
|
||||
double sum_replies = 0;
|
||||
int max_hostname_len = 0;
|
||||
int num_jobs = 0; /* number of hosts still to do */
|
||||
int num_hosts; /* total number of hosts */
|
||||
int max_seq_sent = 0; /* maximum sequence number sent so far */
|
||||
int num_alive = 0, /* total number alive */
|
||||
num_unreachable = 0, /* total number unreachable */
|
||||
num_noaddress = 0; /* total number of addresses not found */
|
||||
@@ -468,15 +459,6 @@ int main( int argc, char **argv )
|
||||
sizeof(opton)))
|
||||
err(1, "setsockopt(IPV6_HOPLIMIT)");
|
||||
#endif
|
||||
#ifdef IPV6_CHECKSUM
|
||||
#ifndef SOL_RAW
|
||||
#define SOL_RAW IPPROTO_IPV6
|
||||
#endif
|
||||
opton = 2;
|
||||
if (setsockopt(s, SOL_RAW, IPV6_CHECKSUM, &opton,
|
||||
sizeof(opton)))
|
||||
err(1, "setsockopt(SOL_RAW,IPV6_CHECKSUM)");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if( ( uid = getuid() ) )
|
||||
@@ -535,7 +517,9 @@ int main( int argc, char **argv )
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
if( !( ping_data_size = ( unsigned int )atoi( optarg ) ) )
|
||||
errno = 0;
|
||||
ping_data_size = (unsigned int) strtol(optarg, (char **)NULL, 10);
|
||||
if( errno )
|
||||
usage(1);
|
||||
|
||||
break;
|
||||
@@ -973,6 +957,8 @@ int main( int argc, char **argv )
|
||||
srandom( start_time.tv_usec );
|
||||
#endif /* DEBUG || _DEBUG */
|
||||
|
||||
seqmap_init();
|
||||
|
||||
/* main loop */
|
||||
main_loop();
|
||||
|
||||
@@ -1531,7 +1517,6 @@ int send_ping( int s, HOST_ENTRY *h )
|
||||
{
|
||||
char *buffer;
|
||||
FPING_ICMPHDR *icp;
|
||||
PING_DATA *pdp;
|
||||
int n;
|
||||
int myseq;
|
||||
|
||||
@@ -1543,8 +1528,7 @@ int send_ping( int s, HOST_ENTRY *h )
|
||||
icp = ( FPING_ICMPHDR* )buffer;
|
||||
|
||||
gettimeofday( &h->last_send_time, &tz );
|
||||
myseq = h->num_sent * num_hosts + h->i;
|
||||
max_seq_sent = myseq > max_seq_sent ? myseq : max_seq_sent;
|
||||
myseq = seqmap_add(h->i, h->num_sent, &h->last_send_time);
|
||||
|
||||
#ifndef IPV6
|
||||
icp->icmp_type = ICMP_ECHO;
|
||||
@@ -1553,10 +1537,6 @@ int send_ping( int s, HOST_ENTRY *h )
|
||||
icp->icmp_seq = htons(myseq);
|
||||
icp->icmp_id = htons(ident);
|
||||
|
||||
pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR );
|
||||
pdp->ping_ts = h->last_send_time;
|
||||
pdp->ping_count = h->num_sent;
|
||||
|
||||
icp->icmp_cksum = in_cksum( ( unsigned short* )icp, ping_pkt_size );
|
||||
#else
|
||||
icp->icmp6_type = ICMP6_ECHO_REQUEST;
|
||||
@@ -1564,10 +1544,6 @@ int send_ping( int s, HOST_ENTRY *h )
|
||||
icp->icmp6_seq = htons(myseq);
|
||||
icp->icmp6_id = htons(ident);
|
||||
|
||||
pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR );
|
||||
pdp->ping_ts = h->last_send_time;
|
||||
pdp->ping_count = h->num_sent;
|
||||
|
||||
icp->icmp6_cksum = 0; // The IPv6 stack calculates the checksum for us...
|
||||
#endif
|
||||
#if defined(DEBUG) || defined(_DEBUG)
|
||||
@@ -1649,7 +1625,8 @@ int wait_for_reply(long wait_time)
|
||||
HOST_ENTRY *h;
|
||||
long this_reply;
|
||||
int this_count;
|
||||
struct timeval sent_time;
|
||||
struct timeval *sent_time;
|
||||
SEQMAP_VALUE *seqmap_value;
|
||||
|
||||
result = recvfrom_wto( s, buffer, sizeof(buffer), &response_addr, wait_time );
|
||||
|
||||
@@ -1695,6 +1672,8 @@ int wait_for_reply(long wait_time)
|
||||
return( 1 ); /* too short */
|
||||
}/* IF */
|
||||
|
||||
gettimeofday( ¤t_time, &tz );
|
||||
|
||||
icp = ( FPING_ICMPHDR* )( buffer + hlen );
|
||||
#ifndef IPV6
|
||||
if( icp->icmp_type != ICMP_ECHOREPLY )
|
||||
@@ -1715,49 +1694,41 @@ int wait_for_reply(long wait_time)
|
||||
#endif
|
||||
return 1; /* packet received, but not the one we are looking for! */
|
||||
|
||||
#ifndef IPV6
|
||||
seqmap_value = seqmap_fetch(ntohs(icp->icmp_seq), ¤t_time);
|
||||
#else
|
||||
seqmap_value = seqmap_fetch(ntohs(icp->icmp6_seq), ¤t_time);
|
||||
#endif
|
||||
if(seqmap_value == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
num_pingreceived++;
|
||||
|
||||
#ifndef IPV6
|
||||
if( ntohs(icp->icmp_seq) > max_seq_sent )
|
||||
#else
|
||||
if( ntohs(icp->icmp6_seq) > max_seq_sent )
|
||||
#endif
|
||||
return( 1 ); /* packet received, don't worry about it anymore */
|
||||
|
||||
#ifndef IPV6
|
||||
n = ntohs(icp->icmp_seq) % num_hosts;
|
||||
#else
|
||||
n = ntohs(icp->icmp6_seq) % num_hosts;
|
||||
#endif
|
||||
n = seqmap_value->host_nr;
|
||||
h = table[n];
|
||||
|
||||
/* received ping is cool, so process it */
|
||||
gettimeofday( ¤t_time, &tz );
|
||||
h->waiting = 0;
|
||||
h->timeout = timeout;
|
||||
h->num_recv++;
|
||||
h->num_recv_i++;
|
||||
|
||||
#ifndef IPV6
|
||||
memcpy( &sent_time, icp->icmp_data + offsetof( PING_DATA, ping_ts ), sizeof( sent_time ) );
|
||||
memcpy( &this_count, icp->icmp_data, sizeof( this_count ) );
|
||||
#else
|
||||
memcpy( &sent_time, ((char *)icp->icmp6_data32)+4+offsetof(PING_DATA, ping_ts), sizeof( sent_time ) );
|
||||
memcpy( &this_count, ((char *)icp->icmp6_data32)+4, sizeof( this_count ) );
|
||||
#endif
|
||||
sent_time = &seqmap_value->ping_ts;
|
||||
this_count = seqmap_value->ping_count;
|
||||
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
if( trace_flag )
|
||||
printf( "received [%d] from %s\n", this_count, h->host );
|
||||
#endif /* DEBUG || _DEBUG */
|
||||
|
||||
this_reply = timeval_diff( ¤t_time, &sent_time );
|
||||
if( this_reply > max_reply ) max_reply = this_reply;
|
||||
if( this_reply < min_reply ) min_reply = this_reply;
|
||||
if( this_reply > h->max_reply ) h->max_reply = this_reply;
|
||||
if( this_reply < h->min_reply ) h->min_reply = this_reply;
|
||||
if( this_reply > h->max_reply_i ) h->max_reply_i = this_reply;
|
||||
if( this_reply < h->min_reply_i ) h->min_reply_i = this_reply;
|
||||
this_reply = timeval_diff( ¤t_time, sent_time );
|
||||
if( !max_reply || this_reply > max_reply ) max_reply = this_reply;
|
||||
if( !min_reply || this_reply < min_reply ) min_reply = this_reply;
|
||||
if( !h->max_reply || this_reply > h->max_reply ) h->max_reply = this_reply;
|
||||
if( !h->min_reply || this_reply < h->min_reply ) h->min_reply = this_reply;
|
||||
if( !h->max_reply_i || this_reply > h->max_reply_i ) h->max_reply_i = this_reply;
|
||||
if( !h->min_reply_i || this_reply < h->min_reply_i ) h->min_reply_i = this_reply;
|
||||
sum_replies += this_reply;
|
||||
h->total_time += this_reply;
|
||||
h->total_time_i += this_reply;
|
||||
@@ -1903,6 +1874,7 @@ int handle_random_icmp( FPING_ICMPHDR *p, int psize, FPING_SOCKADDR *addr )
|
||||
FPING_ICMPHDR *sent_icmp;
|
||||
unsigned char *c;
|
||||
HOST_ENTRY *h;
|
||||
SEQMAP_VALUE *seqmap_value;
|
||||
#ifdef IPV6
|
||||
char addr_ascii[INET6_ADDRSTRLEN];
|
||||
inet_ntop(addr->sin6_family, &addr->sin6_addr, addr_ascii, INET6_ADDRSTRLEN);
|
||||
@@ -1919,14 +1891,14 @@ int handle_random_icmp( FPING_ICMPHDR *p, int psize, FPING_SOCKADDR *addr )
|
||||
sent_icmp = ( FPING_ICMPHDR* )( c + 28 );
|
||||
|
||||
#ifndef IPV6
|
||||
sent_icmp = ( struct icmp* )( c + 28 );
|
||||
seqmap_value = seqmap_fetch(ntohs(sent_icmp->icmp_seq), ¤t_time);
|
||||
|
||||
if( ( sent_icmp->icmp_type == ICMP_ECHO ) &&
|
||||
( ntohs(sent_icmp->icmp_id) == ident ) &&
|
||||
( ntohs(sent_icmp->icmp_seq) <= ( n_short )max_seq_sent ) )
|
||||
( seqmap_value != NULL ) )
|
||||
{
|
||||
/* this is a response to a ping we sent */
|
||||
h = table[ntohs(sent_icmp->icmp_seq) % num_hosts];
|
||||
h = table[seqmap_value->host_nr];
|
||||
|
||||
if( p->icmp_code > ICMP_UNREACH_MAXTYPE )
|
||||
{
|
||||
@@ -1934,9 +1906,11 @@ int handle_random_icmp( FPING_ICMPHDR *p, int psize, FPING_SOCKADDR *addr )
|
||||
inet_ntoa( addr->sin_addr ), h->host );
|
||||
|
||||
#else
|
||||
seqmap_value = seqmap_fetch(ntohs(sent_icmp->icmp6_seq), ¤t_time);
|
||||
|
||||
if( ( sent_icmp->icmp6_type == ICMP_ECHO ) &&
|
||||
( ntohs(sent_icmp->icmp6_id) == ident ) &&
|
||||
( ntohs(sent_icmp->icmp6_seq) <= ( n_short )max_seq_sent ) )
|
||||
( seqmap_value != NULL ) )
|
||||
{
|
||||
/* this is a response to a ping we sent */
|
||||
h = table[ntohs(sent_icmp->icmp6_seq) % num_hosts];
|
||||
@@ -1977,21 +1951,25 @@ int handle_random_icmp( FPING_ICMPHDR *p, int psize, FPING_SOCKADDR *addr )
|
||||
case ICMP_PARAMPROB:
|
||||
sent_icmp = ( FPING_ICMPHDR* )( c + 28 );
|
||||
#ifndef IPV6
|
||||
seqmap_value = seqmap_fetch(ntohs(sent_icmp->icmp_seq), ¤t_time);
|
||||
|
||||
if( ( sent_icmp->icmp_type == ICMP_ECHO ) &&
|
||||
( ntohs(sent_icmp->icmp_id) == ident ) &&
|
||||
( ntohs(sent_icmp->icmp_seq) <= ( n_short )max_seq_sent ) )
|
||||
( seqmap_value != NULL ) )
|
||||
{
|
||||
/* this is a response to a ping we sent */
|
||||
h = table[ntohs(sent_icmp->icmp_seq) % num_hosts];
|
||||
h = table[seqmap_value->host_nr];
|
||||
fprintf( stderr, "%s from %s for ICMP Echo sent to %s",
|
||||
icmp_type_str[p->icmp_type], inet_ntoa( addr->sin_addr ), h->host );
|
||||
|
||||
if( inet_addr( h->host ) == -1 )
|
||||
fprintf( stderr, " (%s)", inet_ntoa( h->saddr.sin_addr ) );
|
||||
#else
|
||||
seqmap_value = seqmap_fetch(ntohs(sent_icmp->icmp6_seq), ¤t_time);
|
||||
|
||||
if( ( sent_icmp->icmp6_type == ICMP_ECHO ) &&
|
||||
( ntohs(sent_icmp->icmp6_id) == ident ) &&
|
||||
( ntohs(sent_icmp->icmp6_seq) <= ( n_short )max_seq_sent ) )
|
||||
( seqmap_value != NULL ) )
|
||||
{
|
||||
/* this is a response to a ping we sent */
|
||||
h = table[ntohs(sent_icmp->icmp6_seq) % num_hosts];
|
||||
@@ -2321,7 +2299,7 @@ void add_addr( char *name, char *host, FPING_SOCKADDR *ipaddr )
|
||||
#endif
|
||||
p->timeout = timeout;
|
||||
p->running = 1;
|
||||
p->min_reply = 10000000;
|
||||
p->min_reply = 0;
|
||||
|
||||
if( strlen( p->host ) > max_hostname_len )
|
||||
max_hostname_len = strlen( p->host );
|
||||
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* fping: fast-ping, file-ping, favorite-ping, funky-ping
|
||||
*
|
||||
* Ping a list of target hosts in a round robin fashion.
|
||||
* A better ping overall.
|
||||
*
|
||||
* fping website: http://www.fping.org
|
||||
*
|
||||
* Current maintainer of fping: David Schweikert
|
||||
* Please send suggestions and patches to: david@schweikert.ch
|
||||
*
|
||||
*
|
||||
* Original author: Roland Schemers <schemers@stanford.edu>
|
||||
* IPv6 Support: Jeroen Massar <jeroen@unfix.org / jeroen@ipng.nl>
|
||||
* Improved main loop: David Schweikert <david@schweikert.ch>
|
||||
* Debian Merge, TOS settings: Tobi Oetiker <tobi@oetiker.ch>
|
||||
* Bugfixes, byte order & senseful seq.-numbers: Stephan Fuhrmann (stephan.fuhrmann AT 1und1.de)
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by Stanford University. The name of the University may not be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* seqmap.c: implementation of a mapping between sequence number and (host, ping_nr)
|
||||
* we can't just use ping_nr*host_count + host_nr, because it can
|
||||
* overflow the 16 bit of the icmp header field. See also:
|
||||
* https://github.com/schweikert/fping/issues/48
|
||||
*/
|
||||
|
||||
#include "seqmap.h"
|
||||
#include "options.h"
|
||||
#include "limits.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* description of the data structure used:
|
||||
*
|
||||
* - we assume that no more than SEQMAP_MAXSEQ (65535) pings are sent in
|
||||
* the timeout interval (SEQMAP_TIMEOUT_IN_S)
|
||||
* - we store the values in an array with SEQMAP_MAXSEQ elements
|
||||
* - current sequence number % SEQMAP_MAXSEQ gives the current index
|
||||
* - when entering a value, we check that the current entry is expired
|
||||
*/
|
||||
|
||||
static SEQMAP_VALUE *seqmap_map = NULL;
|
||||
static unsigned int seqmap_next_id = 0;
|
||||
static SEQMAP_VALUE *seqmap_free_list;
|
||||
|
||||
#define SEQMAP_TIMEOUT_IN_S 10
|
||||
#define SEQMAP_UNASSIGNED_HOST_NR UINT_MAX
|
||||
|
||||
void seqmap_init()
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
seqmap_map = calloc(SEQMAP_MAXSEQ, sizeof(SEQMAP_VALUE));
|
||||
if(seqmap_map == NULL) {
|
||||
perror("malloc error (can't allocate seqmap_map)");
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int seqmap_add(unsigned int host_nr, unsigned int ping_count, struct timeval *now)
|
||||
{
|
||||
unsigned int current_id;
|
||||
SEQMAP_VALUE *next_value;
|
||||
|
||||
if(!seqmap_map) {
|
||||
fprintf(stderr, "fping internal error: seqmap not initialized.\n");
|
||||
exit(4);
|
||||
}
|
||||
|
||||
/* check if expired (note that unused seqmap values will have fields set to
|
||||
* 0, so will be seen as expired */
|
||||
next_value = &seqmap_map[seqmap_next_id];
|
||||
if(next_value->ping_ts.tv_sec != 0 && (now->tv_sec - next_value->ping_ts.tv_sec) < SEQMAP_TIMEOUT_IN_S) {
|
||||
fprintf(stderr, "fping error: not enough sequence numbers available! (expire_timeout=%d, host_nr=%d, ping_count=%d, seqmap_next_id=%d)\n",
|
||||
SEQMAP_TIMEOUT_IN_S, host_nr, ping_count, seqmap_next_id);
|
||||
exit(4);
|
||||
}
|
||||
|
||||
/* store the value */
|
||||
next_value->host_nr = host_nr;
|
||||
next_value->ping_count = ping_count;
|
||||
next_value->ping_ts.tv_sec = now->tv_sec;
|
||||
next_value->ping_ts.tv_usec = now->tv_usec;
|
||||
|
||||
/* increase next id */
|
||||
current_id = seqmap_next_id;
|
||||
seqmap_next_id = (seqmap_next_id + 1) % SEQMAP_MAXSEQ;
|
||||
|
||||
return current_id;
|
||||
}
|
||||
|
||||
SEQMAP_VALUE *seqmap_fetch(unsigned int id, struct timeval *now)
|
||||
{
|
||||
SEQMAP_VALUE *value;
|
||||
|
||||
if(id > SEQMAP_MAXSEQ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
value = &seqmap_map[id];
|
||||
|
||||
/* verify that value is not expired */
|
||||
if(now->tv_sec - value->ping_ts.tv_sec >= SEQMAP_TIMEOUT_IN_S) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef SEQMAP_H
|
||||
#define SEQMAP_H
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
typedef struct seqmap_value
|
||||
{
|
||||
unsigned int host_nr;
|
||||
unsigned int ping_count;
|
||||
struct timeval ping_ts;
|
||||
|
||||
} SEQMAP_VALUE;
|
||||
|
||||
#define SEQMAP_MAXSEQ 65535
|
||||
|
||||
void seqmap_init();
|
||||
unsigned int seqmap_add(unsigned int host_nr, unsigned int ping_count, struct timeval *now);
|
||||
SEQMAP_VALUE *seqmap_fetch(unsigned int id, struct timeval *now);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user