Browse Source

Add zonemgr TODO list and revert to r2688 for merge

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac289@2730 e5f2f494-b856-4b98-b285-d166d9295462
Jerry 15 years ago
parent
commit
6169072e1f
56 changed files with 159 additions and 1804 deletions
  1. 1 34
      ChangeLog
  2. 2 2
      Makefile.am
  3. 8 3
      configure.ac
  4. 1 1
      doc/Doxyfile
  5. 26 18
      doc/guide/bind10-guide.html
  6. 24 6
      doc/guide/bind10-guide.xml
  7. 0 5
      ext/asio/README
  8. 0 1
      src/bin/auth/Makefile.am
  9. 0 1
      src/bin/auth/asio_link.cc
  10. 4 6
      src/bin/auth/auth_srv.cc
  11. 5 31
      src/bin/auth/b10-auth.8
  12. 3 46
      src/bin/auth/b10-auth.xml
  13. 0 55
      src/bin/auth/change_user.cc
  14. 0 59
      src/bin/auth/change_user.h
  15. 2 17
      src/bin/auth/main.cc
  16. 0 2
      src/bin/auth/tests/Makefile.am
  17. 1 7
      src/bin/auth/tests/asio_link_unittest.cc
  18. 2 4
      src/bin/auth/tests/auth_srv_unittest.cc
  19. 0 67
      src/bin/auth/tests/change_user_unittest.cc
  20. 6 31
      src/bin/bind10/bind10.8
  21. 0 2
      src/bin/bind10/bind10.py.in
  22. 9 54
      src/bin/bind10/bind10.xml
  23. 10 19
      src/bin/bindctl/bindcmd.py
  24. 0 5
      src/bin/bindctl/tests/bindctl_test.py
  25. 3 8
      src/bin/cfgmgr/b10-cfgmgr.py.in
  26. 7 6
      src/bin/msgq/b10-msgq.8
  27. 8 10
      src/bin/msgq/msgq.xml
  28. 2 2
      src/bin/usermgr/b10-cmdctl-usermgr.py.in
  29. 0 2
      src/bin/zonemgr/zonemgr.py.in
  30. 1 1
      src/lib/Makefile.am
  31. 0 10
      src/lib/bench/Makefile.am
  32. 0 403
      src/lib/bench/benchmark.h
  33. 0 116
      src/lib/bench/benchmark_util.cc
  34. 0 149
      src/lib/bench/benchmark_util.h
  35. 0 9
      src/lib/bench/example/Makefile.am
  36. 0 144
      src/lib/bench/example/search_bench.cc
  37. 0 24
      src/lib/bench/tests/Makefile.am
  38. 0 143
      src/lib/bench/tests/benchmark_unittest.cc
  39. 0 198
      src/lib/bench/tests/loadquery_unittest.cc
  40. 0 24
      src/lib/bench/tests/run_unittests.cc
  41. 0 6
      src/lib/bench/tests/testdata/query.txt
  42. 0 1
      src/lib/config/Makefile.am
  43. 1 1
      src/lib/config/testdata/b10-config-bad1.db
  44. 0 1
      src/lib/config/testdata/b10-config-bad4.db
  45. 1 1
      src/lib/config/testdata/b10-config.db
  46. 0 3
      src/lib/datasrc/static_datasrc.cc
  47. 0 3
      src/lib/datasrc/tests/static_unittest.cc
  48. 1 1
      src/lib/dns/message.h
  49. 0 1
      src/lib/dns/rdata/generic/txt_16.cc
  50. 2 2
      src/lib/python/isc/config/ccsession.py
  51. 17 30
      src/lib/python/isc/config/cfgmgr.py
  52. 0 7
      src/lib/python/isc/config/config_data.py
  53. 4 5
      src/lib/python/isc/config/tests/ccsession_test.py
  54. 6 10
      src/lib/python/isc/config/tests/cfgmgr_test.py
  55. 1 5
      src/lib/python/isc/config/tests/config_data_test.py
  56. 1 2
      src/lib/xfr/xfrout_client.cc

+ 1 - 34
ChangeLog

