.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.48) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "ping_host_add 3" .TH ping_host_add 3 2026-10-10 1.10.0 liboping .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME ping_host_add \- Add a host to a liboping object .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& int ping_host_add (pingobj_t *obj, const char *host); \& int ping_host_remove (pingobj_t *obj, const char *host); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The \fBping_host_add\fR method tries to resolve the \fIhost\fR argument, open a socket and associate everything with the liboping object \fIobj\fR. .PP The \fIobj\fR argument is a pointer to an liboping object, as returned by \&\fBping_construct\fR\|(3). .PP The \fIhost\fR parameter is a \*(Aq\e0\*(Aq terminated string which is interpreted as a hostname or an IP address. Depending on the address family setting, set with \&\fBping_setopt\fR\|(3), the hostname is resolved to an IPv4 or IPv6 address. .PP The \fBping_host_remove\fR method looks for \fIhost\fR within \fIobj\fR and remove it if found. It will close the socket and deallocate the memory, too. .PP The names passed to \fBping_host_add\fR and \fBping_host_remove\fR must match. This name can be queried using \fBping_iterator_get_info\fR\|(3). .SH "RETURN VALUE" .IX Header "RETURN VALUE" If \fBping_host_add\fR succeeds it returns zero. If an error occurs a value less than zero is returned and the last error is saved internally. You can receive the error message using \fBping_get_error\fR\|(3). .PP \&\fBping_host_remove\fR returns zero upon success and less than zero if it failed. Currently the only reason for failure is that the host isn\*(Aqt found, but this is subject to change. Use \fBping_get_error\fR\|(3) to receive the error message. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBping_construct\fR\|(3), \&\fBping_setopt\fR\|(3), \&\fBping_get_error\fR\|(3), \&\fBliboping\fR\|(3) .SH AUTHOR .IX Header "AUTHOR" liboping is written by Florian "octo" Forster . Its homepage can be found at . .PP Copyright (c) 2006\-2017 by Florian "octo" Forster.