summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a9fa6b9)
raw | patch | inline | side by side (parent: a9fa6b9)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 15 Mar 2009 13:16:19 +0000 (14:16 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 15 Mar 2009 13:16:19 +0000 (14:16 +0100) |
bindings/perl/Oping.xs | patch | blob | history | |
bindings/perl/lib/Net/Oping.pm | patch | blob | history |
diff --git a/bindings/perl/Oping.xs b/bindings/perl/Oping.xs
index c42374fc57fd2ece3c2da9877a7e511c61d3f311..135733d6afdff02d23f90b93e48c171cccd328f7 100644 (file)
--- a/bindings/perl/Oping.xs
+++ b/bindings/perl/Oping.xs
OUTPUT:
RETVAL
+int
+_ping_iterator_get_recv_ttl (iter)
+ pingobj_iter_t *iter
+ CODE:
+#if defined(PING_INFO_RECV_TTL)
+ int tmp;
+ size_t tmp_size;
+ int status;
+
+ RETVAL = -1;
+
+ tmp_size = sizeof (tmp);
+ status = ping_iterator_get_info (iter, PING_INFO_RECV_TTL,
+ (void *) &tmp, &tmp_size);
+ if (status == 0)
+ RETVAL = tmp;
+#else
+ RETVAL = -1;
+#endif
+ OUTPUT:
+ RETVAL
+
const char *
_ping_get_error (obj)
pingobj_t *obj
index b14cc52a21e29a8a2d7ffea85a2026e0dfdde30f..92709e4c7fe0566f6e6433cb50a840ad6fb7b725 100644 (file)
return ($data);
} # get_dropped
+=item my I<$dropped> = I<$obj>-E<gt>B<get_recv_ttl> ()
+
+Returns a hash reference holding the I<Time to Live> (TTL) of the last received
+packet for each host. An example return value would be:
+
+ $ttl = { host1 => 60, host2 => 41, host3 => 243, ... };
+
+To signal an invalid or unavailable TTL, a negative number is returned.
+
+=cut
+
+sub get_recv_ttl
+{
+ my $obj = shift;
+ my $iter;
+ my $data = {};
+
+ $iter = _ping_iterator_get ($obj->{'c_obj'});
+ if (!$iter)
+ {
+ $obj->{'err_msg'} = "" . _ping_get_error ($obj->{'c_obj'});
+ return;
+ }
+
+ while ($iter)
+ {
+ my $host = _ping_iterator_get_hostname ($iter);
+ if ($host)
+ {
+ $data->{$host} = _ping_iterator_get_recv_ttl ($iter);
+ }
+
+ $iter = _ping_iterator_next ($iter);
+ }
+
+ return ($data);
+} # get_recv_ttl
+
=item my I<$errmsg> = I<$obj>-E<gt>B<get_error> ();
Returns the last error that occurred.