#ifndef OCTO_PING_H
#define OCTO_PING_H 1
-#ifndef AI_ADDRCONFIG
-#define AI_ADDRCONFIG 0
+#if HAVE_CONFIG_H
+# include <config.h>
#endif
-#include <stdlib.h>
-#include <sys/types.h>
-
-/* FIXME BEGIN */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include <assert.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/ip_icmp.h>
-#include <netinet/icmp6.h>
-
-#include <sys/time.h>
-#include <time.h>
-/* FIXME END */
+#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;
-
-typedef struct
-{
- int flags;
- pinghost_t *head;
-} pingobj_t;
+struct pinghost;
+typedef struct pinghost pinghost_t;
typedef pinghost_t pingobj_iter_t;
+struct pingobj;
+typedef struct pingobj pingobj_t;
+
+#define PING_OPT_TIMEOUT 0x01
+#define PING_OPT_TTL 0x02
+#define PING_OPT_AF 0x04
+
+#define PING_DEF_TIMEOUT 1.0
+#define PING_DEF_TTL 255
+#define PING_DEF_AF AF_UNSPEC
+
/*
* Method definitions
*/
-pingobj_t *ping_construct (int flags);
+pingobj_t *ping_construct (void);
void ping_destroy (pingobj_t *obj);
+int ping_setopt (pingobj_t *obj, int option, void *value);
+
int ping_send (pingobj_t *obj);
int ping_host_add (pingobj_t *obj, const char *host);
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 */