summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4c83ef7)
raw | patch | inline | side by side (parent: 4c83ef7)
author | Florian Forster <octo@verplant.org> | |
Fri, 22 Aug 2008 07:00:24 +0000 (09:00 +0200) | ||
committer | Florian Forster <octo@verplant.org> | |
Fri, 22 Aug 2008 07:00:24 +0000 (09:00 +0200) |
src/liboping.c | patch | blob | history | |
src/mans/ping_iterator_get_info.pod | patch | blob | history | |
src/oping.h | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index 22ab3a8672167b4d53248c4b92b9646ab82c05ee..c93633c8ea7c6cfba58336f394a4d4c9b1c7019e 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
# 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)
{
index 57322bbfa525446621cc84afc275ca178228f2e5..55c9ec9cbcf286528cb696bc58c4c21ccb1b863f 100644 (file)
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
diff --git a/src/oping.h b/src/oping.h
index d450d6cbe212d8b1c790883bbd8a947b576f3d14..4655d3987c2a5636c4a7a5fa3db3911e777ae289 100644 (file)
--- a/src/oping.h
+++ b/src/oping.h
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);