MAJOR: server: add DNS-based server name resolution
Relies on the DNS protocol freshly implemented in HAProxy.
It performs a server IP addr resolution based on a server hostname.
diff --git a/include/proto/checks.h b/include/proto/checks.h
index 67d659f..9ab3e50 100644
--- a/include/proto/checks.h
+++ b/include/proto/checks.h
@@ -29,6 +29,7 @@
const char *get_check_status_info(short check_status);
int start_checks();
void __health_adjust(struct server *s, short status);
+int trigger_resolution(struct server *s);
extern struct data_cb check_conn_cb;
diff --git a/include/proto/server.h b/include/proto/server.h
index 64f2327..0a0ccc3 100644
--- a/include/proto/server.h
+++ b/include/proto/server.h
@@ -26,6 +26,7 @@
#include <common/config.h>
#include <common/time.h>
+#include <types/dns.h>
#include <types/proxy.h>
#include <types/queue.h>
#include <types/server.h>
@@ -40,6 +41,11 @@
int parse_server(const char *file, int linenum, char **args, struct proxy *curproxy, struct proxy *defproxy);
int update_server_addr(struct server *s, void *ip, int ip_sin_family, char *updater);
+/* functions related to server name resolution */
+int snr_update_srv_status(struct server *s);
+int snr_resolution_cb(struct dns_resolution *resolution, struct dns_nameserver *nameserver, unsigned char *response, int response_len);
+int snr_resolution_error_cb(struct dns_resolution *resolution, int error_code);
+
/* increase the number of cumulated connections on the designated server */
static void inline srv_inc_sess_ctr(struct server *s)
{
diff --git a/include/types/server.h b/include/types/server.h
index f987e25..4b44f22 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -205,6 +205,11 @@
struct check check; /* health-check specific configuration */
struct check agent; /* agent specific configuration */
+ char *resolvers_id; /* resolvers section used by this server */
+ char *hostname; /* server hostname */
+ struct dns_resolution *resolution; /* server name resolution */
+ int resolver_family_priority; /* which IP family should the resolver use when both are returned */
+
#ifdef USE_OPENSSL
int use_ssl; /* ssl enabled */
struct {