[svn] commit: r3326 - in /branches/trac383: ./ src/bin/auth/ src/bin/auth/tests/ src/bin/recurse/ src/bin/recurse/tests/ src/lib/asiolink/

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Oct 22 15:48:51 UTC 2010


Author: jelte
Date: Fri Oct 22 15:48:50 2010
New Revision: 3326

Log:
sync trac327

Modified:
    branches/trac383/   (props changed)
    branches/trac383/src/bin/auth/auth_srv.cc
    branches/trac383/src/bin/auth/auth_srv.h
    branches/trac383/src/bin/auth/main.cc
    branches/trac383/src/bin/auth/tests/auth_srv_unittest.cc
    branches/trac383/src/bin/auth/tests/mockups.h
    branches/trac383/src/bin/recurse/main.cc
    branches/trac383/src/bin/recurse/recursor.cc
    branches/trac383/src/bin/recurse/recursor.h
    branches/trac383/src/bin/recurse/tests/Makefile.am
    branches/trac383/src/lib/asiolink/Makefile.am
    branches/trac383/src/lib/asiolink/ioaddress.h

Modified: branches/trac383/src/bin/auth/auth_srv.cc
==============================================================================
--- branches/trac383/src/bin/auth/auth_srv.cc (original)
+++ branches/trac383/src/bin/auth/auth_srv.cc Fri Oct 22 15:48:50 2010
@@ -78,23 +78,26 @@
                           OutputBufferPtr buffer);
     bool processNotify(const IOMessage& io_message, MessagePtr message, 
                        OutputBufferPtr buffer);
+
+    /// Currently non-configurable, but will be.
+    static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
+
+    /// These members are public because AuthSrv accesses them directly.
+    ModuleCCSession* config_session_;
+    bool verbose_mode_;
+    AbstractSession* xfrin_session_;
+
+private:
     std::string db_file_;
-    ModuleCCSession* config_session_;
+
     MetaDataSrc data_sources_;
     /// We keep a pointer to the currently running sqlite datasource
     /// so that we can specifically remove that one should the database
     /// file change
     ConstDataSrcPtr cur_datasrc_;
 
-    bool verbose_mode_;
-
-    AbstractSession* xfrin_session_;
-
     bool xfrout_connected_;
     AbstractXfroutClient& xfrout_client_;
-
-    /// Currently non-configurable, but will be.
-    static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
 
     /// Hot spot cache
     isc::datasrc::HotCache cache_;

Modified: branches/trac383/src/bin/auth/auth_srv.h
==============================================================================
--- branches/trac383/src/bin/auth/auth_srv.h (original)
+++ branches/trac383/src/bin/auth/auth_srv.h Fri Oct 22 15:48:50 2010
@@ -56,12 +56,27 @@
     //@}
 
     /// \brief Process an incoming DNS message, then signal 'server' to resume 
+    ///
+    /// A DNS query (or other message) has been received by a \c DNSServer
+    /// object.  Find an answer, then post the \c DNSServer object on the
+    /// I/O service queue and return.  When the server resumes, it can
+    /// send the reply.
+    ///
+    /// \param io_message The raw message received
+    /// \param message Pointer to the \c Message object
+    /// \param buffer Pointer to an \c OutputBuffer for the resposne
+    /// \param server Pointer to the \c DNSServer
     void processMessage(const asiolink::IOMessage& io_message,
                         isc::dns::MessagePtr message,
                         isc::dns::OutputBufferPtr buffer,
                         asiolink::DNSServer* server);
-    // \brief Set and get verbose mode
+
+    /// \brief Set verbose flag
+    ///
+    /// \param on The new value of the verbose flag
     void setVerbose(bool on);
+
+    /// \brief Get the current value of the verbose flag
     bool getVerbose() const;
 
     /// \brief Set and get the config session

