mirror of
https://github.com/resiprocate/resiprocate.git
synced 2026-01-12 00:05:02 +08:00
expose already existing possibility to change the DNS servers to the DnsStub API
This commit is contained in:
@@ -450,6 +450,12 @@ AresDns::internalInit(const std::vector<GenericIPAddress>& additionalNameservers
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AresDns::changeNameServers(const std::vector<GenericIPAddress>& additional)
|
||||
{
|
||||
mAdditionalNameservers = additional;
|
||||
}
|
||||
|
||||
bool AresDns::checkDnsChange()
|
||||
{
|
||||
// We must return 'true' if there are changes in the list of DNS servers
|
||||
|
||||
@@ -37,6 +37,7 @@ class AresDns : public ExternalDns, public FdSetIOObserver
|
||||
int internalInit(const std::vector<GenericIPAddress>& additionalNameservers,
|
||||
AfterSocketCreationFuncPtr socketfunc, unsigned int features=0, ares_channeldata** channel = 0, int timeout=0, int tries=0);
|
||||
|
||||
virtual void changeNameServers(const std::vector<GenericIPAddress>& additional);
|
||||
virtual bool checkDnsChange();
|
||||
|
||||
virtual unsigned int getTimeTillNextProcessMS();
|
||||
|
||||
@@ -303,6 +303,17 @@ DnsStub::skipDNSQuestion(const unsigned char *aptr,
|
||||
return aptr;
|
||||
}
|
||||
|
||||
bool
|
||||
DnsStub::changeNameServers(const NameserverList& additional)
|
||||
{
|
||||
if(mDnsProvider)
|
||||
{
|
||||
mDnsProvider->changeNameServers(additional);
|
||||
return mDnsProvider->checkDnsChange();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
DnsStub::checkDnsChange()
|
||||
{
|
||||
|
||||
@@ -182,6 +182,7 @@ class DnsStub : public ExternalDnsHandler
|
||||
void setDnsCacheTTL(int ttl);
|
||||
void setDnsCacheSize(int size);
|
||||
void reloadDnsServers();
|
||||
bool changeNameServers(const NameserverList& additional);
|
||||
bool checkDnsChange();
|
||||
bool supportedType(int);
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ class ExternalDns
|
||||
// reinitializes with the same additionalNameservers and AfterSocketCreationFuncPtr as last call to init
|
||||
virtual int init(int dnsTimeout = 0, int dnsTries = 0, unsigned int features = 0) = 0;
|
||||
|
||||
virtual void changeNameServers(const std::vector<GenericIPAddress>& additional) = 0;
|
||||
//returns 'true' only is there are changes in the DNS server list
|
||||
virtual bool checkDnsChange() = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user