# include <stdlib.h>
# include <stdio.h>
# include <string.h>
+# include <stdint.h>
+# include <inttypes.h>
# include <errno.h>
# include <assert.h>
#else
int sequence;
struct timeval *timer;
double latency;
+ uint32_t dropped;
char *data;
void *context;
else if (status == 0)
{
dprintf ("select timed out\n");
+ for (ptr = ph; ptr != NULL; ptr = ptr->next)
+ if (ptr->latency < 0.0)
+ ptr->dropped++;
break;
}
ph->addrlen = sizeof (struct sockaddr_storage);
ph->fd = -1;
ph->latency = -1.0;
+ ph->dropped = 0;
ph->ident = ping_get_ident () & 0xFFFF;
return (ph);
ret = 0;
break;
+ case PING_INFO_DROPPED:
+ ret = ENOMEM;
+ *buffer_len = sizeof (uint32_t);
+ if (orig_buffer_len < sizeof (uint32_t))
+ break;
+ *((uint32_t *) buffer) = iter->dropped;
+ ret = 0;
+ break;
+
case PING_INFO_SEQUENCE:
ret = ENOMEM;
*buffer_len = sizeof (unsigned int);
}
return (ret);
-}
+} /* ping_iterator_get_info */
void *ping_iterator_get_context (pingobj_iter_t *iter)
{
before a echo response was received. The buffer should be big enough to hold a
double value.
+=item B<PING_INFO_DROPPED>
+
+Return the number of times that no response was received within the timeout.
+This value is only increased but may wrap around at the 32E<nbsp>bit boundary.
+The buffer should be big enough to hold a 32E<nbsp>bit integer, e.E<nbsp>g. an
+C<uint32_t>.
+
=item B<PING_INFO_SEQUENCE>
Return the last sequence number sent. This number is increased regardless of
extern "C" {
#endif
+#define OPING_VERSION 3005
+
/*
* Type definitions
*/
pingobj_iter_t *ping_iterator_get (pingobj_t *obj);
pingobj_iter_t *ping_iterator_next (pingobj_iter_t *iter);
-#define PING_INFO_USERNAME 8
#define PING_INFO_HOSTNAME 1
#define PING_INFO_ADDRESS 2
#define PING_INFO_FAMILY 3
#define PING_INFO_SEQUENCE 5
#define PING_INFO_IDENT 6
#define PING_INFO_DATA 7
+#define PING_INFO_USERNAME 8
+#define PING_INFO_DROPPED 9
int ping_iterator_get_info (pingobj_iter_t *iter, int info,
void *buffer, size_t *buffer_len);