Modified: branches/trac383/src/bin/auth/main.cc
==============================================================================
--- branches/trac383/src/bin/auth/main.cc (original)
+++ branches/trac383/src/bin/auth/main.cc Fri Oct 22 15:48:50 2010
@@ -57,6 +57,7 @@
 
 static bool verbose_mode = false;
 
+// Default port current 5300 for testing purposes
 static const string PROGRAM = "Auth";
 static const char* DNSPORT = "5300";
 
@@ -89,11 +90,13 @@
 
 void
 usage() {
-    cerr << "Usage:  b10-auth [-a address] [-p port] [-4|-6] [-nv]" << endl;
+    cerr << "Usage:  b10-auth [-a address] [-p port] [-u user] [-4|-6] [-nv]"
+         << endl;
     cerr << "\t-a: specify the address to listen on (default: all) " << endl;
-    cerr << "\t-p: specify the port to listen on (default: 5300)" << endl;
+    cerr << "\t-p: specify the port to listen on (default: " << DNSPORT << ")"
+         << endl;
     cerr << "\t-4: listen on all IPv4 addresses (incompatible with -a)" << endl;
-    cerr << "\t-4: listen on all IPv6 addresses (incompatible with -a)" << endl;
+    cerr << "\t-6: listen on all IPv6 addresses (incompatible with -a)" << endl;
     cerr << "\t-n: do not cache answers in memory" << endl;
     cerr << "\t-u: change process UID to the specified user" << endl;
     cerr << "\t-v: verbose output" << endl;

Modified: branches/trac383/src/bin/auth/tests/auth_srv_unittest.cc
==============================================================================
--- branches/trac383/src/bin/auth/tests/auth_srv_unittest.cc (original)
+++ branches/trac383/src/bin/auth/tests/auth_srv_unittest.cc Fri Oct 22 15:48:50 2010
@@ -387,11 +387,11 @@
 
     // An internal command message should have been created and sent to an
     // external module.  Check them.
-    EXPECT_EQ("Zonemgr", notify_session.msg_destination);
+    EXPECT_EQ("Zonemgr", notify_session.getMessageDest());
     EXPECT_EQ("notify",
-              notify_session.sent_msg->get("command")->get(0)->stringValue());
+              notify_session.getSentMessage()->get("command")->get(0)->stringValue());
     ConstElementPtr notify_args =
-        notify_session.sent_msg->get("command")->get(1);
+        notify_session.getSentMessage()->get("command")->get(1);
     EXPECT_EQ("example.com.", notify_args->get("zone_name")->stringValue());
     EXPECT_EQ(DEFAULT_REMOTE_ADDRESS,
               notify_args->get("master")->stringValue());
@@ -420,7 +420,7 @@
     // Other conditions should be the same, so simply confirm the RR class is
     // set correctly.
     ConstElementPtr notify_args =
-        notify_session.sent_msg->get("command")->get(1);
+        notify_session.getSentMessage()->get("command")->get(1);
     EXPECT_EQ("CH", notify_args->get("zone_class")->stringValue());
 }
 

Modified: branches/trac383/src/bin/auth/tests/mockups.h
==============================================================================
--- branches/trac383/src/bin/auth/tests/mockups.h (original)
+++ branches/trac383/src/bin/auth/tests/mockups.h Fri Oct 22 15:48:50 2010
@@ -45,8 +45,8 @@
                       "mock session send is disabled for test");
         }
 
-        sent_msg = msg;
-        msg_destination = group;
+        sent_msg_ = msg;
+        msg_dest_ = group;
         return (0);
     }
 
@@ -83,13 +83,17 @@
     virtual void setTimeout(size_t timeout UNUSED_PARAM) {};
     virtual size_t getTimeout() const { return 0; };
 
+    // The following methods extent AbstractSession to allow testing:
     void setMessage(isc::data::ConstElementPtr msg) { msg_ = msg; }
     void disableSend() { send_ok_ = false; }
     void disableReceive() { receive_ok_ = false; }
 
