Browse Source

Merge branch 'master' into trac2054

Mukund Sivaraman 12 years ago
parent
commit
4f9f077ffa

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+456.	[bug]		muks
+	BIND 10 now compiles against log4cplus-1.1.0 (RC releases)
+	also. Thanks to John Lumby for sending a patch.
+	(Trac #2169, git 7d7e5269d57451191c0aef1b127d292d3615fe2c)
+
 455.	[func]*		vorner
 455.	[func]*		vorner
 	The server now uses newer API for data sources. This would be an
 	The server now uses newer API for data sources. This would be an
 	internal change, however, the data sources are now configured
 	internal change, however, the data sources are now configured

+ 8 - 0
src/bin/auth/tests/testdata/.gitignore

@@ -0,0 +1,8 @@
+/badExampleQuery_fromWire.wire
+/examplequery_fromWire.wire
+/iqueryresponse_fromWire.wire
+/multiquestion_fromWire.wire
+/queryBadEDNS_fromWire.wire
+/shortanswer_fromWire.wire
+/simplequery_fromWire.wire
+/simpleresponse_fromWire.wire

+ 2 - 0
src/bin/cfgmgr/plugins/.gitignore

@@ -0,0 +1,2 @@
+/datasrc.spec
+/datasrc.spec.pre

+ 2 - 4
src/bin/msgq/b10-msgq.8

@@ -2,12 +2,12 @@
 .\"     Title: b10-msgq
 .\"     Title: b10-msgq
 .\"    Author: [see the "AUTHORS" section]
 .\"    Author: [see the "AUTHORS" section]
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: August 4, 2010
+.\"      Date: June 25, 2012
 .\"    Manual: BIND10
 .\"    Manual: BIND10
 .\"    Source: BIND10
 .\"    Source: BIND10
 .\"  Language: English
 .\"  Language: English
 .\"
 .\"
-.TH "B10\-MSGQ" "8" "August 4, 2010" "BIND10" "BIND10"
+.TH "B10\-MSGQ" "8" "June 25, 2012" "BIND10" "BIND10"
 .\" -----------------------------------------------------------------
 .\" -----------------------------------------------------------------
 .\" * set default formatting
 .\" * set default formatting
 .\" -----------------------------------------------------------------
 .\" -----------------------------------------------------------------
@@ -87,8 +87,6 @@ is assigned a unique identifier \-\- this is the local name\&. The commands it h
 .sp
 .sp
 .RE
 .RE
 .PP
 .PP
-It listens on 127\&.0\&.0\&.1\&.
-.PP
 The
 The
 \fBb10\-msgq\fR
 \fBb10\-msgq\fR
 daemon may be cleanly stopped by sending the SIGTERM signal to the process\&. This shutdown does not notify the subscribers\&.
 daemon may be cleanly stopped by sending the SIGTERM signal to the process\&. This shutdown does not notify the subscribers\&.

+ 1 - 0
src/lib/datasrc/memory/tests/.gitignore

@@ -0,0 +1 @@
+/run_unittests

+ 35 - 0
src/lib/datasrc/rbtree.h

@@ -221,6 +221,26 @@ public:
         return (dns::LabelSequence(getLabelsData()));
         return (dns::LabelSequence(getLabelsData()));
     }
     }
 
 
+    /// \brief Return the absolute label sequence of the node.
+    ///
+    /// This method returns the label sequence corresponding to the full
+    /// name of the node; i.e. the entire name as it appears in the zone.
+    ///
+    /// It takes the (partial) name of the node itself, and extends it
+    /// with all upper nodes.
+    ///
+    /// \note Care must be taken with the buffer that is used here; this
+    /// method overwrites its data, so it should not be associated with
+    /// any other LabelSequence during the lifetime of the LabelSequence
+    /// returned by this method. See LabelSequence::extend(), which is used
+    /// by this method.
+    ///
+    /// \param buf A data buffer where the label sequence will be built.
+    ///            The data in this buffer will be overwritten by this call.
+    /// \return A LabelSequence with the absolute name of this node.
+    isc::dns::LabelSequence getAbsoluteLabels(
+        uint8_t buf[isc::dns::LabelSequence::MAX_SERIALIZED_LENGTH]) const;
+
     /// \brief Return the data stored in this node.
     /// \brief Return the data stored in this node.
     ///
     ///
     /// You should not delete the data, it is handled by shared pointers.
     /// You should not delete the data, it is handled by shared pointers.
@@ -503,6 +523,21 @@ RBNode<T>::getUpperNode() const {
 }
 }
 
 
 template <typename T>
 template <typename T>
