MEDIUM: dns: extract options
DNS selection preferences are actually declared inline in the
struct server. There are copied from the server struct to the
dns_resolution struct for each resolution.
Next patchs adds new preferences options, and it is not a good
way to copy all the configuration information before each dns
resolution.
This patch extract the configuration preference from the struct
server and declares a new dedicated struct. Only a pointer to this
new striuict will be copied before each dns resolution.
diff --git a/include/types/dns.h b/include/types/dns.h
index ea1a9f9..cf784cd 100644
--- a/include/types/dns.h
+++ b/include/types/dns.h
@@ -140,6 +140,10 @@
} counters;
};
+struct dns_options {
+ int family_prio; /* which IP family should the resolver use when both are returned */
+};
+
/*
* resolution structure associated to single server and used to manage name resolution for
* this server.
@@ -155,7 +159,7 @@
/* requester callback, for error management */
char *hostname_dn; /* server hostname in domain name label format */
int hostname_dn_len; /* server domain name label len */
- int resolver_family_priority; /* which IP family should the resolver use when both are returned */
+ struct dns_options *opts; /* IP selection options inherited from the configuration file. */
unsigned int last_resolution; /* time of the lastest valid resolution */
unsigned int last_sent_packet; /* time of the latest DNS packet sent */
unsigned int last_status_change; /* time of the latest DNS resolution status change */