-    isc::data::ConstElementPtr sent_msg;
-    std::string msg_destination;
+    isc::data::ConstElementPtr getSentMessage() { return (sent_msg_); }
+    std::string getMessageDest() { return (msg_dest_); }
+
 private:
+    isc::data::ConstElementPtr sent_msg_;
+    std::string msg_dest_;
     isc::data::ConstElementPtr msg_;
     bool send_ok_;
     bool receive_ok_;

Modified: branches/trac383/src/bin/recurse/main.cc
==============================================================================
--- branches/trac383/src/bin/recurse/main.cc (original)
+++ branches/trac383/src/bin/recurse/main.cc Fri Oct 22 15:48:50 2010
@@ -59,6 +59,7 @@
 
 static bool verbose_mode = false;
 
+// Default port current 5300 for testing purposes
 static const string PROGRAM = "Recurse";
 static const char* DNSPORT = "5300";
 
@@ -87,14 +88,15 @@
 
 void
 usage() {
-    cerr << "Usage:  b10-recurse -f nameserver [-a address] [-p port] "
+    cerr << "Usage:  b10-recurse -f nameserver [-a address] [-p port] [-u user]"
                      "[-4|-6] [-v]" << endl;
     cerr << "\t-f: specify the nameserver to which queries should be forwarded"
          << endl;
     cerr << "\t-a: specify the address to listen on (default: all)" << endl;
-    cerr << "\t-p: specify the port to listen on (default: 5300)" << endl;
+    cerr << "\t-p: specify the port to listen on (default: " << DNSPORT << ")"
+         << endl;
     cerr << "\t-4: listen on all IPv4 addresses (incompatible with -a)" << endl;
-    cerr << "\t-4: listen on all IPv6 addresses (incompatible with -a)" << endl;
+    cerr << "\t-6: listen on all IPv6 addresses (incompatible with -a)" << endl;
     cerr << "\t-u: change process UID to the specified user" << endl;
     cerr << "\t-v: verbose output" << endl;
     exit(1);

Modified: branches/trac383/src/bin/recurse/recursor.cc
==============================================================================
--- branches/trac383/src/bin/recurse/recursor.cc (original)
+++ branches/trac383/src/bin/recurse/recursor.cc Fri Oct 22 15:48:50 2010
@@ -86,18 +86,19 @@
                             OutputBufferPtr buffer,
                             DNSServer* server);
 
+    /// Currently non-configurable, but will be.
+    static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
+
+    /// These members are public because Recursor accesses them directly.
     ModuleCCSession* config_session_;
-
     bool verbose_mode_;
 
+private:
     /// Address of the forward nameserver
     const char& forward_;
 
     /// Object to handle upstream queries
     RecursiveQuery* rec_query_;
