Code

bindings/perl: Add support for the number of dropped packets.
[liboping.git] / bindings / perl / Oping.xs
index 19da01c5c14405e5ba5ec2de8d15b81ab6498fee..c42374fc57fd2ece3c2da9877a7e511c61d3f311 100644 (file)
@@ -28,6 +28,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdint.h>
+#include <inttypes.h>
 #include <errno.h>
 #include <assert.h>
 #include <netdb.h> /* NI_MAXHOST */
@@ -164,6 +166,28 @@ _ping_iterator_get_hostname (iter)
                free(buffer);
        } while (0);
 
+int
+_ping_iterator_get_dropped (iter)
+       pingobj_iter_t *iter
+       CODE:
+#if defined(PING_INFO_DROPPED)
+               uint32_t tmp;
+               size_t tmp_size;
+               int status;
+
+               RETVAL = -1;
+
+               tmp_size = sizeof (tmp);
+               status = ping_iterator_get_info (iter, PING_INFO_DROPPED,
+                       (void *) &tmp, &tmp_size);
+               if (status == 0)
+                       RETVAL = (int) tmp;
+#else
+               RETVAL = -1;
+#endif
+       OUTPUT:
+               RETVAL
+
 const char *
 _ping_get_error (obj)
        pingobj_t *obj