MAJOR/REORG: dns: DNS resolution task and requester queues

This patch is a major upgrade of the internal run-time DNS resolver in
HAProxy and it brings the following 2 main changes:

1. DNS resolution task

Up to now, DNS resolution was triggered by the health check task.
From now, DNS resolution task is autonomous. It is started by HAProxy
right after the scheduler is available and it is woken either when a
network IO occurs for one of its nameserver or when a timeout is
matched.

From now, this means we can enable DNS resolution for a server without
enabling health checking.

2. Introduction of a dns_requester structure

Up to now, DNS resolution was purposely made for resolving server
hostnames.
The idea, is to ensure that any HAProxy internal object should be able
to trigger a DNS resolution. For this purpose, 2 things has to be done:
  - clean up the DNS code from the server structure (this was already
    quite clean actually) and clean up the server's callbacks from
    manipulating too much DNS resolution
  - create an agnostic structure which allows linking a DNS resolution
    and a requester of any type (using obj_type enum)

3. Manage requesters through queues

Up to now, there was an uniq relationship between a resolution and it's
owner (aka the requester now). It's a shame, because in some cases,
multiple objects may share the same hostname and may benefit from a
resolution being performed by a third party.
This patch introduces the notion of queues, which are basically lists of
either currently running resolution or waiting ones.

The resolutions are now available as a pool, which belongs to the resolvers.
The pool has has a default size of 64 resolutions per resolvers and is
allocated at configuration parsing.
diff --git a/include/proto/dns.h b/include/proto/dns.h
index 00a6f4a..6675d50 100644
--- a/include/proto/dns.h
+++ b/include/proto/dns.h
@@ -44,11 +44,24 @@
 void dns_print_current_resolutions(struct dns_resolvers *resolvers);
 void dns_update_resolvers_timeout(struct dns_resolvers *resolvers);
 void dns_reset_resolution(struct dns_resolution *resolution);
+void dns_resolution_free(struct dns_resolvers *resolvers, struct dns_resolution *resolution);
+void dns_rm_requester_from_resolution(struct dns_requester *requester, struct dns_resolution *resolution);
 int dns_check_resolution_queue(struct dns_resolvers *resolvers);
 unsigned short dns_response_get_query_id(unsigned char *resp);
 struct dns_resolution *dns_alloc_resolution(void);
 void dns_free_resolution(struct dns_resolution *resolution);
 struct chunk *dns_cache_key(int query_type, char *hostname_dn, int hostname_dn_len, struct chunk *buf);
 struct lru64 *dns_cache_lookup(int query_type, char *hostname_dn, int hostname_dn_len, int valid_period, void *cache_domain);
+int dns_link_resolution(void *requester, int requester_type, struct dns_resolution *resolution);
+struct dns_resolution *dns_resolution_list_get(struct dns_resolvers *resolvers, char *hostname_dn, int query_type);
+int dns_trigger_resolution(struct dns_resolution *resolution);
+int dns_alloc_resolution_pool(struct dns_resolvers *resolvers);
+
+void dump_dns_config(void);
+
+/*
+ * erases all information of a dns_requester structure
+ */
+#define		dns_clear_requester(requester)	memset(requester, '\0', sizeof(*requester));
 
 #endif // _PROTO_DNS_H