aboutsummaryrefslogtreecommitdiffstats
path: root/libglouglou/libggnet_dns.h
blob: ae7b634fee2b2a1e711f20b2656e437c39e8a5c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <event2/dns.h>
#include <event2/util.h>
#include <event2/event.h>

#if defined(__OpenBSD__)
#include <sys/queue.h>
#else
#include <bsd/sys/queue.h>
#endif

struct ggnet_dns_req {
  LIST_ENTRY(ggnet_dns_req) entry;
  struct ggnet_dns *ggdns;
  struct evdns_request *ereq;
  struct in_addr ip;
  char *name;
  void (*cb_usr)(struct in_addr *, char *, void *);
  void  *data;
};

struct ggnet_dns {
  struct event_base *ev_base;
  struct evdns_base *evdns_base;
  int req_pending;
  LIST_HEAD(, ggnet_dns_req) req_list; /* XXX for now unused. remove ? */
};

struct ggnet_dns     *ggnet_dns_new(struct event_base *);
void                  ggnet_dns_free(struct ggnet_dns *);
struct ggnet_dns_req *ggnet_dns_reverse(struct ggnet_dns *, struct in_addr *,
                                        void (*cb_usr)(struct in_addr *, char *, void *),
                                        void *);
void                  ggnet_dns_cancel(struct ggnet_dns *,
                                       struct ggnet_dns_req *);