.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .\" ======================================================================== .\" .IX Title "ping_setopt 3" .TH ping_setopt 3 2024-03-07 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_setopt \- Set options for a liboping object .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& int ping_setopt (pingobj_t *obj, int opt, void *val); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The \fBping_setopt\fR method sets options that apply to all hosts associated with the object \fIobj\fR and hosts that are yet to be added to the object. .PP The \fIobj\fR argument is a pointer to an \fIliboping\fR object, as returned by \&\fBping_construct\fR\|(3). .PP The \fIopt\fR argument specifies the option to set. Use one of the following constants. You can check if the required constant is supported by the library at compile time using \f(CW\*(C`#ifdef\*(C'\fR. It is recommended to check for desired features using the \f(CW\*(C`OPING_VERSION\*(C'\fR define. .IP \fBPING_OPT_TIMEOUT\fR 4 .IX Item "PING_OPT_TIMEOUT" The time to wait for a "echo reply" to be received; in seconds. In this case the memory pointed to by \fIval\fR is interpreted as a double value and must be greater than zero. The default is \fBPING_DEF_TIMEOUT\fR. .IP \fBPING_OPT_TTL\fR 4 .IX Item "PING_OPT_TTL" The value written into the time-to-live (= TTL) field of generated ICMP packets. The memory pointed to by \fIval\fR is interpreted as an integer. Valid values are 1 through 255. Default is \fBPING_DEF_TTL\fR. .IP \fBPING_OPT_AF\fR 4 .IX Item "PING_OPT_AF" The address family to use. The memory pointed to by \fIval\fR is interpreted as an integer and must be either \fBAF_UNSPEC\fR, \fBAF_INET\fR, or \fBAF_INET6\fR. This option only affects hosts that are being added \fBafter\fR this option has been set. Default is \fBPING_DEF_AF\fR. If you change this option, and a source address is set (see \fBPING_OPT_SOURCE\fR) that setting will be reset. .IP \fBPING_OPT_DATA\fR 4 .IX Item "PING_OPT_DATA" Set the data to send. The value passed must be a char-pointer to a null-terminated string. By default a 56 byte long string is used so that the packet size of an ICMPv4 packet is exactly 64 bytes. That's the behavior of the \&\fBping\fR\|(1) command. .IP \fBPING_OPT_SOURCE\fR 4 .IX Item "PING_OPT_SOURCE" Set the source address to use. The value passed must be a char-pointer to a null-terminated string specifying either a numerical network address or network hostname. This option will ignore the address family setting (as set with \fBPING_OPT_AF\fR) and will set the object's address family according to the source address assigned. .IP \fBPING_OPT_DEVICE\fR 4 .IX Item "PING_OPT_DEVICE" Set the outgoing network device to be used. The value passed must be a char-pointer to a null-terminated string specifying an interface name (e.\ g. \f(CW\*(C`eth0\*(C'\fR). Please note that this might not be supported by all operating systems. In that case, \fBping_setopt\fR sets the error to \&\f(CW\*(C`operation not supported\*(C'\fR. .IP \fBPING_OPT_QOS\fR 4 .IX Item "PING_OPT_QOS" Sets the \fIQuality of Service\fR flags that should be used when crafting ICMP and ICMPv6 packets. The memory pointed to by \fIval\fR is interpreted as a \f(CW\*(C`uint8_t\*(C'\fR. The byte is passed to \fBsetsockopt\fR\|(2) without modification, using the \&\f(CW\*(C`IP_TOS\*(C'\fR (IPv4) or \f(CW\*(C`IPV6_TCLASS\*(C'\fR (IPv6) option. It is the caller's responsibility to chose a valid bit combination. For details, read the \fBip\fR\|(7) and \fBipv6\fR\|(7) manual pages, as well as \fIRFC\ 2474\fR. .IP \fBPING_OPT_MARK\fR 4 .IX Item "PING_OPT_MARK" Mark (as in netfilter) outgoing packets using the SO_MARK socket option. Takes an int* pointer as a value. Setting this requires CAP_NET_ADMIN under Linux. Fails with \f(CW\*(C`operation not supported\*(C'\fR on platforms which don't have SO_MARK. .PP The \fIval\fR argument is a pointer to the new value. It must not be NULL. It is dereferenced depending on the value of the \fIopt\fR argument, see above. The memory pointed to by \fIval\fR is not changed. .SH "RETURN VALUE" .IX Header "RETURN VALUE" \&\fBping_setopt\fR returns zero upon success or less than zero upon failure. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBping_construct\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.