1ping_setopt(3)                     liboping                     ping_setopt(3)
2
3
4

NAME

6       ping_setopt - Set options for a liboping object
7

SYNOPSIS

9         #include <oping.h>
10
11         int ping_setopt (pingobj_t *obj, int opt, void *val);
12

DESCRIPTION

14       The ping_setopt method sets options that effect all hosts associated
15       with the object obj and hosts that are yet to be added to the object.
16
17       The obj argument is a pointer to an liboping object, as returned by
18       ping_construct(3).
19
20       The opt argument specifies the option to set. Use one of the following
21       constants. You can check if the required constant is supported by the
22       library at compile time using "#ifdef". It is recommended to check for
23       desired features using the "OPING_VERSION" define.
24
25       PING_OPT_TIMEOUT
26           The time to wait for a "echo reply" to be received; in seconds. In
27           this case the memory pointed to by val is interpreted as a double
28           value and must be greater than zero. The default is
29           PING_DEF_TIMEOUT.
30
31       PING_OPT_TTL
32           The value written into the time-to-live (= TTL) field of generated
33           ICMP packets. The memory pointed to by val is interpreted as an
34           integer. Valid values are 1 through 255. Default is PING_DEF_TTL.
35
36       PING_OPT_AF
37           The address family to use. The memory pointed to by val is
38           interpreted as an integer and must be either AF_UNSPEC, AF_INET, or
39           AF_INET6. This option only effects hosts that are being added after
40           this option has been set. Default is PING_DEF_AF. If you change
41           this option, and a source address is set (see PING_OPT_SOURCE) that
42           setting will be reset.
43
44       PING_OPT_DATA
45           Set the data to send. The value passed must be a char-pointer to a
46           null-terminated string. By default a 56 byte long string is used so
47           that the packet size of an ICMPv4 packet is exactly 64 bytes.
48           That's the behavior of the ping(1) command.
49
50       PING_OPT_SOURCE
51           Set the source address to use. The value passed must be a char-
52           pointer to a null-terminated string specifying either a numerical
53           network address or network hostname. This option will ignore the
54           address family setting (as set with PING_OPT_AF) and will set the
55           object's address family according to the source address assigned.
56
57       PING_OPT_DEVICE
58           Set the outgoing network device to be used. The value passed must
59           be a char-pointer to a null-terminated string specifying an
60           interface name (e. g. "eth0"). Please note that this might not be
61           supported by all operating systems. In that case, ping_setopt sets
62           the error to "operation not supported".
63
64       The val argument is a pointer to the new value. It must not be NULL. It
65       is dereferenced depending on the value of the opt argument, see above.
66       The memory pointed to by val is not changed.
67

RETURN VALUE

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

SEE ALSO

72       ping_construct(3), liboping(3)
73

AUTHOR

75       liboping is written by Florian octo Forster <octo at verplant.org>.
76       It's homepage can be found at <http://verplant.org/liboping/>.
77
78       (c) 2005-2009 by Florian octo Forster.
79
80
81
821.3.4                             2009-12-20                    ping_setopt(3)
Impressum