|
@@ -0,0 +1,57 @@
|
|
|
+// Copyright (C) 2010 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.
|
|
|
+
|
|
|
+// $Id$
|
|
|
+
|
|
|
+#ifndef _LOCAL_ZONE_DATA
|
|
|
+#define _LOCAL_ZONE_DATA
|
|
|
+
|
|
|
+#include <map>
|
|
|
+#include <string>
|
|
|
+#include <boost/shared_ptr.hpp>
|
|
|
+#include <dns/rrset.h>
|
|
|
+
|
|
|
+namespace isc {
|
|
|
+namespace cache {
|
|
|
+
|
|
|
+/// \brief Local Zone Data
|
|
|
+/// The object of LocalZoneData represents the data of one
|
|
|
+/// local zone. It provides the interface for lookup the rrsets
|
|
|
+/// in the zone.
|
|
|
+class LocalZoneData {
|
|
|
+public:
|
|
|
+ LocalZoneData(uint16_t rrset_class) : class_(rrset_class)
|
|
|
+ {}
|
|
|
+
|
|
|
+ /// \brief Look up one rrset.
|
|
|
+ /// \return return the shared_ptr of rrset if it can
|
|
|
+ /// found in the local zone, or else, return NULL.
|
|
|
+ RRsetPtr lookup(const isc::dns::Name& qname,
|
|
|
+ const isc::dns::RRType& qtype);
|
|
|
+
|
|
|
+ /// \brief Update the rrset in the local zone. If the
|
|
|
+ /// the rrset doesn't exist, it will be added directly,
|
|
|
+ /// or else, the existed one will be overwrited.
|
|
|
+ void update(const isc::dns::RRset& rrset);
|
|
|
+
|
|
|
+private:
|
|
|
+ std::map<std::string, RRsetPtr> rrsets_map_; // RRsets of the zone
|
|
|
+ uint16_t class_; // The class of the zone
|
|
|
+};
|
|
|
+
|
|
|
+} // namespace cache
|
|
|
+} // namespace isc
|
|
|
+
|
|
|
+#endif // _LOCAL_ZONE_DATA
|
|
|
+
|