Code

Created standard subversion directories.
[liboping.git] / src / mans / ping_iterator_get_info.pod
1 =head1 NAME
3 ping_iterator_get_info - Constructor for the liboping class
5 =head1 SYNOPSIS
7   #include <oping.h>
9   int ping_iterator_get_info (pingobj_iter_t *iter,
10                   int info,
11                   void *buffer,
12                   size_t *buffer_len);
14 =head1 DESCRIPTION
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
23 following defines:
25 =over 4
27 =item B<PING_INFO_HOSTNAME>
29 Return the hostname of the host the iterator points to. Since the name is
30 looked up using the socket address this may differ from the hostname passed to
31 L<ping_host_add(3)>. The hostname is actually looked up every time you call
32 this method, no cache is involved within liboping.
34 It is recommended to include C<netdb.h> and allocate B<NI_MAXHOST> bytes of
35 buffer.
37 =item B<PING_INFO_ADDRESS>
39 Return the address used in ASCII (i.e. human readable) format. The address is
40 looked up every time you call this method. 40 bytes should be sufficient for
41 the buffer (16 octets in hex format, seven colons and one null byte), but more
42 won't hurt.
44 =item B<PING_INFO_FAMILY>
46 Returns the address family of the host. The buffer should be ig enough to hold
47 an integer. The value is either B<AF_INET> or B<AF_INET6>.
49 =item B<PING_INFO_LATENCY>
51 Return the last measured latency or less than zero if the timeout occured
52 before a echo response was received. The buffer should be big enough to hold a
53 double value.
55 =item B<PING_INFO_SEQUENCE>
57 Return the last sequence number sent. This number is increased regardless of
58 echo responses being received or not. The buffer should hold an integer.
60 =item B<PING_INFO_IDENT>
62 Return the ident that is put into every ICMP packet sent to this host. Per
63 convention this usually is the PID of the sending process, but since liboping
64 can handle several hosts in parallel it uses a (pseudo-)random number here. The
65 buffer should be big enough to hold an integer value.
67 =back
69 The I<buffer> argument is a pointer to an appropriately sized area of memory
70 where the result of the call will be stored. The I<buffer_len> value is used as
71 input and output: When calling B<ping_iterator_get_info> it reports the size of
72 the memory region pointed to by I<buffer>. The method will write the number of
73 bytes actually written to the memory into I<buffer_len> before returning.
75 =head1 RETURN VALUE
77 B<ping_iterator_get_info> returns zero if it succeeds.
79 B<EINVAL> is returned if the value passed as I<info> is unknown. Both,
80 I<buffer> and I<buffer_len>, will be left untouched in this case.
82 If the requested information didn't fit into I<buffer> then the size that would
83 have been needed is written into I<buffer_len>; I<buffer> itself is left
84 untouched. The return value is B<ENOMEM> in this case.
86 =head1 SEE ALSO
88 L<ping_iterator_get(3)>,
89 L<liboping(3)>
91 =head1 AUTHOR
93 liboping is written by Florian octo Forster E<lt>octo at verplant.orgE<gt>.
94 It's homepage can be found at L<http://verplant.org/liboping/>.
96 (c) 2005, 2006 by Florian octo Forster.