"Fossies" - the Fresh Open Source Software Archive

Member "liboping-1.10.0/src/mans/ping_setopt.pod" (11 May 2017, 3786 Bytes) of package /linux/privat/liboping-1.10.0.tar.gz:

Caution: As a special service "Fossies" has tried to format the requested pod source page into HTML format but links to other pod pages may be missing or even erroneous. Alternatively you can here view or download the uninterpreted pod source code. A member file download can also be achieved by clicking within a package contents listing on the according byte size field. See also the latest Fossies "Diffs" side-by-side code changes report for "ping_setopt.pod": 1.9.0_vs_1.10.0.


ping_setopt - Set options for a liboping object


  #include <oping.h>

  int ping_setopt (pingobj_t *obj, int opt, void *val);


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.


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.


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.


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.


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.


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.


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.


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.


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 operation not supported on platforms which don't have SO_MARK.

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.


ping_setopt returns zero upon success or less than zero upon failure.


ping_construct(3), liboping(3)


liboping is written by Florian "octo" Forster <ff at octo.it>. Its homepage can be found at http://noping.cc/.

Copyright (c) 2006-2017 by Florian "octo" Forster.