MINOR: dns: Handle SRV records.

Make it so for each server, instead of specifying a hostname, one can use
a SRV label.
When doing so, haproxy will first resolve the SRV label, then use the
resulting hostnames, as well as port and weight (priority is ignored right
now), to each server using the SRV label.
It is resolved periodically, and any server disappearing from the SRV records
will be removed, and any server appearing will be added, assuming there're
free servers in haproxy.
diff --git a/include/proto/dns.h b/include/proto/dns.h
index 6675d50..a84f07c 100644
--- a/include/proto/dns.h
+++ b/include/proto/dns.h
@@ -27,6 +27,7 @@
 
 char *dns_str_to_dn_label(const char *string, char *dn, int dn_len);
 int dns_str_to_dn_label_len(const char *string);
+void dns_dn_label_to_str(char *dn, char *str, int dn_len);
 int dns_hostname_validation(const char *string, char **err);
 int dns_build_query(int query_id, int query_type, char *hostname_dn, int hostname_dn_len, char *buf, int bufsize);
 struct task *dns_process_resolve(struct task *t);
diff --git a/include/proto/server.h b/include/proto/server.h
index c4f8e1d..d35a9c1 100644
--- a/include/proto/server.h
+++ b/include/proto/server.h
@@ -53,6 +53,7 @@
 
 /* functions related to server name resolution */
 int snr_update_srv_status(struct server *s, int has_no_ip);
+const char *update_server_fqdn(struct server *server, const char *fqdn, const char *updater);
 int snr_resolution_cb(struct dns_requester *requester, struct dns_nameserver *nameserver);
 int snr_resolution_error_cb(struct dns_requester *requester, int error_code);
 struct server *snr_check_ip_callback(struct server *srv, void *ip, unsigned char *ip_family);
diff --git a/include/types/dns.h b/include/types/dns.h
index 12c1155..c371d5f 100644
--- a/include/types/dns.h
+++ b/include/types/dns.h
@@ -63,6 +63,7 @@
 #define DNS_RTYPE_A		1	/* IPv4 address */
 #define DNS_RTYPE_CNAME		5	/* canonical name */
 #define DNS_RTYPE_AAAA		28	/* IPv6 address */
+#define DNS_RTYPE_SRV		33	/* SRV record */
 #define DNS_RTYPE_ANY		255	/* all records */
 
 /* dns rcode values */
@@ -318,4 +319,19 @@
 	DNS_UPD_OBSOLETE_IP,		/* The server IP was obsolete, and no other IP was found */
 };
 
+struct dns_srvrq {
+	enum obj_type obj_type;			/* object type == OBJ_TYPE_SRVRQ */
+	struct dns_resolvers *resolvers;	/* pointer to the resolvers structure used for this server template */
+
+	struct dns_resolution *resolution;	/* server name resolution */
+
+	struct proxy *proxy;			/* associated proxy */
+	char *name;
+	char *hostname_dn;			/* server hostname in Domain Name format */
+	int hostname_dn_len;			/* string length of the server hostname in Domain Name format */
+	struct dns_requester *dns_requester;	/* used to link to its DNS resolution */
+	int inter;				/* time in ms */
+	struct list list;			/* Next SRV RQ for the same proxy */
+};
+
 #endif /* _TYPES_DNS_H */
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 5306a3b..a4f3b9e 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -438,6 +438,7 @@
 						 * name is used
 						 */
 	struct list filter_configs;		/* list of the filters that are declared on this proxy */
+	struct list srvrq_list;			/* List of SRV requests associated with this proxy */
 };
 
 struct switching_rule {
diff --git a/include/types/server.h b/include/types/server.h
index 724d496..77263db 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -298,6 +298,7 @@
 		int nb_low;
 		int nb_high;
 	} tmpl_info;
+	struct dns_srvrq *srvrq;		/* Pointer representing the DNS SRV requeest, if any */
 };
 
 /* Descriptor for a "server" keyword. The ->parse() function returns 0 in case of