+isc::dns::LabelSequence
+RBNode<T>::getAbsoluteLabels(
+    uint8_t buf[isc::dns::LabelSequence::MAX_SERIALIZED_LENGTH]) const
+{
+    isc::dns::LabelSequence result(getLabels(), buf);
+    const RBNode<T>* upper = getUpperNode();
+    while (upper != NULL) {
+        result.extend(upper->getLabels(), buf);
+        upper = upper->getUpperNode();
+    }
+
+    return (result);
+}
+
+template <typename T>
 const RBNode<T>*
 const RBNode<T>*
 RBNode<T>::abstractSuccessor(typename RBNode<T>::RBNodePtr RBNode<T>::*left,
 RBNode<T>::abstractSuccessor(typename RBNode<T>::RBNodePtr RBNode<T>::*left,
                              typename RBNode<T>::RBNodePtr RBNode<T>::*right)
                              typename RBNode<T>::RBNodePtr RBNode<T>::*right)

+ 53 - 0
src/lib/datasrc/tests/rbtree_unittest.cc

@@ -104,6 +104,7 @@ protected:
     RBTree<int>& rbtree_expose_empty_node;
     RBTree<int>& rbtree_expose_empty_node;
     RBNode<int>* rbtnode;
     RBNode<int>* rbtnode;
     const RBNode<int>* crbtnode;
     const RBNode<int>* crbtnode;
