Added reporting of errors:
[collectd.git] / src / liboping / liboping.h
index 73d878c..9fd7597 100644 (file)
 #ifndef OCTO_PING_H
 #define OCTO_PING_H 1
 
-#include <stdlib.h>
-#include <unistd.h>
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
 
 /*
  * Type definitions
  */
-typedef struct pinghost
-{
-       char                    *hostname;
-       struct sockaddr_storage *addr;
-       socklen_t                addrlen;
-       int                      addrfamily;
-       int                      fd;
-       int                      ident;
-       int                      sequence;
-       struct timeval          *timer;
-       double                   latency;
-
-       struct pinghost         *next;
-} pinghost_t;
+struct pinghost;
+typedef struct pinghost pinghost_t;
 
 typedef pinghost_t pingobj_iter_t;
 
-typedef struct pingobj
-{
-       double      timeout;
-       int         ttl;
-       int         addrfamily;
-
-       pinghost_t *head;
-} pingobj_t;
+struct pingobj;
+typedef struct pingobj pingobj_t;
 
 #define PING_OPT_TIMEOUT 0x01
 #define PING_OPT_TTL     0x02
@@ -79,4 +72,6 @@ pingobj_iter_t *ping_iterator_next (pingobj_iter_t *iter);
 const char *ping_iterator_get_host (pingobj_iter_t *iter);
 double ping_iterator_get_latency (pingobj_iter_t *iter);
 
+const char *ping_get_error (pingobj_t *obj);
+
 #endif /* OCTO_PING_H */