@@ -1,32 +1,3 @@
-bind10-devel-20100812 released on August 12, 2010
-
-  84.   [bug]       jinmei, jerry
-	This is a quick fix patch for the issue: AXFR fails half the 
-	time because of connection problems. xfrout client will make
-	a new connection every time. (Trac #299, svn r2697)
-
-  83.	[build]*
-	The configure --with-boost-lib option is removed. It was not
-	used since the build included ASIO. (svn r2684)
-
-  82.	[func]		jinmei
-	bin/auth: Added -u option to allow the effective process user
-	of the authoritative server after invocation.  The same option to
-	the boss process will be propagated to b10-auth, too.
-	(Trac #268, svn r2675)
-
-  81.	[func]		jinmei
-	Added a C++ framework for micro benchmark tests.  A supplemental
-	library functions to build query data for the tests were also
-	provided. (Trac #241, svn r2664)
-
-  80.	[bug]		jelte
-	bindctl no longer accepts configuration changes for unknown or
-	non-running modules (for the latter, this is until we have a
-	way to verify those options, at which point it'll be allowed
-	again).
-	(Trac #99, r2657)
-
   79.	[func]		feng, jinmei
 	Refactored the ASIO link interfaces to move incoming XFR and
 	NOTIFY processing to the auth server class.  Wrapper classes for
@@ -225,11 +196,7 @@ bind10-devel-20100602 released on June 2, 2010
 	a remote server. (Trac #218, svn r2038)
 
   49.	[func]*		jelte
-	Use unix domain sockets for msgq. For b10-msgq, the command
-	line options --msgq-port and -m were removed. For bind10,
-	the -msgq-port option was removed, and the -m command line
-	option was changed to be a filename (instead of port number).
-	(Trac #183, svn r2009)
+	Use unix domain sockets for msgq. (Trac #183, svn r2009)
 
   48.	[func]		jelte
 	bin/auth: Use asio's io_service for the msgq handling.

+ 2 - 2
Makefile.am

@@ -41,8 +41,8 @@ report-coverage:
 coverage: clean-coverage perform-coverage report-coverage
 
 #### include external sources in the distributed tarball:
-EXTRA_DIST = ext/asio/README
-EXTRA_DIST += ext/asio/asio/local/stream_protocol.hpp
+# EXTRA_DIST = ext/asio/README
+EXTRA_DIST = ext/asio/asio/local/stream_protocol.hpp
 EXTRA_DIST += ext/asio/asio/local/basic_endpoint.hpp
 EXTRA_DIST += ext/asio/asio/local/datagram_protocol.hpp
 EXTRA_DIST += ext/asio/asio/local/connect_pair.hpp

+ 8 - 3
configure.ac

@@ -256,6 +256,14 @@ if test "${boost_include_path}" ; then
 fi
 AC_SUBST(BOOST_INCLUDES)
 
+AC_ARG_WITH([boost-lib],
+AC_HELP_STRING([--with-boost-lib=PATH],
+  [specify exact directory for Boost libraries]),
+  [if test "$withval" != "yes" -a "$withval" != "no"; then
+   BOOST_LDFLAGS="-L$withval"
+   fi])
+AC_SUBST(BOOST_LDFLAGS)
+
 #
 # Check availability of gtest, which will be used for unit tests.
 #
@@ -407,9 +415,6 @@ AC_CONFIG_FILES([Makefile
                  src/bin/zonemgr/tests/Makefile
                  src/bin/usermgr/Makefile
                  src/lib/Makefile
-                 src/lib/bench/Makefile
-                 src/lib/bench/example/Makefile
-                 src/lib/bench/tests/Makefile
                  src/lib/cc/Makefile
                  src/lib/python/Makefile
                  src/lib/python/isc/Makefile

+ 1 - 1
doc/Doxyfile

@@ -568,7 +568,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  = ../src/lib/cc ../src/lib/config ../src/lib/dns ../src/lib/exceptions ../src/lib/datasrc ../src/bin/auth ../src/lib/bench
+INPUT                  = ../src/lib/cc ../src/lib/config ../src/lib/dns ../src/lib/exceptions ../src/lib/datasrc ../src/bin/auth
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

File diff suppressed because it is too large
+ 26 - 18
doc/guide/bind10-guide.html


+ 24 - 6
doc/guide/bind10-guide.xml

@@ -75,8 +75,9 @@
 	data source backend is SQLite3. The authoritative server
 	requires SQLite 3.3.9 or newer.
         The <command>b10-xfrin</command> and <command>b10-xfrout</command>
-        modules require the libpython3 library and the Python
-        _sqlite3.so module.
+	modules require the libboost library,
+        libpython3 library,
+	and the Python _sqlite3.so module.
       </para></note>
 <!-- TODO: this will change ... -->
 
@@ -271,8 +272,9 @@ var/
         </para>
 
         <para>
-	  The Python Library and Python _sqlite3 module are required to
-          enable the Xfrout and Xfrin support.
+	  The Boost Library, Python Library,
+	  and Python _sqlite3 module are required to enable the
+	  Xfrout and Xfrin support.
         </para>
 
         <note><simpara>
@@ -485,6 +487,14 @@ var/
           </varlistentry>
 
           <varlistentry>
+            <term>--with-boost-lib</term>
+            <listitem> 
+              <simpara>Define the path to find the Boost library.
+              </simpara>
+            </listitem> 
+          </varlistentry>
+
+          <varlistentry>
             <term>--with-pythonpath</term>
             <listitem> 
               <simpara>Define the path to Python 3.1 if it is not in the
@@ -510,10 +520,10 @@ var/
 
         <para>
           For example, the following configures it to
-    find the Boost headers, find the
+    find the Boost headers and library, find the
     Python interpreter, and sets the installation location:
 
-          <screen>$ <userinput>./configure \
+          <screen>$ <userinput>./configure --with-boost-lib=/usr/pkg/lib \
       --with-boost-include=/usr/pkg/include \
       --with-pythonpath=/usr/pkg/bin/python3.1 \
       --prefix=/opt/bind10</userinput></screen>
@@ -547,6 +557,14 @@ var/
           <para>The install step may require superuser privileges.</para>
         </note>
 
+<!-- Trac #148 -->
+        <note><simpara>
+	  Depending on your system and the location of your Boost
+	  Python and Python shared libraries, you may need to
+	  configure your run-time linker to find them (such as
+	  setting LD_LIBRARY_PATH).
+        </simpara></note>
+
       </section>
 
   <!-- TODO: tests -->

+ 0 - 5
ext/asio/README

@@ -1,5 +0,0 @@
-ASIO library header files
-Version 1.4.5 (2010-05-12)
-Downloaded from http://sourceforge.net/projects/asio/files
-Project page: http://think-async.com/Asio
-No local modifications.

+ 0 - 1
src/bin/auth/Makefile.am

@@ -47,7 +47,6 @@ libasio_link_a_CPPFLAGS = $(AM_CPPFLAGS)
 BUILT_SOURCES = spec_config.h 
 pkglibexec_PROGRAMS = b10-auth
 b10_auth_SOURCES = auth_srv.cc auth_srv.h
-b10_auth_SOURCES += change_user.cc change_user.h
 b10_auth_SOURCES += common.h
 b10_auth_SOURCES += main.cc
 b10_auth_LDADD =  $(top_builddir)/src/lib/datasrc/.libs/libdatasrc.a

+ 0 - 1
src/bin/auth/asio_link.cc

@@ -368,7 +368,6 @@ public:
         dns_message_(Message::PARSE),
         custom_callback_(NULL)
     {
-        socket_.set_option(socket_base::reuse_address(true));
         // Set v6-only (we use a different instantiation for v4,
         // otherwise asio will bind to both v4 and v6
         if (addr.is_v6()) {

+ 4 - 6
src/bin/auth/auth_srv.cc

@@ -342,8 +342,10 @@ AuthSrvImpl::processAxfrQuery(const IOMessage& io_message, Message& message,
     }
 
     try {
-        xfrout_client_.connect();
-        xfrout_connected_ = true;
+        if (!xfrout_connected_) {
+            xfrout_client_.connect();
+            xfrout_connected_ = true;
+        }
         xfrout_client_.sendXfroutRequestInfo(
             io_message.getSocket().getNative(),
             io_message.getData(),
@@ -366,10 +368,6 @@ AuthSrvImpl::processAxfrQuery(const IOMessage& io_message, Message& message,
                          verbose_mode_);
         return (true);
     }
-
-    xfrout_client_.disconnect();
-    xfrout_connected_ = false;
-
     return (false);
 }
 

+ 5 - 31
src/bin/auth/b10-auth.8

@@ -2,12 +2,12 @@
 .\"     Title: b10-auth
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: July 29, 2010
+.\"      Date: March 16, 2010
 .\"    Manual: BIND10
 .\"    Source: BIND10
 .\"  Language: English
 .\"
-.TH "B10\-AUTH" "8" "July 29, 2010" "BIND10" "BIND10"
+.TH "B10\-AUTH" "8" "March 16, 2010" "BIND10" "BIND10"
 .\" -----------------------------------------------------------------
 .\" * set default formatting
 .\" -----------------------------------------------------------------
@@ -22,7 +22,7 @@
 b10-auth \- Authoritative DNS server
 .SH "SYNOPSIS"
 .HP \w'\fBb10\-auth\fR\ 'u
-\fBb10\-auth\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-a\ \fR\fB\fIaddress\fR\fR] [\fB\-n\fR] [\fB\-p\ \fR\fB\fInumber\fR\fR] [\fB\-u\ \fR\fB\fIusername\fR\fR] [\fB\-v\fR]
+\fBb10\-auth\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-p\ \fR\fB\fInumber\fR\fR] [\fB\-v\fR]
 .SH "DESCRIPTION"
 .PP
 The
@@ -64,30 +64,13 @@ The arguments are as follows:
 \fB\-4\fR
 .RS 4
 Enables IPv4 only mode\&. This switch may not be used with
-\fB\-6\fR
-nor
-\fB\-a\fR\&. By default, it listens on both IPv4 and IPv6 (if capable)\&.
+\fB\-6\fR\&. By default, it listens on both IPv4 and IPv6 (if capable)\&.
 .RE
 .PP
 \fB\-6\fR
 .RS 4
 Enables IPv6 only mode\&. This switch may not be used with
-\fB\-4\fR
-nor
-\fB\-a\fR\&. By default, it listens on both IPv4 and IPv6 (if capable)\&.
-.RE
-.PP
-\fB\-a \fR\fB\fIaddress\fR\fR
-.RS 4
-The IPv4 or IPv6 address to listen on\&. This switch may not be used with
-\fB\-4\fR
-nor
-\fB\-6\fR\&. The default is to listen on all addresses\&. (This is a short term workaround\&. This argument may change\&.)
-.RE
-.PP
-\fB\-n\fR
-.RS 4
-Do not cache answers in memory\&. The default is to use the cache for faster responses\&. The cache keeps the most recent 30,000 answers (positive and negative) in memory for 30 seconds (instead of querying the data source, such as SQLite3 database, each time)\&.
+\fB\-4\fR\&. By default, it listens on both IPv4 and IPv6 (if capable)\&.
 .RE
 .PP
 \fB\-p \fR\fB\fInumber\fR\fR
@@ -110,15 +93,6 @@ The Y1 prototype runs on all interfaces and on this nonstandard port\&.
 .RE
 .RE
 .PP
-\fB\-u \fR\fB\fIusername\fR\fR
-.RS 4
-The user name of the
-\fBb10\-auth\fR
-daemon\&. If specified, the daemon changes the process owner to the specified user\&. The
-\fIusername\fR
-must be either a valid numeric user ID or a valid user name\&. By default the daemon runs as the user who invokes it\&.
-.RE
-.PP
 \fB\-v\fR
 .RS 4
 Enabled verbose mode\&. This enables diagnostic messages to STDERR\&.

+ 3 - 46
src/bin/auth/b10-auth.xml

@@ -21,7 +21,7 @@
 <refentry>
 
   <refentryinfo>
-    <date>July 29, 2010</date>
+    <date>March 16, 2010</date>
   </refentryinfo>
 
   <refmeta>
@@ -47,10 +47,7 @@
       <command>b10-auth</command>
       <arg><option>-4</option></arg>
       <arg><option>-6</option></arg>
-      <arg><option>-a <replaceable>address</replaceable></option></arg>
-      <arg><option>-n</option></arg>
       <arg><option>-p <replaceable>number</replaceable></option></arg>
-      <arg><option>-u <replaceable>username</replaceable></option></arg>
       <arg><option>-v</option></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -98,8 +95,7 @@
         <term><option>-4</option></term>
         <listitem><para>
           Enables IPv4 only mode.
-          This switch may not be used with <option>-6</option> nor
-          <option>-a</option>.
+          This switch may not be used with <option>-6</option>.
           By default, it listens on both IPv4 and IPv6 (if capable).
         </para></listitem>
       </varlistentry>
@@ -108,37 +104,12 @@
         <term><option>-6</option></term>
         <listitem><para>
           Enables IPv6 only mode.
-          This switch may not be used with <option>-4</option> nor
-          <option>-a</option>.
+          This switch may not be used with <option>-4</option>.
           By default, it listens on both IPv4 and IPv6 (if capable).
         </para></listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><option>-a <replaceable>address</replaceable></option></term>
-
-        <listitem>
-          <para>The IPv4 or IPv6 address to listen on.
-            This switch may not be used with <option>-4</option> nor
-            <option>-6</option>.
-            The default is to listen on all addresses.
-            (This is a short term workaround. This argument may change.)   
-          </para>                      
-         </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-n</option></term>
-        <listitem><para>
-          Do not cache answers in memory.
-          The default is to use the cache for faster responses.
-	  The cache keeps the most recent 30,000 answers (positive
-	  and negative) in memory for 30 seconds (instead of querying
-	  the data source, such as SQLite3 database, each time).
-        </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
         <term><option>-p <replaceable>number</replaceable></option></term>
         <listitem><para>
           The port number it listens on.
@@ -149,20 +120,6 @@
       </varlistentry>
 
       <varlistentry>
-        <term><option>-u <replaceable>username</replaceable></option></term>
-        <listitem>
-	  <para>
-	    The user name of the <command>b10-auth</command> daemon.
-	    If specified, the daemon changes the process owner to the
-	    specified user.
-	    The <replaceable>username</replaceable> must be either a
-	    valid numeric user ID or a valid user name.
-	    By default the daemon runs as the user who invokes it.
-	  </para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
         <term><option>-v</option></term>
         <listitem><para>
           Enabled verbose mode. This enables diagnostic messages to

+ 0 - 55
src/bin/auth/change_user.cc

@@ -1,55 +0,0 @@
-// 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$
-
-#include <errno.h>
-#include <string.h>
-#include <pwd.h>
-#include <unistd.h>
-
-#include <boost/lexical_cast.hpp>
-
-#include <exceptions/exceptions.h>
-
-#include <auth/common.h>
-
-using namespace boost;
-
-void
-changeUser(const char* const username) {
-    const struct passwd *runas_pw = NULL;
-
-    runas_pw = getpwnam(username);
-    endpwent();
-    if (runas_pw == NULL) {
-        try {
-            runas_pw = getpwuid(lexical_cast<uid_t>(username));
-            endpwent();
-        } catch (const bad_lexical_cast&) {
-            ;                   // fall through to isc_throw below.
-        }
-    }
-    if (runas_pw == NULL) {
-        isc_throw(FatalError, "Unknown user name or UID:" << username);
-    }
-
-    if (setgid(runas_pw->pw_gid) < 0) {
-        isc_throw(FatalError, "setgid() failed: " << strerror(errno));
-    }
-
-    if (setuid(runas_pw->pw_uid) < 0) {
-        isc_throw(FatalError, "setuid() failed: " << strerror(errno));
-    }
-}

+ 0 - 59
src/bin/auth/change_user.h

@@ -1,59 +0,0 @@
-// 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 __CHANGE_USER_H
-#define __CHANGE_USER_H 1
-
-/// \brief Change the run time user.
-///
-/// This function changes the user and its group of the authoritative server
-/// process.
-///
-/// On success the user ID of the process is changed to the specified user,
-/// and the group is changed to that of the new user.
-///
-/// This is considered a short term workaround until we develop clearer
-/// privilege separation, where the server won't even have to open privileged
-/// ports and can be started by a non privileged user from the beginning.
-/// This function therefore ignores some corner case problems (see below)
-/// which we would address otherwise.
-///
-/// \c username can be either a textual user name or its numeric ID.
-/// If the specified user name (or ID) doesn't specify a local user ID
-/// or the user originally starting the process doesn't have a permission
-/// of changing the user to \c username, this function throws an exception
-/// of class \c FatalError.
-///
-/// This function internally uses system libraries that do not guarantee
-/// reentrancy.  In fact, it doesn't even expect to be called more than once.
-/// The behavior is undefined if this function is called from multiple threads
-/// simultaneously or more generally called multiple times.
-///
-/// This function only offers the basic exception guarantee, that is, if
-/// an exception is thrown from this function, it's possible that an exception
-/// is thrown after changing the group ID.  This function doesn't recover
-/// from that situation.  In practice, the process is expected to consider
-/// this event a fatal error and will immediately exit, and shouldn't cause
-/// a real trouble.
-///
-/// \param username User name or ID of the new effective user.
-void changeUser(const char* const username);
-
-#endif // __CHANGE_USER_H
-
-// Local Variables:
-// mode: c++
-// End:

+ 2 - 17
src/bin/auth/main.cc

@@ -41,7 +41,6 @@
 
 #include <auth/spec_config.h>
 #include <auth/common.h>
-#include <auth/change_user.h>
 #include <auth/auth_srv.h>
 #include <auth/asio_link.h>
 
@@ -98,10 +97,9 @@ main(int argc, char* argv[]) {
     int ch;
     const char* port = DNSPORT;
     const char* address = NULL;
-    const char* uid = NULL;
     bool use_ipv4 = true, use_ipv6 = true, cache = true;
 
-    while ((ch = getopt(argc, argv, "46a:np:u:v")) != -1) {
+    while ((ch = getopt(argc, argv, "46a:np:v")) != -1) {
         switch (ch) {
         case '4':
             // Note that -4 means "ipv4 only", we need to set "use_ipv6" here,
@@ -123,9 +121,6 @@ main(int argc, char* argv[]) {
         case 'p':
             port = optarg;
             break;
-        case 'u':
-            uid = optarg;
-            break;
         case 'v':
             verbose_mode = true;
             break;
@@ -156,13 +151,7 @@ main(int argc, char* argv[]) {
     Session* xfrin_session = NULL;
     bool xfrin_session_established = false; // XXX (see Trac #287)
     ModuleCCSession* config_session = NULL;
-    string xfrout_socket_path;
-    if (getenv("B10_FROM_BUILD") != NULL) {
-        xfrout_socket_path = string(getenv("B10_FROM_BUILD")) + "/auth_xfrout_conn";
-    } else {
-        xfrout_socket_path = UNIX_SOCKET_FILE;
-    }
-    XfroutClient xfrout_client(xfrout_socket_path);
+    XfroutClient xfrout_client(UNIX_SOCKET_FILE);
     try {
         string specfile;
         if (getenv("B10_FROM_BUILD")) {
@@ -199,10 +188,6 @@ main(int argc, char* argv[]) {
                                              my_command_handler);
         cout << "[b10-auth] Configuration channel established." << endl;
 
-        if (uid != NULL) {
-            changeUser(uid);
-        }
-
         xfrin_session = new Session(io_service->get_io_service());
         cout << "[b10-auth] Xfrin session channel created." << endl;
         xfrin_session->establish(NULL);

+ 0 - 2
src/bin/auth/tests/Makefile.am

@@ -13,9 +13,7 @@ TESTS += run_unittests
 run_unittests_SOURCES = $(top_srcdir)/src/lib/dns/tests/unittest_util.h
 run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.cc
 run_unittests_SOURCES += ../auth_srv.h ../auth_srv.cc
-run_unittests_SOURCES += ../change_user.h ../change_user.cc
 run_unittests_SOURCES += auth_srv_unittest.cc
-run_unittests_SOURCES += change_user_unittest.cc
 run_unittests_SOURCES += asio_link_unittest.cc
 run_unittests_SOURCES += run_unittests.cc
 run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)

+ 1 - 7
src/bin/auth/tests/asio_link_unittest.cc

@@ -108,14 +108,8 @@ TEST(IOServiceTest, badAddress) {
 TEST(IOServiceTest, unavailableAddress) {
     // These addresses should generally be unavailable as a valid local
     // address, although there's no guarantee in theory.
+    EXPECT_THROW(IOService(NULL, *TEST_PORT, *"ffff:ffff::"), IOError);
     EXPECT_THROW(IOService(NULL, *TEST_PORT, *"255.255.0.0"), IOError);
-
-    // Some OSes would simply reject binding attempt for an AF_INET6 socket
-    // to an IPv4-mapped IPv6 address.  Even if those that allow it, since
-    // the corresponding IPv4 address is the same as the one used in the
-    // AF_INET socket case above, it should at least show the same result
-    // as the previous one.
-    EXPECT_THROW(IOService(NULL, *TEST_PORT, *"::ffff:255.255.0.0"), IOError);
 }
 
 TEST(IOServiceTest, duplicateBind) {

+ 2 - 4
src/bin/auth/tests/auth_srv_unittest.cc

@@ -469,7 +469,7 @@ TEST_F(AuthSrvTest, AXFRSuccess) {
     // so we shouldn't have to respond.
     EXPECT_EQ(false, server.processMessage(*io_message, parse_message,
                                            response_renderer));
-    EXPECT_FALSE(xfrout.isConnected());
+    EXPECT_TRUE(xfrout.isConnected());
 }
 
 TEST_F(AuthSrvTest, AXFRConnectFail) {
@@ -481,8 +481,6 @@ TEST_F(AuthSrvTest, AXFRConnectFail) {
                                       response_renderer));
     headerCheck(parse_message, default_qid, Rcode::SERVFAIL(),
                 opcode.getCode(), QR_FLAG, 1, 0, 0, 0);
-    // For a shot term workaround with xfrout we currently close the connection
-    // for each AXFR attempt
     EXPECT_FALSE(xfrout.isConnected());
 }
 
@@ -492,7 +490,7 @@ TEST_F(AuthSrvTest, AXFRSendFail) {
     createRequestPacket(opcode, Name("example.com"), RRClass::IN(),
                         RRType::AXFR(), IPPROTO_TCP);
     server.processMessage(*io_message, parse_message, response_renderer);
-    EXPECT_FALSE(xfrout.isConnected()); // see above
+    EXPECT_TRUE(xfrout.isConnected());
 
     xfrout.disableSend();
     parse_message.clear(Message::PARSE);

+ 0 - 67
src/bin/auth/tests/change_user_unittest.cc

@@ -1,67 +0,0 @@
-// 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$
-
-#include <stdlib.h>
-#include <unistd.h>             // for getuid
-
-#include <string>
-
-#include <boost/lexical_cast.hpp>
-
-#include <gtest/gtest.h>
-
-#include <auth/common.h>
-#include <auth/change_user.h>
-
-using namespace std;
-
-namespace {
-TEST(ChangeUserTest, changeToTheSameUser) {
-    const char* const my_username = getenv("USER");
-
-    // normally the USER environment variable should be set to the name
-    // of the local user running this test, but it's not always the case.
-    if (my_username == NULL) {
-        cerr << "Environment variable USER is undefined, skipping the test"
-             << endl;
-        return;
-    }
-
-    // changing to the run time user should succeed.
-    EXPECT_NO_THROW(changeUser(my_username));
-}
-
-TEST(ChangeUserTest, changeToTheSameUserId) {
-    // same as above, but using numeric user ID
-    EXPECT_NO_THROW(changeUser(
-                        (boost::lexical_cast<string>(getuid())).c_str()));
-}
-
-TEST(ChangeUserTest, badUID) {
-    // -1 should be an invalid numeric UID, and (hopefully) shouldn't be
-    // a valid textual username.
-    EXPECT_THROW(changeUser("-1"), FatalError);
-}
-
-TEST(ChangeUserTest, promotionAttempt) {
-    // change to root should fail unless the running user is a super user.
-    if (getuid() == 0) {
-        cerr << "Already a super user, skipping the test" << endl;
-        return;
-    }
-    EXPECT_THROW(changeUser("root"), FatalError);
-}
-}

+ 6 - 31
src/bin/bind10/bind10.8

@@ -2,12 +2,12 @@
 .\"     Title: bind10
 .\"    Author: [see the "AUTHORS" section]
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: July 29, 2010
+.\"      Date: April 19, 2010
 .\"    Manual: BIND10
 .\"    Source: BIND10
 .\"  Language: English
 .\"
-.TH "BIND10" "8" "July 29, 2010" "BIND10" "BIND10"
+.TH "BIND10" "8" "April 19, 2010" "BIND10" "BIND10"
 .\" -----------------------------------------------------------------
 .\" * set default formatting
 .\" -----------------------------------------------------------------
@@ -22,7 +22,7 @@
 bind10 \- BIND 10 boss process
 .SH "SYNOPSIS"
 .HP \w'\fBbind10\fR\ 'u
-\fBbind10\fR [\fB\-a\ \fR\fB\fIaddress\fR\fR] [\fB\-m\ \fR\fB\fIfile\fR\fR] [\fB\-n\fR] [\fB\-p\ \fR\fB\fInumber\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-v\fR] [\fB\-\-address\ \fR\fB\fIaddress\fR\fR] [\fB\-\-msgq\-socket\-file\ \fR\fB\fIfile\fR\fR] [\fB\-\-no\-cache\fR] [\fB\-\-port\ \fR\fB\fInumber\fR\fR] [\fB\-\-user\ \fR\fB\fIuser\fR\fR] [\fB\-\-verbose\fR]
+\fBbind10\fR [\fB\-m\ \fR\fB\fInumber\fR\fR] [\fB\-p\ \fR\fB\fInumber\fR\fR] [\fB\-v\fR] [\fB\-msgq\-port\ \fR\fB\fInumber\fR\fR] [\fB\-port\ \fR\fB\fInumber\fR\fR] [\fB\-verbose\fR]
 .SH "DESCRIPTION"
 .PP
 The
@@ -32,26 +32,11 @@ daemon starts up other BIND 10 required daemons\&. It handles restarting of exit
 .PP
 The arguments are as follows:
 .PP
-\fB\-a\fR \fIaddress\fR, \fB\-\-address\fR \fIaddress\fR
+\fB\-m\fR \fInumber\fR, \fB\-\-msgq\-port\fR \fInumber\fR
 .RS 4
-The IPv4 or IPv6 address for the
-\fBb10-auth\fR(8)
-daemon to listen on\&. The default is to listen on all addresses\&. (This is a short term workaround\&. This argument may change\&.)
-.RE
-.PP
-\fB\-m\fR \fIfile\fR, \fB\-\-msgq\-socket\-file\fR \fIfile\fR
-.RS 4
-The UNIX domain socket file for the
+The port number for the
 \fBb10-msgq\fR(8)
-daemon to use\&. The default is
-/usr/local/var/bind10\-devel/msg_socket\&.
-.RE
-.PP
-\fB\-n\fR, \fB\-\-no\-cache\fR
-.RS 4
-Disables the hot\-spot caching used by the
-\fBb10-auth\fR(8)
-daemon\&.
+daemon to listen on\&. The default is 9912\&.
 .RE
 .PP
 \fB\-p\fR \fInumber\fR, \fB\-\-port\fR \fInumber\fR
@@ -76,16 +61,6 @@ The Y1 prototype release uses a non\-default port for domain service\&.
 .RE
 .RE
 .PP
-\fB\-u\fR \fIuser\fR, \fB\-\-user\fR \fIname\fR
-.RS 4
-The username for
-\fBbind10\fR
-to run as\&.
-
-\fBbind10\fR
-must be initially ran as the root user to use this option\&. The default is to run as the current user\&.
-.RE
-.PP
 \fB\-v\fR, \fB\-\-verbose\fR
 .RS 4
 Display more about what is going on for

+ 0 - 2
src/bin/bind10/bind10.py.in

@@ -336,8 +336,6 @@ class BoB:
             authargs += ['-a', str(self.address)]
         if self.nocache:
             authargs += ['-n']
-        if self.uid:
-            authargs += ['-u', str(self.uid)]
         if self.verbose:
             authargs += ['-v']
             sys.stdout.write("Starting b10-auth using port %d" %

+ 9 - 54
src/bin/bind10/bind10.xml

@@ -21,7 +21,7 @@
 <refentry>
 
   <refentryinfo>
-    <date>July 29, 2010</date>
+    <date>April 19, 2010</date>
   </refentryinfo>
 
   <refmeta>
@@ -45,18 +45,12 @@
   <refsynopsisdiv>
     <cmdsynopsis>
       <command>bind10</command>    
-      <arg><option>-a <replaceable>address</replaceable></option></arg>
-      <arg><option>-m <replaceable>file</replaceable></option></arg>
-      <arg><option>-n</option></arg>
+      <arg><option>-m <replaceable>number</replaceable></option></arg>
       <arg><option>-p <replaceable>number</replaceable></option></arg>
-      <arg><option>-u <replaceable>user</replaceable></option></arg>
       <arg><option>-v</option></arg>
-      <arg><option>--address <replaceable>address</replaceable></option></arg>
-      <arg><option>--msgq-socket-file <replaceable>file</replaceable></option></arg>
-      <arg><option>--no-cache</option></arg>
-      <arg><option>--port <replaceable>number</replaceable></option></arg>
-      <arg><option>--user <replaceable>user</replaceable></option></arg>
-      <arg><option>--verbose</option></arg>
+      <arg><option>-msgq-port <replaceable>number</replaceable></option></arg>
+      <arg><option>-port <replaceable>number</replaceable></option></arg>
+      <arg><option>-verbose</option></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
 
@@ -86,43 +80,17 @@
     <variablelist>
 
       <varlistentry>
-        <term><option>-a</option> <replaceable>address</replaceable>, <option>--address</option> <replaceable>address</replaceable></term>
+        <term><option>-m</option> <replaceable>number</replaceable>, <option>--msgq-port</option> <replaceable>number</replaceable></term>
 
         <listitem>
-	  <para>The IPv4 or IPv6 address for the
-	    <citerefentry><refentrytitle>b10-auth</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-            daemon to listen on.
-            The default is to listen on all addresses. 
-            (This is a short term workaround. This argument may change.)
-          </para>
-         </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-m</option> <replaceable>file</replaceable>,
-           <option>--msgq-socket-file</option> <replaceable>file</replaceable></term>
-
-        <listitem>
-          <para>The UNIX domain socket file for the
+          <para>The port number for the
 	    <citerefentry><refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-            daemon to use.
-            The default is
-            <filename>/usr/local/var/bind10-devel/msg_socket</filename>.
-<!-- @localstatedir@/@PACKAGE_NAME@/msg_socket -->
-           </para>
+            daemon to listen on.
+            The default is 9912.</para>
          </listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><option>-n</option>, <option>--no-cache</option></term>
-        <listitem>
-	  <para>Disables the hot-spot caching used by the
-	    <citerefentry><refentrytitle>b10-auth</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-	  daemon.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
         <term><option>-p</option> <replaceable>number</replaceable>, <option>--port</option> <replaceable>number</replaceable></term>
 
         <listitem>
@@ -137,18 +105,6 @@
       </varlistentry>
 
       <varlistentry>
-        <term><option>-u</option> <replaceable>user</replaceable>, <option>--user</option> <replaceable>name</replaceable></term>
-
-        <listitem>
-          <para>The username for <command>bind10</command> to run as.
-<!-- TODO: example more detail. -->
-            <command>bind10</command> must be initially ran as the
-            root user to use this option.
-            The default is to run as the current user.</para>
-         </listitem>
-      </varlistentry>
-
-      <varlistentry>
         <term><option>-v</option>, <option>--verbose</option></term>
         <listitem>
 	  <para>Display more about what is going on for
@@ -156,7 +112,6 @@
 <!-- TODO: not true about all children yet -->
         </listitem>
       </varlistentry>
-
     </variablelist>
   </refsect1>
 

+ 10 - 19
src/bin/bindctl/bindcmd.py

@@ -38,6 +38,7 @@ import csv
 import json
 import pwd
 import getpass
+import traceback
 
 try:
     from collections import OrderedDict
@@ -122,6 +123,7 @@ class BindCmdInterpreter(Cmd):
         except FailToLogin as err:
             print(err)
             print(FAIL_TO_CONNECT_WITH_CMDCTL)
+            traceback.print_exc()
         except KeyboardInterrupt:
             print('\nExit from bindctl')
 
@@ -140,8 +142,8 @@ class BindCmdInterpreter(Cmd):
             users_info = csv.reader(csvfile)
             for row in users_info:
                 users.append([row[0], row[1]])
-        except (IOError, IndexError) as err:
-            print("Error reading saved username and password from %s%s: %s" % (dir, file_name, err))
+        except (IOError, IndexError) as e:
+            pass
         finally:
             if csvfile:
                 csvfile.close()
@@ -160,9 +162,8 @@ class BindCmdInterpreter(Cmd):
             writer = csv.writer(csvfile)
             writer.writerow([username, passwd])
             csvfile.close()
-        except IOError as err:
-            print("Error saving user information:", err)
-            print("user info file name: %s%s" % (dir, file_name))
+        except Exception as e:
+            print(e, "\nCannot write %s%s; default user is not stored" % (dir, file_name))
             return False
 
         return True
@@ -182,8 +183,8 @@ class BindCmdInterpreter(Cmd):
             try:
                 response = self.send_POST('/login', param)
                 data = response.read().decode()
-            except socket.error as err:
-                print("Socket error while sending login information:", err)
+            except socket.error:
+                traceback.print_exc()
                 raise FailToLogin()
 
             if response.status == http.client.OK:
@@ -205,8 +206,8 @@ class BindCmdInterpreter(Cmd):
                 response = self.send_POST('/login', param)
                 data = response.read().decode()
                 print(data)
-            except socket.error as err:
-                print("Socket error while sending login information:", err)
+            except socket.error as e:
+                traceback.print_exc()
                 raise FailToLogin()
 
             if response.status == http.client.OK:
@@ -542,16 +543,6 @@ class BindCmdInterpreter(Cmd):
                     identifier = cmd.params['identifier']
                 else:
                     identifier += cmd.params['identifier']
-
-                # Check if the module is known; for unknown modules
-                # we currently deny setting preferences, as we have
-                # no way yet to determine if they are ok.
-                module_name = identifier.split('/')[1]
-                if self.config_data is None or \
-                   not self.config_data.have_specification(module_name):
-                    print("Error: Module '" + module_name + "' unknown or not running")
-                    return
-
             if cmd.command == "show":
                 values = self.config_data.get_value_maps(identifier)
                 for value_map in values:

+ 0 - 5
src/bin/bindctl/tests/bindctl_test.py

@@ -237,11 +237,6 @@ class TestNameSequence(unittest.TestCase):
             assert self.random_names[i] == cmd_names[i+1]
             assert self.random_names[i] == module_names[i+1]
             i = i + 1
-
-    def test_apply_cfg_command(self):
-        self.tool.location = '/'
-        cmd = cmdparse.BindCmdParse("config set identifier=\"foo/bar\" value=\"5\"")
-        self.tool.apply_config_cmd(cmd)
     
 class FakeBindCmdInterpreter(bindcmd.BindCmdInterpreter):
     def __init__(self):

+ 3 - 8
src/bin/cfgmgr/b10-cfgmgr.py.in

@@ -19,7 +19,7 @@
 
 import sys; sys.path.append ('@@PYTHONPATH@@')
 
-from isc.config.cfgmgr import ConfigManager, ConfigManagerDataReadError
+from isc.config.cfgmgr import ConfigManager
 from isc.cc import SessionError
 import signal
 import os
@@ -52,15 +52,10 @@ def main():
     except SessionError as se:
         print("[b10-cfgmgr] Error creating config manager, "
               "is the command channel daemon running?")
-        return 1
     except KeyboardInterrupt as kie:
         print("[b10-cfgmgr] Interrupted, exiting")
-    except ConfigManagerDataReadError as cmdre:
-        print("[b10-cfgmgr] " + str(cmdre))
-        return 2
     if cm:
-        return cm.write_config()
-    return 0
+        cm.write_config()
 
 if __name__ == "__main__":
-    sys.exit(main())
+    main()

+ 7 - 6
src/bin/msgq/b10-msgq.8

@@ -2,12 +2,12 @@
 .\"     Title: b10-msgq
 .\"    Author: [see the "AUTHORS" section]
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: August 4, 2010
+.\"      Date: April 19, 2010
 .\"    Manual: BIND10
 .\"    Source: BIND10
 .\"  Language: English
 .\"
-.TH "B10\-MSGQ" "8" "August 4, 2010" "BIND10" "BIND10"
+.TH "B10\-MSGQ" "8" "April 19, 2010" "BIND10" "BIND10"
 .\" -----------------------------------------------------------------
 .\" * set default formatting
 .\" -----------------------------------------------------------------
@@ -22,7 +22,7 @@
 b10-msgq \- message routing daemon for the Command Channel
 .SH "SYNOPSIS"
 .HP \w'\fBb10\-msgq\fR\ 'u
-\fBb10\-msgq\fR [\fB\-s\ \fR\fB\fIfile\fR\fR] [\fB\-v\fR] [\fB\-\-socket\-file\ \fR\fB\fIfile\fR\fR] [\fB\-\-verbose\fR]
+\fBb10\-msgq\fR [\fB\-m\ \fR\fB\fInumber\fR\fR] [\fB\-v\fR] [\fB\-\-msgq\-port\ \fR\fB\fInumber\fR\fR] [\fB\-\-verbose\fR]
 .SH "DESCRIPTION"
 .PP
 The
@@ -96,10 +96,11 @@ daemon may be cleanly stopped by sending the SIGTERM signal to the process\&. Th
 .PP
 The arguments are as follows:
 .PP
-\fB\-s \fR\fB\fIfile\fR\fR, \fB\-\-socket\-file \fR\fB\fIfile\fR\fR
+\fB\-m \fR\fB\fInumber\fR\fR, \fB\-\-msgq\-port \fR\fB\fInumber\fR\fR
 .RS 4
-The UNIX domain socket file this daemon will use\&. The default is
-/usr/local/var/bind10\-devel/msg_socket\&.
+The port number that
+\fBb10\-msgq\fR
+will listen on\&. The default is 9912\&.
 .RE
 .PP
 \fB\-v\fR, \fB\-\-verbose\fR

+ 8 - 10
src/bin/msgq/msgq.xml

@@ -21,7 +21,7 @@
 <refentry>
 
   <refentryinfo>
-    <date>August 4, 2010</date>
+    <date>April 19, 2010</date>
   </refentryinfo>
 
   <refmeta>
@@ -45,9 +45,9 @@
   <refsynopsisdiv>
     <cmdsynopsis>
       <command>b10-msgq</command>
-      <arg><option>-s <replaceable>file</replaceable></option></arg>
+      <arg><option>-m <replaceable>number</replaceable></option></arg>
       <arg><option>-v</option></arg>
-      <arg><option>--socket-file <replaceable>file</replaceable></option></arg>
+      <arg><option>--msgq-port <replaceable>number</replaceable></option></arg>
       <arg><option>--verbose</option></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -111,14 +111,12 @@
 
     <variablelist>
       <varlistentry>
-        <term><option>-s <replaceable>file</replaceable></option>,
-          <option>--socket-file <replaceable>file</replaceable></option></term>
+        <term><option>-m <replaceable>number</replaceable></option>,
+          <option>--msgq-port <replaceable>number</replaceable></option></term>
         <listitem><para>
-          The UNIX domain socket file this daemon will use.
-          The default is
-          <filename>/usr/local/var/bind10-devel/msg_socket</filename>.
-<!-- @localstatedir@/@PACKAGE_NAME@/msg_socket -->
-          </para></listitem>
+          The port number that <command>b10-msgq</command> will listen on.
+          The default is 9912.</para>
+        </listitem>
       </varlistentry>
 
       <varlistentry>

+ 2 - 2
src/bin/usermgr/b10-cmdctl-usermgr.py.in

@@ -69,8 +69,8 @@ def usage():
 def main():
     filename = DEFAULT_FILE
     try: 
-        opts, args = getopt.getopt(sys.argv[1:], 'f:hv', 
-                                   ['file=', 'help', 'version']) 
+        opts, args = getopt.getopt(sys.argv[1:], 'hvf:', 
+                                   ['help', 'file=', 'version=']) 
     except getopt.GetoptError as err: 
         print(err) 
         usage() 

+ 0 - 2
src/bin/zonemgr/zonemgr.py.in

@@ -334,8 +334,6 @@ class ZonemgrRefresh:
                 time.sleep(LOWERBOUND_RETRY) # A better time?
                 continue
 
-            print (self._zonemgr_refresh_info)
-
             zone_need_refresh = self._find_need_do_refresh_zone()
             # If don't get zone with minimum next refresh time, set timer timeout = LOWERBOUND_REFRESH
             if not zone_need_refresh:

+ 1 - 1
src/lib/Makefile.am

@@ -1 +1 @@
-SUBDIRS = exceptions dns cc config datasrc python xfr bench
+SUBDIRS = exceptions dns cc config datasrc python xfr

+ 0 - 10
src/lib/bench/Makefile.am

@@ -1,10 +0,0 @@
-SUBDIRS = . tests example
-
-AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
-AM_CXXFLAGS = $(B10_CXXFLAGS)
-
-CLEANFILES = *.gcno *.gcda
-
-lib_LTLIBRARIES = libbench.la
-libbench_la_SOURCES = benchmark_util.h benchmark_util.cc
-EXTRA_DIST = benchmark.h

+ 0 - 403
src/lib/bench/benchmark.h

@@ -1,403 +0,0 @@
-// 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 __BENCHMARK_H
-#define __BENCHMARK_H 1
-
-#include <sys/time.h>
-
-#include <iostream>
-#include <ios>
-
-namespace isc {
-namespace bench {
-
-/// \brief Templated micro benchmark framework.
-///
-/// "Premature optimization is the root of all evil."
-/// But programmers are often tempted to focus on performance optimization
-/// too early.
-/// Likewise, it's not uncommon for an engineer to introduce a minor
-/// optimization with a lot of complicated code logic that actually improves
-/// performance only marginally.
-/// Making benchmark easier will help avoid such common pitfalls.
-/// Of course, it also helps when we really need to introduce optimization
-/// to identify where is the bottleneck and see how a particular optimization
-/// improves the performance.
-///
-/// The BenchMark class template provides a simple framework for so-called
-/// "stopwatch" micro benchmarking.
-/// It just encapsulates the common operations for this type of benchmark:
-/// repeat a specified operation for a given number of times,
-/// record the start and end times of the operations,
-/// and provide major accumulated results such as the number of iterations
-/// per second.
-/// The main goal of this class is to help developers write benchmark test
-/// cases with fewer strokes of typing.
-///
-/// The constructors of a \c BenchMark class is to take the number of
-/// iterations (which is referred to as \c niter below)
-/// and an object (or reference to it) of the type of the template
-/// parameter, \c T.  Class \c T implements the benchmark target code via
-/// its \c run() method, whose signature is as follows:
-/// \code  unsigned int T::run(); \endcode
-///
-/// A BenchMark class object, via its own \c run() method, calls \c T::run()
-/// for \c niter times.
-/// In the simplest form \c T::run() would perform a single operation to
-/// be benchmarked and returns 1.
-/// In some cases, however, the operation is very lightweight (e.g. performing
-/// a binary search on a moderate length of integer vector), and it may be
-/// desirable to have an internal iterations within \c T::run() to avoid
-/// the overhead of function calls to \c T::run().
-/// In that case, \c T::run() would return the number of internal iterations
-/// instead of 1.
-///
-/// The \c BenchMark::run() method records some statistics %data on the
-/// benchmarking, including the start and end times and the total number of
-/// iterations (which is the sum of the return value of \c T::run(), and,
-/// is equal to \c niter in the simplest case where \c T::run() always
-/// returns 1).
-/// This %data can be retried via other methods of \c BenchMark, but in
-/// the primarily intended use case the \c BenchMark object would calls its
-/// \c run() method at the end of its construction, and prints summarized
-/// statistics to the standard output.
-/// This way, the developer can only write a single line of code to perform
-/// everything other than the benchmark target code (see the example below).
-///
-/// \b Example
-///
-/// Suppose that we want to measure performance of the search (find)
-/// operation on STL set objects.  We'd first define the implementation
-/// class (to be the template parameter of the \c BenchMark class) as follows:
-///
-/// \code class SetSearchBenchMark {
-/// public:
-///    SetSearchBenchMark(const set<int>& data, const vector<int>& keys) :
-///        data_(data), keys_(keys)
-///    {}
-///    unsigned int run() {
-///        vector<int>::const_iterator iter;
-///        vector<int>::const_iterator end_key = keys_.end();
-///        for (iter = keys_.begin(); iter != end_key; ++iter) {
-///            data_.find(*iter);
-///        }        
-///        return (keys_.size());
-///    }
-///    const set<int>& data_;
-///    const vector<int>& keys_;
-/// }; \endcode
-///
-/// In its constructor the \c SetSearchBenchMark class takes a set of
-/// integers (\c %data) and a vector of integers (\c keys).  \c %data is
-/// the STL set to be searched, and \c keys stores the search keys.
-/// The constructor keeps local references to these objects.
-///
-/// The \c SetSearchBenchMark::run() method, which is called via
-/// \c BenchMark::run(), iterates over the key vector, and performs the
-/// \c find() method of the set class for each key.
-/// (This is only for performance measurement, so the result is ignored).
-/// Note that this \c run() method has its own internal iterations.
-/// This is because each invocation of \c find() would be pretty lightweight,
-/// and the function call overhead may be relatively heavier.
-/// Due to the internal iterations, this method returns the number of
-/// \c find() calls, which is equal to the size of the key vector.
-///
-/// Next, we should prepare test %data.  In this simple example, let's assume
-/// we use a fixed size: a set of 10,000 integers (from 0 to 9999), and use
-/// the same number of search keys randomly chosen from that range:
-/// \code
-///    set<int> data_set;
-///    vector<int> keys;
-///    for (int i = 0; i < 10000; ++i) {
-///        data_set.insert(i);
-///        keys.push_back(rand() % 10000);
-///    } \endcode
-///
-/// Then construct a \c BenchMark<SetSearchBenchMark> object with the
-/// test %data:
-/// \code
-///    BenchMark<SetSearchBenchMark>(100, SetSearchBenchMark(data_set, keys));
-/// \endcode
-/// Here we specify 100 for the number of iterations, which would cause
-/// 1 million search attempts in total.
-///
-/// That's it.  If we put these in a C++ source file with usual necessary
-/// stuff (such as \c %main()), compile it, and run the executable, then
-/// we'll see something like this:
-///
-/// \code Performed 1000000 iterations in 0.180172s (5550251.98ips) \endcode
-///
-/// It should be obvious what this means (ips stands for "iterations
-///  per second").
-///
-/// A complete example program of this measurement scenario (with some
-/// additional test cases and configurable parameters) can be found in
-/// example/search_bench.cc.
-///
-/// \b Customization
-///
-/// The above simple usage should be sufficient in many benchmark cases,
-/// but the \c BenchMark class provides some customization points by
-/// specializing some of its (templated) public methods.
-/// For example, assume you want to customize the output of benchmark result.
-/// It can be done by specializing \c BenchMark::printResult():
-/// \code namespace isc {
-/// namespace bench {
-/// template<>
-/// void
-/// BenchMark<SetSearchBenchMark>::printResult() const {
-///     cout << "Searched for " << target_.keys_.size() << " keys "
-///         << getIteration() << " times in " << getDuration() << "s" << endl;
-/// }
-/// }
-/// } \endcode
-///
-/// Then the Result would be something like this:
-///
-/// \code Searched for 10000 keys 1000000 times in 0.21s \endcode
-///
-/// Note that the specialization must be defined in the same namespace as
-/// that of the \c BenchMark class, that is, \c isc::bench.
-/// It should also be noted that the corresponding \c SetSearchBenchMark
-/// object can be accessed (through its public interfaces) via the \c target_
-/// member variable of \c BenchMark.
-///
-/// <b>Future Plans and Compatibility Notes</b>
-///
-/// Currently, benchmark developers need to write supplemental code that is
-/// not directly related to benchmarks (such as \c %main()) by hand.
-/// It would be better if we could minimize such development overhead.
-/// In future versions we may provide a common \c %main() function and
-/// option parsers, thereby allowing the developer to only write the benchmark
-/// classes and invoke them, just like what various unit test frameworks do.
-///
-/// If and when we implement it, some existing benchmark cases may need to be
-/// adjusted.
-template <typename T>
-class BenchMark {
-    ///
-    /// \name Constructors
-    ///
-    /// Note: The copy constructor and the assignment operator are
-    /// intentionally defined as private, making this class non-copyable.
-    /// We use the default destructor.
-    //@{
-private:
-    BenchMark(const BenchMark& source);
-    BenchMark& operator=(const BenchMark& source);
-public:
-    /// \bench Constructor for immediate run.
-    ///
-    /// This is the constructor that is expected to be used normally.
-    /// It runs the benchmark within the constructor and prints the result,
-    /// thereby making it possible to do everything with a single line of
-    /// code (see the above example).
-    ///
-    /// \param iterations The number of iterations.  The \c run() method will
-    /// be called this number of times.
-    /// \param target The templated class object that
-    /// implements the code to be benchmarked.
-    BenchMark(const int iterations, T target) :
-        iterations_(iterations), sub_iterations_(0), target_(target)
-    {
-        initialize(true);
-    }
-
-    /// \bench Constructor for finer-grained control.
-    ///
-    /// This constructor takes the third parameter, \c immediate, to control
-    /// whether to run the benchmark within the constructor.
-    /// It also takes a reference to the templated class object rather than
-    /// an object copy, so if the copy overhead isn't acceptable this
-    /// constructor must be used.
-    ///
-    /// \param iterations The number of iterations.  The \c run() method will
-    /// be called this number of times.
-    /// \param target A reference to the templated class object that
-    /// implements the code to be benchmarked.
-    /// \param immediate If \c true the benchmark will be performed within
-    /// the constructor; otherwise it only does initialization.
-    BenchMark(const int iterations, T& target, const bool immediate) :
-        iterations_(iterations), sub_iterations_(0), target_(target)
-    {
-        initialize(immediate);
-    }
-    //@}
-
-    /// \brief Hook to be called before starting benchmark.
-    ///
-    /// This method will be called from \c run() before starting the benchmark.
-    /// By default it's empty, but can be customized via template
-    /// specialization.
-    void setUp() {}
-
-    /// \brief Hook to be called after benchmark.
-    ///
-    /// This method will be called from \c run() when the benchmark completes.
-    /// By default it's empty, but can be customized via template
-    /// specialization.
-    void tearDown() {}
-
-    /// \brief Perform benchmark.
-    ///
-    /// This method first calls \c setUp().
-    /// It then records the current time, calls \c T::run() for the number
-    /// of times specified on construction, and records the time on completion.
-    /// Finally, it calls \c tearDown().
-    void run() {
-        setUp();
-
-        struct timeval beg, end;
-        gettimeofday(&beg, NULL);
-        for (int i = 0; i < iterations_; ++i) {
-            sub_iterations_ += target_.run();
-        }
-        gettimeofday(&end, NULL);
-        tv_diff_ = tv_subtract(end, beg);
-
-        tearDown();
-    }
-
-    /// \brief Print the benchmark result.
-    ///
-    /// This method prints the benchmark result in a common style to the
-    /// standard out.  The result contains the number of total iterations,
-    /// the duration of the test, and the number of iterations per second
-    /// calculated from the previous two parameters.
-    ///
-    /// A call to this method is only meaningful after the completion of
-    /// \c run().  The behavior is undefined in other cases.
-    void printResult() const {
-        std::cout.precision(6);
-        std::cout << "Performed " << getIteration() << " iterations in "
-                  << std::fixed << getDuration() << "s";
-        std::cout.precision(2);
-        std::cout << " (" << std::fixed << getIterationPerSecond() << "ips)"
-                  << std::endl;
-    }
-
-    /// \brief Return the number of iterations.
-    ///
-    /// It returns the total iterations of benchmark, which is the sum
-    /// of the return value of \c T::run() over all calls to it
-    /// (note that it may not equal to the number of calls to \c T::run(),
-    /// which was specified on construction of this class).
-    ///
-    /// A call to this method is only meaningful after the completion of
-    /// \c run().  The behavior is undefined in other cases.
-    unsigned int getIteration() const { return (sub_iterations_); }
-
-    /// \brief Return the duration of benchmark in seconds.
-    ///
-    /// The highest possible precision of this value is microseconds.
-    ///
-    /// A call to this method is only meaningful after the completion of
-    /// \c run().  The behavior is undefined in other cases.
-    double getDuration() const {
-        return (tv_diff_.tv_sec +
-                static_cast<double>(tv_diff_.tv_usec) / ONE_MILLION);
-    }
-
-    /// \brief Return the average duration per iteration in seconds.
-    ///
-    /// The highest possible precision of this value is microseconds.
-    /// The iteration is the sum of the return value of \c T::run() over
-    /// all calls to it (note that it may not equal to the number of calls
-    /// to \c T::run()).
-    ///
-    /// If it cannot calculate the average, it returns \c TIME_FAILURE.
-    ///
-    /// A call to this method is only meaningful after the completion of
-    /// \c run().  The behavior is undefined in other cases.
-    double getAverageTime() const {
-        if (sub_iterations_ == 0) {
-            return (TIME_FAILURE);
-        }
-        return ((tv_diff_.tv_sec +
-                 static_cast<double>(tv_diff_.tv_usec) / ONE_MILLION ) /
-                sub_iterations_);
-    }
-
-    /// \brief Return the number of possible iterations per second based on
-    /// the benchmark result.
-    ///
-    /// If it cannot calculate that number (e.g. because the duration is
-    /// too small) it returns \c ITERATION_FAILURE.
-    /// A call to this method is only meaningful after the completion of
-    /// \c run().  The behavior is undefined in other cases.
-    double getIterationPerSecond() const {
-        const double duration_usec = tv_diff_.tv_sec +
-            static_cast<double>(tv_diff_.tv_usec) / ONE_MILLION;
-        if (duration_usec == 0) {
-            return (ITERATION_FAILURE);
-        }
-        return (sub_iterations_ / duration_usec);
-    }
-public:
-    /// \brief A constant that indicates a failure in \c getAverageTime().
-    ///
-    /// This constant be used as double but is defined as int so that it can
-    /// be initialized within the class definition.  Type conversion will be
-    /// performed implicitly.
-    static const int TIME_FAILURE = -1;
-
-    /// \brief A constant that indicates a failure in
-    /// \c getIterationPerSecond().
-    ///
-    /// This constant be used as double but is defined as int so that it can
-    /// be initialized within the class definition.  Type conversion will be
-    /// performed implicitly.
-    static const int ITERATION_FAILURE = -1;
-private:
-    void initialize(const bool immediate) {
-        if (immediate) {
-            run();
-            printResult();
-        }
-    }
-private:
-    // return t1 - t2
-    struct timeval tv_subtract(const struct timeval& t1,
-                               const struct timeval& t2)
-    {
-        struct timeval result;
-
-        result.tv_sec = t1.tv_sec - t2.tv_sec;
-        if (t1.tv_usec >= t2.tv_usec) {
-            result.tv_usec = t1.tv_usec- t2.tv_usec;
-        } else {
-            result.tv_usec = ONE_MILLION + t1.tv_usec - t2.tv_usec;
-            --result.tv_sec;
-        }
-
-        return (result);
-    }
-private:
-    static const int ONE_MILLION = 1000000;
-    const unsigned int iterations_;
-    unsigned int sub_iterations_;
-    T& target_;
-    struct timeval tv_diff_;
-};
-
-}
-}
-#endif  // __BENCHMARK_H
-
-// Local Variables: 
-// mode: c++
-// End: 

+ 0 - 116
src/lib/bench/benchmark_util.cc

@@ -1,116 +0,0 @@
-// 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$
-
-#include <fstream>
-#include <iostream>
-#include <string>
-#include <vector>
-
-#include <exceptions/exceptions.h>
-
-#include <dns/buffer.h>
-#include <dns/exceptions.h>
-#include <dns/name.h>
-#include <dns/message.h>
-#include <dns/messagerenderer.h>
-#include <dns/rrtype.h>
-#include <dns/rrclass.h>
-#include <dns/question.h>
-
-#include <bench/benchmark_util.h>
-
-using namespace std;
-using namespace isc;
-using namespace isc::dns;
-
-namespace isc {
-namespace bench {
-void
-loadQueryData(const char* const input_file, BenchQueries& queries,
-              const RRClass& qclass, const bool strict)
-{
-    ifstream ifs;
-
-    ifs.open(input_file, ios_base::in);
-    if ((ifs.rdstate() & istream::failbit) != 0) {
-        isc_throw(BenchMarkError, "failed to load query data file: " +
-                  string(input_file));
-    }
-    loadQueryData(ifs, queries, qclass, strict);
-    ifs.close();
-}
-
-void
-loadQueryData(istream& input, BenchQueries& queries, const RRClass& qclass,
-              const bool strict)
-{
-    string line;
-    unsigned int linenum = 0;
-    Message query_message(Message::RENDER);
-    OutputBuffer buffer(128); // this should be sufficiently large
-    MessageRenderer renderer(buffer);
-    while (getline(input, line), !input.eof()) {
-        ++linenum;
-        if (input.bad() || input.fail()) {
-            isc_throw(BenchMarkError,
-                      "Unexpected line in query data file around line " <<
-                      linenum);
-        }
-        if (line.empty() || line[0] == '#') {
-            continue;           // skip comment and blank lines
-        }
-
-        istringstream iss(line);
-        string qname_string, qtype_string;
-        iss >> qname_string >> qtype_string;
-        if (iss.bad() || iss.fail()) {
-            if (strict) {
-                isc_throw(BenchMarkError,
-                          "load query: unexpected input around line " <<
-                          linenum);
-            }
-            continue;
-        }
-
-        // We expect broken lines of data, which will be ignored with a
-        // warning message.
-        try {
-            query_message.clear(Message::RENDER);
-            query_message.setQid(0);
-            query_message.setOpcode(Opcode::QUERY());
-            query_message.setRcode(Rcode::NOERROR());
-            query_message.addQuestion(Question(Name(qname_string), qclass,
-                                               RRType(qtype_string)));
-
-            renderer.clear();
-            query_message.toWire(renderer);
-            vector<unsigned char> query_data(
-                static_cast<const unsigned char*>(buffer.getData()),
-                static_cast<const unsigned char*>(buffer.getData()) +
-                buffer.getLength());
-            queries.push_back(query_data);
-        } catch (const Exception& error) {
-            if (strict) {
-                isc_throw(BenchMarkError,
-                          "failed to parse/create query around line " <<
-                          linenum);
-            }
-            continue;
-        }
-    }
-}
-}
-}

+ 0 - 149
src/lib/bench/benchmark_util.h

@@ -1,149 +0,0 @@
-// 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 __BENCHMARK_UTIL_H
-#define __BENCHMARK_UTIL_H 1
-
-/// \file
-/// Utilities to help write benchmark cases.
-///
-/// The initial version of this library only contains utilities for very
-/// specific benchmark cases, that is, building DNS query data.
-/// It's not clear if we have more utilities including scenario-independent
-/// ones in future, but we have them here for now.
-/// If we find we only need utilities specific to individual benchmark
-/// scenarios, we may move them to more specific places.
-/// For example, the query generator may go to benchmarks for DNS server
-/// implementations.
-
-#include <istream>
-#include <vector>
-
-#include <exceptions/exceptions.h>
-
-namespace isc {
-namespace dns {
-class RRClass;
-}
-
-namespace bench {
-/// \brief An exception that is thrown if an error occurs within the benchmark
-/// module.
-class BenchMarkError : public Exception {
-public:
-    BenchMarkError(const char* file, size_t line, const char* what) :
-        isc::Exception(file, line, what) {}
-};
-
-/// \brief A convenient shortcut type to represent a sequence of query %data
-/// in wire format.
-typedef std::vector<std::vector<unsigned char> > BenchQueries; 
-
-/// \brief Load query %data from a file into a vector.
-///
-/// The format of the %data file is a sequence of tuples of query name and
-/// query type.  Each line specifies a single tuple.  Empty lines and
-/// lines beginning with a pound sign (#) are considered comments and will
-/// be ignored.  Example:
-/// \code
-/// # This is a comment line, will be ignored.  same for the next line.
-///
-/// www.example.com AAAA
-/// ftp.example.org NS
-/// text.dot.example TXT \endcode
-///
-/// For those who are familiar with BIND 9's queryperf tool, this is the
-/// same as the simplest form of the input file for queryperf.
-///
-/// For each tuple, this function builds a wire-format non recursive DNS
-/// query message, and appends it to the given vector in a form of
-/// a vector of <code>unsigned char</code>.
-///
-/// The resulting vector can be used, e.g., for benchmarking query processing
-/// code without involving disk access or network I/O.
-/// It would be handier than existing tool such as queryperf and can help
-/// measure the "bare" (or the best possible) performance of the query
-/// processing itself.
-///
-/// If this function fails to open the specified file to read the %data,
-/// an exception of class \c BenchMarkError will be thrown.
-/// If it fails to recognize an input line either as a comment or as
-/// a tuple of strings, an exception of class \c BenchMarkError will be
-/// thrown.
-///
-/// By default, this function does not require the strings be a valid
-/// domain name or a valid textual representation of an RR type.
-/// This is because the input %data may be built from a packet dump of
-/// real query samples without validation, which may contain bogus values.
-/// It would make more sense to just ignore the bogus %data than filter
-/// the sample beforehand.
-/// This behavior can be changed by setting the \c strict argument to
-/// \c true, in which case if this function fails to parse the query name
-/// or the type, it will throw an exception of class \c BenchMarkError.
-///
-/// If memory allocation fails during the processing, a corresponding standard
-/// exception will be thrown.
-///
-/// This function only offers the basic exception guarantee.  That is, if
-/// exception is thrown from this function, it is not guaranteed that
-/// \c queries keeps the content before this function is called.
-/// It is not so difficult to offer a stronger exception guarantee, but
-/// since this function is used in a limited usage, mainly for testing
-/// purposes, its benefit wouldn't outweigh the implementation complexity.
-///
-/// \param input_file A character string specifying the %data file name.
-/// \param queries A vector wherein the query %data is to be stored.
-/// \param qclass The RR class of the resulting queries.  The same RR class
-/// is used for all queries.
-/// \param strict If \c true, apply stricter validation on the query name and
-/// query RR types; otherwise invalid inputs will be ignored.
-void loadQueryData(const char* const input_file, BenchQueries& queries,
-                   const isc::dns::RRClass& qclass, const bool strict = false);
-
-/// \brief Load query %data from an input stream into a vector.
-///
-/// This version of function is same as
-/// loadQueryData(const char*,  BenchQueries&, const isc::dns::RRClass&, const bool)
-/// except it reads the input query sequence from a specified input stream.
-///
-/// This version will be used for a smaller scale test where query %data is
-///  hardcoded in the benchmark source code.  For example, we could build
-/// a sequence of wire-format queries via the following code:
-/// \code
-///    vector<QueryParam> queries;
-///    stringstream qstream;
-///    qstream << "www.example.com AAAA" << endl
-///            << "ftp.example.org NS" << endl
-///            << "text.dot.example TXT" << endl;
-///    loadQueryData(qstream, queries, RRClass::IN()); \endcode
-/// This will result in the same sequence of queries as the example using
-/// a %data file shown in the other version of the function.
-///
-/// \param input An input stream object that is to emit the query sequence.
-/// \param queries A vector wherein the query %data is to be stored.
-/// \param qclass The RR class of the resulting queries.  The same RR class
-/// is used for all queries.
-/// \param strict If \c true, apply stricter validation on the query name and
-/// query RR types; otherwise invalid inputs will be ignored.
-void loadQueryData(std::istream& input, BenchQueries& queries,
-                   const isc::dns::RRClass& qclass, const bool strict = false);
-}
-}
-#endif  // __BENCHMARK_UTIL_H
-
-// Local Variables: 
-// mode: c++
-// End: 

+ 0 - 9
src/lib/bench/example/Makefile.am

@@ -1,9 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
-
-CLEANFILES = *.gcno *.gcda
-
-noinst_PROGRAMS = search_bench
-search_bench_SOURCES = search_bench.cc
-
-search_bench_LDADD = $(top_builddir)/src/lib/exceptions/libexceptions.la
-

+ 0 - 144
src/lib/bench/example/search_bench.cc

@@ -1,144 +0,0 @@
-// 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$
-
-#include <unistd.h>             // for getpid
-
-#include <cstdlib>              // for rand
-#include <algorithm>
-#include <iostream>
-#include <vector>
-#include <set>
-
-#include <exceptions/exceptions.h>
-
-#include <bench/benchmark.h>
-
-using namespace std;
-using namespace isc::bench;
-
-namespace {
-template <bool Sorted>
-class VectorSearchBenchMark {
-public:
-    VectorSearchBenchMark(const vector<int>& data,
-                          const vector<int>& keys) :
-        data_(data), keys_(keys)
-    {}
-    unsigned int run() {
-        vector<int>::const_iterator iter;
-        vector<int>::const_iterator end_key = keys_.end();
-        for (iter = keys_.begin(); iter != end_key; ++iter) {
-            if (Sorted) {
-                binary_search(data_.begin(), data_.end(), *iter);
-            } else {
-                find(data_.begin(), data_.end(), *iter);
-            }
-        }
-        return (keys_.size());
-    }
-private:
-    const vector<int>& data_;
-    const vector<int>& keys_;
-};
-
-class SetSearchBenchMark {
-public:
-    SetSearchBenchMark(const set<int>& data, const vector<int>& keys) :
-        data_(data), keys_(keys)
-    {}
-    unsigned int run() {
-        vector<int>::const_iterator iter;
-        vector<int>::const_iterator end_key = keys_.end();
-        for (iter = keys_.begin(); iter != end_key; ++iter) {
-            data_.find(*iter);
-        }        
-        return (keys_.size());
-    }
-public:   // make it visible to the BenchMark class
-    const set<int>& data_;
-private:
-    const vector<int>& keys_;
-};
-}
-
-namespace isc {
-namespace bench {
-template<>
-void
-BenchMark<SetSearchBenchMark>::setUp() {
-    cout << "Benchmark for searching std::set (size="
-         << target_.data_.size() << ")" << endl;    
-}
-}
-}
-
-namespace {
-const int DEFAULT_ITERATION = 100;
-const int DEFAULT_SIZE = 10000;
-
-void
-usage() {
-    cerr << "Usage: search_bench [-n iterations] [-s data_size]" << endl;
-    exit (1);
-}
-}
-
-int
-main(int argc, char* argv[]) {
-    int ch;
-    int iteration = DEFAULT_ITERATION;
-    int size = DEFAULT_SIZE;
-    while ((ch = getopt(argc, argv, "n:s:")) != -1) {
-        switch (ch) {
-        case 'n':
-            iteration = atoi(optarg);
-            break;
-        case 's':
-            size = atoi(optarg);
-            break;
-        case '?':
-        default:
-            usage();
-        }
-    }
-    argc -= optind;
-    argv += optind;
-    if (argc != 0) {
-        usage();
-    }
-
-    srand(getpid());
-    vector<int> data_vector;
-    set<int> data_set;
-    vector<int> keys;
-    for (int i = 0; i < size; ++i) {
-        data_vector.push_back(i);
-        data_set.insert(i);
-        keys.push_back(rand() % size);
-    }
-
-    cout << "Benchmark for linear search" << endl;
-    BenchMark<VectorSearchBenchMark<false> >(iteration,
-                                             VectorSearchBenchMark<false>(
-                                                 data_vector, keys));
-    cout << "Benchmark for binary search" << endl;
-    BenchMark<VectorSearchBenchMark<true> >(iteration,
-                                             VectorSearchBenchMark<true>(
-                                                 data_vector, keys));
-    BenchMark<SetSearchBenchMark>(iteration,
-                                  SetSearchBenchMark(data_set, keys));
-    return (0);
-}

+ 0 - 24
src/lib/bench/tests/Makefile.am

@@ -1,24 +0,0 @@
-AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
-AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
-AM_CXXFLAGS = $(B10_CXXFLAGS)
-
-CLEANFILES = *.gcno *.gcda
-
-TESTS =
-if HAVE_GTEST
-TESTS += run_unittests
-run_unittests_SOURCES = run_unittests.cc
-run_unittests_SOURCES += benchmark_unittest.cc
-run_unittests_SOURCES += loadquery_unittest.cc
-
-run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
-run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
-run_unittests_LDADD = $(top_builddir)/src/lib/exceptions/libexceptions.la
-run_unittests_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
-run_unittests_LDADD += $(top_builddir)/src/lib/bench/libbench.la
-run_unittests_LDADD += $(GTEST_LDADD)
-endif
-
-noinst_PROGRAMS = $(TESTS)
-
-EXTRA_DIST = testdata/query.txt

+ 0 - 143
src/lib/bench/tests/benchmark_unittest.cc

@@ -1,143 +0,0 @@
-// 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$
-
-#include <unistd.h>             // for usleep
-
-#include <bench/benchmark.h>
-
-#include <gtest/gtest.h>
-
-using namespace std;
-using namespace isc::bench;
-
-namespace {
-// Our "benchmark" simply sleeps for a short period, and reports a faked
-// number of iterations.
-class TestBenchMark {
-public:
-    TestBenchMark(const int sub_iterations, const int sleep_time) :
-        sub_iterations_(sub_iterations), sleep_time_(sleep_time),
-        setup_completed_(false), teardown_completed_(false)
-    {}
-    unsigned int run() {
-        usleep(sleep_time_);
-        return (sub_iterations_);
-    }
-    const int sub_iterations_;
-    const int sleep_time_;
-    bool setup_completed_;
-    bool teardown_completed_;
-};
-}
-
-namespace isc {
-namespace bench {
-template <>
-void
-BenchMark<TestBenchMark>::setUp() {
-    target_.setup_completed_ = true;
-};
-
-template <>
-void
-BenchMark<TestBenchMark>::tearDown() {
-    target_.teardown_completed_ = true;
-};
-
-// XXX: some compilers cannot find class static constants used in
-// EXPECT_xxx macross, for which we need an explicit definition.
-template <typename T>
-const int BenchMark<T>::TIME_FAILURE;
-}
-}
-
-namespace {
-TEST(BenchMarkTest, run) {
-    // use some uncommon iterations for testing purpose:
-    const int sub_iterations = 23;
-    const int sleep_time = 50000; // will sleep for 50ms
-    // we cannot expect particular accuracy on the measured duration, so
-    // we'll include some conservative margin (25%) and perform range
-    // comparison below.
-    const int duration_margin = 12500; // 12.5ms
-    const int ONE_MILLION = 1000000;
-
-    // Prerequisite check: since the tests in this case may depend on subtle
-    // timing, it may result in false positives.  There are reportedly systems
-    // where usleep() doesn't work as this test expects.  So we check the
-    // conditions before the tests, and if it fails skip the tests at the
-    // risk of overlooking possible bugs.
-    struct timeval check_begin, check_end;
-    gettimeofday(&check_begin, NULL);
-    usleep(sleep_time);
-    gettimeofday(&check_end, NULL);
-    check_end.tv_sec -= check_begin.tv_sec;
-    if (check_end.tv_usec >= check_begin.tv_usec) {
-        check_end.tv_usec = check_end.tv_usec - check_begin.tv_usec;
-    } else {
-        check_end.tv_usec = ONE_MILLION + check_begin.tv_usec -
-            check_end.tv_usec;
-        --check_end.tv_sec;
-    }
-    if (check_end.tv_sec != 0 ||
-        sleep_time - duration_margin > check_end.tv_usec ||
-        sleep_time + duration_margin < check_end.tv_usec) {
-        cerr << "Prerequisite check failed.  skipping test" << endl;
-        return;
-    }
-
-    TestBenchMark test_bench(sub_iterations, sleep_time);
-    BenchMark<TestBenchMark> bench(1, test_bench, false);
-    // Check pre-test conditions.
-    EXPECT_FALSE(test_bench.setup_completed_);
-    EXPECT_FALSE(test_bench.teardown_completed_);
-
-    bench.run();
-
-    // Check if specialized setup and teardown were performed.
-    EXPECT_TRUE(test_bench.setup_completed_);
-    EXPECT_TRUE(test_bench.teardown_completed_);
-
-    // Check accuracy of the measured statistics.
-    EXPECT_EQ(sub_iterations, bench.getIteration());
-    EXPECT_LT(sleep_time - duration_margin, bench.getDuration() * ONE_MILLION);
-    EXPECT_GT(sleep_time + duration_margin, bench.getDuration() * ONE_MILLION);
-    EXPECT_LT((sleep_time - duration_margin) /
-              static_cast<double>(sub_iterations),
-              bench.getAverageTime() * ONE_MILLION);
-    EXPECT_GT((sleep_time + duration_margin) /
-              static_cast<double>(sub_iterations),
-              bench.getAverageTime() * ONE_MILLION);
-    EXPECT_LT(static_cast<double>(sub_iterations) /
-              (sleep_time + duration_margin),
-              bench.getIterationPerSecond() / ONE_MILLION);
-    EXPECT_GT(static_cast<double>(sub_iterations) /
-              (sleep_time - duration_margin),
-              bench.getIterationPerSecond() / ONE_MILLION);
-}
-
-TEST(BenchMarkTest, runWithNoIteration) {
-    // we'll lie on the number of iteration (0).  it will result in
-    // meaningless result, but at least it shouldn't crash.
-    TestBenchMark test_bench(0, 0);
-    BenchMark<TestBenchMark> bench(1, test_bench, false);
-    bench.run();
-    EXPECT_EQ(0, bench.getIteration());
-    // Since the reported iteration is 0, naive calculation of the average
-    // time would cause a division by 0 failure.
-    EXPECT_EQ(bench.TIME_FAILURE, bench.getAverageTime());
-}
-}

+ 0 - 198
src/lib/bench/tests/loadquery_unittest.cc

@@ -1,198 +0,0 @@
-// 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$
-
-#include <algorithm>
-#include <utility>
-#include <vector>
-#include <sstream>
-
-#include <dns/buffer.h>
-#include <dns/message.h>
-#include <dns/name.h>
-#include <dns/rrclass.h>
-#include <dns/rrtype.h>
-
-#include <bench/benchmark_util.h>
-
-#include <gtest/gtest.h>
-
-using namespace std;
-using namespace isc::bench;
-using namespace isc::dns;
-
-namespace {
-typedef pair<string, string> QueryParam;
-
-class LoadQueryTest : public ::testing::Test {
-protected:
-    LoadQueryTest() : query_rrclass(RRClass::IN()) {
-        queries.push_back(QueryParam("www.example.org", "AAAA"));
-        queries.push_back(QueryParam("www.example.com", "A"));
-        queries.push_back(QueryParam("test.example", "NS"));
-    }
-    RRClass query_rrclass;
-    BenchQueries result_queries;
-    vector<QueryParam> queries;
-    stringstream query_stream;
-    static const char* const DATA_DIR;
-};
-
-const char* const LoadQueryTest::DATA_DIR = TEST_DATA_DIR;
-
-class QueryInserter {
-public:
-    QueryInserter(stringstream& stream) : stream_(stream) {}
-    void operator()(const QueryParam& query) {
-        stream_ << query.first << " " << query.second << endl;
-    }
-private:
-    stringstream& stream_;
-};
-
-class QueryChecker {
-public:
-    QueryChecker(const vector<QueryParam>* expected, const RRClass& rrclass) :
-        expected_(expected), rrclass_(rrclass)
-    {
-        if (expected != NULL) {
-            iter_ = expected_->begin();
-        }
-    }
-    void operator()(const vector<unsigned char>& actual_data) {
-        InputBuffer buffer(&actual_data[0], actual_data.size());
-        Message message(Message::PARSE);
-        message.fromWire(buffer);
-
-        // Check if the header part indicates an expected standard query.
-        EXPECT_EQ(0, message.getQid());
-        EXPECT_EQ(Opcode::QUERY(), message.getOpcode());
-        EXPECT_EQ(Rcode::NOERROR(), message.getRcode());
-        EXPECT_EQ(Rcode::NOERROR(), message.getRcode());
-        EXPECT_FALSE(message.getHeaderFlag(MessageFlag::QR()));
-        EXPECT_FALSE(message.getHeaderFlag(MessageFlag::AA()));
-        EXPECT_EQ(1, message.getRRCount(Section::QUESTION()));
-        EXPECT_EQ(0, message.getRRCount(Section::ANSWER()));
-        EXPECT_EQ(0, message.getRRCount(Section::AUTHORITY()));
-        EXPECT_EQ(0, message.getRRCount(Section::ADDITIONAL()));
-
-        // Check if the question matches our original data, if the expected
-        // data is given.
-        if (expected_ != NULL) {
-            ConstQuestionPtr question = *message.beginQuestion();;
-            EXPECT_EQ(Name((*iter_).first), question->getName());
-            EXPECT_EQ(RRType((*iter_).second), question->getType());
-            EXPECT_EQ(rrclass_, question->getClass());
-        
-            ++iter_;
-        }
-    }
-private:
-    const vector<QueryParam>* expected_;
-    vector<QueryParam>::const_iterator iter_;
-    const RRClass rrclass_;
-};
-
-TEST_F(LoadQueryTest, load) {
-    for_each(queries.begin(), queries.end(), QueryInserter(query_stream));
-
-    loadQueryData(query_stream, result_queries, query_rrclass);
-
-    EXPECT_EQ(queries.size(), result_queries.size());
-    for_each(result_queries.begin(), result_queries.end(),
-             QueryChecker(&queries, query_rrclass));
-}
-
-TEST_F(LoadQueryTest, loadForCHClass) {
-    for_each(queries.begin(), queries.end(), QueryInserter(query_stream));
-    query_rrclass = RRClass::CH();
-
-    loadQueryData(query_stream, result_queries, query_rrclass);
-
-    EXPECT_EQ(queries.size(), result_queries.size());
-    for_each(result_queries.begin(), result_queries.end(),
-             QueryChecker(&queries, query_rrclass));
-}
-
-TEST_F(LoadQueryTest, loadWithComment) {
-    for_each(queries.begin(), queries.end(), QueryInserter(query_stream));
-    // add a comment line.  this shouldn't change the result.
-    query_stream << "# this is a comment" << endl;
-    query_stream << endl;       // empty line.  should be ignored, too.
-
-    loadQueryData(query_stream, result_queries, query_rrclass);
-    EXPECT_EQ(queries.size(), result_queries.size());
-    for_each(result_queries.begin(), result_queries.end(),
-             QueryChecker(&queries, query_rrclass));
-}
-
-TEST_F(LoadQueryTest, loadWithIncompleteData) {
-    for_each(queries.begin(), queries.end(), QueryInserter(query_stream));
-    // RRType is missing.  It should be ignored by default.
-    query_stream << "type-is-missing" << endl;
-
-    loadQueryData(query_stream, result_queries, query_rrclass);
-    EXPECT_EQ(queries.size(), result_queries.size());
-    for_each(result_queries.begin(), result_queries.end(),
-             QueryChecker(&queries, query_rrclass));
-}
-
-TEST_F(LoadQueryTest, loadWithIncompleteDataToBeRejected) {
-    for_each(queries.begin(), queries.end(), QueryInserter(query_stream));
-    // RRType is missing.  We're going to specify the "strict" check, so
-    // we should receive an exception.
-    query_stream << "type-is-missing" << endl;
-    EXPECT_THROW(loadQueryData(query_stream, result_queries, query_rrclass,
-                               true), BenchMarkError);
-}
-
-TEST_F(LoadQueryTest, loadWithBadData) {
-    for_each(queries.begin(), queries.end(), QueryInserter(query_stream));
-    // invalid RRType.  It should be ignored by default.
-    query_stream << "www.example.com NOSUCHRRTYPE" << endl;
-
-    loadQueryData(query_stream, result_queries, query_rrclass);
-    EXPECT_EQ(queries.size(), result_queries.size());
-    for_each(result_queries.begin(), result_queries.end(),
-             QueryChecker(&queries, query_rrclass));
-}
-
-TEST_F(LoadQueryTest, loadWithBadDataToBeRejected) {
-    for_each(queries.begin(), queries.end(), QueryInserter(query_stream));
-    // invalid RRType, which should trigger an exception.
-    query_stream << "www.example.com NOSUCHRRTYPE" << endl;
-    EXPECT_THROW(loadQueryData(query_stream, result_queries, query_rrclass,
-                               true), BenchMarkError);
-}
-
-TEST_F(LoadQueryTest, loadFromFile) {
-    const string data_file = string(DATA_DIR) + string("/query.txt");
-    loadQueryData(data_file.c_str(), result_queries, query_rrclass);
-    EXPECT_LT(0, result_queries.size());
-
-    // We are going to skip matching the query data; we only check the header.
-    // We could check the data, too, but to do so we need to populate the
-    // expected data from the file (or prepare a consistent copy locally).
-    // Since the implementation is shared with the stringstream case, the
-    // additional setup wouldn't be worthwhile.
-    for_each(result_queries.begin(), result_queries.end(),
-             QueryChecker(NULL, query_rrclass));
-}
-
-TEST_F(LoadQueryTest, loadFromFileNotExist) {
-    EXPECT_THROW(loadQueryData("notexistent/query.data", result_queries,
-                               query_rrclass), BenchMarkError);
-}
-}

+ 0 - 24
src/lib/bench/tests/run_unittests.cc

@@ -1,24 +0,0 @@
-// 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$
-
-#include <gtest/gtest.h>
-
-int
-main(int argc, char* argv[]) {
-    ::testing::InitGoogleTest(&argc, argv);
-
-    return (RUN_ALL_TESTS());
-}

+ 0 - 6
src/lib/bench/tests/testdata/query.txt

@@ -1,6 +0,0 @@
-# This is sample query data for benchmark.
-# The format is the same as BIND 9's queryperf.
-
-www.example.com TXT
-www.example.org SOA
-ftp.example.org RRSIG

+ 0 - 1
src/lib/config/Makefile.am

@@ -15,7 +15,6 @@ endif
 EXTRA_DIST =  testdata/b10-config-bad1.db
 EXTRA_DIST += testdata/b10-config-bad2.db
 EXTRA_DIST += testdata/b10-config-bad3.db
-EXTRA_DIST += testdata/b10-config-bad4.db
 EXTRA_DIST += testdata/b10-config.db
 EXTRA_DIST += testdata/data22_1.data
 EXTRA_DIST += testdata/data22_2.data

+ 1 - 1
src/lib/config/testdata/b10-config-bad1.db

@@ -1 +1 @@
-{"version": 0}
+{'version': 0}

+ 0 - 1
src/lib/config/testdata/b10-config-bad4.db

@@ -1 +0,0 @@
-{'version': 2}

+ 1 - 1
src/lib/config/testdata/b10-config.db

@@ -1 +1 @@
-{"version": 2, "TestModule": {"test": 125}}
+{"version": 1, "TestModule": {"test": 125}}

+ 0 - 3
src/lib/datasrc/static_datasrc.cc

@@ -70,7 +70,6 @@ StaticDataSrcImpl::StaticDataSrcImpl() :
 {
     authors = RRsetPtr(new RRset(authors_name, RRClass::CH(),
                                  RRType::TXT(), RRTTL(0)));
-    authors->addRdata(generic::TXT("Chen Zhengzhang")); // Jerry
     authors->addRdata(generic::TXT("Evan Hunt"));
     authors->addRdata(generic::TXT("Han Feng"));
     authors->addRdata(generic::TXT("Jelte Jansen"));
@@ -81,8 +80,6 @@ StaticDataSrcImpl::StaticDataSrcImpl() :
     authors->addRdata(generic::TXT("Michael Graff"));
     authors->addRdata(generic::TXT("Naoki Kambe"));
     authors->addRdata(generic::TXT("Shane Kerr"));
-    authors->addRdata(generic::TXT("Shen Tingting"));
-    authors->addRdata(generic::TXT("Stephen Morris"));
     authors->addRdata(generic::TXT("Zhang Likun"));
 
     authors_ns = RRsetPtr(new RRset(authors_name, RRClass::CH(),

+ 0 - 3
src/lib/datasrc/tests/static_unittest.cc

@@ -54,7 +54,6 @@ protected:
         version_data.push_back(PACKAGE_STRING);
 
         // XXX: in addition, the order the following items matter.
-        authors_data.push_back("Chen Zhengzhang");
         authors_data.push_back("Evan Hunt");
         authors_data.push_back("Han Feng");
         authors_data.push_back("Jelte Jansen");
@@ -65,8 +64,6 @@ protected:
         authors_data.push_back("Michael Graff");
         authors_data.push_back("Naoki Kambe");
         authors_data.push_back("Shane Kerr");
-        authors_data.push_back("Shen Tingting");
-        authors_data.push_back("Stephen Morris");
         authors_data.push_back("Zhang Likun");
 
         version_ns_data.push_back("version.bind.");

+ 1 - 1
src/lib/dns/message.h

@@ -80,7 +80,7 @@ typedef uint16_t qid_t;
 class InputBuffer;
 class MessageRenderer;
 class Message;
-class MessageImpl;
+struct MessageImpl;
 
 template <typename T>
 struct SectionIteratorImpl;

+ 0 - 1
src/lib/dns/rdata/generic/txt_16.cc

@@ -21,7 +21,6 @@
 #include <vector>
 
 #include <dns/buffer.h>
-#include <dns/exceptions.h>
 #include <dns/messagerenderer.h>
 #include <dns/rdata.h>
 #include <dns/rdataclass.h>

+ 2 - 2
src/lib/python/isc/config/ccsession.py

@@ -37,7 +37,7 @@
 """
 
 from isc.cc import Session
-from isc.config.config_data import ConfigData, MultiConfigData, BIND10_CONFIG_DATA_VERSION
+from isc.config.config_data import ConfigData, MultiConfigData
 import isc
 
 class ModuleCCSessionError(Exception): pass
@@ -333,7 +333,7 @@ class UIModuleCCSession(MultiConfigData):
         """Requests the current configuration from the configuration
            manager through b10-cmdctl, and stores those as CURRENT"""
         config = self._conn.send_GET('/config_data')
-        if 'version' not in config or config['version'] != BIND10_CONFIG_DATA_VERSION:
+        if 'version' not in config or config['version'] != 1:
             raise ModuleCCSessionError("Bad config version")
         self._set_current_config(config)
 

+ 17 - 30
src/lib/python/isc/config/cfgmgr.py

@@ -27,7 +27,7 @@ import copy
 import tempfile
 import json
 from isc.cc import data
-from isc.config import ccsession, config_data
+from isc.config import ccsession
 
 class ConfigManagerDataReadError(Exception):
     """This exception is thrown when there is an error while reading
@@ -43,13 +43,15 @@ class ConfigManagerData:
     """This class hold the actual configuration information, and
        reads it from and writes it to persistent storage"""
 
+    CONFIG_VERSION = 1
+
     def __init__(self, data_path, file_name = "b10-config.db"):
         """Initialize the data for the configuration manager, and
            set the version and path for the data store. Initializing
            this does not yet read the database, a call to
            read_from_file is needed for that."""
         self.data = {}
-        self.data['version'] = config_data.BIND10_CONFIG_DATA_VERSION
+        self.data['version'] = ConfigManagerData.CONFIG_VERSION
         self.data_path = data_path
         self.db_filename = data_path + os.sep + file_name
 
@@ -63,36 +65,21 @@ class ConfigManagerData:
            the second exception, the best way is probably to report the
            error and stop loading the system."""
         config = ConfigManagerData(data_path, file_name)
-        file = None
         try:
             file = open(config.db_filename, 'r')
             file_config = json.loads(file.read())
-            # handle different versions here
-            # If possible, we automatically convert to the new
-            # scheme and update the configuration
-            # If not, we raise an exception
-            if 'version' in file_config:
-                if file_config['version'] == config_data.BIND10_CONFIG_DATA_VERSION:
-                    config.data = file_config
-                elif file_config['version'] == 1:
-                    # only format change, no other changes necessary
-                    file_config['version'] = 2
-                    print("[b10-cfgmgr] Updating configuration database version from 1 to 2")
-                    config.data = file_config
-                else:
-                    if config_data.BIND10_CONFIG_DATA_VERSION > file_config['version']:
-                        raise ConfigManagerDataReadError("Cannot load configuration file: version %d no longer supported" % file_config['version'])
-                    else:
-                        raise ConfigManagerDataReadError("Cannot load configuration file: version %d not yet supported" % file_config['version'])
+            if 'version' in file_config and \
+                file_config['version'] == ConfigManagerData.CONFIG_VERSION:
+                config.data = file_config
             else:
-                raise ConfigManagerDataReadError("No version information in configuration file " + config.db_filename)
+                # We can put in a migration path here for old data
+                raise ConfigManagerDataReadError("[b10-cfgmgr] Old version of data found")
+            file.close()
         except IOError as ioe:
-            raise ConfigManagerDataEmpty("No configuration file found")
-        except ValueError:
-            raise ConfigManagerDataReadError("Configuration file out of date or corrupt, please update or remove " + config.db_filename)
-        finally:
-            if file:
-                file.close();
+            raise ConfigManagerDataEmpty("No config file found")
+        except:
+            raise ConfigManagerDataReadError("Config file unreadable")
+
         return config
         
     def write_to_file(self, output_file_name = None):
@@ -115,11 +102,11 @@ class ConfigManagerData:
                 os.rename(filename, self.db_filename)
         except IOError as ioe:
             # TODO: log this (level critical)
-            print("[b10-cfgmgr] Unable to write configuration file; configuration not stored: " + str(ioe))
+            print("[b10-cfgmgr] Unable to write config file; configuration not stored: " + str(ioe))
             # TODO: debug option to keep file?
         except OSError as ose:
             # TODO: log this (level critical)
-            print("[b10-cfgmgr] Unable to write configuration file; configuration not stored: " + str(ose))
+            print("[b10-cfgmgr] Unable to write config file; configuration not stored: " + str(ose))
         try:
             if filename and os.path.exists(filename):
                 os.remove(filename)
@@ -256,7 +243,7 @@ class ConfigManager:
             except data.DataNotFoundError as dnfe:
                 # no data is ok, that means we have nothing that
                 # deviates from default values
-                return ccsession.create_answer(0, { 'version': config_data.BIND10_CONFIG_DATA_VERSION })
+                return ccsession.create_answer(0, { 'version': self.config.CONFIG_VERSION })
         else:
             return ccsession.create_answer(1, "Bad module_name in get_config command")
 

+ 0 - 7
src/lib/python/isc/config/config_data.py

@@ -25,8 +25,6 @@ import isc.config.module_spec
 
 class ConfigDataError(Exception): pass
 
-BIND10_CONFIG_DATA_VERSION = 2
-
 def check_type(spec_part, value):
     """Does nothing if the value is of the correct type given the
        specification part relevant for the value. Raises an
@@ -253,11 +251,6 @@ class MultiConfigData:
         if module_name in self._specifications:
             del self._specifications[module_name]
 
-    def have_specification(self, module_name):
-        """Returns True if we have a specification for the module with the given name.
-           Returns False if we do not."""
-        return module_name in self._specifications
-
     def get_module_spec(self, module):
         """Returns the ModuleSpec for the module with the given name.
            If there is no such module, it returns None"""

+ 4 - 5
src/lib/python/isc/config/tests/ccsession_test.py

@@ -22,7 +22,6 @@
 import unittest
 import os
 from isc.config.ccsession import *
-from isc.config.config_data import BIND10_CONFIG_DATA_VERSION
 from unittest_fakesession import FakeModuleCCSession
 
 class TestHelperFunctions(unittest.TestCase):
@@ -443,20 +442,20 @@ class TestUIModuleCCSession(unittest.TestCase):
     def create_uccs2(self, fake_conn):
         module_spec = isc.config.module_spec_from_file(self.spec_file("spec2.spec"))
         fake_conn.set_get_answer('/module_spec', { module_spec.get_module_name(): module_spec.get_full_spec()})
-        fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
+        fake_conn.set_get_answer('/config_data', { 'version': 1 })
         return UIModuleCCSession(fake_conn)
 
     def test_init(self):
         fake_conn = fakeUIConn()
         fake_conn.set_get_answer('/module_spec', {})
-        fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
+        fake_conn.set_get_answer('/config_data', { 'version': 1 })
         uccs = UIModuleCCSession(fake_conn)
         self.assertEqual({}, uccs._specifications)
-        self.assertEqual({ 'version': BIND10_CONFIG_DATA_VERSION}, uccs._current_config)
+        self.assertEqual({ 'version': 1}, uccs._current_config)
 
         module_spec = isc.config.module_spec_from_file(self.spec_file("spec2.spec"))
         fake_conn.set_get_answer('/module_spec', { module_spec.get_module_name(): module_spec.get_full_spec()})
-        fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
+        fake_conn.set_get_answer('/config_data', { 'version': 1 })
         uccs = UIModuleCCSession(fake_conn)
         self.assertEqual(module_spec._module_spec, uccs._specifications['Spec2']._module_spec)
 

+ 6 - 10
src/lib/python/isc/config/tests/cfgmgr_test.py

@@ -22,7 +22,6 @@
 import unittest
 import os
 from isc.config.cfgmgr import *
-from isc.config import config_data
 from unittest_fakesession import FakeModuleCCSession
 
 class TestConfigManagerData(unittest.TestCase):
@@ -33,7 +32,7 @@ class TestConfigManagerData(unittest.TestCase):
 
     def test_init(self):
         self.assertEqual(self.config_manager_data.data['version'],
-                         config_data.BIND10_CONFIG_DATA_VERSION)
+                         ConfigManagerData.CONFIG_VERSION)
         self.assertEqual(self.config_manager_data.data_path,
                          self.data_path)
         self.assertEqual(self.config_manager_data.db_filename,
@@ -53,9 +52,6 @@ class TestConfigManagerData(unittest.TestCase):
         self.assertRaises(ConfigManagerDataReadError,
                           ConfigManagerData.read_from_file,
                           self.data_path, "b10-config-bad3.db")
-        self.assertRaises(ConfigManagerDataReadError,
-                          ConfigManagerData.read_from_file,
-                          self.data_path, "b10-config-bad4.db")
 
     def test_write_to_file(self):
         output_file_name = "b10-config-write-test";
@@ -165,13 +161,13 @@ class TestConfigManager(unittest.TestCase):
         self.assertEqual(commands_spec['Spec2'], module_spec.get_commands_spec())
 
     def test_read_config(self):
-        self.assertEqual(self.cm.config.data, {'version': config_data.BIND10_CONFIG_DATA_VERSION})
+        self.assertEqual(self.cm.config.data, {'version': 1})
         self.cm.read_config()
         # due to what get written, the value here is what the last set_config command in test_handle_msg does
-        self.assertEqual(self.cm.config.data, {'TestModule': {'test': 125}, 'version': config_data.BIND10_CONFIG_DATA_VERSION})
+        self.assertEqual(self.cm.config.data, {'TestModule': {'test': 125}, 'version': 1})
         self.cm.data_path = "/no_such_path"
         self.cm.read_config()
-        self.assertEqual(self.cm.config.data, {'version': config_data.BIND10_CONFIG_DATA_VERSION})
+        self.assertEqual(self.cm.config.data, {'version': 1})
 
     def test_write_config(self):
         # tested in ConfigManagerData tests
@@ -194,9 +190,9 @@ class TestConfigManager(unittest.TestCase):
                                 {'result': [1, 'Bad get_module_spec command, argument not a dict']})
         self._handle_msg_helper({ "command": [ "get_module_spec", { } ] },
                                 {'result': [1, 'Bad module_name in get_module_spec command']})
-        self._handle_msg_helper({ "command": [ "get_config" ] }, { 'result': [ 0, { 'version': config_data.BIND10_CONFIG_DATA_VERSION } ]})
+        self._handle_msg_helper({ "command": [ "get_config" ] }, { 'result': [ 0, { 'version': 1} ]})
         self._handle_msg_helper({ "command": [ "get_config", { "module_name": "nosuchmodule" } ] },
-                                {'result': [0, { 'version': config_data.BIND10_CONFIG_DATA_VERSION }]})
+                                {'result': [0, { 'version': 1 }]})
         self._handle_msg_helper({ "command": [ "get_config", 1 ] },
                                 {'result': [1, 'Bad get_config command, argument not a dict']})
         self._handle_msg_helper({ "command": [ "get_config", { } ] },

+ 1 - 5
src/lib/python/isc/config/tests/config_data_test.py

@@ -267,16 +267,12 @@ class TestMultiConfigData(unittest.TestCase):
         self.assertEqual({}, self.mcd._current_config)
         self.assertEqual({}, self.mcd._local_changes)
 
-    def test_set_remove_specification(self):
+    def test_set_specification(self):
         module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec1.spec")
-        self.assertFalse(self.mcd.have_specification(module_spec.get_module_name()))
         self.mcd.set_specification(module_spec)
-        self.assertTrue(self.mcd.have_specification(module_spec.get_module_name()))
         self.assert_(module_spec.get_module_name() in self.mcd._specifications)
         self.assertEquals(module_spec, self.mcd._specifications[module_spec.get_module_name()])
         self.assertRaises(ConfigDataError, self.mcd.set_specification, "asdf")
-        self.mcd.remove_specification(module_spec.get_module_name())
-        self.assertFalse(self.mcd.have_specification(module_spec.get_module_name()))
 
     def test_get_module_spec(self):
         module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec1.spec")

+ 1 - 2
src/lib/xfr/xfrout_client.cc

@@ -77,8 +77,7 @@ XfroutClient::sendXfroutRequestInfo(const int tcp_sock,
 {
     if (-1 == send_fd(impl_->socket_.native(), tcp_sock)) {
         isc_throw(XfroutError,
-                  "Failed to send the socket file descriptor "
-                  "to xfrout module");
+                  "Fail to send the socket file descriptor to xfrout module");
     }
 
     // XXX: this shouldn't be blocking send, even though it's unlikely to