[svn] commit: r562 - in /branches/parkinglot/src/bin/parkinglot: Makefile.am builtin.cc builtin.h parkinglot.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jan 27 09:15:19 UTC 2010
Author: jinmei
Date: Wed Jan 27 09:15:19 2010
New Revision: 562
Log:
added an experimental implementation of "optimized built-in answers".
this version records pre-rendered authors/version.bind answers and reuses
them to build responses very efficiently.
This implementation intends to show how we can customize the RRset class
by inheritance from the base abstract class to optimize response generation.
Added:
branches/parkinglot/src/bin/parkinglot/builtin.cc
branches/parkinglot/src/bin/parkinglot/builtin.h
Modified:
branches/parkinglot/src/bin/parkinglot/Makefile.am
branches/parkinglot/src/bin/parkinglot/parkinglot.cc
Modified: branches/parkinglot/src/bin/parkinglot/Makefile.am
==============================================================================
--- branches/parkinglot/src/bin/parkinglot/Makefile.am (original)
+++ branches/parkinglot/src/bin/parkinglot/Makefile.am Wed Jan 27 09:15:19 2010
@@ -5,6 +5,7 @@
parkinglot_SOURCES += parkinglot.h main.cc
parkinglot_SOURCES += data_source_plot.h data_source_plot.cc
parkinglot_SOURCES += data_source.h data_source.cc
+parkinglot_SOURCES += builtin.h builtin.cc
parkinglot_LDADD = $(top_srcdir)/src/lib/dns/cpp/.libs/libdns.a
parkinglot_LDADD += $(top_srcdir)/src/lib/config/cpp/libclient.a
parkinglot_LDADD += $(top_srcdir)/src/lib/cc/cpp/libcc.a
Modified: branches/parkinglot/src/bin/parkinglot/parkinglot.cc
==============================================================================
--- branches/parkinglot/src/bin/parkinglot/parkinglot.cc (original)
+++ branches/parkinglot/src/bin/parkinglot/parkinglot.cc Wed Jan 27 09:15:19 2010
@@ -36,6 +36,7 @@
#include <cc/cpp/data.h>
#include "common.h"
+#include "builtin.h"
#include "parkinglot.h"
#include <boost/lexical_cast.hpp>
@@ -106,6 +107,11 @@
};
}
+namespace {
+const Name authors_name("authors.bind");
+const Name version_name("version.bind");
+}
+
void
ParkingLot::processMessage() {
struct sockaddr_storage ss;
@@ -146,7 +152,17 @@
SearchResult::status_type status;
bool included_ns = false;
msg.setRcode(Rcode::NOERROR());
- if (data_source.hasZoneFor(query->getName(), zname)) {
+ if (qtype == RRType::TXT() && qclass == RRClass::CH() &&
+ name == authors_name) {
+ msg.addRRset(Section::ANSWER(), getBuiltinAuthors().getAnswer());
+ msg.addRRset(Section::AUTHORITY(),
+ getBuiltinAuthors().getAuthority());
+ } else if (qtype == RRType::TXT() && qclass == RRClass::CH() &&
+ name == version_name) {
+ msg.addRRset(Section::ANSWER(), getBuiltinVersion().getAnswer());
+ msg.addRRset(Section::AUTHORITY(),
+ getBuiltinVersion().getAuthority());
+ } else if (data_source.hasZoneFor(query->getName(), zname)) {
status = data_source.addToMessage(msg, Section::ANSWER(), zname,
name, qclass, qtype);
// rcode is based on this result?
More information about the bind10-changes
mailing list