+    uint8_t buf[LabelSequence::MAX_SERIALIZED_LENGTH];
 };
 };
 
 
 TEST_F(RBTreeTest, nodeCount) {
 TEST_F(RBTreeTest, nodeCount) {
@@ -449,6 +450,11 @@ TEST_F(RBTreeTest, chainLevel) {
               tree.find(node_name, &crbtnode, chain));
               tree.find(node_name, &crbtnode, chain));
     EXPECT_EQ(1, chain.getLevelCount());
     EXPECT_EQ(1, chain.getLevelCount());
 
 
+    // Check the name of the found node (should have '.' as both non-absolute
+    // and absolute name
+    EXPECT_EQ(".", crbtnode->getLabels().toText());
+    EXPECT_EQ(".", crbtnode->getAbsoluteLabels(buf).toText());
+
     /*
     /*
      * Now creating a possibly deepest tree with MAX_LABELS levels.
      * Now creating a possibly deepest tree with MAX_LABELS levels.
      * it should look like:
      * it should look like:
@@ -472,6 +478,12 @@ TEST_F(RBTreeTest, chainLevel) {
         EXPECT_EQ(RBTree<int>::EXACTMATCH,
         EXPECT_EQ(RBTree<int>::EXACTMATCH,
                   tree.find(node_name, &crbtnode, found_chain));
                   tree.find(node_name, &crbtnode, found_chain));
         EXPECT_EQ(i, found_chain.getLevelCount());
         EXPECT_EQ(i, found_chain.getLevelCount());
+
+        // The non-absolute name should only have the first label
+        EXPECT_EQ("a", crbtnode->getLabels().toText());
+        // But the absolute name should have all labels
+        EXPECT_EQ(node_name.toText(),
+                  crbtnode->getAbsoluteLabels(buf).toText());
     }
     }
 
 
     // Confirm the last inserted name has the possible maximum length with
     // Confirm the last inserted name has the possible maximum length with
@@ -1018,4 +1030,45 @@ TEST_F(RBTreeTest, root) {
               root.find(Name("example.com"), &crbtnode));
               root.find(Name("example.com"), &crbtnode));
     EXPECT_EQ(rbtnode, crbtnode);
     EXPECT_EQ(rbtnode, crbtnode);
 }
 }
+
+TEST_F(RBTreeTest, getAbsoluteLabels) {
+    // The full absolute names of the nodes in the tree
+    // with the addition of the explicit root node
+    const char* const domain_names[] = {
+        "c", "b", "a", "x.d.e.f", "z.d.e.f", "g.h", "i.g.h", "o.w.y.d.e.f",
+        "j.z.d.e.f", "p.w.y.d.e.f", "q.w.y.d.e.f", "k.g.h"};
+    // The names of the nodes themselves, as they end up in the tree
+    const char* const first_labels[] = {
+        "c", "b", "a", "x", "z", "g.h", "i", "o",
+        "j", "p", "q", "k"};
+
+    const int name_count = sizeof(domain_names) / sizeof(domain_names[0]);
+    for (int i = 0; i < name_count; ++i) {
+        EXPECT_EQ(RBTree<int>::EXACTMATCH, rbtree.find(Name(domain_names[i]),
+                  &crbtnode));
+
+        // First make sure the names themselves are not absolute
+        const LabelSequence ls(crbtnode->getLabels());
+        EXPECT_EQ(first_labels[i], ls.toText());
+        EXPECT_FALSE(ls.isAbsolute());
+
+        // Now check the absolute names
+        const LabelSequence abs_ls(crbtnode->getAbsoluteLabels(buf));
+        EXPECT_EQ(Name(domain_names[i]).toText(), abs_ls.toText());
+        EXPECT_TRUE(abs_ls.isAbsolute());
+    }
+
+    // Explicitly add and find a root node, to see that getAbsoluteLabels
+    // also works when getLabels() already returns an absolute LabelSequence
+    rbtree.insert(mem_sgmt_, Name("."), &rbtnode);
+    rbtnode->setData(RBNode<int>::NodeDataPtr(new int(1)));
+
+    EXPECT_EQ(RBTree<int>::EXACTMATCH, rbtree.find(Name("."), &crbtnode));
+
+    EXPECT_TRUE(crbtnode->getLabels().isAbsolute());
+    EXPECT_EQ(".", crbtnode->getLabels().toText());
+    EXPECT_TRUE(crbtnode->getAbsoluteLabels(buf).isAbsolute());
+    EXPECT_EQ(".", crbtnode->getAbsoluteLabels(buf).toText());
+}
+
 }
 }

+ 1 - 0
src/lib/log/logger_impl.cc

@@ -22,6 +22,7 @@
 #include <boost/static_assert.hpp>
 #include <boost/static_assert.hpp>
 
 
 #include <log4cplus/configurator.h>
 #include <log4cplus/configurator.h>
+#include <log4cplus/loggingmacros.h>
 
 
 #include <log/logger.h>
 #include <log/logger.h>
 #include <log/logger_impl.h>
 #include <log/logger_impl.h>

+ 5 - 3
src/lib/log/logger_level_impl.cc

@@ -185,20 +185,22 @@ LoggerLevelImpl::logLevelFromString(const log4cplus::tstring& level) {
 
 
 // Convert logging level to string.  If the level is a valid debug level,
 // Convert logging level to string.  If the level is a valid debug level,
 // return the string DEBUG, else return the empty string.
 // return the string DEBUG, else return the empty string.
-log4cplus::tstring
+LoggerLevelImpl::LogLevelString
 LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) {
 LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) {
+    static const tstring debug_string("DEBUG");
+    static const tstring empty_string;
     Level bindlevel = convertToBindLevel(level);
     Level bindlevel = convertToBindLevel(level);
     Severity& severity = bindlevel.severity;
     Severity& severity = bindlevel.severity;
     int& dbglevel = bindlevel.dbglevel;
     int& dbglevel = bindlevel.dbglevel;
 
 
     if ((severity == DEBUG) &&
     if ((severity == DEBUG) &&
         ((dbglevel >= MIN_DEBUG_LEVEL) && (dbglevel <= MAX_DEBUG_LEVEL))) {
         ((dbglevel >= MIN_DEBUG_LEVEL) && (dbglevel <= MAX_DEBUG_LEVEL))) {
-        return (tstring("DEBUG"));
+        return (debug_string);
     }
     }
 
 
     // Unknown, so return empty string for log4cplus to try other conversion
     // Unknown, so return empty string for log4cplus to try other conversion
     // functions.
     // functions.
-    return (tstring());
+    return (empty_string);
 }
 }
 
 
 // Initialization.  Register the conversion functions with the LogLevelManager.
 // Initialization.  Register the conversion functions with the LogLevelManager.

+ 8 - 1
src/lib/log/logger_level_impl.h

@@ -16,6 +16,7 @@
 #define __LOGGER_LEVEL_IMPL_H
 #define __LOGGER_LEVEL_IMPL_H
 
 
 #include <log4cplus/logger.h>
 #include <log4cplus/logger.h>
+#include <log4cplus/version.h>
 #include <log/logger_level.h>
 #include <log/logger_level.h>
 
 
 namespace isc {
 namespace isc {
@@ -65,6 +66,12 @@ namespace log {
 class LoggerLevelImpl {
 class LoggerLevelImpl {
 public:
 public:
 
 
+#if (LOG4CPLUS_VERSION >= LOG4CPLUS_MAKE_VERSION(1, 1, 0))
+    typedef log4cplus::tstring const & LogLevelString;
+#else
+    typedef log4cplus::tstring LogLevelString;
+#endif
+
     /// \brief Convert BIND 10 level to log4cplus logging level
     /// \brief Convert BIND 10 level to log4cplus logging level
     ///
     ///
     /// Converts the BIND 10 severity level into a log4cplus logging level.
     /// Converts the BIND 10 severity level into a log4cplus logging level.
@@ -112,7 +119,7 @@ public:
     /// \param level Extended logging level
     /// \param level Extended logging level
     ///
     ///
     /// \return Equivalent string.
     /// \return Equivalent string.
-    static log4cplus::tstring logLevelToString(log4cplus::LogLevel level);
+    static LogLevelString logLevelToString(log4cplus::LogLevel level);
 
 
     /// \brief Initialize extended logging levels
     /// \brief Initialize extended logging levels
     ///
     ///

+ 1 - 0
src/lib/log/logger_manager_impl.cc

@@ -17,6 +17,7 @@
 
 
 #include <log4cplus/logger.h>
 #include <log4cplus/logger.h>
 #include <log4cplus/configurator.h>
 #include <log4cplus/configurator.h>
+#include <log4cplus/hierarchy.h>
 #include <log4cplus/consoleappender.h>
 #include <log4cplus/consoleappender.h>
 #include <log4cplus/fileappender.h>
 #include <log4cplus/fileappender.h>
 #include <log4cplus/syslogappender.h>
 #include <log4cplus/syslogappender.h>