Commit 8677186a authored by Michal Vaner's avatar Michal Vaner

Feed nameservers into a list

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac408@3511 e5f2f494-b856-4b98-b285-d166d9295462
parent 3f191da3
......@@ -17,6 +17,7 @@
#include <boost/shared_ptr.hpp>
#include <config.h>
#include <dns/rdataclass.h>
#include "hash_deleter.h"
#include "nsas_entry_compare.h"
......@@ -57,8 +58,8 @@ typedef shared_ptr<AddressRequestCallback> CallbackPtr;
// One function to call new on both ZoneEntry and NameserverEntry
template<class T>
shared_ptr<T>
newT(const std::string& zone, uint16_t class_code) {
return (shared_ptr<T>(new T(zone, class_code)));
newT(const std::string& name, uint16_t class_code) {
return (shared_ptr<T>(new T(name, class_code)));
}
}
......@@ -91,6 +92,18 @@ NameserverAddressStore::lookup(const std::string& zone, uint16_t class_code,
isc_throw(NotNS, "Authority section with non-NS RR type: " <<
authority.getType().toText());
}
// Make sure the name servers exist
RdataIteratorPtr ns(authority.getRdataIterator());
for (ns->first(); !ns->isLast(); ns->next()) {
Name nsName(dynamic_cast<const rdata::generic::NS&>(
ns->getCurrent()).getNSName());
pair<bool, NameserverPtr> ns_lookup(
nameserver_hash_.getOrAdd(HashKey(nsName.toText(), class_code),
bind(newT<NameserverEntry>, nsName.toText(), class_code)));
if (ns_lookup.first) { // Is it a new nameserver?
// TODO Fill in the values from additional section
}
}
} else { // Was already here
zone_lru_.touch(zone_ptr);
// TODO Do we update the TTL and nameservers here?
......@@ -100,7 +113,7 @@ NameserverAddressStore::lookup(const std::string& zone, uint16_t class_code,
}
void NameserverAddressStore::processZone(ZonePtr) {
}
} // namespace nsas
......
......@@ -103,7 +103,7 @@ protected:
}
// A nameserver serving data
authority_->addRdata(rdata::generic::NS(Name("ns.example.com.")));
authority_->addRdata(ConstRdataPtr(new rdata::generic::NS(Name("ns.example.com."))));
// This is reused because of convenience, clear it just in case
NSASCallback::results.clear();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment