3 ping_iterator_get_info - Constructor for the liboping class
9 int ping_iterator_get_info (pingobj_iter_t *iter,
16 The B<ping_iterator_get_info> method can be used on an host iterator to return
17 various information about the current host.
19 The I<iter> argument is an iterator as returned by L<ping_iterator_get(3)> or
20 L<ping_iterator_next(3)>.
22 The I<info> argument specifies the type of information returned. Use the
27 =item B<PING_INFO_USERNAME>
29 Return the hostname of the host the iterator points to as supplied by the user.
30 This is the name you passed to L<ping_host_add(3)> and which you need to pass
31 to C<ping_host_remove>, too.
33 =item B<PING_INFO_HOSTNAME>
35 Return the hostname of the host the iterator points to. Since the name is
36 looked up using the socket address this may differ from the hostname passed to
37 L<ping_host_add(3)>. The hostname is actually looked up every time you call
38 this method, no cache is involved within liboping.
40 It is recommended to include C<netdb.h> and allocate B<NI_MAXHOST> bytes of
43 =item B<PING_INFO_ADDRESS>
45 Return the address used in ASCII (i.e. human readable) format. The address is
46 looked up every time you call this method. 40 bytes should be sufficient for
47 the buffer (16 octets in hex format, seven colons and one null byte), but more
50 =item B<PING_INFO_FAMILY>
52 Returns the address family of the host. The buffer should be ig enough to hold
53 an integer. The value is either B<AF_INET> or B<AF_INET6>.
55 =item B<PING_INFO_LATENCY>
57 Return the last measured latency or less than zero if the timeout occured
58 before a echo response was received. The buffer should be big enough to hold a
61 =item B<PING_INFO_SEQUENCE>
63 Return the last sequence number sent. This number is increased regardless of
64 echo responses being received or not. The buffer should hold an integer.
66 =item B<PING_INFO_IDENT>
68 Return the ident that is put into every ICMP packet sent to this host. Per
69 convention this usually is the PID of the sending process, but since liboping
70 can handle several hosts in parallel it uses a (pseudo-)random number here. The
71 buffer should be big enough to hold an integer value.
75 The I<buffer> argument is a pointer to an appropriately sized area of memory
76 where the result of the call will be stored. The I<buffer_len> value is used as
77 input and output: When calling B<ping_iterator_get_info> it reports the size of
78 the memory region pointed to by I<buffer>. The method will write the number of
79 bytes actually written to the memory into I<buffer_len> before returning.
83 B<ping_iterator_get_info> returns zero if it succeeds.
85 B<EINVAL> is returned if the value passed as I<info> is unknown. Both,
86 I<buffer> and I<buffer_len>, will be left untouched in this case.
88 If the requested information didn't fit into I<buffer> then the size that would
89 have been needed is written into I<buffer_len>; I<buffer> itself is left
90 untouched. The return value is B<ENOMEM> in this case.
94 L<ping_iterator_get(3)>,
99 liboping is written by Florian octo Forster E<lt>octo at verplant.orgE<gt>.
100 It's homepage can be found at L<http://verplant.org/liboping/>.
102 (c) 2005-2008 by Florian octo Forster.