1 =head1 NAME
3 ping_host_add - Add a host to a liboping object
5 =head1 SYNOPSIS
7 #include <oping.h>
9 int ping_host_add (pingobj_t *obj, const char *host);
10 int ping_host_remove (pingobj_t *obj, const char *host);
12 =head1 DESCRIPTION
14 The B<ping_host_add> method tries to resolve the I<host> argument, open a
15 socket and associate everything with the liboping object I<obj>.
17 The I<obj> argument is a pointer to an liboping object, as returned by
18 L<ping_construct(3)>.
20 The I<host> parameter is a '\0' terminated string which is interpreted as a
21 hostname or an IP address. Depending on the address family setting, set with
22 L<ping_setopt(3)>, the hostname is resolved to an IPv4 or IPv6 address.
24 The B<ping_host_remove> method looks for I<host> within I<obj> and remove it if
25 found. It will close the socket and deallocate the memory, too.
27 The names passed to B<ping_host_add> and B<ping_host_remove> must match. This
28 name can be queried using L<ping_iterator_get_info(3)>.
30 =head1 RETURN VALUE
32 If B<ping_host_add> succeeds it returns zero. If an error occurs a value less
33 than zero is returned and the last error is saved internally. You can receive
34 the error message using L<ping_get_error(3)>.
36 B<ping_host_remove> returns zero upon success and less than zero if it failed.
37 Currently the only reason for failure is that the host isn't found, but this is
38 subject to change. Use L<ping_get_error(3)> to receive the error message.
40 =head1 SEE ALSO
42 L<ping_construct(3)>,
43 L<ping_setopt(3)>,
44 L<ping_get_error(3)>,
45 L<liboping(3)>
47 =head1 AUTHOR
49 liboping is written by Florian "octo" Forster E<lt>octo at verplant.orgE<gt>.
50 Its homepage can be found at L<http://verplant.org/liboping/>.
52 Copyright (c) 2005-2011 by Florian "octo" Forster.