2 * Object oriented C module to send ICMP and ICMPv6 `echo's.
3 * Copyright (C) 2006-2009 Florian octo Forster <octo at verplant.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; only version 2 of the License is
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 # include <sys/types.h>
37 # include <sys/socket.h>
44 #define OPING_VERSION 1000000
50 typedef struct pinghost pinghost_t;
52 typedef pinghost_t pingobj_iter_t;
55 typedef struct pingobj pingobj_t;
57 #define PING_OPT_TIMEOUT 0x01
58 #define PING_OPT_TTL 0x02
59 #define PING_OPT_AF 0x04
60 #define PING_OPT_DATA 0x08
61 #define PING_OPT_SOURCE 0x10
63 #define PING_DEF_TIMEOUT 1.0
64 #define PING_DEF_TTL 255
65 #define PING_DEF_AF AF_UNSPEC
66 #define PING_DEF_DATA "Florian Forster <octo@verplant.org> http://verplant.org/"
71 pingobj_t *ping_construct (void);
72 void ping_destroy (pingobj_t *obj);
74 int ping_setopt (pingobj_t *obj, int option, void *value);
76 int ping_send (pingobj_t *obj);
78 int ping_host_add (pingobj_t *obj, const char *host);
79 int ping_host_remove (pingobj_t *obj, const char *host);
81 pingobj_iter_t *ping_iterator_get (pingobj_t *obj);
82 pingobj_iter_t *ping_iterator_next (pingobj_iter_t *iter);
84 #define PING_INFO_HOSTNAME 1
85 #define PING_INFO_ADDRESS 2
86 #define PING_INFO_FAMILY 3
87 #define PING_INFO_LATENCY 4
88 #define PING_INFO_SEQUENCE 5
89 #define PING_INFO_IDENT 6
90 #define PING_INFO_DATA 7
91 #define PING_INFO_USERNAME 8
92 #define PING_INFO_DROPPED 9
93 int ping_iterator_get_info (pingobj_iter_t *iter, int info,
94 void *buffer, size_t *buffer_len);
96 const char *ping_get_error (pingobj_t *obj);
98 void *ping_iterator_get_context (pingobj_iter_t *iter);
99 void ping_iterator_set_context (pingobj_iter_t *iter, void *context);
105 #endif /* OCTO_PING_H */