[svn] commit: r3673 - in /branches/trac408/src/lib/nsas: nameserver_entry.cc resolver_interface.h tests/nsas_test.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Nov 30 12:30:16 UTC 2010
Author: vorner
Date: Tue Nov 30 12:30:15 2010
New Revision: 3673
Log:
More convenient resolver interface
It does not return the whole message, just the RRset. This way we can
extract the data easier and it can be provided directly from cache.
Modified:
branches/trac408/src/lib/nsas/nameserver_entry.cc
branches/trac408/src/lib/nsas/resolver_interface.h
branches/trac408/src/lib/nsas/tests/nsas_test.h
Modified: branches/trac408/src/lib/nsas/nameserver_entry.cc
==============================================================================
--- branches/trac408/src/lib/nsas/nameserver_entry.cc (original)
+++ branches/trac408/src/lib/nsas/nameserver_entry.cc Tue Nov 30 12:30:15 2010
@@ -297,45 +297,30 @@
family_(family),
type_(type)
{ }
- virtual void success(const Message& response) {
+ virtual void success(shared_ptr<AbstractRRset> response) {
Lock lock(entry_->mutex_);
vector<AddressEntry> entries;
- bool found(false);
- for (RRsetIterator set(
- // TODO Trunk does Section::ANSWER() by constant
- response.beginSection(Section::ANSWER()));
- set != response.endSection(Section::ANSWER()); ++ set)
+ if (response->getType() != type_ ||
+ response->getClass() != RRClass(entry_->getClass()))
{
- if (found) {
- // TODO Log this
- // There are more than one RRset in the answer,
- // this shouldn't happen
- failureInternal(lock);
- return;
- }
-
- if ((*set)->getType() != type_ ||
- (*set)->getClass() != RRClass(entry_->getClass()))
- {
- // TODO Log we got answer of different type
- failureInternal(lock);
- return;
- }
-
- /**
- * TODO Move to common function, this is similar to
- * what is in constructor.
- */
- RdataIteratorPtr i((*set)->getRdataIterator());
- // TODO Remove at merge with trunk
- i->first();
- while (! i->isLast()) {
- entries.push_back(AddressEntry(IOAddress(
- i->getCurrent().toText()), ++ rtt_));
- i->next();
- }
+ // TODO Log we got answer of different type
+ failureInternal(lock);
+ return;
+ }
+
+ /**
+ * TODO Move to common function, this is similar to
+ * what is in constructor.
+ */
+ RdataIteratorPtr i(response->getRdataIterator());
+ // TODO Remove at merge with trunk
+ i->first();
+ while (! i->isLast()) {
+ entries.push_back(AddressEntry(IOAddress(
+ i->getCurrent().toText()), ++ rtt_));
+ i->next();
}
if (entries.empty()) {
Modified: branches/trac408/src/lib/nsas/resolver_interface.h
==============================================================================
--- branches/trac408/src/lib/nsas/resolver_interface.h (original)
+++ branches/trac408/src/lib/nsas/resolver_interface.h Tue Nov 30 12:30:15 2010
@@ -18,6 +18,7 @@
#define __RESOLVER_INTERFACE_H
#include <dns/message.h>
+#include <dns/rrset.h>
/**
* \file resolver_interface.h
@@ -45,7 +46,8 @@
class Callback {
public:
/// \short Some data arrived.
- virtual void success(const isc::dns::Message& response) = 0;
+ virtual void success(boost::shared_ptr<isc::dns::AbstractRRset>
+ response) = 0;
/**
* \short No data available.
*
Modified: branches/trac408/src/lib/nsas/tests/nsas_test.h
==============================================================================
--- branches/trac408/src/lib/nsas/tests/nsas_test.h (original)
+++ branches/trac408/src/lib/nsas/tests/nsas_test.h Tue Nov 30 12:30:15 2010
@@ -274,10 +274,7 @@
RRsetPtr set(new RRset(name, RRClass::IN(),
type, RRTTL(TTL)));
set->addRdata(rdata);
- Message address(Message::RENDER); // Not able to create different one
- address.addRRset(Section::ANSWER(), set);
- address.addQuestion(requests[index].first);
- requests[index].second->success(address);
+ requests[index].second->success(set);
}
};
More information about the bind10-changes
mailing list