Commit 699b22f2 authored by Jeremy C. Reed's avatar Jeremy C. Reed
Browse files

[master]Merge branch 'master' of ssh://git.bind10.isc.org/var/bind10/git/bind10

parents 041dbdee 31c9326b
SUBDIRS = memory . tests
SUBDIRS = . memory tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
......@@ -64,7 +64,6 @@ libb10_datasrc_la_LIBADD = $(top_builddir)/src/lib/exceptions/libb10-exceptions.
libb10_datasrc_la_LIBADD += $(top_builddir)/src/lib/dns/libb10-dns++.la
libb10_datasrc_la_LIBADD += $(top_builddir)/src/lib/log/libb10-log.la
libb10_datasrc_la_LIBADD += $(top_builddir)/src/lib/cc/libb10-cc.la
libb10_datasrc_la_LIBADD += memory/libdatasrc_memory.la # convenience library
libb10_datasrc_la_LIBADD += $(SQLITE_LIBS)
BUILT_SOURCES = datasrc_config.h datasrc_messages.h datasrc_messages.cc
......
......@@ -16,9 +16,10 @@ libdatasrc_memory_la_SOURCES += treenode_rrset.h treenode_rrset.cc
libdatasrc_memory_la_SOURCES += rdata_serialization.h rdata_serialization.cc
libdatasrc_memory_la_SOURCES += zone_data.h zone_data.cc
libdatasrc_memory_la_SOURCES += segment_object_holder.h
libdatasrc_memory_la_SOURCES += zone_table.h zone_table.cc
libdatasrc_memory_la_SOURCES += memory_client.h memory_client.cc
libdatasrc_memory_la_SOURCES += logger.h logger.cc
libdatasrc_memory_la_SOURCES += zone_table.h zone_table.cc
libdatasrc_memory_la_SOURCES += zone_finder.h zone_finder.cc
nodist_libdatasrc_memory_la_SOURCES = memory_messages.h memory_messages.cc
EXTRA_DIST = rdata_serialization_priv.cc
......
......@@ -27,6 +27,8 @@ run_unittests_SOURCES += domaintree_unittest.cc
run_unittests_SOURCES += treenode_rrset_unittest.cc
run_unittests_SOURCES += zone_table_unittest.cc
run_unittests_SOURCES += zone_data_unittest.cc
run_unittests_SOURCES += zone_finder_unittest.cc
run_unittests_SOURCES += ../../tests/faked_nsec3.h ../../tests/faked_nsec3.cc
run_unittests_SOURCES += memory_segment_test.h
run_unittests_SOURCES += segment_object_holder_unittest.cc
run_unittests_SOURCES += memory_client_unittest.cc
......@@ -35,6 +37,7 @@ run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
run_unittests_LDADD = $(builddir)/../libdatasrc_memory.la
run_unittests_LDADD += $(top_builddir)/src/lib/datasrc/libb10-datasrc.la
run_unittests_LDADD += $(top_builddir)/src/lib/dns/libb10-dns++.la
run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
run_unittests_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
......
This diff is collapsed.
......@@ -260,6 +260,8 @@ private:
mutable dns::RRTTL* ttl_;
};
typedef boost::shared_ptr<TreeNodeRRset> TreeNodeRRsetPtr;
} // namespace memory
} // namespace datasrc
} // namespace isc
......
This diff is collapsed.
// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#ifndef DATASRC_MEMORY_ZONE_FINDER_H
#define DATASRC_MEMORY_ZONE_FINDER_H 1
#include <datasrc/memory/zone_data.h>
#include <datasrc/memory/treenode_rrset.h>
#include <datasrc/zone.h>
#include <dns/name.h>
#include <dns/rrset.h>
#include <dns/rrtype.h>
namespace isc {
namespace datasrc {
namespace memory {
class ZoneFinderResultContext {
public:
/// \brief Constructor
///
/// The first three parameters correspond to those of
/// ZoneFinder::ResultContext. If node is non NULL, it specifies the
/// found RBNode in the search.
ZoneFinderResultContext(ZoneFinder::Result code_param,
TreeNodeRRsetPtr rrset_param,
ZoneFinder::FindResultFlags flags_param,
const ZoneNode* node) :
code(code_param), rrset(rrset_param), flags(flags_param),
found_node(node)
{}
const ZoneFinder::Result code;
const TreeNodeRRsetPtr rrset;
const ZoneFinder::FindResultFlags flags;
const ZoneNode* const found_node;
};
/// A derived zone finder class intended to be used with the memory data
/// source, using ZoneData for its contents.
class InMemoryZoneFinder : boost::noncopyable, public ZoneFinder {
public:
/// \brief Constructor.
///
/// Since ZoneData does not keep RRClass information, but this
/// information is needed in order to construct actual RRsets,
/// this needs to be passed here (the datasource client should
/// have this information). In the future, this may be replaced
/// by some construction to pull TreeNodeRRsets from a pool, but
/// currently, these are created dynamically with the given RRclass
///
/// \param zone_data The ZoneData containing the zone.
/// \param rrclass The RR class of the zone
InMemoryZoneFinder(const ZoneData& zone_data,
const isc::dns::RRClass& rrclass) :
zone_data_(zone_data),
rrclass_(rrclass)
{}
/// \brief Find an RRset in the datasource
virtual boost::shared_ptr<ZoneFinder::Context> find(
const isc::dns::Name& name,
const isc::dns::RRType& type,
const FindOptions options = FIND_DEFAULT);
/// \brief Version of find that returns all types at once
///
/// It acts the same as find, just that when the correct node is found,
/// all the RRsets are filled into the target parameter instead of being
/// returned by the result.
virtual boost::shared_ptr<ZoneFinder::Context> findAll(
const isc::dns::Name& name,
std::vector<isc::dns::ConstRRsetPtr>& target,
const FindOptions options = FIND_DEFAULT);
/// Look for NSEC3 for proving (non)existence of given name.
///
/// See documentation in \c Zone.
virtual FindNSEC3Result
findNSEC3(const isc::dns::Name& name, bool recursive);
/// \brief Returns the origin of the zone.
virtual isc::dns::Name getOrigin() const {
return zone_data_.getOriginNode()->getName();
}
/// \brief Returns the RR class of the zone.
virtual isc::dns::RRClass getClass() const {
return rrclass_;
}
private:
/// \brief In-memory version of finder context.
///
/// The implementation (and any specialized interface) is completely local
/// to the InMemoryZoneFinder class, so it's defined as private
class Context;
/// Actual implementation for both find() and findAll()
ZoneFinderResultContext find_internal(
const isc::dns::Name& name,
const isc::dns::RRType& type,
std::vector<isc::dns::ConstRRsetPtr>* target,
const FindOptions options =
FIND_DEFAULT);
const ZoneData& zone_data_;
const isc::dns::RRClass& rrclass_;
};
} // namespace memory
} // namespace datasrc
} // namespace isc
#endif // DATASRC_MEMORY_ZONE_FINDER_H
......@@ -91,10 +91,16 @@ matchRdata(const char*, const char*,
void
setRRset(RRsetPtr rrset, RRsetPtr* rrsetp) {
if (*rrsetp) {
isc_throw(isc::Unexpected,
"multiple RRsets are given to textToRRset");
// may be a sig
if (rrset->getType() == RRType::RRSIG()) {
(*rrsetp)->addRRsig(rrset);
} else {
isc_throw(isc::Unexpected,
"multiple RRsets are given to textToRRset");
}
} else {
*rrsetp = rrset;
}
*rrsetp = rrset;
}
}
......
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