-
-    /// Currently non-configurable, but will be.
-    static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
 };
 
 class QuestionInserter {

Modified: branches/trac383/src/bin/recurse/recursor.h
==============================================================================
--- branches/trac383/src/bin/recurse/recursor.h (original)
+++ branches/trac383/src/bin/recurse/recursor.h Fri Oct 22 15:48:50 2010
@@ -48,13 +48,27 @@
     //@}
 
     /// \brief Process an incoming DNS message, then signal 'server' to resume 
+    ///
+    /// A DNS query (or other message) has been received by a \c DNSServer
+    /// object.  Find an answer, then post the \c DNSServer object on the
+    /// I/O service queue and return.  When the server resumes, it can
+    /// send the reply.
+    ///
+    /// \param io_message The raw message received
+    /// \param message Pointer to the \c Message object
+    /// \param buffer Pointer to an \c OutputBuffer for the resposne
+    /// \param server Pointer to the \c DNSServer
     void processMessage(const asiolink::IOMessage& io_message,
                         isc::dns::MessagePtr message,
                         isc::dns::OutputBufferPtr buffer,
                         asiolink::DNSServer* server);
 
-    // \brief Set and get verbose mode
+    /// \brief Set verbose flag
+    ///
+    /// \param on The new value of the verbose flag
     void setVerbose(bool on);
+
+    /// \brief Get the current value of the verbose flag
     bool getVerbose() const;
 
     /// \brief Set and get the config session

Modified: branches/trac383/src/bin/recurse/tests/Makefile.am
==============================================================================
--- branches/trac383/src/bin/recurse/tests/Makefile.am (original)
+++ branches/trac383/src/bin/recurse/tests/Makefile.am Fri Oct 22 15:48:50 2010
@@ -35,24 +35,12 @@
 
 noinst_PROGRAMS = $(TESTS)
 
-EXTRA_DIST =  testdata/badExampleQuery_fromWire
-EXTRA_DIST += testdata/badExampleQuery_fromWire.spec
-EXTRA_DIST += testdata/example.com
-EXTRA_DIST += testdata/examplequery_fromWire
-EXTRA_DIST += testdata/examplequery_fromWire.spec
-EXTRA_DIST += testdata/example.sqlite3
-EXTRA_DIST += testdata/iqueryresponse_fromWire
-EXTRA_DIST += testdata/iqueryresponse_fromWire.spec
+EXTRA_DIST = testdata/iqueryresponse_fromWire
 EXTRA_DIST += testdata/multiquestion_fromWire
-EXTRA_DIST += testdata/multiquestion_fromWire.spec
 EXTRA_DIST += testdata/queryBadEDNS_fromWire
-EXTRA_DIST += testdata/queryBadEDNS_fromWire.spec
 EXTRA_DIST += testdata/shortanswer_fromWire
-EXTRA_DIST += testdata/shortanswer_fromWire.spec
 EXTRA_DIST += testdata/shortmessage_fromWire
 EXTRA_DIST += testdata/shortquestion_fromWire
 EXTRA_DIST += testdata/shortresponse_fromWire
 EXTRA_DIST += testdata/simplequery_fromWire
-EXTRA_DIST += testdata/simplequery_fromWire.spec
 EXTRA_DIST += testdata/simpleresponse_fromWire
-EXTRA_DIST += testdata/simpleresponse_fromWire.spec

Modified: branches/trac383/src/lib/asiolink/Makefile.am
==============================================================================
--- branches/trac383/src/lib/asiolink/Makefile.am (original)
+++ branches/trac383/src/lib/asiolink/Makefile.am Fri Oct 22 15:48:50 2010
@@ -12,11 +12,12 @@
 # which would make the build fail with -Werror (our default setting).
 lib_LTLIBRARIES = libasiolink.la
 libasiolink_la_SOURCES = asiolink.cc asiolink.h
-libasiolink_la_SOURCES += iosocket.h
+libasiolink_la_SOURCES += iosocket.h iomessage.h
 libasiolink_la_SOURCES += ioaddress.cc ioaddress.h
 libasiolink_la_SOURCES += ioendpoint.cc ioendpoint.h
 libasiolink_la_SOURCES += udpdns.cc internal/udpdns.h
 libasiolink_la_SOURCES += tcpdns.cc internal/tcpdns.h
+libasiolink_la_SOURCES += internal/coroutine.h
 # Note: the ordering matters: -Wno-... must follow -Wextra (defined in
 # B10_CXXFLAGS)
 libasiolink_la_CXXFLAGS = $(AM_CXXFLAGS)

Modified: branches/trac383/src/lib/asiolink/ioaddress.h
==============================================================================
--- branches/trac383/src/lib/asiolink/ioaddress.h (original)
+++ branches/trac383/src/lib/asiolink/ioaddress.h Fri Oct 22 15:48:50 2010
@@ -73,7 +73,7 @@
     /// and if it fails the corresponding standard exception will be thrown.
     ///
     /// \return A string representation of the address.
-    std::string toText() const;
+    virtual std::string toText() const;
 
     /// \brief Returns the address family.
     virtual short getFamily() const;




More information about the bind10-changes mailing list