Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ping_setopt(3) [debian man page]

ping_setopt(3)							     liboping							    ping_setopt(3)

NAME
ping_setopt - Set options for a liboping object SYNOPSIS
#include <oping.h> int ping_setopt (pingobj_t *obj, int opt, void *val); DESCRIPTION
The ping_setopt method sets options that apply to all hosts associated with the object obj and hosts that are yet to be added to the object. The obj argument is a pointer to an liboping object, as returned by ping_construct(3). The opt 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 "#ifdef". It is recommended to check for desired features using the "OPING_VERSION" define. PING_OPT_TIMEOUT The time to wait for a "echo reply" to be received; in seconds. In this case the memory pointed to by val is interpreted as a double value and must be greater than zero. The default is PING_DEF_TIMEOUT. PING_OPT_TTL The value written into the time-to-live (= TTL) field of generated ICMP packets. The memory pointed to by val is interpreted as an integer. Valid values are 1 through 255. Default is PING_DEF_TTL. PING_OPT_AF The address family to use. The memory pointed to by val is interpreted as an integer and must be either AF_UNSPEC, AF_INET, or AF_INET6. This option only affects hosts that are being added after this option has been set. Default is PING_DEF_AF. If you change this option, and a source address is set (see PING_OPT_SOURCE) that setting will be reset. 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 ping(1) command. 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 PING_OPT_AF) and will set the object's address family according to the source address assigned. 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. "eth0"). Please note that this might not be supported by all operating systems. In that case, ping_setopt sets the error to "operation not supported". PING_OPT_QOS Sets the Quality of Service flags that should be used when crafting ICMP and ICMPv6 packets. The memory pointed to by val is interpreted as a "uint8_t". The byte is passed to setsockopt(2) without modification, using the "IP_TOS" (IPv4) or "IPV6_TCLASS" (IPv6) option. It is the caller's responsibility to chose a valid bit combination. For details, read the ip(7) and ipv6(7) manual pages, as well as RFC 2474. The val argument is a pointer to the new value. It must not be NULL. It is dereferenced depending on the value of the opt argument, see above. The memory pointed to by val is not changed. RETURN VALUE
ping_setopt returns zero upon success or less than zero upon failure. SEE ALSO
ping_construct(3), liboping(3) AUTHOR
liboping is written by Florian "octo" Forster <octo at verplant.org>. Its homepage can be found at <http://verplant.org/liboping/>. Copyright (c) 2005-2011 by Florian "octo" Forster. 1.6.2 2012-01-31 ping_setopt(3)

Check Out this Related Man Page

liboping(3)							     liboping							       liboping(3)

NAME
liboping - Library to send ICMPv4/ICMPv6 echo packets to multiple hosts DESCRIPTION
This is an overview of liboping, a C library to send ICMP ECHO_REQUEST packets to remote hosts and measure the time it takes for replies to be received. This method, often simply called "ping", is a common way to measure network latency and/or host reachability. The goals of this library are to provide the above functionality in a platform and protocol independent manner. The interface is simple, object oriented and (hopefully) ANSI-C compliant. GENERAL USAGE
There are two main types that are used by applications. Both are "opaque types", meaning they are structures that are not completely defined in the header file, so you cannot access the structures' members. You don't need to, don't do it. These structures are subject to change without notice. "pingobj_t" A ping-object. You can set specific options for this object, add and remove hosts to/from it and send ICMP packets to all associated hosts. This is often called a "handle". "pingobj_iter_t" An iterator over the hosts associated with a "pingobj_t" object. This iterator can be used to query more information about a host, for example the hostname, the measured latency or the current ICMP sequence. Upon startup you usually create one or more "pingobj_t" objects and add hosts to it using the "ping_host_add" method (see below). You periodically send "echo requests" using the "ping_send" method, iterate over all hosts using "ping_iterator_get" and "ping_iterator_next". For each host you call "ping_iterator_get_info" to read the current latency and do something with it. If an error occurs you can use "ping_get_error" so get information on what failed. LINKING WITH LIBOPING
Depending on you platform you don't need any extra libraries (e.g. GNU/Linux) or "libsocket" (using "-lsocket") if the "socket" function is not in the C-library. The latter is the case for the Solaris operating system. SYMBOL NAMES
All "official" function or method names are prefixed with "ping_". Don't use any other functions or methods. Although no such functions should exist. THREAD SAFETY
liboping has been designed to be as thread safe a possible. However, this has not been tested and may need some additional work. Use at your own risk and please report back any problems or success messages. Thank you :) SEE ALSO
ping_construct(3), ping_setopt(3), ping_host_add(3), ping_send(3), ping_get_error(3), ping_iterator_get(3), ping_iterator_get_info(3), ping_iterator_get_context(3) LICENSE
liboping is licensed under the GPLv2. No other version of the license is applicable. AUTHOR
liboping is written by Florian "octo" Forster <octo at verplant.org>. Its homepage can be found at <http://verplant.org/liboping/>. Copyright (c) 2005-2011 by Florian "octo" Forster. 1.6.2 2012-01-31 liboping(3)
Man Page