[svn] commit: r2759 - in /branches/trac296: ./ doc/ doc/guide/ ext/asio/ src/bin/ src/bin/auth/ src/bin/auth/tests/ src/bin/bind10/ src/bin/bindctl/ src/bin/bindctl/tests/ src/bin/cfgmgr/ src/bin/host/ src/bin/msgq/ src/bin/usermgr/ src/bin/xfrin/ src/bin/xfrin/tests/ src/bin/xfrout/ src/bin/xfrout/tests/ src/bin/zonemgr/ src/lib/ src/lib/bench/ src/lib/cc/ src/lib/cc/tests/ src/lib/config/ src/lib/config/testdata/ src/lib/config/tests/ src/lib/datasrc/ src/lib/datasrc/tests/ src/lib/dns/ src/lib/dns/python/ src/lib/dns/rdata/generic/ src/lib/dns/tests/ src/lib/dns/util/ src/lib/exceptions/ src/lib/exceptions/tests/ src/lib/python/isc/ src/lib/python/isc/config/ src/lib/python/isc/config/tests/ src/lib/python/isc/datasrc/ src/lib/python/isc/notify/ src/lib/xfr/
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Aug 18 08:19:01 UTC 2010
Author: jelte
Date: Wed Aug 18 08:19:01 2010
New Revision: 2759
Log:
sync trunk for merge
Added:
branches/trac296/ext/asio/README
- copied unchanged from r2758, trunk/ext/asio/README
branches/trac296/src/bin/auth/change_user.cc
- copied unchanged from r2758, trunk/src/bin/auth/change_user.cc
branches/trac296/src/bin/auth/change_user.h
- copied unchanged from r2758, trunk/src/bin/auth/change_user.h
branches/trac296/src/bin/auth/tests/change_user_unittest.cc
- copied unchanged from r2758, trunk/src/bin/auth/tests/change_user_unittest.cc
branches/trac296/src/bin/zonemgr/
- copied from r2758, trunk/src/bin/zonemgr/
branches/trac296/src/lib/bench/
- copied from r2758, trunk/src/lib/bench/
branches/trac296/src/lib/cc/tests/
- copied from r2758, trunk/src/lib/cc/tests/
branches/trac296/src/lib/cc/tests/session_unittests_config.h.in
- copied unchanged from r2758, branches/trac296/src/lib/cc/session_unittests_config.h.in
branches/trac296/src/lib/config/testdata/b10-config-bad4.db
- copied unchanged from r2758, trunk/src/lib/config/testdata/b10-config-bad4.db
branches/trac296/src/lib/exceptions/tests/
- copied from r2758, trunk/src/lib/exceptions/tests/
branches/trac296/src/lib/python/isc/notify/
- copied from r2758, trunk/src/lib/python/isc/notify/
Removed:
branches/trac296/src/lib/cc/data_unittests.cc
branches/trac296/src/lib/cc/run_unittests.cc
branches/trac296/src/lib/cc/session_unittests_config.h.in
branches/trac296/src/lib/exceptions/exceptions_unittest.cc
branches/trac296/src/lib/exceptions/run_unittests.cc
Modified:
branches/trac296/ (props changed)
branches/trac296/ChangeLog
branches/trac296/Makefile.am
branches/trac296/configure.ac
branches/trac296/doc/Doxyfile
branches/trac296/doc/guide/bind10-guide.html
branches/trac296/doc/guide/bind10-guide.xml
branches/trac296/src/bin/Makefile.am
branches/trac296/src/bin/auth/Makefile.am
branches/trac296/src/bin/auth/asio_link.cc
branches/trac296/src/bin/auth/auth_srv.cc
branches/trac296/src/bin/auth/b10-auth.8
branches/trac296/src/bin/auth/b10-auth.xml
branches/trac296/src/bin/auth/main.cc
branches/trac296/src/bin/auth/tests/Makefile.am
branches/trac296/src/bin/auth/tests/asio_link_unittest.cc
branches/trac296/src/bin/auth/tests/auth_srv_unittest.cc
branches/trac296/src/bin/bind10/bind10.8
branches/trac296/src/bin/bind10/bind10.py.in
branches/trac296/src/bin/bind10/bind10.xml
branches/trac296/src/bin/bind10/run_bind10.sh.in
branches/trac296/src/bin/bindctl/bindcmd.py
branches/trac296/src/bin/bindctl/tests/bindctl_test.py
branches/trac296/src/bin/cfgmgr/b10-cfgmgr.py.in
branches/trac296/src/bin/host/Makefile.am
branches/trac296/src/bin/msgq/b10-msgq.8
branches/trac296/src/bin/msgq/msgq.xml
branches/trac296/src/bin/usermgr/b10-cmdctl-usermgr.py.in
branches/trac296/src/bin/xfrin/ (props changed)
branches/trac296/src/bin/xfrin/tests/Makefile.am
branches/trac296/src/bin/xfrin/tests/xfrin_test.py
branches/trac296/src/bin/xfrin/xfrin.py.in
branches/trac296/src/bin/xfrin/xfrin.spec.pre.in
branches/trac296/src/bin/xfrout/tests/Makefile.am
branches/trac296/src/bin/xfrout/xfrout.py.in
branches/trac296/src/lib/Makefile.am
branches/trac296/src/lib/cc/ (props changed)
branches/trac296/src/lib/cc/Makefile.am
branches/trac296/src/lib/cc/data.cc
branches/trac296/src/lib/cc/data.h
branches/trac296/src/lib/cc/session.cc
branches/trac296/src/lib/cc/tests/session_unittests.cc
branches/trac296/src/lib/config/Makefile.am
branches/trac296/src/lib/config/ccsession.cc
branches/trac296/src/lib/config/config_data.cc
branches/trac296/src/lib/config/config_data.h
branches/trac296/src/lib/config/module_spec.cc
branches/trac296/src/lib/config/module_spec.h
branches/trac296/src/lib/config/testdata/b10-config-bad1.db
branches/trac296/src/lib/config/testdata/b10-config.db
branches/trac296/src/lib/config/tests/Makefile.am
branches/trac296/src/lib/config/tests/ccsession_unittests.cc
branches/trac296/src/lib/config/tests/config_data_unittests.cc
branches/trac296/src/lib/config/tests/fake_session.cc
branches/trac296/src/lib/config/tests/module_spec_unittests.cc
branches/trac296/src/lib/datasrc/ (props changed)
branches/trac296/src/lib/datasrc/data_source.cc
branches/trac296/src/lib/datasrc/data_source.h
branches/trac296/src/lib/datasrc/sqlite3_datasrc.h
branches/trac296/src/lib/datasrc/static_datasrc.cc
branches/trac296/src/lib/datasrc/tests/Makefile.am
branches/trac296/src/lib/datasrc/tests/datasrc_unittest.cc
branches/trac296/src/lib/datasrc/tests/static_unittest.cc
branches/trac296/src/lib/datasrc/tests/test_datasrc.cc
branches/trac296/src/lib/dns/ (props changed)
branches/trac296/src/lib/dns/message.h
branches/trac296/src/lib/dns/name.h
branches/trac296/src/lib/dns/python/libdns_python.cc
branches/trac296/src/lib/dns/python/message_python.cc (contents, props changed)
branches/trac296/src/lib/dns/python/messagerenderer_python.cc
branches/trac296/src/lib/dns/python/name_python.cc
branches/trac296/src/lib/dns/python/question_python.cc
branches/trac296/src/lib/dns/python/rdata_python.cc
branches/trac296/src/lib/dns/python/rrclass_python.cc
branches/trac296/src/lib/dns/python/rrset_python.cc
branches/trac296/src/lib/dns/python/rrttl_python.cc
branches/trac296/src/lib/dns/python/rrtype_python.cc
branches/trac296/src/lib/dns/rdata/generic/ds_43.cc
branches/trac296/src/lib/dns/rdata/generic/nsec3_50.cc
branches/trac296/src/lib/dns/rdata/generic/rrsig_46.cc (props changed)
branches/trac296/src/lib/dns/rdata/generic/txt_16.cc
branches/trac296/src/lib/dns/rrsetlist.cc
branches/trac296/src/lib/dns/rrtype-placeholder.h
branches/trac296/src/lib/dns/tests/ (props changed)
branches/trac296/src/lib/dns/tests/Makefile.am
branches/trac296/src/lib/dns/tests/rrparamregistry_unittest.cc
branches/trac296/src/lib/dns/tests/unittest_util.cc
branches/trac296/src/lib/dns/util/base16_from_binary.h
branches/trac296/src/lib/dns/util/base32hex_from_binary.h
branches/trac296/src/lib/dns/util/binary_from_base16.h
branches/trac296/src/lib/dns/util/binary_from_base32hex.h
branches/trac296/src/lib/dns/util/sha1.cc
branches/trac296/src/lib/exceptions/Makefile.am
branches/trac296/src/lib/python/isc/Makefile.am
branches/trac296/src/lib/python/isc/config/ccsession.py
branches/trac296/src/lib/python/isc/config/cfgmgr.py
branches/trac296/src/lib/python/isc/config/config_data.py
branches/trac296/src/lib/python/isc/config/tests/ccsession_test.py
branches/trac296/src/lib/python/isc/config/tests/cfgmgr_test.py
branches/trac296/src/lib/python/isc/config/tests/config_data_test.py
branches/trac296/src/lib/python/isc/datasrc/sqlite3_ds.py
branches/trac296/src/lib/xfr/fdshare_python.cc
branches/trac296/src/lib/xfr/xfrout_client.cc
Modified: branches/trac296/ChangeLog
==============================================================================
--- branches/trac296/ChangeLog (original)
+++ branches/trac296/ChangeLog Wed Aug 18 08:19:01 2010
@@ -1,3 +1,50 @@
+ 87. [func] zhanglikun
+ lib/python/isc/notifyout: Add the feature of notify-out, when
+ zone axfr/ixfr finishing, the server will notify its slaves.
+ (Trac #289, svn r2737)
+
+ 86. [func] jerry
+ bin/zonemgr: Added zone manager module. The zone manager is one
+ of the co-operating processes of BIND10, which keeps track of
+ timers and other information necessary for BIND10 to act as a
+ slave. (Trac #215, svn r2737)
+
+ 85. [build]* jinmei
+ Build programs using dynamic link by default. A new configure
+ option --enable-static-link is provided to force static link for
+ executable programs. Statically linked programs can be run on a
+ debugger more easily and would be convenient for developers.
+ (Trac #309, svn r2723)
+
+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]* jreed
+ 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 change 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
@@ -196,7 +243,11 @@
a remote server. (Trac #218, svn r2038)
49. [func]* jelte
- Use unix domain sockets for msgq. (Trac #183, svn r2009)
+ 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)
48. [func] jelte
bin/auth: Use asio's io_service for the msgq handling.
Modified: branches/trac296/Makefile.am
==============================================================================
--- branches/trac296/Makefile.am (original)
+++ branches/trac296/Makefile.am Wed Aug 18 08:19:01 2010
@@ -28,6 +28,7 @@
c++/4.4\*/ext/\* \
c++/4.4\*/\*-\*/bits/\* \
boost/\* \
+ ext/asio/\* \
gtest/\* \
usr/include/\* \
tests/\* \
@@ -41,8 +42,8 @@
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
Modified: branches/trac296/configure.ac
==============================================================================
--- branches/trac296/configure.ac (original)
+++ branches/trac296/configure.ac Wed Aug 18 08:19:01 2010
@@ -31,6 +31,14 @@
rpath_available=no
])
LDFLAGS=$LDFLAGS_SAVED
+
+# allow building programs with static link. we need to make it selective
+# because loadable modules cannot be statically linked.
+AC_ARG_ENABLE([static-link],
+AC_HELP_STRING([--enable-static-link],
+ [build programs with static link [[default=no]]]),
+ [enable_static_link=yes], [enable_static_link=no])
+AM_CONDITIONAL(USE_STATIC_LINK, test $enable_static_link = yes)
# OS dependent compiler flags
case "$host" in
@@ -255,14 +263,6 @@
CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
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.
@@ -411,9 +411,15 @@
src/bin/xfrin/tests/Makefile
src/bin/xfrout/Makefile
src/bin/xfrout/tests/Makefile
+ src/bin/zonemgr/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/cc/tests/Makefile
src/lib/python/Makefile
src/lib/python/isc/Makefile
src/lib/python/isc/datasrc/Makefile
@@ -423,6 +429,8 @@
src/lib/python/isc/config/tests/Makefile
src/lib/python/isc/log/Makefile
src/lib/python/isc/log/tests/Makefile
+ src/lib/python/isc/notify/Makefile
+ src/lib/python/isc/notify/tests/Makefile
src/lib/config/Makefile
src/lib/config/tests/Makefile
src/lib/dns/Makefile
@@ -430,6 +438,7 @@
src/lib/dns/python/Makefile
src/lib/dns/python/tests/Makefile
src/lib/exceptions/Makefile
+ src/lib/exceptions/tests/Makefile
src/lib/datasrc/Makefile
src/lib/datasrc/tests/Makefile
src/lib/xfr/Makefile
@@ -448,6 +457,10 @@
src/bin/xfrout/xfrout.spec.pre
src/bin/xfrout/tests/xfrout_test
src/bin/xfrout/run_b10-xfrout.sh
+ src/bin/zonemgr/zonemgr.py
+ src/bin/zonemgr/zonemgr.spec.pre
+ src/bin/zonemgr/tests/zonemgr_test
+ src/bin/zonemgr/run_b10-zonemgr.sh
src/bin/bind10/bind10.py
src/bin/bind10/tests/bind10_test
src/bin/bind10/run_bind10.sh
@@ -469,19 +482,22 @@
src/lib/python/isc/config/tests/config_test
src/lib/python/isc/cc/tests/cc_test
src/lib/python/isc/log/tests/log_test
+ src/lib/python/isc/notify/tests/notify_out_test
src/lib/dns/gen-rdatacode.py
src/lib/python/bind10_config.py
src/lib/dns/tests/testdata/gen-wiredata.py
src/lib/cc/session_config.h.pre
- src/lib/cc/session_unittests_config.h
+ src/lib/cc/tests/session_unittests_config.h
], [
chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
chmod +x src/bin/xfrin/run_b10-xfrin.sh
chmod +x src/bin/xfrout/run_b10-xfrout.sh
+ chmod +x src/bin/zonemgr/run_b10-zonemgr.sh
chmod +x src/bin/bind10/run_bind10.sh
chmod +x src/bin/cmdctl/tests/cmdctl_test
chmod +x src/bin/xfrin/tests/xfrin_test
chmod +x src/bin/xfrout/tests/xfrout_test
+ chmod +x src/bin/zonemgr/tests/zonemgr_test
chmod +x src/bin/bindctl/tests/bindctl_test
chmod +x src/bin/bindctl/run_bindctl.sh
chmod +x src/bin/loadzone/run_loadzone.sh
Modified: branches/trac296/doc/Doxyfile
==============================================================================
--- branches/trac296/doc/Doxyfile (original)
+++ branches/trac296/doc/Doxyfile Wed Aug 18 08:19:01 2010
@@ -568,7 +568,7 @@
# 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
+INPUT = ../src/lib/cc ../src/lib/config ../src/lib/dns ../src/lib/exceptions ../src/lib/datasrc ../src/bin/auth ../src/lib/bench
# 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
Modified: branches/trac296/doc/guide/bind10-guide.html
==============================================================================
--- branches/trac296/doc/guide/bind10-guide.html (original)
+++ branches/trac296/doc/guide/bind10-guide.html Wed Aug 18 08:19:01 2010
@@ -2,7 +2,7 @@
The most up-to-date version of this document, along with other documents
for BIND 10, can be found at
<a class="ulink" href="http://bind10.isc.org/docs" target="_top">http://bind10.isc.org/docs</a>.
- </p></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="#intro">1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230342718">Supported Platforms</a></span></dt><dt><span class="section"><a href="#id1168230342746">Required Software</a></span></dt><dt><span class="section"><a href="#starting_stopping">Starting and Stopping the Server</a></span></dt><dt><span class="section"><a href="#managing_once_running">Managing BIND 10</a></span></dt></dl></dd><dt><span class="chapter"><a href="#installation">2. Installation</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230328220">Building Requirements</a></span></dt><dt><span class="section"><a href="#quickstart">Quick start</a></span></dt><dt><span class="section"><a href="#install">Installation from source</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230328405">Download Tar File</a></span></dt><dt><s
pan class="section"><a href="#id1168230328425">Retrieve from Subversion</a></span></dt><dt><span class="section"><a href="#id1168230328485">Configure before the build</a></span></dt><dt><span class="section"><a href="#id1168230328596">Build</a></span></dt><dt><span class="section"><a href="#id1168230328611">Install</a></span></dt><dt><span class="section"><a href="#id1168230328642">Install Hierarchy</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#bind10">3. Starting BIND10 with <span class="command"><strong>bind10</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#start">Starting BIND 10</a></span></dt></dl></dd><dt><span class="chapter"><a href="#msgq">4. Command channel</a></span></dt><dt><span class="chapter"><a href="#cfgmgr">5. Configuration manager</a></span></dt><dt><span class="chapter"><a href="#cmdctl">6. Remote control daemon</a></span></dt><dd><dl><dt><span class="section"><a href="#cmdctl.spec">Configuration specifi
cation for b10-cmdctl</a></span></dt></dl></dd><dt><span class="chapter"><a href="#bindctl">7. Control and configure user interface</a></span></dt><dt><span class="chapter"><a href="#authserver">8. Authoritative Server</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230329208">Server Configurations</a></span></dt><dt><span class="section"><a href="#id1168230329273">Data Source Backends</a></span></dt><dt><span class="section"><a href="#id1168230329303">Loading Master Zones Files</a></span></dt></dl></dd><dt><span class="chapter"><a href="#xfrin">9. Incoming Zone Transfers</a></span></dt><dt><span class="chapter"><a href="#xfrout">10. Outbound Zone Transfers</a></span></dt></dl></div><div class="chapter" title="Chapter 1. Introduction"><div class="titlepage"><div><div><h2 class="title"><a name="intro"></a>Chapter 1. Introduction</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id1168230342718">S
upported Platforms</a></span></dt><dt><span class="section"><a href="#id1168230342746">Required Software</a></span></dt><dt><span class="section"><a href="#starting_stopping">Starting and Stopping the Server</a></span></dt><dt><span class="section"><a href="#managing_once_running">Managing BIND 10</a></span></dt></dl></div><p>
+ </p></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="#intro">1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230342718">Supported Platforms</a></span></dt><dt><span class="section"><a href="#id1168230342746">Required Software</a></span></dt><dt><span class="section"><a href="#starting_stopping">Starting and Stopping the Server</a></span></dt><dt><span class="section"><a href="#managing_once_running">Managing BIND 10</a></span></dt></dl></dd><dt><span class="chapter"><a href="#installation">2. Installation</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230328220">Building Requirements</a></span></dt><dt><span class="section"><a href="#quickstart">Quick start</a></span></dt><dt><span class="section"><a href="#install">Installation from source</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230328406">Download Tar File</a></span></dt><dt><s
pan class="section"><a href="#id1168230328426">Retrieve from Subversion</a></span></dt><dt><span class="section"><a href="#id1168230328486">Configure before the build</a></span></dt><dt><span class="section"><a href="#id1168230328584">Build</a></span></dt><dt><span class="section"><a href="#id1168230328599">Install</a></span></dt><dt><span class="section"><a href="#id1168230328622">Install Hierarchy</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#bind10">3. Starting BIND10 with <span class="command"><strong>bind10</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#start">Starting BIND 10</a></span></dt></dl></dd><dt><span class="chapter"><a href="#msgq">4. Command channel</a></span></dt><dt><span class="chapter"><a href="#cfgmgr">5. Configuration manager</a></span></dt><dt><span class="chapter"><a href="#cmdctl">6. Remote control daemon</a></span></dt><dd><dl><dt><span class="section"><a href="#cmdctl.spec">Configuration specifi
cation for b10-cmdctl</a></span></dt></dl></dd><dt><span class="chapter"><a href="#bindctl">7. Control and configure user interface</a></span></dt><dt><span class="chapter"><a href="#authserver">8. Authoritative Server</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230329190">Server Configurations</a></span></dt><dt><span class="section"><a href="#id1168230329255">Data Source Backends</a></span></dt><dt><span class="section"><a href="#id1168230329285">Loading Master Zones Files</a></span></dt></dl></dd><dt><span class="chapter"><a href="#xfrin">9. Incoming Zone Transfers</a></span></dt><dt><span class="chapter"><a href="#xfrout">10. Outbound Zone Transfers</a></span></dt></dl></div><div class="chapter" title="Chapter 1. Introduction"><div class="titlepage"><div><div><h2 class="title"><a name="intro"></a>Chapter 1. Introduction</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id1168230342718">S
upported Platforms</a></span></dt><dt><span class="section"><a href="#id1168230342746">Required Software</a></span></dt><dt><span class="section"><a href="#starting_stopping">Starting and Stopping the Server</a></span></dt><dt><span class="section"><a href="#managing_once_running">Managing BIND 10</a></span></dt></dl></div><p>
BIND is the popular implementation of a DNS server, developer
interfaces, and DNS tools.
BIND 10 is a rewrite of BIND 9. BIND 10 is written in C++ and Python
@@ -32,9 +32,8 @@
data source backend is SQLite3. The authoritative server
requires SQLite 3.3.9 or newer.
The <span class="command"><strong>b10-xfrin</strong></span> and <span class="command"><strong>b10-xfrout</strong></span>
- modules require the libboost library,
- libpython3 library,
- and the Python _sqlite3.so module.
+ modules require the libpython3 library and the Python
+ _sqlite3.so module.
</p></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
Some operating systems do not provide these dependencies
in their default installation nor standard packages
@@ -117,7 +116,7 @@
and, of course, DNS. These include detailed developer
documentation and code examples.
- </p></div><div class="chapter" title="Chapter 2. Installation"><div class="titlepage"><div><div><h2 class="title"><a name="installation"></a>Chapter 2. Installation</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id1168230328220">Building Requirements</a></span></dt><dt><span class="section"><a href="#quickstart">Quick start</a></span></dt><dt><span class="section"><a href="#install">Installation from source</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230328405">Download Tar File</a></span></dt><dt><span class="section"><a href="#id1168230328425">Retrieve from Subversion</a></span></dt><dt><span class="section"><a href="#id1168230328485">Configure before the build</a></span></dt><dt><span class="section"><a href="#id1168230328596">Build</a></span></dt><dt><span class="section"><a href="#id1168230328611">Install</a></span></dt><dt><span class="section"><a href="#id1168230328642">Install
Hierarchy</a></span></dt></dl></dd></dl></div><div class="section" title="Building Requirements"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id1168230328220"></a>Building Requirements</h2></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
+ </p></div><div class="chapter" title="Chapter 2. Installation"><div class="titlepage"><div><div><h2 class="title"><a name="installation"></a>Chapter 2. Installation</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id1168230328220">Building Requirements</a></span></dt><dt><span class="section"><a href="#quickstart">Quick start</a></span></dt><dt><span class="section"><a href="#install">Installation from source</a></span></dt><dd><dl><dt><span class="section"><a href="#id1168230328406">Download Tar File</a></span></dt><dt><span class="section"><a href="#id1168230328426">Retrieve from Subversion</a></span></dt><dt><span class="section"><a href="#id1168230328486">Configure before the build</a></span></dt><dt><span class="section"><a href="#id1168230328584">Build</a></span></dt><dt><span class="section"><a href="#id1168230328599">Install</a></span></dt><dt><span class="section"><a href="#id1168230328622">Install
Hierarchy</a></span></dt></dl></dd></dl></div><div class="section" title="Building Requirements"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id1168230328220"></a>Building Requirements</h2></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
Some operating systems have split their distribution packages into
a run-time and a development package. You will need to install
the development package versions, which include header files and
@@ -128,9 +127,8 @@
</p><p>
- The Boost Library, Python Library,
- and Python _sqlite3 module are required to enable the
- Xfrout and Xfrin support.
+ The Python Library and Python _sqlite3 module are required to
+ enable the Xfrout and Xfrin support.
</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
The Python related libraries and modules need to be built
for Python 3.1.
@@ -178,14 +176,14 @@
the Subversion code revision control system or as a downloadable
tar file. It may also be available in pre-compiled ready-to-use
packages from operating system vendors.
- </p><div class="section" title="Download Tar File"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328405"></a>Download Tar File</h3></div></div></div><p>
+ </p><div class="section" title="Download Tar File"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328406"></a>Download Tar File</h3></div></div></div><p>
Downloading a release tar file is the recommended method to
obtain the source code.
</p><p>
The BIND 10 releases are available as tar file downloads from
<a class="ulink" href="ftp://ftp.isc.org/isc/bind10/" target="_top">ftp://ftp.isc.org/isc/bind10/</a>.
Periodic development snapshots may also be available.
- </p></div><div class="section" title="Retrieve from Subversion"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328425"></a>Retrieve from Subversion</h3></div></div></div><p>
+ </p></div><div class="section" title="Retrieve from Subversion"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328426"></a>Retrieve from Subversion</h3></div></div></div><p>
Downloading this "bleeding edge" code is recommended only for
developers or advanced users. Using development code in a production
environment is not recommended.
@@ -217,7 +215,7 @@
<span class="command"><strong>autoheader</strong></span>,
<span class="command"><strong>automake</strong></span>,
and related commands.
- </p></div><div class="section" title="Configure before the build"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328485"></a>Configure before the build</h3></div></div></div><p>
+ </p></div><div class="section" title="Configure before the build"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328486"></a>Configure before the build</h3></div></div></div><p>
BIND 10 uses the GNU Build System to discover build environment
details.
To generate the makefiles using the defaults, simply run:
@@ -229,7 +227,6 @@
</p><div class="variablelist"><dl><dt><span class="term">--prefix</span></dt><dd>Define the the installation location (the
default is <code class="filename">/usr/local/</code>).
</dd><dt><span class="term">--with-boost-include</span></dt><dd>Define the path to find the Boost headers.
- </dd><dt><span class="term">--with-boost-lib</span></dt><dd>Define the path to find the Boost library.
</dd><dt><span class="term">--with-pythonpath</span></dt><dd>Define the path to Python 3.1 if it is not in the
standard execution path.
</dd><dt><span class="term">--with-gtest</span></dt><dd>Enable building the C++ Unit Tests using the
@@ -239,31 +236,26 @@
</p><p>
For example, the following configures it to
- find the Boost headers and library, find the
+ find the Boost headers, find the
Python interpreter, and sets the installation location:
- </p><pre class="screen">$ <strong class="userinput"><code>./configure --with-boost-lib=/usr/pkg/lib \
+ </p><pre class="screen">$ <strong class="userinput"><code>./configure \
--with-boost-include=/usr/pkg/include \
--with-pythonpath=/usr/pkg/bin/python3.1 \
--prefix=/opt/bind10</code></strong></pre><p>
</p><p>
If the configure fails, it may be due to missing or old
dependencies.
- </p></div><div class="section" title="Build"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328596"></a>Build</h3></div></div></div><p>
+ </p></div><div class="section" title="Build"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328584"></a>Build</h3></div></div></div><p>
After the configure step is complete, to build the executables
from the C++ code and prepare the Python scripts, run:
</p><pre class="screen">$ <strong class="userinput"><code>make</code></strong></pre><p>
- </p></div><div class="section" title="Install"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328611"></a>Install</h3></div></div></div><p>
+ </p></div><div class="section" title="Install"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328599"></a>Install</h3></div></div></div><p>
To install the BIND 10 executables, support files,
and documentation, run:
</p><pre class="screen">$ <strong class="userinput"><code>make install</code></strong></pre><p>
- </p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The install step may require superuser privileges.</p></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
- 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).
- </p></div></div><div class="section" title="Install Hierarchy"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328642"></a>Install Hierarchy</h3></div></div></div><p>
+ </p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The install step may require superuser privileges.</p></div></div><div class="section" title="Install Hierarchy"><div class="titlepage"><div><div><h3 class="title"><a name="id1168230328622"></a>Install Hierarchy</h3></div></div></div><p>
The following is the layout of the complete BIND 10 installation:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<code class="filename">bin/</code> —
@@ -475,7 +467,7 @@
the details and relays (over a <span class="command"><strong>b10-msgq</strong></span> command
channel) the configuration on to the specified module.
</p><p>
- </p></div><div class="chapter" title="Chapter 8. Authoritative Server"><div class="titlepage"><div><div><h2 class="title"><a name="authserver"></a>Chapter 8. Authoritative Server</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id1168230329208">Server Configurations</a></span></dt><dt><span class="section"><a href="#id1168230329273">Data Source Backends</a></span></dt><dt><span class="section"><a href="#id1168230329303">Loading Master Zones Files</a></span></dt></dl></div><p>
+ </p></div><div class="chapter" title="Chapter 8. Authoritative Server"><div class="titlepage"><div><div><h2 class="title"><a name="authserver"></a>Chapter 8. Authoritative Server</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id1168230329190">Server Configurations</a></span></dt><dt><span class="section"><a href="#id1168230329255">Data Source Backends</a></span></dt><dt><span class="section"><a href="#id1168230329285">Loading Master Zones Files</a></span></dt></dl></div><p>
The <span class="command"><strong>b10-auth</strong></span> is the authoritative DNS server.
It supports EDNS0 and DNSSEC. It supports IPv6.
Normally it is started by the <span class="command"><strong>bind10</strong></span> master
@@ -483,7 +475,7 @@
</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
This development prototype release listens on all interfaces
and the non-standard port 5300.
- </p></div><div class="section" title="Server Configurations"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id1168230329208"></a>Server Configurations</h2></div></div></div><p>
+ </p></div><div class="section" title="Server Configurations"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id1168230329190"></a>Server Configurations</h2></div></div></div><p>
<span class="command"><strong>b10-auth</strong></span> is configured via the
<span class="command"><strong>b10-cfgmgr</strong></span> configuration manager.
The module name is <span class="quote">“<span class="quote">Auth</span>”</span>.
@@ -503,7 +495,7 @@
</p><div class="variablelist"><dl><dt><span class="term">shutdown</span></dt><dd>Stop the authoritative DNS server.
</dd></dl></div><p>
- </p></div><div class="section" title="Data Source Backends"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id1168230329273"></a>Data Source Backends</h2></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
+ </p></div><div class="section" title="Data Source Backends"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id1168230329255"></a>Data Source Backends</h2></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
For the development prototype release, <span class="command"><strong>b10-auth</strong></span>
only supports the SQLite3 data source backend.
Upcoming versions will be able to use multiple different
@@ -516,7 +508,7 @@
The default is <code class="filename">/usr/local/var/</code>.)
This data file location may be changed by defining the
<span class="quote">“<span class="quote">database_file</span>”</span> configuration.
- </p></div><div class="section" title="Loading Master Zones Files"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id1168230329303"></a>Loading Master Zones Files</h2></div></div></div><p>
+ </p></div><div class="section" title="Loading Master Zones Files"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id1168230329285"></a>Loading Master Zones Files</h2></div></div></div><p>
RFC 1035 style DNS master zone files may imported
into a BIND 10 data source by using the
<span class="command"><strong>b10-loadzone</strong></span> utility.
Modified: branches/trac296/doc/guide/bind10-guide.xml
==============================================================================
--- branches/trac296/doc/guide/bind10-guide.xml (original)
+++ branches/trac296/doc/guide/bind10-guide.xml Wed Aug 18 08:19:01 2010
@@ -75,9 +75,8 @@
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 libboost library,
- libpython3 library,
- and the Python _sqlite3.so module.
+ modules require the libpython3 library and the Python
+ _sqlite3.so module.
</para></note>
<!-- TODO: this will change ... -->
@@ -272,9 +271,8 @@
</para>
<para>
- The Boost Library, Python Library,
- and Python _sqlite3 module are required to enable the
- Xfrout and Xfrin support.
+ The Python Library and Python _sqlite3 module are required to
+ enable the Xfrout and Xfrin support.
</para>
<note><simpara>
@@ -487,14 +485,6 @@
</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
@@ -520,10 +510,10 @@
<para>
For example, the following configures it to
- find the Boost headers and library, find the
+ find the Boost headers, find the
Python interpreter, and sets the installation location:
- <screen>$ <userinput>./configure --with-boost-lib=/usr/pkg/lib \
+ <screen>$ <userinput>./configure \
--with-boost-include=/usr/pkg/include \
--with-pythonpath=/usr/pkg/bin/python3.1 \
--prefix=/opt/bind10</userinput></screen>
@@ -556,14 +546,6 @@
<note>
<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>
Modified: branches/trac296/src/bin/Makefile.am
==============================================================================
--- branches/trac296/src/bin/Makefile.am (original)
+++ branches/trac296/src/bin/Makefile.am Wed Aug 18 08:19:01 2010
@@ -1,1 +1,1 @@
-SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout usermgr
+SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout usermgr zonemgr
Modified: branches/trac296/src/bin/auth/Makefile.am
==============================================================================
--- branches/trac296/src/bin/auth/Makefile.am (original)
+++ branches/trac296/src/bin/auth/Makefile.am Wed Aug 18 08:19:01 2010
@@ -7,6 +7,10 @@
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CXXFLAGS = $(B10_CXXFLAGS)
+
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
+endif
pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -47,15 +51,16 @@
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
-b10_auth_LDADD += $(top_builddir)/src/lib/dns/.libs/libdns++.a
-b10_auth_LDADD += $(top_builddir)/src/lib/config/.libs/libcfgclient.a
-b10_auth_LDADD += $(top_builddir)/src/lib/cc/.libs/libcc.a
-b10_auth_LDADD += $(top_builddir)/src/lib/exceptions/.libs/libexceptions.a
+b10_auth_LDADD = $(top_builddir)/src/lib/datasrc/libdatasrc.la
+b10_auth_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
+b10_auth_LDADD += $(top_builddir)/src/lib/config/libcfgclient.la
+b10_auth_LDADD += $(top_builddir)/src/lib/cc/libcc.la
+b10_auth_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
b10_auth_LDADD += $(top_builddir)/src/bin/auth/libasio_link.a
-b10_auth_LDADD += $(top_builddir)/src/lib/xfr/.libs/libxfr.a
+b10_auth_LDADD += $(top_builddir)/src/lib/xfr/libxfr.la
b10_auth_LDADD += $(SQLITE_LIBS)
# TODO: config.h.in is wrong because doesn't honor pkgdatadir
Modified: branches/trac296/src/bin/auth/asio_link.cc
==============================================================================
--- branches/trac296/src/bin/auth/asio_link.cc (original)
+++ branches/trac296/src/bin/auth/asio_link.cc Wed Aug 18 08:19:01 2010
@@ -368,6 +368,7 @@
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()) {
@@ -562,7 +563,7 @@
asio::io_service&
IOService::get_io_service() {
- return impl_->io_service_;
+ return (impl_->io_service_);
}
void
Modified: branches/trac296/src/bin/auth/auth_srv.cc
==============================================================================
--- branches/trac296/src/bin/auth/auth_srv.cc (original)
+++ branches/trac296/src/bin/auth/auth_srv.cc Wed Aug 18 08:19:01 2010
@@ -327,7 +327,6 @@
return (true);
}
-
bool
AuthSrvImpl::processAxfrQuery(const IOMessage& io_message, Message& message,
MessageRenderer& response_renderer)
@@ -342,10 +341,8 @@
}
try {
- if (!xfrout_connected_) {
- xfrout_client_.connect();
- xfrout_connected_ = true;
- }
+ xfrout_client_.connect();
+ xfrout_connected_ = true;
xfrout_client_.sendXfroutRequestInfo(
io_message.getSocket().getNative(),
io_message.getData(),
@@ -368,6 +365,10 @@
verbose_mode_);
return (true);
}
+
+ xfrout_client_.disconnect();
+ xfrout_connected_ = false;
+
return (false);
}
@@ -421,7 +422,7 @@
static const string command_template_start =
"{\"command\": [\"notify\", {\"zone_name\" : \"";
static const string command_template_master = "\", \"master\" : \"";
- static const string command_template_rrclass = "\", \"rrclass\" : \"";
+ static const string command_template_rrclass = "\", \"zone_class\" : \"";
static const string command_template_end = "\"}]}";
try {
@@ -431,7 +432,7 @@
command_template_rrclass + question->getClass().toText() +
command_template_end);
const unsigned int seq =
- xfrin_session_->group_sendmsg(notify_command, "Xfrin",
+ xfrin_session_->group_sendmsg(notify_command, "Zonemgr",
"*", "*");
ElementPtr env, answer, parsed_answer;
xfrin_session_->group_recvmsg(env, answer, false, seq);
@@ -439,14 +440,14 @@
parsed_answer = parseAnswer(rcode, answer);
if (rcode != 0) {
if (verbose_mode_) {
- cerr << "[b10-auth] failed to notify Xfrin: "
+ cerr << "[b10-auth] failed to notify Zonemgr: "
<< parsed_answer->str() << endl;
}
return (false);
}
} catch (const Exception& ex) {
if (verbose_mode_) {
- cerr << "[b10-auth] failed to notify Xfrin: " << ex.what() << endl;
+ cerr << "[b10-auth] failed to notify Zonemgr: " << ex.what() << endl;
}
return (false);
}
@@ -520,11 +521,11 @@
ElementPtr answer = isc::config::createAnswer();
answer = impl_->setDbFile(new_config);
- return answer;
+ return (answer);
} catch (const isc::Exception& error) {
if (impl_->verbose_mode_) {
cerr << "[b10-auth] error: " << error.what() << endl;
}
- return isc::config::createAnswer(1, error.what());
- }
-}
+ return (isc::config::createAnswer(1, error.what()));
+ }
+}
Modified: branches/trac296/src/bin/auth/b10-auth.8
==============================================================================
--- branches/trac296/src/bin/auth/b10-auth.8 (original)
+++ branches/trac296/src/bin/auth/b10-auth.8 Wed Aug 18 08:19:01 2010
@@ -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: March 16, 2010
+.\" Date: July 29, 2010
.\" Manual: BIND10
.\" Source: BIND10
.\" Language: English
.\"
-.TH "B10\-AUTH" "8" "March 16, 2010" "BIND10" "BIND10"
+.TH "B10\-AUTH" "8" "July 29, 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\-p\ \fR\fB\fInumber\fR\fR] [\fB\-v\fR]
+\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]
.SH "DESCRIPTION"
.PP
The
@@ -64,13 +64,30 @@
\fB\-4\fR
.RS 4
Enables IPv4 only mode\&. This switch may not be used with
-\fB\-6\fR\&. By default, it listens on both IPv4 and IPv6 (if capable)\&.
+\fB\-6\fR
+nor
+\fB\-a\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\&. By default, it listens on both IPv4 and IPv6 (if capable)\&.
+\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)\&.
.RE
.PP
\fB\-p \fR\fB\fInumber\fR\fR
@@ -91,6 +108,15 @@
The Y1 prototype runs on all interfaces and on this nonstandard port\&.
.sp .5v
.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
Modified: branches/trac296/src/bin/auth/b10-auth.xml
==============================================================================
--- branches/trac296/src/bin/auth/b10-auth.xml (original)
+++ branches/trac296/src/bin/auth/b10-auth.xml Wed Aug 18 08:19:01 2010
@@ -21,7 +21,7 @@
<refentry>
<refentryinfo>
- <date>March 16, 2010</date>
+ <date>July 29, 2010</date>
</refentryinfo>
<refmeta>
@@ -47,7 +47,10 @@
<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>
@@ -95,7 +98,8 @@
<term><option>-4</option></term>
<listitem><para>
Enables IPv4 only mode.
- This switch may not be used with <option>-6</option>.
+ This switch may not be used with <option>-6</option> nor
+ <option>-a</option>.
By default, it listens on both IPv4 and IPv6 (if capable).
</para></listitem>
</varlistentry>
@@ -104,8 +108,33 @@
<term><option>-6</option></term>
<listitem><para>
Enables IPv6 only mode.
- This switch may not be used with <option>-4</option>.
+ This switch may not be used with <option>-4</option> nor
+ <option>-a</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>
@@ -120,6 +149,20 @@
</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
Modified: branches/trac296/src/bin/auth/main.cc
==============================================================================
--- branches/trac296/src/bin/auth/main.cc (original)
+++ branches/trac296/src/bin/auth/main.cc Wed Aug 18 08:19:01 2010
@@ -41,6 +41,7 @@
#include <auth/spec_config.h>
#include <auth/common.h>
+#include <auth/change_user.h>
#include <auth/auth_srv.h>
#include <auth/asio_link.h>
@@ -67,7 +68,7 @@
ElementPtr
my_config_handler(ElementPtr new_config) {
- return auth_server->updateConfig(new_config);
+ return (auth_server->updateConfig(new_config));
}
ElementPtr
@@ -82,7 +83,7 @@
io_service->stop();
}
- return answer;
+ return (answer);
}
void
@@ -97,9 +98,10 @@
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:v")) != -1) {
+ while ((ch = getopt(argc, argv, "46a:np:u:v")) != -1) {
switch (ch) {
case '4':
// Note that -4 means "ipv4 only", we need to set "use_ipv6" here,
@@ -121,6 +123,9 @@
case 'p':
port = optarg;
break;
+ case 'u':
+ uid = optarg;
+ break;
case 'v':
verbose_mode = true;
break;
@@ -151,7 +156,13 @@
Session* xfrin_session = NULL;
bool xfrin_session_established = false; // XXX (see Trac #287)
ModuleCCSession* config_session = NULL;
- XfroutClient xfrout_client(UNIX_SOCKET_FILE);
+ 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);
try {
string specfile;
if (getenv("B10_FROM_BUILD")) {
@@ -188,6 +199,10 @@
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);
Modified: branches/trac296/src/bin/auth/tests/Makefile.am
==============================================================================
--- branches/trac296/src/bin/auth/tests/Makefile.am (original)
+++ branches/trac296/src/bin/auth/tests/Makefile.am Wed Aug 18 08:19:01 2010
@@ -4,6 +4,10 @@
AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
AM_CXXFLAGS = $(B10_CXXFLAGS)
+
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
+endif
CLEANFILES = *.gcno *.gcda
@@ -13,20 +17,22 @@
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)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
run_unittests_LDADD = $(GTEST_LDADD)
run_unittests_LDADD += $(SQLITE_LIBS)
-run_unittests_LDADD += $(top_builddir)/src/lib/datasrc/.libs/libdatasrc.a
-run_unittests_LDADD += $(top_builddir)/src/lib/dns/.libs/libdns++.a
-run_unittests_LDADD += $(top_builddir)/src/lib/config/.libs/libcfgclient.a
-run_unittests_LDADD += $(top_builddir)/src/lib/cc/.libs/libcc.a
-run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/.libs/libexceptions.a
+run_unittests_LDADD += $(top_builddir)/src/lib/datasrc/libdatasrc.la
+run_unittests_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
+run_unittests_LDADD += $(top_builddir)/src/lib/config/libcfgclient.la
+run_unittests_LDADD += $(top_builddir)/src/lib/cc/libcc.la
+run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
run_unittests_LDADD += $(top_builddir)/src/bin/auth/libasio_link.a
-run_unittests_LDADD += $(top_builddir)/src/lib/xfr/.libs/libxfr.a
+run_unittests_LDADD += $(top_builddir)/src/lib/xfr/libxfr.la
endif
noinst_PROGRAMS = $(TESTS)
Modified: branches/trac296/src/bin/auth/tests/asio_link_unittest.cc
==============================================================================
--- branches/trac296/src/bin/auth/tests/asio_link_unittest.cc (original)
+++ branches/trac296/src/bin/auth/tests/asio_link_unittest.cc Wed Aug 18 08:19:01 2010
@@ -108,8 +108,14 @@
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) {
Modified: branches/trac296/src/bin/auth/tests/auth_srv_unittest.cc
==============================================================================
--- branches/trac296/src/bin/auth/tests/auth_srv_unittest.cc (original)
+++ branches/trac296/src/bin/auth/tests/auth_srv_unittest.cc Wed Aug 18 08:19:01 2010
@@ -471,7 +471,7 @@
// so we shouldn't have to respond.
EXPECT_EQ(false, server.processMessage(*io_message, parse_message,
response_renderer));
- EXPECT_TRUE(xfrout.isConnected());
+ EXPECT_FALSE(xfrout.isConnected());
}
TEST_F(AuthSrvTest, AXFRConnectFail) {
@@ -483,6 +483,8 @@
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 +494,7 @@
createRequestPacket(opcode, Name("example.com"), RRClass::IN(),
RRType::AXFR(), IPPROTO_TCP);
server.processMessage(*io_message, parse_message, response_renderer);
- EXPECT_TRUE(xfrout.isConnected());
+ EXPECT_FALSE(xfrout.isConnected()); // see above
xfrout.disableSend();
parse_message.clear(Message::PARSE);
@@ -534,14 +536,14 @@
// An internal command message should have been created and sent to an
// external module. Check them.
- EXPECT_EQ("Xfrin", notify_session.msg_destination);
+ EXPECT_EQ("Zonemgr", notify_session.msg_destination);
EXPECT_EQ("notify",
notify_session.sent_msg->get("command")->get(0)->stringValue());
ElementPtr notify_args = notify_session.sent_msg->get("command")->get(1);
EXPECT_EQ("example.com.", notify_args->get("zone_name")->stringValue());
EXPECT_EQ(DEFAULT_REMOTE_ADDRESS,
notify_args->get("master")->stringValue());
- EXPECT_EQ("IN", notify_args->get("rrclass")->stringValue());
+ EXPECT_EQ("IN", notify_args->get("zone_class")->stringValue());
// On success, the server should return a response to the notify.
headerCheck(parse_message, default_qid, Rcode::NOERROR(),
@@ -566,7 +568,7 @@
// Other conditions should be the same, so simply confirm the RR class is
// set correctly.
ElementPtr notify_args = notify_session.sent_msg->get("command")->get(1);
- EXPECT_EQ("CH", notify_args->get("rrclass")->stringValue());
+ EXPECT_EQ("CH", notify_args->get("zone_class")->stringValue());
}
TEST_F(AuthSrvTest, notifyEmptyQuestion) {
Modified: branches/trac296/src/bin/bind10/bind10.8
==============================================================================
--- branches/trac296/src/bin/bind10/bind10.8 (original)
+++ branches/trac296/src/bin/bind10/bind10.8 Wed Aug 18 08:19:01 2010
@@ -2,12 +2,12 @@
.\" Title: bind10
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: April 19, 2010
+.\" Date: July 29, 2010
.\" Manual: BIND10
.\" Source: BIND10
.\" Language: English
.\"
-.TH "BIND10" "8" "April 19, 2010" "BIND10" "BIND10"
+.TH "BIND10" "8" "July 29, 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\-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]
+\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]
.SH "DESCRIPTION"
.PP
The
@@ -32,11 +32,26 @@
.PP
The arguments are as follows:
.PP
-\fB\-m\fR \fInumber\fR, \fB\-\-msgq\-port\fR \fInumber\fR
+\fB\-a\fR \fIaddress\fR, \fB\-\-address\fR \fIaddress\fR
.RS 4
-The port number for the
+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
\fBb10-msgq\fR(8)
-daemon to listen on\&. The default is 9912\&.
+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\&.
.RE
.PP
\fB\-p\fR \fInumber\fR, \fB\-\-port\fR \fInumber\fR
@@ -59,6 +74,16 @@
The Y1 prototype release uses a non\-default port for domain service\&.
.sp .5v
.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
Modified: branches/trac296/src/bin/bind10/bind10.py.in
==============================================================================
--- branches/trac296/src/bin/bind10/bind10.py.in (original)
+++ branches/trac296/src/bin/bind10/bind10.py.in Wed Aug 18 08:19:01 2010
@@ -336,6 +336,8 @@
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" %
@@ -396,6 +398,26 @@
sys.stdout.write("[bind10] Started b10-xfrin (PID %d)\n" %
xfrind.pid)
+ # start b10-zonemgr
+ zonemgr_args = ['b10-zonemgr']
+ if self.verbose:
+ sys.stdout.write("[bind10] Starting b10-zonemgr\n")
+ zonemgr_args += ['-v']
+ try:
+ zonemgr = ProcessInfo("b10-zonemgr", zonemgr_args,
+ c_channel_env)
+ except Exception as e:
+ c_channel.process.kill()
+ bind_cfgd.process.kill()
+ xfrout.process.kill()
+ auth.process.kill()
+ xfrind.process.kill()
+ return "Unable to start b10-zonemgr; " + str(e)
+ self.processes[zonemgr.pid] = zonemgr
+ if self.verbose:
+ sys.stdout.write("[bind10] Started b10-zonemgr(PID %d)\n" %
+ zonemgr.pid)
+
# start the b10-cmdctl
# XXX: we hardcode port 8080
cmdctl_args = ['b10-cmdctl']
@@ -411,6 +433,7 @@
xfrout.process.kill()
auth.process.kill()
xfrind.process.kill()
+ zonemgr.process.kill()
return "Unable to start b10-cmdctl; " + str(e)
self.processes[cmd_ctrld.pid] = cmd_ctrld
if self.verbose:
@@ -429,6 +452,7 @@
self.cc_session.group_sendmsg(cmd, "Boss", "Auth")
self.cc_session.group_sendmsg(cmd, "Boss", "Xfrout")
self.cc_session.group_sendmsg(cmd, "Boss", "Xfrin")
+ self.cc_session.group_sendmsg(cmd, "Boss", "Zonemgr")
def stop_process(self, process):
"""Stop the given process, friendly-like."""
Modified: branches/trac296/src/bin/bind10/bind10.xml
==============================================================================
--- branches/trac296/src/bin/bind10/bind10.xml (original)
+++ branches/trac296/src/bin/bind10/bind10.xml Wed Aug 18 08:19:01 2010
@@ -21,7 +21,7 @@
<refentry>
<refentryinfo>
- <date>April 19, 2010</date>
+ <date>July 29, 2010</date>
</refentryinfo>
<refmeta>
@@ -45,12 +45,18 @@
<refsynopsisdiv>
<cmdsynopsis>
<command>bind10</command>
- <arg><option>-m <replaceable>number</replaceable></option></arg>
+ <arg><option>-a <replaceable>address</replaceable></option></arg>
+ <arg><option>-m <replaceable>file</replaceable></option></arg>
+ <arg><option>-n</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>-msgq-port <replaceable>number</replaceable></option></arg>
- <arg><option>-port <replaceable>number</replaceable></option></arg>
- <arg><option>-verbose</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>
</cmdsynopsis>
</refsynopsisdiv>
@@ -80,14 +86,40 @@
<variablelist>
<varlistentry>
- <term><option>-m</option> <replaceable>number</replaceable>, <option>--msgq-port</option> <replaceable>number</replaceable></term>
-
- <listitem>
- <para>The port number for the
+ <term><option>-a</option> <replaceable>address</replaceable>, <option>--address</option> <replaceable>address</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
<citerefentry><refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- daemon to listen on.
- The default is 9912.</para>
- </listitem>
+ daemon to use.
+ The default is
+ <filename>/usr/local/var/bind10-devel/msg_socket</filename>.
+<!-- @localstatedir@/@PACKAGE_NAME@/msg_socket -->
+ </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>
@@ -105,6 +137,18 @@
</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
@@ -112,6 +156,7 @@
<!-- TODO: not true about all children yet -->
</listitem>
</varlistentry>
+
</variablelist>
</refsect1>
Modified: branches/trac296/src/bin/bind10/run_bind10.sh.in
==============================================================================
--- branches/trac296/src/bin/bind10/run_bind10.sh.in (original)
+++ branches/trac296/src/bin/bind10/run_bind10.sh.in Wed Aug 18 08:19:01 2010
@@ -20,7 +20,7 @@
BIND10_PATH=@abs_top_builddir@/src/bin/bind10
-PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:@abs_top_builddir@/src/bin/xfrin:@abs_top_builddir@/src/bin/xfrout:$PATH
+PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:@abs_top_builddir@/src/bin/xfrin:@abs_top_builddir@/src/bin/xfrout:@abs_top_builddir@/src/bin/zonemgr:$PATH
export PATH
PYTHONPATH=@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs
Modified: branches/trac296/src/bin/bindctl/bindcmd.py
==============================================================================
--- branches/trac296/src/bin/bindctl/bindcmd.py (original)
+++ branches/trac296/src/bin/bindctl/bindcmd.py Wed Aug 18 08:19:01 2010
@@ -38,7 +38,6 @@
import json
import pwd
import getpass
-import traceback
try:
from collections import OrderedDict
@@ -123,7 +122,6 @@
except FailToLogin as err:
print(err)
print(FAIL_TO_CONNECT_WITH_CMDCTL)
- traceback.print_exc()
except KeyboardInterrupt:
print('\nExit from bindctl')
@@ -142,8 +140,8 @@
users_info = csv.reader(csvfile)
for row in users_info:
users.append([row[0], row[1]])
- except (IOError, IndexError) as e:
- pass
+ except (IOError, IndexError) as err:
+ print("Error reading saved username and password from %s%s: %s" % (dir, file_name, err))
finally:
if csvfile:
csvfile.close()
@@ -162,8 +160,9 @@
writer = csv.writer(csvfile)
writer.writerow([username, passwd])
csvfile.close()
- except Exception as e:
- print(e, "\nCannot write %s%s; default user is not stored" % (dir, file_name))
+ except IOError as err:
+ print("Error saving user information:", err)
+ print("user info file name: %s%s" % (dir, file_name))
return False
return True
@@ -183,8 +182,8 @@
try:
response = self.send_POST('/login', param)
data = response.read().decode()
- except socket.error:
- traceback.print_exc()
+ except socket.error as err:
+ print("Socket error while sending login information:", err)
raise FailToLogin()
if response.status == http.client.OK:
@@ -206,8 +205,8 @@
response = self.send_POST('/login', param)
data = response.read().decode()
print(data)
- except socket.error as e:
- traceback.print_exc()
+ except socket.error as err:
+ print("Socket error while sending login information:", err)
raise FailToLogin()
if response.status == http.client.OK:
@@ -543,6 +542,16 @@
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:
Modified: branches/trac296/src/bin/bindctl/tests/bindctl_test.py
==============================================================================
--- branches/trac296/src/bin/bindctl/tests/bindctl_test.py (original)
+++ branches/trac296/src/bin/bindctl/tests/bindctl_test.py Wed Aug 18 08:19:01 2010
@@ -237,6 +237,11 @@
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):
Modified: branches/trac296/src/bin/cfgmgr/b10-cfgmgr.py.in
==============================================================================
--- branches/trac296/src/bin/cfgmgr/b10-cfgmgr.py.in (original)
+++ branches/trac296/src/bin/cfgmgr/b10-cfgmgr.py.in Wed Aug 18 08:19:01 2010
@@ -19,7 +19,7 @@
import sys; sys.path.append ('@@PYTHONPATH@@')
-from isc.config.cfgmgr import ConfigManager
+from isc.config.cfgmgr import ConfigManager, ConfigManagerDataReadError
from isc.cc import SessionError
import signal
import os
@@ -52,10 +52,15 @@
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:
- cm.write_config()
+ return cm.write_config()
+ return 0
if __name__ == "__main__":
- main()
+ sys.exit(main())
Modified: branches/trac296/src/bin/host/Makefile.am
==============================================================================
--- branches/trac296/src/bin/host/Makefile.am (original)
+++ branches/trac296/src/bin/host/Makefile.am Wed Aug 18 08:19:01 2010
@@ -3,12 +3,16 @@
AM_CXXFLAGS = $(B10_CXXFLAGS)
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
+endif
+
CLEANFILES = *.gcno *.gcda
bin_PROGRAMS = host
host_SOURCES = host.cc
-host_LDADD = $(top_builddir)/src/lib/dns/.libs/libdns++.a
-host_LDADD += $(top_builddir)/src/lib/exceptions/.libs/libexceptions.a
+host_LDADD = $(top_builddir)/src/lib/dns/libdns++.la
+host_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
#man_MANS = host.1
#EXTRA_DIST = $(man_MANS) host.xml
Modified: branches/trac296/src/bin/msgq/b10-msgq.8
==============================================================================
--- branches/trac296/src/bin/msgq/b10-msgq.8 (original)
+++ branches/trac296/src/bin/msgq/b10-msgq.8 Wed Aug 18 08:19:01 2010
@@ -2,12 +2,12 @@
.\" Title: b10-msgq
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: April 19, 2010
+.\" Date: August 4, 2010
.\" Manual: BIND10
.\" Source: BIND10
.\" Language: English
.\"
-.TH "B10\-MSGQ" "8" "April 19, 2010" "BIND10" "BIND10"
+.TH "B10\-MSGQ" "8" "August 4, 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\-m\ \fR\fB\fInumber\fR\fR] [\fB\-v\fR] [\fB\-\-msgq\-port\ \fR\fB\fInumber\fR\fR] [\fB\-\-verbose\fR]
+\fBb10\-msgq\fR [\fB\-s\ \fR\fB\fIfile\fR\fR] [\fB\-v\fR] [\fB\-\-socket\-file\ \fR\fB\fIfile\fR\fR] [\fB\-\-verbose\fR]
.SH "DESCRIPTION"
.PP
The
@@ -96,11 +96,10 @@
.PP
The arguments are as follows:
.PP
-\fB\-m \fR\fB\fInumber\fR\fR, \fB\-\-msgq\-port \fR\fB\fInumber\fR\fR
+\fB\-s \fR\fB\fIfile\fR\fR, \fB\-\-socket\-file \fR\fB\fIfile\fR\fR
.RS 4
-The port number that
-\fBb10\-msgq\fR
-will listen on\&. The default is 9912\&.
+The UNIX domain socket file this daemon will use\&. The default is
+/usr/local/var/bind10\-devel/msg_socket\&.
.RE
.PP
\fB\-v\fR, \fB\-\-verbose\fR
Modified: branches/trac296/src/bin/msgq/msgq.xml
==============================================================================
--- branches/trac296/src/bin/msgq/msgq.xml (original)
+++ branches/trac296/src/bin/msgq/msgq.xml Wed Aug 18 08:19:01 2010
@@ -21,7 +21,7 @@
<refentry>
<refentryinfo>
- <date>April 19, 2010</date>
+ <date>August 4, 2010</date>
</refentryinfo>
<refmeta>
@@ -45,9 +45,9 @@
<refsynopsisdiv>
<cmdsynopsis>
<command>b10-msgq</command>
- <arg><option>-m <replaceable>number</replaceable></option></arg>
+ <arg><option>-s <replaceable>file</replaceable></option></arg>
<arg><option>-v</option></arg>
- <arg><option>--msgq-port <replaceable>number</replaceable></option></arg>
+ <arg><option>--socket-file <replaceable>file</replaceable></option></arg>
<arg><option>--verbose</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -111,12 +111,14 @@
<variablelist>
<varlistentry>
- <term><option>-m <replaceable>number</replaceable></option>,
- <option>--msgq-port <replaceable>number</replaceable></option></term>
+ <term><option>-s <replaceable>file</replaceable></option>,
+ <option>--socket-file <replaceable>file</replaceable></option></term>
<listitem><para>
- The port number that <command>b10-msgq</command> will listen on.
- The default is 9912.</para>
- </listitem>
+ 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>
</varlistentry>
<varlistentry>
Modified: branches/trac296/src/bin/usermgr/b10-cmdctl-usermgr.py.in
==============================================================================
--- branches/trac296/src/bin/usermgr/b10-cmdctl-usermgr.py.in (original)
+++ branches/trac296/src/bin/usermgr/b10-cmdctl-usermgr.py.in Wed Aug 18 08:19:01 2010
@@ -69,8 +69,8 @@
def main():
filename = DEFAULT_FILE
try:
- opts, args = getopt.getopt(sys.argv[1:], 'hvf:',
- ['help', 'file=', 'version='])
+ opts, args = getopt.getopt(sys.argv[1:], 'f:hv',
+ ['file=', 'help', 'version'])
except getopt.GetoptError as err:
print(err)
usage()
Modified: branches/trac296/src/bin/xfrin/tests/Makefile.am
==============================================================================
--- branches/trac296/src/bin/xfrin/tests/Makefile.am (original)
+++ branches/trac296/src/bin/xfrin/tests/Makefile.am Wed Aug 18 08:19:01 2010
@@ -7,6 +7,6 @@
check-local:
for pytest in $(PYTESTS) ; do \
echo Running test: $$pytest ; \
- env PYTHONPATH=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \
+ env PYTHONPATH=$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \
$(PYCOVERAGE) $(abs_srcdir)/$$pytest ; \
done
Modified: branches/trac296/src/bin/xfrin/tests/xfrin_test.py
==============================================================================
--- branches/trac296/src/bin/xfrin/tests/xfrin_test.py (original)
+++ branches/trac296/src/bin/xfrin/tests/xfrin_test.py Wed Aug 18 08:19:01 2010
@@ -63,6 +63,9 @@
def _cc_setup(self):
pass
+
+ def _get_db_file(self):
+ pass
def _cc_check_command(self):
self._shutdown_event.set()
@@ -408,11 +411,16 @@
def tearDown(self):
self.xfr.shutdown()
- def _do_parse(self):
- return self.xfr._parse_cmd_params(self.args)
+ def _do_parse_zone_name_class(self):
+ return self.xfr._parse_zone_name_and_class(self.args)
+
+ def _do_parse_master_port(self):
+ return self.xfr._parse_master_and_port(self.args)
def test_parse_cmd_params(self):
- name, rrclass, master_addrinfo, db_file = self._do_parse()
+ name, rrclass = self._do_parse_zone_name_class()
+ master_addrinfo = self._do_parse_master_port()
+ db_file = self.args.get('db_file')
self.assertEqual(master_addrinfo[4][1], int(TEST_MASTER_PORT))
self.assertEqual(name, TEST_ZONE_NAME)
self.assertEqual(rrclass, TEST_RRCLASS)
@@ -421,49 +429,50 @@
def test_parse_cmd_params_default_port(self):
del self.args['port']
- master_addrinfo = self._do_parse()[2]
+ master_addrinfo = self._do_parse_master_port()
self.assertEqual(master_addrinfo[4][1], 53)
def test_parse_cmd_params_ip6master(self):
self.args['master'] = TEST_MASTER_IPV6_ADDRESS
- master_addrinfo = self._do_parse()[2]
+ master_addrinfo = self._do_parse_master_port()
self.assertEqual(master_addrinfo[4][0], TEST_MASTER_IPV6_ADDRESS)
def test_parse_cmd_params_chclass(self):
- self.args['rrclass'] = 'CH'
- self.assertEqual(self._do_parse()[1], RRClass.CH())
+ self.args['zone_class'] = 'CH'
+ self.assertEqual(self._do_parse_zone_name_class()[1], RRClass.CH())
def test_parse_cmd_params_bogusclass(self):
- self.args['rrclass'] = 'XXX'
- self.assertRaises(XfrinException, self._do_parse)
+ self.args['zone_class'] = 'XXX'
+ self.assertRaises(XfrinException, self._do_parse_zone_name_class)
def test_parse_cmd_params_nozone(self):
# zone name is mandatory.
del self.args['zone_name']
- self.assertRaises(XfrinException, self._do_parse)
+ self.assertRaises(XfrinException, self._do_parse_zone_name_class)
def test_parse_cmd_params_nomaster(self):
# master address is mandatory.
del self.args['master']
- self.assertRaises(XfrinException, self._do_parse)
+ master_addrinfo = self._do_parse_master_port()
+ self.assertEqual(master_addrinfo[4][0], DEFAULT_MASTER)
def test_parse_cmd_params_bad_ip4(self):
self.args['master'] = '3.3.3.3.3'
- self.assertRaises(XfrinException, self._do_parse)
+ self.assertRaises(XfrinException, self._do_parse_master_port)
def test_parse_cmd_params_bad_ip6(self):
self.args['master'] = '1::1::1'
- self.assertRaises(XfrinException, self._do_parse)
+ self.assertRaises(XfrinException, self._do_parse_master_port)
def test_parse_cmd_params_bad_port(self):
self.args['port'] = '-1'
- self.assertRaises(XfrinException, self._do_parse)
+ self.assertRaises(XfrinException, self._do_parse_master_port)
self.args['port'] = '65536'
- self.assertRaises(XfrinException, self._do_parse)
+ self.assertRaises(XfrinException, self._do_parse_master_port)
self.args['port'] = 'http'
- self.assertRaises(XfrinException, self._do_parse)
+ self.assertRaises(XfrinException, self._do_parse_master_port)
def test_command_handler_shutdown(self):
self.assertEqual(self.xfr.command_handler("shutdown",
@@ -518,10 +527,31 @@
self.args['master'] = TEST_MASTER_IPV6_ADDRESS
# ...but right now we disable the feature due to security concerns.
self.assertEqual(self.xfr.command_handler("notify",
- self.args)['result'][0], 1)
+ self.args)['result'][0], 0)
def test_command_handler_unknown(self):
self.assertEqual(self.xfr.command_handler("xxx", None)['result'][0], 1)
+
+ def test_command_handler_transfers_in(self):
+ self.assertEqual(self.xfr.config_handler({})['result'][0], 0)
+ self.assertEqual(self.xfr.config_handler({'transfers_in': 3})['result'][0], 0)
+ self.assertEqual(self.xfr._max_transfers_in, 3)
+
+ def test_command_handler_masters(self):
+ master_info = {'master_addr': '1.1.1.1', 'master_port':53}
+ self.assertEqual(self.xfr.config_handler(master_info)['result'][0], 0)
+
+ master_info = {'master_addr': '1111.1.1.1', 'master_port':53 }
+ self.assertEqual(self.xfr.config_handler(master_info)['result'][0], 1)
+
+ master_info = {'master_addr': '2.2.2.2', 'master_port':530000 }
+ self.assertEqual(self.xfr.config_handler(master_info)['result'][0], 1)
+
+ master_info = {'master_addr': '2.2.2.2', 'master_port':53 }
+ self.xfr.config_handler(master_info)
+ self.assertEqual(self.xfr._master_addr, '2.2.2.2')
+ self.assertEqual(self.xfr._master_port, 53)
+
def raise_interrupt():
raise KeyboardInterrupt()
Modified: branches/trac296/src/bin/xfrin/xfrin.py.in
==============================================================================
--- branches/trac296/src/bin/xfrin/xfrin.py.in (original)
+++ branches/trac296/src/bin/xfrin/xfrin.py.in Wed Aug 18 08:19:01 2010
@@ -28,6 +28,7 @@
import random
from optparse import OptionParser, OptionValueError
from isc.config.ccsession import *
+from isc.notify import notify_out
try:
from libdns_python import *
except ImportError as e:
@@ -49,13 +50,17 @@
SPECFILE_LOCATION = SPECFILE_PATH + "/xfrin.spec"
AUTH_SPECFILE_LOCATION = AUTH_SPECFILE_PATH + "/auth.spec"
-
+XFROUT_MODULE_NAME = 'Xfrout'
+ZONE_MANAGER_MODULE_NAME = 'Zonemgr'
+REFRESH_FROM_ZONEMGR = 'refresh_from_zonemgr'
+ZONE_XFRIN_FAILED = 'zone_xfrin_failed'
__version__ = 'BIND10'
# define xfrin rcode
XFRIN_OK = 0
XFRIN_FAIL = 1
DEFAULT_MASTER_PORT = '53'
+DEFAULT_MASTER = '127.0.0.1'
def log_error(msg):
sys.stderr.write("[b10-xfrin] %s\n" % str(msg))
@@ -316,14 +321,15 @@
sys.stdout.write('[b10-xfrin] %s\n' % str(msg))
-def process_xfrin(xfrin_recorder, zone_name, rrclass, db_file,
+def process_xfrin(server, xfrin_recorder, zone_name, rrclass, db_file,
shutdown_event, master_addrinfo, check_soa, verbose):
xfrin_recorder.increment(zone_name)
sock_map = {}
conn = XfrinConnection(sock_map, zone_name, rrclass, db_file,
shutdown_event, master_addrinfo, verbose)
if conn.connect_to_master():
- conn.do_xfrin(check_soa)
+ ret = conn.do_xfrin(check_soa)
+ server.publish_xfrin_news(zone_name, rrclass, ret)
xfrin_recorder.decrement(zone_name)
@@ -358,32 +364,54 @@
class Xfrin:
def __init__(self, verbose = False):
+ self._max_transfers_in = 10
+ #TODO, this is the temp way to set the zone's master.
+ self._master_addr = DEFAULT_MASTER
+ self._master_port = DEFAULT_MASTER_PORT
self._cc_setup()
- self._max_transfers_in = 10
self.recorder = XfrinRecorder()
self._shutdown_event = threading.Event()
self._verbose = verbose
def _cc_setup(self):
- '''
-This method is used only as part of initialization, but is implemented
-separately for convenience of unit tests; by letting the test code override
-this method we can test most of this class without requiring a command channel.
-'''
- self._cc = isc.config.ModuleCCSession(SPECFILE_LOCATION,
+ '''This method is used only as part of initialization, but is
+ implemented separately for convenience of unit tests; by letting
+ the test code override this method we can test most of this class
+ without requiring a command channel.'''
+ # Create one session for sending command to other modules, because the
+ # listening session will block the send operation.
+ self._send_cc_session = isc.cc.Session()
+ self._module_cc = isc.config.ModuleCCSession(SPECFILE_LOCATION,
self.config_handler,
self.command_handler)
- self._cc.start()
+ self._module_cc.start()
+ config_data = self._module_cc.get_full_config()
+ self._max_transfers_in = config_data.get("transfers_in")
+ self._master_addr = config_data.get('master_addr') or self._master_addr
+ self._master_port = config_data.get('master_port') or self._master_port
def _cc_check_command(self):
- '''
-This is a straightforward wrapper for cc.check_command, but provided as
-a separate method for the convenience of unit tests.
-'''
- self._cc.check_command()
+ '''This is a straightforward wrapper for cc.check_command,
+ but provided as a separate method for the convenience
+ of unit tests.'''
+ self._module_cc.check_command()
def config_handler(self, new_config):
- # TODO, process new config data
+ self._max_transfers_in = new_config.get("transfers_in") or self._max_transfers_in
+ if ('master_addr' in new_config) or ('master_port' in new_config):
+ # Check if the new master is valid, there should be library for check it.
+ # and user should change the port and address together.
+ try:
+ addr = new_config.get('master_addr') or self._master_addr
+ port = new_config.get('master_port') or self._master_port
+ check_addr_port(addr, port)
+ self._master_addr = addr
+ self._master_port = port
+ except:
+ errmsg = "bad format for zone's master: " + str(new_config)
+ log_error(errmsg)
+ return create_answer(1, errmsg)
+
return create_answer(0)
def shutdown(self):
@@ -397,95 +425,97 @@
continue
th.join()
-
def command_handler(self, command, args):
answer = create_answer(0)
try:
if command == 'shutdown':
self._shutdown_event.set()
+ elif command == 'notify' or command == REFRESH_FROM_ZONEMGR:
+ # Xfrin receives the refresh/notify command from zone manager.
+ # notify command maybe has the parameters which
+ # specify the notifyfrom address and port, according the RFC1996, zone
+ # transfer should starts first from the notifyfrom, but now, let 'TODO' it.
+ (zone_name, rrclass) = self._parse_zone_name_and_class(args)
+ (master_addr) = check_addr_port(self._master_addr, self._master_port)
+ ret = self.xfrin_start(zone_name,
+ rrclass,
+ self._get_db_file(),
+ master_addr,
+ True)
+ answer = create_answer(ret[0], ret[1])
+
elif command == 'retransfer' or command == 'refresh':
- (zone_name, rrclass,
- master_addr, db_file) = self._parse_cmd_params(args)
- ret = self.xfrin_start(zone_name, rrclass, db_file,
+ # Xfrin receives the retransfer/refresh from cmdctl(sent by bindctl).
+ # If the command has specified master address, do transfer from the
+ # master address, or else do transfer from the configured masters.
+ (zone_name, rrclass) = self._parse_zone_name_and_class(args)
+ master_addr = self._parse_master_and_port(args)
+ db_file = args.get('db_file') or self._get_db_file()
+ ret = self.xfrin_start(zone_name,
+ rrclass,
+ db_file,
master_addr,
- False if command == 'retransfer' else True)
+ (False if command == 'retransfer' else True))
answer = create_answer(ret[0], ret[1])
- elif command == 'notify':
- # This is the temporary implementation for notify.
- # actually the notfiy command should be sent to the
- # Zone Manager module. Being temporary, we separate this case
- # from refresh/retransfer while we could (and should otherwise)
- # share the code.
- (zone_name, rrclass,
- master_addr, db_file) = self._parse_cmd_params(args)
-
- # XXX: master_addr is the sender of the notify message.
- # It's very dangerous to naively trust it as the source of
- # subsequent zone transfer; any remote node can easily exploit
- # it to mount zone poisoning or DoS attacks. We should
- # locally identify the appropriate set of master servers.
- # For now, we disable the code below.
- master_is_valid = False
-
- if master_is_valid:
- ret = self.xfrin_start(zone_name, rrclass, db_file,
- master_addr, True)
- else:
- errmsg = 'Failed to validate the master address ('
- errmsg += args['master'] + '), ignoring notify'
- ret = [1, errmsg]
- answer = create_answer(ret[0], ret[1])
+
else:
answer = create_answer(1, 'unknown command: ' + command)
-
except XfrinException as err:
+ log_error('error happened for command: %s, %s' % (command, str(err)) )
answer = create_answer(1, str(err))
-
return answer
- def _parse_cmd_params(self, args):
+ def _parse_zone_name_and_class(self, args):
zone_name = args.get('zone_name')
if not zone_name:
raise XfrinException('zone name should be provided')
- rrclass = args.get('rrclass')
+ rrclass = args.get('zone_class')
if not rrclass:
- # The default RR class is IN. We should fix this so that
- # the class is always passed in the command arg (where we specify
- # the default)
rrclass = RRClass.IN()
else:
try:
rrclass = RRClass(rrclass)
except InvalidRRClass as e:
raise XfrinException('invalid RRClass: ' + rrclass)
-
- master = args.get('master')
- if not master:
- raise XfrinException('master address should be provided')
-
- port_str = args.get('port')
- if not port_str:
- port_str = DEFAULT_MASTER_PORT
- master_addrinfo = check_addr_port(master, port_str)
-
- db_file = args.get('db_file')
- if not db_file:
- #TODO, the db file path should be got in auth server's configuration
- # if we need access to this configuration more often, we
- # should add it on start, and not remove it here
- # (or, if we have writable ds, we might not need this in
- # the first place)
- self._cc.add_remote_config(AUTH_SPECFILE_LOCATION)
- db_file, is_default = self._cc.get_remote_config_value("Auth", "database_file")
- if is_default and "B10_FROM_BUILD" in os.environ:
- # this too should be unnecessary, but currently the
- # 'from build' override isn't stored in the config
- # (and we don't have writable datasources yet)
- db_file = os.environ["B10_FROM_BUILD"] + os.sep + "bind10_zones.sqlite3"
- self._cc.remove_remote_config(AUTH_SPECFILE_LOCATION)
-
- return (zone_name, rrclass, master_addrinfo, db_file)
+
+ return zone_name, rrclass
+
+ def _parse_master_and_port(self, args):
+ port = args.get('port') or self._master_port
+ master = args.get('master') or self._master_addr
+ return check_addr_port(master, port)
+
+ def _get_db_file(self):
+ #TODO, the db file path should be got in auth server's configuration
+ # if we need access to this configuration more often, we
+ # should add it on start, and not remove it here
+ # (or, if we have writable ds, we might not need this in
+ # the first place)
+ self._module_cc.add_remote_config(AUTH_SPECFILE_LOCATION)
+ db_file, is_default = self._module_cc.get_remote_config_value("Auth", "database_file")
+ if is_default and "B10_FROM_BUILD" in os.environ:
+ # this too should be unnecessary, but currently the
+ # 'from build' override isn't stored in the config
+ # (and we don't have writable datasources yet)
+ db_file = os.environ["B10_FROM_BUILD"] + os.sep + "bind10_zones.sqlite3"
+ self._module_cc.remove_remote_config(AUTH_SPECFILE_LOCATION)
+ return db_file
+
+ def publish_xfrin_news(self, zone_name, zone_class, xfr_result):
+ '''Send command to xfrout/zone manager module.
+ If xfrin has finished successfully for one zone, tell the good
+ news(command: zone_new_data_ready) to zone manager and xfrout.
+ if xfrin failed, just tell the bad news to zone manager, so that
+ it can reset the refresh timer for that zone. '''
+ param = {'zone_name': zone_name, 'zone_class': zone_class.to_text()}
+ if xfr_result == XFRIN_OK:
+ msg = create_command(notify_out.ZONE_NEW_DATA_READY_CMD, param)
+ self._send_cc_session.group_sendmsg(msg, XFROUT_MODULE_NAME)
+ self._send_cc_session.group_sendmsg(msg, ZONE_MANAGER_MODULE_NAME)
+ else:
+ msg = create_command(ZONE_XFRIN_FAILED, param)
+ self._send_cc_session.group_sendmsg(msg, ZONE_MANAGER_MODULE_NAME)
def startup(self):
while not self._shutdown_event.is_set():
@@ -504,7 +534,8 @@
return (1, 'zone xfrin is in progress')
xfrin_thread = threading.Thread(target = process_xfrin,
- args = (self.recorder,
+ args = (self,
+ self.recorder,
zone_name, rrclass,
db_file,
self._shutdown_event,
Modified: branches/trac296/src/bin/xfrin/xfrin.spec.pre.in
==============================================================================
--- branches/trac296/src/bin/xfrin/xfrin.spec.pre.in (original)
+++ branches/trac296/src/bin/xfrin/xfrin.spec.pre.in Wed Aug 18 08:19:01 2010
@@ -8,6 +8,17 @@
"item_type": "integer",
"item_optional": false,
"item_default": 10
+ },
+ {
+ "item_name": "master_addr",
+ "item_type": "string",
+ "item_optional": false,
+ "item_default": ""
+ },
+ { "item_name": "master_port",
+ "item_type": "integer",
+ "item_optional": false,
+ "item_default": 53
}
],
"commands": [
@@ -21,9 +32,15 @@
"item_default": ""
},
{
+ "item_name": "zone_class",
+ "item_type": "string",
+ "item_optional": true,
+ "item_default": "IN"
+ },
+ {
"item_name": "master",
"item_type": "string",
- "item_optional": false,
+ "item_optional": true,
"item_default": ""
},
{
Modified: branches/trac296/src/bin/xfrout/tests/Makefile.am
==============================================================================
--- branches/trac296/src/bin/xfrout/tests/Makefile.am (original)
+++ branches/trac296/src/bin/xfrout/tests/Makefile.am Wed Aug 18 08:19:01 2010
@@ -7,6 +7,6 @@
check-local:
for pytest in $(PYTESTS) ; do \
echo Running test: $$pytest ; \
- env PYTHONPATH=$(abs_top_builddir)/src/bin/xfrout:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \
+ env PYTHONPATH=$(abs_top_builddir)/src/bin/xfrout:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \
$(PYCOVERAGE) $(abs_srcdir)/$$pytest ; \
done
Modified: branches/trac296/src/bin/xfrout/xfrout.py.in
==============================================================================
--- branches/trac296/src/bin/xfrout/xfrout.py.in (original)
+++ branches/trac296/src/bin/xfrout/xfrout.py.in Wed Aug 18 08:19:01 2010
@@ -28,6 +28,7 @@
from isc.config.ccsession import *
from isc.log.log import *
from isc.cc import SessionError
+from isc.notify import notify_out
import socket
import select
import errno
@@ -303,7 +304,7 @@
self._log = log
self.update_config_data(config_data)
self._cc = cc
-
+
def finish_request(self, request, client_address):
'''Finish one request by instantiating RequestHandlerClass.'''
self.RequestHandlerClass(request, client_address, self, self._log)
@@ -415,16 +416,25 @@
self._config_data.get('log_severity'), self._config_data.get('log_versions'),
self._config_data.get('log_max_bytes'), True)
self._start_xfr_query_listener()
+ self._start_notifier()
def _start_xfr_query_listener(self):
'''Start a new thread to accept xfr query. '''
-
self._unix_socket_server = UnixSockServer(self._listen_sock_file, XfroutSession,
self._shutdown_event, self._config_data,
self._cc, self._log);
listener = threading.Thread(target = listen_on_xfr_query, args = (self._unix_socket_server,))
listener.start()
-
+
+ def _start_notifier(self):
+ datasrc = self._unix_socket_server.get_db_file()
+ self._notifier = notify_out.NotifyOut(datasrc, self._log)
+ td = threading.Thread(target = notify_out.dispatcher, args = (self._notifier,))
+ td.daemon = True
+ td.start()
+
+ def send_notify(self, zone_name, zone_class):
+ self._notifier.send_notify(zone_name, zone_class)
def config_handler(self, new_config):
'''Update config data. TODO. Do error check'''
@@ -466,11 +476,22 @@
self._log.log_message("info", "Received shutdown command.")
self.shutdown()
answer = create_answer(0)
+
+ elif cmd == notify_out.ZONE_NEW_DATA_READY_CMD:
+ zone_name = args.get('zone_name')
+ zone_class = args.get('zone_class')
+ if zone_name and zone_class:
+ self._log.log_message("info", "Receive notify command for zone:'%s/%s'" \
+ % (zone_name, zone_class))
+ self.send_notify(zone_name, zone_class)
+ answer = create_answer(0)
+ else:
+ answer = create_answer(1, "Bad command parameter:" + str(args))
+
else:
answer = create_answer(1, "Unknown command:" + str(cmd))
return answer
-
def run(self):
'''Get and process all commands sent from cfgmgr or other modules. '''
Modified: branches/trac296/src/lib/Makefile.am
==============================================================================
--- branches/trac296/src/lib/Makefile.am (original)
+++ branches/trac296/src/lib/Makefile.am Wed Aug 18 08:19:01 2010
@@ -1,1 +1,1 @@
-SUBDIRS = exceptions dns cc config datasrc python xfr
+SUBDIRS = exceptions dns cc config datasrc python xfr bench
Modified: branches/trac296/src/lib/cc/Makefile.am
==============================================================================
--- branches/trac296/src/lib/cc/Makefile.am (original)
+++ branches/trac296/src/lib/cc/Makefile.am Wed Aug 18 08:19:01 2010
@@ -1,3 +1,5 @@
+SUBDIRS = . tests
+
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
@@ -19,20 +21,3 @@
$(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" session_config.h.pre >$@
BUILT_SOURCES = session_config.h
-
-TESTS =
-if HAVE_GTEST
-TESTS += run_unittests
-# (TODO: these need to be completed and moved to tests/)
-run_unittests_SOURCES = data_unittests.cc session_unittests.cc run_unittests.cc
-run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
-# TODO: remove PTHREAD_LDFLAGS (and from configure too)
-run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) $(PTHREAD_LDFLAGS)
-
-run_unittests_LDADD = libcc.la $(GTEST_LDADD)
-run_unittests_LDADD += $(top_builddir)/src/lib/dns/.libs/libdns++.a
-run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/.libs/libexceptions.a
-
-endif
-
-noinst_PROGRAMS = $(TESTS)
Modified: branches/trac296/src/lib/cc/data.cc
==============================================================================
--- branches/trac296/src/lib/cc/data.cc (original)
+++ branches/trac296/src/lib/cc/data.cc Wed Aug 18 08:19:01 2010
@@ -35,24 +35,21 @@
namespace data {
std::string
-Element::str()
-{
+Element::str() {
std::stringstream ss;
toJSON(ss);
- return ss.str();
+ return (ss.str());
}
std::string
-Element::toWire()
-{
+Element::toWire() {
std::stringstream ss;
toJSON(ss);
- return ss.str();
-}
-
-void
-Element::toWire(std::ostream& ss)
-{
+ return (ss.str());
+}
+
+void
+Element::toWire(std::ostream& ss) {
toJSON(ss);
}
@@ -65,63 +62,62 @@
//
bool
Element::getValue(long int& t UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::getValue(double& t UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::getValue(bool& t UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::getValue(std::string& t UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::getValue(std::vector<ElementPtr>& t UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::getValue(std::map<std::string, ElementPtr>& t UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::setValue(const long int v UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::setValue(const double v UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::setValue(const bool t UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::setValue(const std::string& v UNUSED_PARAM) {
- return false;
+ return (false);
}
bool
Element::setValue(const std::vector<ElementPtr>& v UNUSED_PARAM) {
- return false;
-}
-
-bool
-Element::setValue(const std::map<std::string, ElementPtr>& v UNUSED_PARAM)
-{
- return false;
+ return (false);
+}
+
+bool
+Element::setValue(const std::map<std::string, ElementPtr>& v UNUSED_PARAM) {
+ return (false);
}
ElementPtr
@@ -180,7 +176,7 @@
Element::find(const std::string& identifier UNUSED_PARAM,
ElementPtr& t UNUSED_PARAM)
{
- return false;
+ return (false);
}
namespace {
@@ -194,11 +190,11 @@
}
std::ostream& operator <<(std::ostream &out, const isc::data::ElementPtr& e) {
- return out << e->str();
+ return (out << e->str());
}
bool operator==(const isc::data::ElementPtr a, const isc::data::ElementPtr b) {
- return a->equals(b);
+ return (a->equals(b));
};
//
@@ -206,37 +202,37 @@
//
ElementPtr
Element::create() {
- return ElementPtr(new NullElement());
+ return (ElementPtr(new NullElement()));
}
ElementPtr
Element::create(const long int i) {
- return ElementPtr(new IntElement(i));
+ return (ElementPtr(new IntElement(i)));
}
ElementPtr
Element::create(const double d) {
- return ElementPtr(new DoubleElement(d));
+ return (ElementPtr(new DoubleElement(d)));
}
ElementPtr
Element::create(const std::string& s) {
- return ElementPtr(new StringElement(s));
+ return (ElementPtr(new StringElement(s)));
}
ElementPtr
Element::create(const bool b) {
- return ElementPtr(new BoolElement(b));
+ return (ElementPtr(new BoolElement(b)));
}
ElementPtr
Element::createList() {
- return ElementPtr(new ListElement());
+ return (ElementPtr(new ListElement()));
}
ElementPtr
Element::createMap() {
- return ElementPtr(new MapElement());
+ return (ElementPtr(new MapElement()));
}
@@ -248,10 +244,10 @@
char_in(const char c, const char *chars) {
for (size_t i = 0; i < strlen(chars); ++i) {
if (chars[i] == c) {
- return true;
- }
- }
- return false;
+ return (true);
+ }
+ }
+ return (false);
}
void
@@ -332,7 +328,7 @@
c = in.get();
++pos;
}
- return ss.str();
+ return (ss.str());
}
std::string
@@ -342,7 +338,7 @@
ss << (char) in.get();
}
pos += ss.str().size();
- return ss.str();
+ return (ss.str());
}
static std::string
@@ -353,7 +349,7 @@
ss << (char) in.get();
}
pos += ss.str().size();
- return ss.str();
+ return (ss.str());
}
// Should we change from IntElement and DoubleElement to NumberElement
@@ -386,9 +382,9 @@
}
if (is_double) {
- return Element::create(d);
- } else {
- return Element::create(i);
+ return (Element::create(d));
+ } else {
+ return (Element::create(i));
}
}
@@ -398,13 +394,13 @@
{
const std::string word = word_from_stringstream(in, pos);
if (boost::iequals(word, "True")) {
- return Element::create(true);
+ return (Element::create(true));
} else if (boost::iequals(word, "False")) {
- return Element::create(false);
+ return (Element::create(false));
} else {
throwJSONError(std::string("Bad boolean value: ") + word, file, line, pos);
// above is a throw shortcurt, return empty is never reached
- return ElementPtr();
+ return (ElementPtr());
}
}
@@ -414,17 +410,17 @@
{
const std::string word = word_from_stringstream(in, pos);
if (boost::iequals(word, "null")) {
- return Element::create();
+ return (Element::create());
} else {
throwJSONError(std::string("Bad null value: ") + word, file, line, pos);
- return ElementPtr();
+ return (ElementPtr());
}
}
ElementPtr
from_stringstream_string(std::istream& in, const std::string& file, int& line, int& pos)
{
- return Element::create(str_from_stringstream(in, file, line, pos));
+ return (Element::create(str_from_stringstream(in, file, line, pos)));
}
ElementPtr
@@ -444,7 +440,7 @@
c = in.get();
pos++;
}
- return list;
+ return (list);
}
ElementPtr
@@ -474,53 +470,53 @@
pos++;
}
}
- return map;
+ return (map);
}
}
std::string
Element::typeToName(Element::types type)
{
- switch(type) {
+ switch (type) {
case Element::integer:
- return std::string("integer");
+ return (std::string("integer"));
case Element::real:
- return std::string("real");
+ return (std::string("real"));
case Element::boolean:
- return std::string("boolean");
+ return (std::string("boolean"));
case Element::string:
- return std::string("string");
+ return (std::string("string"));
case Element::list:
- return std::string("list");
+ return (std::string("list"));
case Element::map:
- return std::string("map");
+ return (std::string("map"));
case Element::null:
- return std::string("null");
+ return (std::string("null"));
case Element::any:
- return std::string("any");
+ return (std::string("any"));
default:
- return std::string("unknown");
+ return (std::string("unknown"));
}
}
Element::types
Element::nameToType(const std::string& type_name) {
if (type_name == "integer") {
- return Element::integer;
+ return (Element::integer);
} else if (type_name == "real") {
- return Element::real;
+ return (Element::real);
} else if (type_name == "boolean") {
- return Element::boolean;
+ return (Element::boolean);
} else if (type_name == "string") {
- return Element::string;
+ return (Element::string);
} else if (type_name == "list") {
- return Element::list;
+ return (Element::list);
} else if (type_name == "map") {
- return Element::map;
+ return (Element::map);
} else if (type_name == "null") {
- return Element::null;
+ return (Element::null);
} else if (type_name == "any") {
- return Element::any;
+ return (Element::any);
} else {
isc_throw(TypeError, type_name + " is not a valid type name");
}
@@ -529,14 +525,14 @@
ElementPtr
Element::fromJSON(std::istream& in) throw(JSONError) {
int line = 1, pos = 1;
- return fromJSON(in, "<istream>", line, pos);
+ return (fromJSON(in, "<istream>", line, pos));
}
ElementPtr
Element::fromJSON(std::istream& in, const std::string& file_name) throw(JSONError)
{
int line = 1, pos = 1;
- return fromJSON(in, file_name, line, pos);
+ return (fromJSON(in, file_name, line, pos));
}
ElementPtr
@@ -602,7 +598,7 @@
}
}
if (el_read) {
- return element;
+ return (element);
} else {
isc_throw(JSONError, "nothing read");
}
@@ -612,7 +608,7 @@
Element::fromJSON(const std::string &in) {
std::stringstream ss;
ss << in;
- return fromJSON(ss, "<string>");
+ return (fromJSON(ss, "<string>"));
}
// to JSON format
@@ -698,18 +694,18 @@
MapElement::find(const std::string& id) {
const size_t sep = id.find('/');
if (sep == std::string::npos) {
- return get(id);
+ return (get(id));
} else {
ElementPtr ce = get(id.substr(0, sep));
if (ce) {
// ignore trailing slash
if (sep + 1 != id.size()) {
- return ce->find(id.substr(sep + 1));
+ return (ce->find(id.substr(sep + 1)));
} else {
- return ce;
+ return (ce);
}
} else {
- return ElementPtr();
+ return (ElementPtr());
}
}
}
@@ -719,7 +715,7 @@
std::stringstream ss;
ss << s;
int line = 0, pos = 0;
- return fromJSON(ss, "<wire>", line, pos);
+ return (fromJSON(ss, "<wire>", line, pos));
}
ElementPtr
@@ -735,7 +731,7 @@
//}
//length -= 4;
int line = 0, pos = 0;
- return fromJSON(in, "<wire>", line, pos);
+ return (fromJSON(in, "<wire>", line, pos));
}
void
@@ -749,12 +745,12 @@
ElementPtr p = find(id);
if (p) {
t = p;
- return true;
+ return (true);
}
} catch (const TypeError& e) {
// ignore
}
- return false;
+ return (false);
}
bool
@@ -777,7 +773,7 @@
bool
NullElement::equals(ElementPtr other) {
- return other->getType() == Element::null;
+ return (other->getType() == Element::null);
}
bool
@@ -791,16 +787,16 @@
if (other->getType() == Element::list) {
const int s = size();
if (s != other->size()) {
- return false;
+ return (false);
}
for (int i = 0; i < s; ++i) {
if (!get(i)->equals(other->get(i))) {
- return false;
+ return (false);
}
}
- return true;
- } else {
- return false;
+ return (true);
+ } else {
+ return (false);
}
}
@@ -812,10 +808,10 @@
it != m.end() ; ++it) {
if (other->contains((*it).first)) {
if (!get((*it).first)->equals(other->get((*it).first))) {
- return false;
+ return (false);
}
} else {
- return false;
+ return (false);
}
}
// quickly walk through the other map too, to see if there's
@@ -827,18 +823,18 @@
for (std::map<std::string, ElementPtr>::const_iterator it = m.begin();
it != m.end() ; ++it) {
if (!contains((*it).first)) {
- return false;
+ return (false);
}
}
- return true;
- } else {
- return false;
+ return (true);
+ } else {
+ return (false);
}
}
bool
isNull(ElementPtr p) {
- return !p;
+ return (!p);
}
void
Modified: branches/trac296/src/lib/cc/data.h
==============================================================================
--- branches/trac296/src/lib/cc/data.h (original)
+++ branches/trac296/src/lib/cc/data.h Wed Aug 18 08:19:01 2010
@@ -90,7 +90,7 @@
virtual ~Element() {};
/// \return the type of this element
- int getType() { return type; };
+ int getType() { return (type); }
/// Returns a string representing the Element and all its
/// child elements; note that this is different from stringValue(),
@@ -265,13 +265,13 @@
//@{
static ElementPtr create();
static ElementPtr create(const long int i);
- static ElementPtr create(const int i) { return create(static_cast<long int>(i)); };
+ static ElementPtr create(const int i) { return (create(static_cast<long int>(i))); };
static ElementPtr create(const double d);
static ElementPtr create(const bool b);
static ElementPtr create(const std::string& s);
// need both std:string and char *, since c++ will match
// bool before std::string when you pass it a char *
- static ElementPtr create(const char *s) { return create(std::string(s)); };
+ static ElementPtr create(const char *s) { return (create(std::string(s))); }
/// \brief Creates an empty ListElement type ElementPtr.
static ElementPtr createList();
@@ -364,12 +364,12 @@
long int i;
public:
- IntElement(long int v) : Element(integer), i(v) { };
- long int intValue() { return i; }
+ IntElement(long int v) : Element(integer), i(v) { }
+ long int intValue() { return (i); }
using Element::getValue;
- bool getValue(long int& t) { t = i; return true; };
+ bool getValue(long int& t) { t = i; return (true); }
using Element::setValue;
- bool setValue(const long int v) { i = v; return true; };
+ bool setValue(const long int v) { i = v; return (true); }
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
@@ -379,11 +379,11 @@
public:
DoubleElement(double v) : Element(real), d(v) {};
- double doubleValue() { return d; }
+ double doubleValue() { return (d); }
using Element::getValue;
- bool getValue(double& t) { t = d; return true; };
+ bool getValue(double& t) { t = d; return (true); }
using Element::setValue;
- bool setValue(const double v) { d = v; return true; };
+ bool setValue(const double v) { d = v; return (true); }
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
@@ -393,11 +393,11 @@
public:
BoolElement(const bool v) : Element(boolean), b(v) {};
- bool boolValue() { return b; }
+ bool boolValue() { return (b); }
using Element::getValue;
- bool getValue(bool& t) { t = b; return true; };
+ bool getValue(bool& t) { t = b; return (true); }
using Element::setValue;
- bool setValue(const bool v) { b = v; return true; };
+ bool setValue(const bool v) { b = v; return (true); }
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
@@ -414,11 +414,11 @@
public:
StringElement(std::string v) : Element(string), s(v) {};
- std::string stringValue() { return s; };
+ std::string stringValue() { return (s); }
using Element::getValue;
- bool getValue(std::string& t) { t = s; return true; };
+ bool getValue(std::string& t) { t = s; return (true); }
using Element::setValue;
- bool setValue(const std::string& v) { s = v; return true; };
+ bool setValue(const std::string& v) { s = v; return (true); }
void toJSON(std::ostream& ss);
bool equals(ElementPtr other);
};
@@ -428,20 +428,20 @@
public:
ListElement() : Element(list), l(std::vector<ElementPtr>()) {};
- const std::vector<ElementPtr>& listValue() { return l; }
+ const std::vector<ElementPtr>& listValue() { return (l); }
using Element::getValue;
- bool getValue(std::vector<ElementPtr>& t) { t = l; return true; };
+ bool getValue(std::vector<ElementPtr>& t) { t = l; return (true); }
using Element::setValue;
- bool setValue(const std::vector<ElementPtr>& v) { l = v; return true; };
+ bool setValue(const std::vector<ElementPtr>& v) { l = v; return (true); }
using Element::get;
- ElementPtr get(int i) { return l.at(i); };
+ ElementPtr get(int i) { return (l.at(i)); }
using Element::set;
void set(size_t i, ElementPtr e) { if (i <= l.size()) {l[i] = e;} else { throw std::out_of_range("vector::_M_range_check"); } };
void add(ElementPtr e) { l.push_back(e); };
using Element::remove;
void remove(int i) { l.erase(l.begin() + i); };
void toJSON(std::ostream& ss);
- size_t size() { return l.size(); }
+ size_t size() { return (l.size()); }
bool equals(ElementPtr other);
};
@@ -451,18 +451,18 @@
public:
MapElement() : Element(map), m(std::map<std::string, ElementPtr>()) {};
// TODO: should we have direct iterators instead of exposing the std::map here?
- const std::map<std::string, ElementPtr>& mapValue() { return m; }
+ const std::map<std::string, ElementPtr>& mapValue() { return (m); }
using Element::getValue;
- bool getValue(std::map<std::string, ElementPtr>& t) { t = m; return true; };
+ bool getValue(std::map<std::string, ElementPtr>& t) { t = m; return (true); }
using Element::setValue;
- bool setValue(std::map<std::string, ElementPtr>& v) { m = v; return true; };
+ bool setValue(std::map<std::string, ElementPtr>& v) { m = v; return (true); }
using Element::get;
- ElementPtr get(const std::string& s) { if (contains(s)) { return m[s]; } else { return ElementPtr();} };
+ ElementPtr get(const std::string& s) { if (contains(s)) { return (m[s]); } else { return (ElementPtr());} }
using Element::set;
void set(const std::string& key, ElementPtr value);
using Element::remove;
void remove(const std::string& s) { m.erase(s); }
- bool contains(const std::string& s) { return m.find(s) != m.end(); }
+ bool contains(const std::string& s) { return (m.find(s) != m.end()); }
void toJSON(std::ostream& ss);
// we should name the two finds better...
Modified: branches/trac296/src/lib/cc/session.cc
==============================================================================
--- branches/trac296/src/lib/cc/session.cc (original)
+++ branches/trac296/src/lib/cc/session.cc Wed Aug 18 08:19:01 2010
@@ -210,7 +210,7 @@
}
}
} catch (const asio::system_error& asio_ex) {
- // to hide boost specific exceptions, we catch them explicitly
+ // to hide ASIO specific exceptions, we catch them explicitly
// and convert it to SessionError.
isc_throw(SessionError, "ASIO read failed: " << asio_ex.what());
}
@@ -344,7 +344,7 @@
bool
Session::recvmsg(ElementPtr& msg, bool nonblock, int seq) {
ElementPtr l_env;
- return recvmsg(l_env, msg, nonblock, seq);
+ return (recvmsg(l_env, msg, nonblock, seq));
}
bool
@@ -366,7 +366,7 @@
env = q_el->get(0);
msg = q_el->get(1);
impl_->queue_->remove(i);
- return true;
+ return (true);
}
}
}
@@ -404,13 +404,13 @@
) {
env = l_env;
msg = l_msg;
- return true;
+ return (true);
} else {
ElementPtr q_el = Element::createList();
q_el->add(l_env);
q_el->add(l_msg);
impl_->queue_->add(q_el);
- return recvmsg(env, msg, nonblock, seq);
+ return (recvmsg(env, msg, nonblock, seq));
}
// XXXMLG handle non-block here, and return false for short reads
}
@@ -453,7 +453,7 @@
//env->set("msg", Element::create(msg->toWire()));
sendmsg(env, msg);
- return nseq;
+ return (nseq);
}
bool
@@ -478,7 +478,7 @@
sendmsg(env, newmsg);
- return nseq;
+ return (nseq);
}
bool
Modified: branches/trac296/src/lib/cc/tests/session_unittests.cc
==============================================================================
--- branches/trac296/src/lib/cc/tests/session_unittests.cc (original)
+++ branches/trac296/src/lib/cc/tests/session_unittests.cc Wed Aug 18 08:19:01 2010
@@ -22,10 +22,13 @@
#include <asio.hpp>
#include <gtest/gtest.h>
+#include <boost/bind.hpp>
#include <exceptions/exceptions.h>
#include <cc/session.h>
+#include <cc/data.h>
+#include <session_unittests_config.h>
using namespace isc::cc;
@@ -48,3 +51,190 @@
);
}
+
+// This class sets up a domain socket for the session to connect to
+// it will impersonate the msgq a tiny bit (if setSendLname() has
+// been called, it will send an 'answer' to the lname query that is
+// sent in the initialization of Session objects)
+class TestDomainSocket {
+
+public:
+ TestDomainSocket(asio::io_service& io_service, const char* file) :
+ io_service_(io_service),
+ ep_(file),
+ acceptor_(io_service_, ep_),
+ socket_(io_service_)
+ {
+ acceptor_.async_accept(socket_,
+ boost::bind(&TestDomainSocket::acceptHandler,
+ this, _1));
+ }
+
+ ~TestDomainSocket() {
+ socket_.close();
+ unlink(BIND10_TEST_SOCKET_FILE);
+ }
+
+ void
+ acceptHandler(const asio::error_code& error UNUSED_PARAM) {
+ }
+
+ void
+ sendmsg(isc::data::ElementPtr& env, isc::data::ElementPtr& msg) {
+ const std::string header_wire = env->toWire();
+ const std::string body_wire = msg->toWire();
+ const unsigned int length = 2 + header_wire.length() +
+ body_wire.length();
+ const unsigned int length_net = htonl(length);
+ const unsigned short header_length = header_wire.length();
+ const unsigned short header_length_net = htons(header_length);
+
+ socket_.send(asio::buffer(&length_net, sizeof(length_net)));
+ socket_.send(asio::buffer(&header_length_net,
+ sizeof(header_length_net)));
+ socket_.send(asio::buffer(header_wire.data(), header_length));
+ socket_.send(asio::buffer(body_wire.data(), body_wire.length()));
+ }
+
+ void
+ sendLname() {
+ isc::data::ElementPtr lname_answer1 =
+ isc::data::Element::fromJSON("{ \"type\": \"lname\" }");
+ isc::data::ElementPtr lname_answer2 =
+ isc::data::Element::fromJSON("{ \"lname\": \"foobar\" }");
+ sendmsg(lname_answer1, lname_answer2);
+ }
+
+ void
+ setSendLname() {
+ // ignore whatever data we get, send back an lname
+ asio::async_read(socket_, asio::buffer(data_buf, 0),
+ boost::bind(&TestDomainSocket::sendLname, this));
+ }
+
+private:
+ asio::io_service& io_service_;
+ asio::local::stream_protocol::endpoint ep_;
+ asio::local::stream_protocol::acceptor acceptor_;
+ asio::local::stream_protocol::socket socket_;
+ char data_buf[1024];
+};
+
+class SessionTest : public ::testing::Test {
+protected:
+ SessionTest() : sess(my_io_service), work(my_io_service) {
+ // The TestDomainSocket is held as a 'new'-ed pointer,
+ // so we can call unlink() first.
+ unlink(BIND10_TEST_SOCKET_FILE);
+ tds = new TestDomainSocket(my_io_service, BIND10_TEST_SOCKET_FILE);
+ }
+
+ ~SessionTest() {
+ delete tds;
+ }
+
+public:
+ // used in the handler test
+ // This handler first reads (and ignores) whatever message caused
+ // it to be invoked. Then it calls group_recv for a second message.
+ // If this message is { "command": "stop" } it'll tell the
+ // io_service it is done. Otherwise it'll re-register this handler
+ void someHandler() {
+ isc::data::ElementPtr env, msg;
+ sess.group_recvmsg(env, msg, false, -1);
+
+ sess.group_recvmsg(env, msg, false, -1);
+ if (msg && msg->contains("command") &&
+ msg->get("command")->stringValue() == "stop") {
+ my_io_service.stop();
+ } else {
+ sess.startRead(boost::bind(&SessionTest::someHandler, this));
+ }
+ }
+
+protected:
+ asio::io_service my_io_service;
+ TestDomainSocket* tds;
+ Session sess;
+ // Keep run() from stopping right away by informing it it has work to do
+ asio::io_service::work work;
+};
+
+TEST_F(SessionTest, timeout_on_connect) {
+ // set to a short timeout so the test doesn't take too long
+ EXPECT_EQ(4000, sess.getTimeout());
+ sess.setTimeout(100);
+ EXPECT_EQ(100, sess.getTimeout());
+ // no answer, should timeout
+ EXPECT_THROW(sess.establish(BIND10_TEST_SOCKET_FILE), SessionTimeout);
+}
+
+TEST_F(SessionTest, connect_ok) {
+ tds->setSendLname();
+ sess.establish(BIND10_TEST_SOCKET_FILE);
+}
+
+TEST_F(SessionTest, connect_ok_no_timeout) {
+ tds->setSendLname();
+
+ sess.setTimeout(0);
+ sess.establish(BIND10_TEST_SOCKET_FILE);
+}
+
+TEST_F(SessionTest, connect_ok_connection_reset) {
+ tds->setSendLname();
+
+ sess.establish(BIND10_TEST_SOCKET_FILE);
+ // Close the session again, so the next recv() should throw
+ sess.disconnect();
+
+ isc::data::ElementPtr env, msg;
+ EXPECT_THROW(sess.group_recvmsg(env, msg, false, -1), SessionError);
+}
+
+TEST_F(SessionTest, run_with_handler) {
+ tds->setSendLname();
+
+ sess.establish(BIND10_TEST_SOCKET_FILE);
+ sess.startRead(boost::bind(&SessionTest::someHandler, this));
+
+ isc::data::ElementPtr env = isc::data::Element::fromJSON("{ \"to\": \"me\" }");
+ isc::data::ElementPtr msg = isc::data::Element::fromJSON("{ \"some\": \"message\" }");
+ tds->sendmsg(env, msg);
+
+ msg = isc::data::Element::fromJSON("{ \"another\": \"message\" }");
+ tds->sendmsg(env, msg);
+
+ msg = isc::data::Element::fromJSON("{ \"a third\": \"message\" }");
+ tds->sendmsg(env, msg);
+
+ msg = isc::data::Element::fromJSON("{ \"command\": \"stop\" }");
+ tds->sendmsg(env, msg);
+
+
+ size_t count = my_io_service.run();
+ ASSERT_EQ(2, count);
+}
+
+TEST_F(SessionTest, run_with_handler_timeout) {
+ tds->setSendLname();
+
+ sess.establish(BIND10_TEST_SOCKET_FILE);
+ sess.startRead(boost::bind(&SessionTest::someHandler, this));
+ sess.setTimeout(100);
+
+ isc::data::ElementPtr env = isc::data::Element::fromJSON("{ \"to\": \"me\" }");
+ isc::data::ElementPtr msg = isc::data::Element::fromJSON("{ \"some\": \"message\" }");
+ tds->sendmsg(env, msg);
+
+ msg = isc::data::Element::fromJSON("{ \"another\": \"message\" }");
+ tds->sendmsg(env, msg);
+
+ msg = isc::data::Element::fromJSON("{ \"a third\": \"message\" }");
+ tds->sendmsg(env, msg);
+
+ // No followup message, should time out.
+ ASSERT_THROW(my_io_service.run(), SessionTimeout);
+}
+
+
Modified: branches/trac296/src/lib/config/Makefile.am
==============================================================================
--- branches/trac296/src/lib/config/Makefile.am (original)
+++ branches/trac296/src/lib/config/Makefile.am Wed Aug 18 08:19:01 2010
@@ -1,3 +1,5 @@
+SUBDIRS = . tests
+
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc
AM_CXXFLAGS = $(B10_CXXFLAGS) -Wno-strict-aliasing
@@ -7,14 +9,10 @@
CLEANFILES = *.gcno *.gcda
-TESTS =
-if HAVE_GTEST
-SUBDIRS = . tests
-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
Modified: branches/trac296/src/lib/config/ccsession.cc
==============================================================================
--- branches/trac296/src/lib/config/ccsession.cc (original)
+++ branches/trac296/src/lib/config/ccsession.cc Wed Aug 18 08:19:01 2010
@@ -53,17 +53,15 @@
/// Creates a standard config/command protocol answer message
ElementPtr
-createAnswer()
-{
+createAnswer() {
ElementPtr answer = Element::fromJSON("{\"result\": [] }");
ElementPtr answer_content = answer->get("result");
answer_content->add(Element::create(0));
- return answer;
-}
-
-ElementPtr
-createAnswer(const int rcode, const ElementPtr arg)
-{
+ return (answer);
+}
+
+ElementPtr
+createAnswer(const int rcode, const ElementPtr arg) {
if (rcode != 0 && (!arg || arg->getType() != Element::string)) {
isc_throw(CCSessionError, "Bad or no argument for rcode != 0");
}
@@ -71,22 +69,20 @@
ElementPtr answer_content = answer->get("result");
answer_content->add(Element::create(rcode));
answer_content->add(arg);
- return answer;
-}
-
-ElementPtr
-createAnswer(const int rcode, const std::string& arg)
-{
+ return (answer);
+}
+
+ElementPtr
+createAnswer(const int rcode, const std::string& arg) {
ElementPtr answer = Element::fromJSON("{\"result\": [] }");
ElementPtr answer_content = answer->get("result");
answer_content->add(Element::create(rcode));
answer_content->add(Element::create(arg));
- return answer;
-}
-
-ElementPtr
-parseAnswer(int &rcode, const ElementPtr msg)
-{
+ return (answer);
+}
+
+ElementPtr
+parseAnswer(int &rcode, const ElementPtr msg) {
if (msg &&
msg->getType() == Element::map &&
msg->contains("result")) {
@@ -99,13 +95,13 @@
rcode = result->get(0)->intValue();
if (result->size() > 1) {
if (rcode == 0 || result->get(1)->getType() == Element::string) {
- return result->get(1);
+ return (result->get(1));
} else {
isc_throw(CCSessionError, "Error description in result with rcode != 0 is not a string");
}
} else {
if (rcode == 0) {
- return ElementPtr();
+ return (ElementPtr());
} else {
isc_throw(CCSessionError, "Result with rcode != 0 does not have an error description");
}
@@ -116,14 +112,12 @@
}
ElementPtr
-createCommand(const std::string& command)
-{
- return createCommand(command, ElementPtr());
-}
-
-ElementPtr
-createCommand(const std::string& command, ElementPtr arg)
-{
+createCommand(const std::string& command) {
+ return (createCommand(command, ElementPtr()));
+}
+
+ElementPtr
+createCommand(const std::string& command, ElementPtr arg) {
ElementPtr cmd = Element::createMap();
ElementPtr cmd_parts = Element::createList();
cmd_parts->add(Element::create(command));
@@ -131,7 +125,7 @@
cmd_parts->add(arg);
}
cmd->set("command", cmd_parts);
- return cmd;
+ return (cmd);
}
/// Returns "" and empty ElementPtr() if this does not
@@ -151,7 +145,7 @@
} else {
arg = ElementPtr();
}
- return cmd->get(0)->stringValue();
+ return (cmd->get(0)->stringValue());
} else {
isc_throw(CCSessionError, "Command part in command message missing, empty, or not a list");
}
@@ -182,7 +176,7 @@
exit(1);
}
file.close();
- return module_spec;
+ return (module_spec);
}
void
@@ -275,7 +269,7 @@
setLocalConfig(local_config);
}
}
- return answer;
+ return (answer);
}
bool
@@ -293,7 +287,7 @@
/* ignore result messages (in case we're out of sync, to prevent
* pingpongs */
if (data->getType() != Element::map || data->contains("result")) {
- return 0;
+ return (0);
}
ElementPtr arg;
ElementPtr answer;
@@ -308,7 +302,7 @@
// in our remote config list, update that
updateRemoteConfig(target_module, arg);
// we're not supposed to answer to this, so return
- return 0;
+ return (0);
}
} else {
if (target_module == module_name_) {
@@ -329,7 +323,7 @@
}
}
- return 0;
+ return (0);
}
std::string
@@ -356,7 +350,7 @@
// all ok, add it
remote_module_configs_[module_name] = rmod_config;
- return module_name;
+ return (module_name);
}
void
@@ -378,7 +372,7 @@
it = remote_module_configs_.find(module_name);
if (it != remote_module_configs_.end()) {
- return remote_module_configs_[module_name].getValue(identifier);
+ return (remote_module_configs_[module_name].getValue(identifier));
} else {
isc_throw(CCSessionError, "Remote module " + module_name + " not found.");
}
Modified: branches/trac296/src/lib/config/config_data.cc
==============================================================================
--- branches/trac296/src/lib/config/config_data.cc (original)
+++ branches/trac296/src/lib/config/config_data.cc Wed Aug 18 08:19:01 2010
@@ -104,7 +104,7 @@
}
}
//std::cout << "[XX] found spec part: " << std::endl << spec_part << std::endl;
- return spec_part;
+ return (spec_part);
}
//
@@ -142,17 +142,15 @@
}
ElementPtr
-ConfigData::getValue(const std::string& identifier)
-{
+ConfigData::getValue(const std::string& identifier) {
// 'fake' is set, but dropped by this function and
// serves no further purpose.
bool fake;
- return getValue(fake, identifier);
+ return (getValue(fake, identifier));
}
ElementPtr
-ConfigData::getValue(bool& is_default, const std::string& identifier)
-{
+ConfigData::getValue(bool& is_default, const std::string& identifier) {
ElementPtr value = _config->find(identifier);
if (value) {
is_default = false;
@@ -166,7 +164,7 @@
value = ElementPtr();
}
}
- return value;
+ return (value);
}
/// Returns an ElementPtr pointing to a ListElement containing
@@ -181,7 +179,7 @@
spec_part = find_spec_part(spec_part, identifier);
}
spec_name_list(result, spec_part, identifier, recurse);
- return result;
+ return (result);
}
/// Returns an ElementPtr containing a MapElement with identifier->value
@@ -194,7 +192,7 @@
BOOST_FOREACH(ElementPtr item, items->listValue()) {
result->set(item->stringValue(), getValue(item->stringValue()));
}
- return result;
+ return (result);
}
}
Modified: branches/trac296/src/lib/config/config_data.h
==============================================================================
--- branches/trac296/src/lib/config/config_data.h (original)
+++ branches/trac296/src/lib/config/config_data.h Wed Aug 18 08:19:01 2010
@@ -40,7 +40,7 @@
/// Constructs a ConfigData option with no specification and an
/// empty configuration.
ConfigData() { _config = Element::createMap(); };
-
+
/// Constructs a ConfigData option with the given specification
/// and an empty configuration.
/// \param module_spec A ModuleSpec for the relevant module
@@ -70,22 +70,22 @@
ElementPtr getValue(bool &is_default, const std::string& identifier);
/// Returns the ModuleSpec associated with this ConfigData object
- const ModuleSpec getModuleSpec() { return _module_spec; };
-
+ const ModuleSpec getModuleSpec() { return (_module_spec); }
+
/// Set the ModuleSpec associated with this ConfigData object
void setModuleSpec(ModuleSpec module_spec) { _module_spec = module_spec; };
-
+
/// Set the local configuration (i.e. all non-default values)
/// \param config An ElementPtr pointing to a MapElement containing
/// *all* non-default configuration values. Existing values
/// will be removed.
void setLocalConfig(ElementPtr config) { _config = config; }
-
+
/// Returns the local (i.e. non-default) configuration.
/// \returns An ElementPtr pointing to a MapElement containing all
/// non-default configuration options.
- ElementPtr getLocalConfig() { return _config; }
-
+ ElementPtr getLocalConfig() { return (_config); }
+
/// Returns a list of all possible configuration options as specified
/// by the ModuleSpec.
/// \param identifier If given, show the items at the given identifier
@@ -97,7 +97,7 @@
/// location (or all possible identifiers if identifier==""
/// and recurse==false)
ElementPtr getItemList(const std::string& identifier = "", bool recurse = false);
-
+
/// Returns all current configuration settings (both non-default and default).
/// \return An ElementPtr pointing to a MapElement containing
/// string->value elements, where the string is the
Modified: branches/trac296/src/lib/config/module_spec.cc
==============================================================================
--- branches/trac296/src/lib/config/module_spec.cc (original)
+++ branches/trac296/src/lib/config/module_spec.cc Wed Aug 18 08:19:01 2010
@@ -141,53 +141,49 @@
}
const ElementPtr
-ModuleSpec::getCommandsSpec() const
-{
+ModuleSpec::getCommandsSpec() const {
if (module_specification->contains("commands")) {
- return module_specification->get("commands");
- } else {
- return ElementPtr();
+ return (module_specification->get("commands"));
+ } else {
+ return (ElementPtr());
}
}
const ElementPtr
-ModuleSpec::getConfigSpec() const
-{
+ModuleSpec::getConfigSpec() const {
if (module_specification->contains("config_data")) {
- return module_specification->get("config_data");
- } else {
- return ElementPtr();
+ return (module_specification->get("config_data"));
+ } else {
+ return (ElementPtr());
}
}
const std::string
-ModuleSpec::getModuleName() const
-{
- return module_specification->get("module_name")->stringValue();
+ModuleSpec::getModuleName() const {
+ return (module_specification->get("module_name")->stringValue());
}
const std::string
-ModuleSpec::getModuleDescription() const
-{
+ModuleSpec::getModuleDescription() const {
if (module_specification->contains("module_description")) {
- return module_specification->get("module_description")->stringValue();
- } else {
- return std::string("");
- }
-}
-
-bool
-ModuleSpec::validate_config(const ElementPtr data, const bool full)
-{
+ return (module_specification->get("module_description")->stringValue());
+ } else {
+ return (std::string(""));
+ }
+}
+
+bool
+ModuleSpec::validate_config(const ElementPtr data, const bool full) {
ElementPtr spec = module_specification->find("config_data");
- return validate_spec_list(spec, data, full, ElementPtr());
-}
-
-bool
-ModuleSpec::validate_config(const ElementPtr data, const bool full, ElementPtr errors)
+ return (validate_spec_list(spec, data, full, ElementPtr()));
+}
+
+bool
+ModuleSpec::validate_config(const ElementPtr data, const bool full,
+ ElementPtr errors)
{
ElementPtr spec = module_specification->find("config_data");
- return validate_spec_list(spec, data, full, errors);
+ return (validate_spec_list(spec, data, full, errors));
}
ModuleSpec
@@ -205,7 +201,7 @@
ElementPtr module_spec_element = Element::fromJSON(file, file_name);
if (module_spec_element->contains("module_spec")) {
- return ModuleSpec(module_spec_element->get("module_spec"), check);
+ return (ModuleSpec(module_spec_element->get("module_spec"), check));
} else {
throw ModuleSpecError("No module_spec in specification");
}
@@ -213,10 +209,11 @@
ModuleSpec
moduleSpecFromFile(std::ifstream& in, const bool check)
- throw(JSONError, ModuleSpecError) {
+ throw(JSONError, ModuleSpecError)
+{
ElementPtr module_spec_element = Element::fromJSON(in);
if (module_spec_element->contains("module_spec")) {
- return ModuleSpec(module_spec_element->get("module_spec"), check);
+ return (ModuleSpec(module_spec_element->get("module_spec"), check));
} else {
throw ModuleSpecError("No module_spec in specification");
}
@@ -236,29 +233,29 @@
std::string cur_item_type;
cur_item_type = spec->get("item_type")->stringValue();
if (cur_item_type == "any") {
- return true;
+ return (true);
}
switch (element->getType()) {
case Element::integer:
- return cur_item_type == "integer";
+ return (cur_item_type == "integer");
break;
case Element::real:
- return cur_item_type == "real";
+ return (cur_item_type == "real");
break;
case Element::boolean:
- return cur_item_type == "boolean";
+ return (cur_item_type == "boolean");
break;
case Element::string:
- return cur_item_type == "string";
+ return (cur_item_type == "string");
break;
case Element::list:
- return cur_item_type == "list";
+ return (cur_item_type == "list");
break;
case Element::map:
- return cur_item_type == "map";
- break;
- }
- return false;
+ return (cur_item_type == "map");
+ break;
+ }
+ return (false);
}
bool
@@ -270,7 +267,7 @@
if (errors) {
errors->add(Element::create("Type mismatch"));
}
- return false;
+ return (false);
}
if (data->getType() == Element::list) {
ElementPtr list_spec = spec->get("list_item_spec");
@@ -279,21 +276,21 @@
if (errors) {
errors->add(Element::create("Type mismatch"));
}
- return false;
+ return (false);
}
if (list_spec->get("item_type")->stringValue() == "map") {
if (!validate_item(list_spec, list_el, full, errors)) {
- return false;
+ return (false);
}
}
}
}
if (data->getType() == Element::map) {
if (!validate_spec_list(spec->get("map_item_spec"), data, full, errors)) {
- return false;
- }
- }
- return true;
+ return (false);
+ }
+ }
+ return (true);
}
// spec is a map with item_name etc, data is a map
@@ -306,17 +303,17 @@
if (data_el) {
if (!validate_item(spec, data_el, full, errors)) {
- return false;
+ return (false);
}
} else {
if (!optional && full) {
if (errors) {
errors->add(Element::create("Non-optional value missing"));
}
- return false;
- }
- }
- return true;
+ return (false);
+ }
+ }
+ return (true);
}
// spec is a list of maps, data is a map
@@ -326,11 +323,11 @@
std::string cur_item_name;
BOOST_FOREACH(ElementPtr cur_spec_el, spec->listValue()) {
if (!validate_spec(cur_spec_el, data, full, errors)) {
- return false;
- }
- }
- return true;
-}
-
-}
-}
+ return (false);
+ }
+ }
+ return (true);
+}
+
+}
+}
Modified: branches/trac296/src/lib/config/module_spec.h
==============================================================================
--- branches/trac296/src/lib/config/module_spec.h (original)
+++ branches/trac296/src/lib/config/module_spec.h Wed Aug 18 08:19:01 2010
@@ -34,7 +34,7 @@
public:
ModuleSpecError(std::string m = "Module specification is invalid") : msg(m) {}
~ModuleSpecError() throw() {}
- const char* what() const throw() { return msg.c_str(); }
+ const char* what() const throw() { return (msg.c_str()); }
private:
std::string msg;
};
@@ -72,7 +72,7 @@
/// Returns the full module specification as an ElementPtr
/// \return ElementPtr Shared pointer to the specification
- const ElementPtr getFullSpec() const { return module_specification; };
+ const ElementPtr getFullSpec() const { return (module_specification); }
/// Returns the module name as specified by the specification
const std::string getModuleName() const;
Modified: branches/trac296/src/lib/config/testdata/b10-config-bad1.db
==============================================================================
--- branches/trac296/src/lib/config/testdata/b10-config-bad1.db (original)
+++ branches/trac296/src/lib/config/testdata/b10-config-bad1.db Wed Aug 18 08:19:01 2010
@@ -1,1 +1,1 @@
-{'version': 0}
+{"version": 0}
Modified: branches/trac296/src/lib/config/testdata/b10-config.db
==============================================================================
--- branches/trac296/src/lib/config/testdata/b10-config.db (original)
+++ branches/trac296/src/lib/config/testdata/b10-config.db Wed Aug 18 08:19:01 2010
@@ -1,1 +1,1 @@
-{"version": 1, "TestModule": {"test": 125}}
+{"version": 2, "TestModule": {"test": 125}}
Modified: branches/trac296/src/lib/config/tests/Makefile.am
==============================================================================
--- branches/trac296/src/lib/config/tests/Makefile.am (original)
+++ branches/trac296/src/lib/config/tests/Makefile.am Wed Aug 18 08:19:01 2010
@@ -4,6 +4,10 @@
# see src/lib/cc/Makefile.am for -Wno-unused-parameter
if USE_GXX
AM_CXXFLAGS += -Wno-unused-parameter
+endif
+
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
endif
CLEANFILES = *.gcno *.gcda
Modified: branches/trac296/src/lib/config/tests/ccsession_unittests.cc
==============================================================================
--- branches/trac296/src/lib/config/tests/ccsession_unittests.cc (original)
+++ branches/trac296/src/lib/config/tests/ccsession_unittests.cc Wed Aug 18 08:19:01 2010
@@ -34,12 +34,12 @@
namespace {
std::string
ccspecfile(const std::string name) {
- return std::string(TEST_DATA_PATH) + "/" + name;
+ return (std::string(TEST_DATA_PATH) + "/" + name);
}
ElementPtr
el(const std::string& str) {
- return Element::fromJSON(str);
+ return (Element::fromJSON(str));
}
class CCSessionTest : public ::testing::Test {
@@ -183,28 +183,28 @@
ElementPtr my_config_handler(ElementPtr new_config) {
if (new_config && new_config->contains("item1") &&
new_config->get("item1")->intValue() == 5) {
- return createAnswer(6, "I do not like the number 5");
+ return (createAnswer(6, "I do not like the number 5"));
}
- return createAnswer();
+ return (createAnswer());
}
ElementPtr my_command_handler(const std::string& command,
ElementPtr arg UNUSED_PARAM)
{
if (command == "good_command") {
- return createAnswer();
+ return (createAnswer());
} else if (command == "command_with_arg") {
if (arg) {
if (arg->getType() == Element::integer) {
- return createAnswer(0, el("2"));
+ return (createAnswer(0, el("2")));
} else {
- return createAnswer(1, "arg bad type");
+ return (createAnswer(1, "arg bad type"));
}
} else {
- return createAnswer(1, "arg missing");
+ return (createAnswer(1, "arg missing"));
}
} else {
- return createAnswer(1, "bad command");
+ return (createAnswer(1, "bad command"));
}
}
Modified: branches/trac296/src/lib/config/tests/config_data_unittests.cc
==============================================================================
--- branches/trac296/src/lib/config/tests/config_data_unittests.cc (original)
+++ branches/trac296/src/lib/config/tests/config_data_unittests.cc Wed Aug 18 08:19:01 2010
@@ -26,10 +26,9 @@
using namespace isc::config;
ConfigData
-setupSpec2()
-{
+setupSpec2() {
ModuleSpec spec2 = moduleSpecFromFile(std::string(TEST_DATA_PATH) + "/spec22.spec");
- return ConfigData(spec2);
+ return (ConfigData(spec2));
}
TEST(ConfigData, Creation) {
Modified: branches/trac296/src/lib/config/tests/fake_session.cc
==============================================================================
--- branches/trac296/src/lib/config/tests/fake_session.cc (original)
+++ branches/trac296/src/lib/config/tests/fake_session.cc Wed Aug 18 08:19:01 2010
@@ -145,7 +145,7 @@
// do we need initial message to have env[group] and [to] too?
msg = messages_->get(0);
messages_->remove(0);
- return true;
+ return (true);
} else if (msg_queue_) {
BOOST_FOREACH(ElementPtr c_m, msg_queue_->listValue()) {
ElementPtr to_remove = ElementPtr();
@@ -158,13 +158,13 @@
}
if (to_remove) {
listRemove(msg_queue_, to_remove);
- return true;
+ return (true);
}
}
}
msg = ElementPtr();
env = ElementPtr();
- return false;
+ return (false);
}
void
@@ -198,7 +198,7 @@
//cout << "[XX] client sends message: " << msg << endl;
//cout << "[XX] to: " << group << " . " << instance << "." << to << endl;
addMessage(msg, group, to);
- return 1;
+ return (1);
}
bool
@@ -213,12 +213,12 @@
//cout << "[XX] client sends reply: " << newmsg << endl;
//cout << "[XX] env: " << envelope << endl;
addMessage(newmsg, envelope->get("group")->stringValue(), envelope->get("to")->stringValue());
- return 1;
+ return (1);
}
bool
FakeSession::hasQueuedMsgs() {
- return false;
+ return (false);
}
ElementPtr
@@ -229,7 +229,7 @@
msg_queue_->remove(0);
group = el->get(0)->stringValue();
to = el->get(1)->stringValue();
- return el->get(2);
+ return (el->get(2));
} else {
group = "";
to = "";
Modified: branches/trac296/src/lib/config/tests/module_spec_unittests.cc
==============================================================================
--- branches/trac296/src/lib/config/tests/module_spec_unittests.cc (original)
+++ branches/trac296/src/lib/config/tests/module_spec_unittests.cc Wed Aug 18 08:19:01 2010
@@ -26,7 +26,7 @@
using namespace isc::config;
std::string specfile(const std::string name) {
- return std::string(TEST_DATA_PATH) + "/" + name;
+ return (std::string(TEST_DATA_PATH) + "/" + name);
}
void
@@ -134,15 +134,14 @@
}
bool
-data_test(ModuleSpec dd, const std::string& data_file_name)
-{
+data_test(ModuleSpec dd, const std::string& data_file_name) {
std::ifstream data_file;
data_file.open(specfile(data_file_name).c_str());
ElementPtr data = Element::fromJSON(data_file, data_file_name);
data_file.close();
- return dd.validate_config(data);
+ return (dd.validate_config(data));
}
bool
@@ -154,7 +153,7 @@
ElementPtr data = Element::fromJSON(data_file, data_file_name);
data_file.close();
- return dd.validate_config(data, true, errors);
+ return (dd.validate_config(data, true, errors));
}
TEST(ModuleSpec, DataValidation) {
Modified: branches/trac296/src/lib/datasrc/data_source.cc
==============================================================================
--- branches/trac296/src/lib/datasrc/data_source.cc (original)
+++ branches/trac296/src/lib/datasrc/data_source.cc Wed Aug 18 08:19:01 2010
@@ -1246,7 +1246,7 @@
//
DataSrc::Result
DataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) {
- return NOT_IMPLEMENTED;
+ return (NOT_IMPLEMENTED);
}
DataSrc::Result
Modified: branches/trac296/src/lib/datasrc/data_source.h
==============================================================================
--- branches/trac296/src/lib/datasrc/data_source.h (original)
+++ branches/trac296/src/lib/datasrc/data_source.h Wed Aug 18 08:19:01 2010
@@ -182,13 +182,13 @@
virtual void findClosestEnclosure(DataSrcMatch& match) const = 0;
- const isc::dns::RRClass& getClass() const { return rrclass; }
+ const isc::dns::RRClass& getClass() const { return (rrclass); }
void setClass(isc::dns::RRClass& c) { rrclass = c; }
void setClass(const isc::dns::RRClass& c) { rrclass = c; }
- Result init() { return NOT_IMPLEMENTED; }
+ Result init() { return (NOT_IMPLEMENTED); }
Result init(const isc::data::ElementPtr config);
- Result close() { return NOT_IMPLEMENTED; }
+ Result close() { return (NOT_IMPLEMENTED); }
virtual Result findRRset(const isc::dns::Name& qname,
const isc::dns::RRClass& qclass,
@@ -247,7 +247,7 @@
void addDataSrc(ConstDataSrcPtr data_src);
void removeDataSrc(ConstDataSrcPtr data_src);
- size_t dataSrcCount() { return data_sources.size(); };
+ size_t dataSrcCount() { return (data_sources.size()); }
void findClosestEnclosure(DataSrcMatch& match) const;
Modified: branches/trac296/src/lib/datasrc/sqlite3_datasrc.h
==============================================================================
--- branches/trac296/src/lib/datasrc/sqlite3_datasrc.h (original)
+++ branches/trac296/src/lib/datasrc/sqlite3_datasrc.h Wed Aug 18 08:19:01 2010
@@ -94,7 +94,7 @@
std::string& hash,
isc::dns::RRsetList& target) const;
- Result init() { return init(isc::data::ElementPtr()); };
+ Result init() { return (init(isc::data::ElementPtr())); }
Result init(const isc::data::ElementPtr config);
Result close();
Modified: branches/trac296/src/lib/datasrc/static_datasrc.cc
==============================================================================
--- branches/trac296/src/lib/datasrc/static_datasrc.cc (original)
+++ branches/trac296/src/lib/datasrc/static_datasrc.cc Wed Aug 18 08:19:01 2010
@@ -70,6 +70,7 @@
{
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"));
@@ -80,6 +81,8 @@
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(),
@@ -258,7 +261,7 @@
// is intentionally ignored.
DataSrc::Result
StaticDataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) {
- return init();
+ return (init());
}
DataSrc::Result
Modified: branches/trac296/src/lib/datasrc/tests/Makefile.am
==============================================================================
--- branches/trac296/src/lib/datasrc/tests/Makefile.am (original)
+++ branches/trac296/src/lib/datasrc/tests/Makefile.am Wed Aug 18 08:19:01 2010
@@ -3,6 +3,10 @@
AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
AM_CXXFLAGS = $(B10_CXXFLAGS)
+
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
+endif
CLEANFILES = *.gcno *.gcda
@@ -22,10 +26,10 @@
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
run_unittests_LDADD = $(GTEST_LDADD)
run_unittests_LDADD += $(SQLITE_LIBS)
-run_unittests_LDADD += $(top_builddir)/src/lib/datasrc/.libs/libdatasrc.a
-run_unittests_LDADD += $(top_builddir)/src/lib/dns/.libs/libdns++.a
-run_unittests_LDADD += $(top_builddir)/src/lib/cc/.libs/libcc.a
-run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/.libs/libexceptions.a
+run_unittests_LDADD += $(top_builddir)/src/lib/datasrc/libdatasrc.la
+run_unittests_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
+run_unittests_LDADD += $(top_builddir)/src/lib/cc/libcc.la
+run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
endif
noinst_PROGRAMS = $(TESTS)
Modified: branches/trac296/src/lib/datasrc/tests/datasrc_unittest.cc
==============================================================================
--- branches/trac296/src/lib/datasrc/tests/datasrc_unittest.cc (original)
+++ branches/trac296/src/lib/datasrc/tests/datasrc_unittest.cc Wed Aug 18 08:19:01 2010
@@ -1056,7 +1056,6 @@
EXPECT_EQ(&datasrc1, match.getDataSource());
}
-// This test currently fails.
TEST_F(DataSrcMatchTest, initialUpdateWithNoMatch) {
DataSrcMatch match(Name("www.example.com"), RRClass::IN());
Modified: branches/trac296/src/lib/datasrc/tests/static_unittest.cc
==============================================================================
--- branches/trac296/src/lib/datasrc/tests/static_unittest.cc (original)
+++ branches/trac296/src/lib/datasrc/tests/static_unittest.cc Wed Aug 18 08:19:01 2010
@@ -54,6 +54,7 @@
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");
@@ -64,6 +65,8 @@
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.");
Modified: branches/trac296/src/lib/datasrc/tests/test_datasrc.cc
==============================================================================
--- branches/trac296/src/lib/datasrc/tests/test_datasrc.cc (original)
+++ branches/trac296/src/lib/datasrc/tests/test_datasrc.cc Wed Aug 18 08:19:01 2010
@@ -309,7 +309,7 @@
DataSrc::Result
TestDataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM)
{
- return init();
+ return (init());
}
void
Modified: branches/trac296/src/lib/dns/message.h
==============================================================================
--- branches/trac296/src/lib/dns/message.h (original)
+++ branches/trac296/src/lib/dns/message.h Wed Aug 18 08:19:01 2010
@@ -80,7 +80,7 @@
class InputBuffer;
class MessageRenderer;
class Message;
-struct MessageImpl;
+class MessageImpl;
template <typename T>
struct SectionIteratorImpl;
Modified: branches/trac296/src/lib/dns/name.h
==============================================================================
--- branches/trac296/src/lib/dns/name.h (original)
+++ branches/trac296/src/lib/dns/name.h Wed Aug 18 08:19:01 2010
@@ -406,7 +406,7 @@
/// This method simply negates the result of \c equal() method, and in that
/// sense it's redundant. The separate method is provided just for
/// convenience.
- bool nequals(const Name& other) const { return !(equals(other)); }
+ bool nequals(const Name& other) const { return (!(equals(other))); }
/// Same as nequals()
bool operator!=(const Name& other) const { return (nequals(other)); }
Modified: branches/trac296/src/lib/dns/python/libdns_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/libdns_python.cc (original)
+++ branches/trac296/src/lib/dns/python/libdns_python.cc Wed Aug 18 08:19:01 2010
@@ -22,6 +22,8 @@
// NULL/*mod
//
// And of course care has to be taken that all identifiers be unique
+
+// $Id$
#define PY_SSIZE_T_CLEAN
#include <Python.h>
Modified: branches/trac296/src/lib/dns/python/message_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/message_python.cc (original)
+++ branches/trac296/src/lib/dns/python/message_python.cc Wed Aug 18 08:19:01 2010
@@ -12,7 +12,7 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-// $Id: message_python.cc 1711 2010-04-14 15:14:53Z jelte $
+// $Id$
#include <dns/message.h>
using namespace isc::dns;
@@ -326,9 +326,9 @@
static PyObject*
Opcode_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
@@ -589,7 +589,7 @@
try {
self->rcode = new Rcode(code);
self->static_code = false;
- } catch (isc::OutOfRange) {
+ } catch (const isc::OutOfRange&) {
PyErr_SetString(PyExc_OverflowError,
"rcode out of range");
return (-1);
@@ -624,9 +624,9 @@
static PyObject*
Rcode_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
@@ -886,22 +886,22 @@
static PyObject*
Section_QUESTION(s_Section* self UNUSED_PARAM) {
- return Section_createStatic(Section::QUESTION());
+ return (Section_createStatic(Section::QUESTION()));
}
static PyObject*
Section_ANSWER(s_Section* self UNUSED_PARAM) {
- return Section_createStatic(Section::ANSWER());
+ return (Section_createStatic(Section::ANSWER()));
}
static PyObject*
Section_AUTHORITY(s_Section* self UNUSED_PARAM) {
- return Section_createStatic(Section::AUTHORITY());
+ return (Section_createStatic(Section::AUTHORITY()));
}
static PyObject*
Section_ADDITIONAL(s_Section* self UNUSED_PARAM) {
- return Section_createStatic(Section::ADDITIONAL());
+ return (Section_createStatic(Section::ADDITIONAL()));
}
static PyObject*
@@ -1221,7 +1221,7 @@
try {
self->message->setHeaderFlag(*messageflag->messageflag);
Py_RETURN_NONE;
- } catch (isc::dns::InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_Clear();
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
@@ -1238,7 +1238,7 @@
try {
self->message->clearHeaderFlag(*messageflag->messageflag);
Py_RETURN_NONE;
- } catch (isc::dns::InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_Clear();
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
@@ -1269,7 +1269,7 @@
self->message->setDNSSECSupported(false);
}
Py_RETURN_NONE;
- } catch (isc::dns::InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
}
@@ -1289,10 +1289,10 @@
try {
self->message->setUDPSize(size);
Py_RETURN_NONE;
- } catch (isc::dns::InvalidMessageUDPSize imus) {
+ } catch (const InvalidMessageUDPSize& imus) {
PyErr_SetString(po_InvalidMessageUDPSize, imus.what());
return (NULL);
- } catch (isc::dns::InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
}
@@ -1312,7 +1312,7 @@
try {
self->message->setQid(id);
Py_RETURN_NONE;
- } catch (InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
}
@@ -1344,7 +1344,7 @@
try {
self->message->setRcode(*rcode->rcode);
Py_RETURN_NONE;
- } catch (InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
}
@@ -1379,7 +1379,7 @@
try {
self->message->setOpcode(*opcode->opcode);
Py_RETURN_NONE;
- } catch (InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
}
@@ -1482,7 +1482,7 @@
self->message->addRRset(*section->section, rrset->rrset, false);
}
Py_RETURN_NONE;
- } catch (InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
}
@@ -1526,9 +1526,9 @@
static PyObject*
Message_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
@@ -1541,7 +1541,7 @@
// If we return NULL it is seen as an error, so use this for
// None returns
Py_RETURN_NONE;
- } catch (isc::dns::InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_Clear();
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
@@ -1565,16 +1565,16 @@
try {
self->message->fromWire(inbuf);
Py_RETURN_NONE;
- } catch (isc::dns::InvalidMessageOperation imo) {
+ } catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
- } catch (isc::dns::DNSMessageFORMERR dmfe) {
+ } catch (const DNSMessageFORMERR& dmfe) {
PyErr_SetString(po_DNSMessageFORMERR, dmfe.what());
return (NULL);
- } catch (isc::dns::DNSMessageBADVERS dmfe) {
+ } catch (const DNSMessageBADVERS& dmfe) {
PyErr_SetString(po_DNSMessageBADVERS, dmfe.what());
return (NULL);
- } catch (isc::dns::MessageTooShort mts) {
+ } catch (const MessageTooShort& mts) {
PyErr_SetString(po_MessageTooShort, mts.what());
return (NULL);
}
Modified: branches/trac296/src/lib/dns/python/messagerenderer_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/messagerenderer_python.cc (original)
+++ branches/trac296/src/lib/dns/python/messagerenderer_python.cc Wed Aug 18 08:19:01 2010
@@ -133,9 +133,9 @@
static PyObject*
MessageRenderer_getData(s_MessageRenderer* self) {
- return Py_BuildValue("y#",
+ return (Py_BuildValue("y#",
self->messagerenderer->getData(),
- self->messagerenderer->getLength());
+ self->messagerenderer->getLength()));
}
static PyObject*
Modified: branches/trac296/src/lib/dns/python/name_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/name_python.cc (original)
+++ branches/trac296/src/lib/dns/python/name_python.cc Wed Aug 18 08:19:01 2010
@@ -291,26 +291,26 @@
self->name = new Name(n, downcase == Py_True);
self->position = 0;
- } catch (EmptyLabel) {
+ } catch (const EmptyLabel&) {
PyErr_SetString(po_EmptyLabel, "EmptyLabel");
return (-1);
- } catch (TooLongLabel) {
+ } catch (const TooLongLabel&) {
PyErr_SetString(po_TooLongLabel, "TooLongLabel");
return (-1);
- } catch (BadLabelType) {
+ } catch (const BadLabelType&) {
PyErr_SetString(po_BadLabelType, "BadLabelType");
return (-1);
- } catch (BadEscape) {
+ } catch (const BadEscape&) {
PyErr_SetString(po_BadEscape, "BadEscape");
return (-1);
- } catch (TooLongName) {
+ } catch (const TooLongName&) {
PyErr_SetString(po_TooLongName, "TooLongName");
return (-1);
- } catch (IncompleteName) {
+ } catch (const IncompleteName&) {
PyErr_SetString(po_IncompleteName, "IncompleteName");
return (-1);
#ifdef CATCHMEMERR
- } catch (std::bad_alloc) {
+ } catch (const std::bad_alloc&) {
PyErr_NoMemory();
return (-1);
#endif
@@ -338,11 +338,11 @@
buffer.setPosition(position);
self->name = new Name(buffer, downcase == Py_True);
self->position = buffer.getPosition();
- } catch (InvalidBufferPosition) {
+ } catch (const InvalidBufferPosition&) {
PyErr_SetString(po_InvalidBufferPosition,
"InvalidBufferPosition");
return (-1);
- } catch (DNSMessageFORMERR) {
+ } catch (const DNSMessageFORMERR&) {
PyErr_SetString(po_DNSMessageFORMERR, "DNSMessageFORMERR");
return (-1);
} catch (...) {
@@ -373,7 +373,7 @@
}
try {
return (Py_BuildValue("I", self->name->at(pos)));
- } catch (isc::OutOfRange oor) {
+ } catch (const isc::OutOfRange&) {
PyErr_SetString(PyExc_IndexError,
"name index out of range");
return (NULL);
@@ -400,9 +400,9 @@
// Simply call the to_text method we already defined
// str() is not defined in the c++ version, only to_text
// and we already have a wrapper for that one.
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
@@ -472,7 +472,7 @@
ret->name = NULL;
try {
ret->name = new Name(self->name->split(first, n));
- } catch(isc::OutOfRange oor) {
+ } catch(const isc::OutOfRange& oor) {
PyErr_SetString(PyExc_IndexError, oor.what());
ret->name = NULL;
}
@@ -487,7 +487,7 @@
ret->name = NULL;
try {
ret->name = new Name(self->name->split(n));
- } catch(isc::OutOfRange oor) {
+ } catch(const isc::OutOfRange& oor) {
PyErr_SetString(PyExc_IndexError, oor.what());
ret->name = NULL;
}
@@ -572,7 +572,7 @@
if (ret != NULL) {
try {
ret->name = new Name(self->name->concatenate(*other->name));
- } catch (isc::dns::TooLongName tln) {
+ } catch (const TooLongName& tln) {
PyErr_SetString(po_TooLongName, tln.what());
return (NULL);
}
Modified: branches/trac296/src/lib/dns/python/question_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/question_python.cc (original)
+++ branches/trac296/src/lib/dns/python/question_python.cc Wed Aug 18 08:19:01 2010
@@ -156,15 +156,15 @@
self->question = QuestionPtr(new Question(inbuf));
return (0);
}
- } catch (isc::dns::DNSMessageFORMERR dmfe) {
+ } catch (const DNSMessageFORMERR& dmfe) {
PyErr_Clear();
PyErr_SetString(po_DNSMessageFORMERR, dmfe.what());
return (-1);
- } catch (isc::dns::IncompleteRRClass irc) {
+ } catch (const IncompleteRRClass& irc) {
PyErr_Clear();
PyErr_SetString(po_IncompleteRRClass, irc.what());
return (-1);
- } catch (isc::dns::IncompleteRRType irt) {
+ } catch (const IncompleteRRType& irt) {
PyErr_Clear();
PyErr_SetString(po_IncompleteRRType, irt.what());
return (-1);
@@ -231,9 +231,9 @@
static PyObject*
Question_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
Modified: branches/trac296/src/lib/dns/python/rdata_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/rdata_python.cc (original)
+++ branches/trac296/src/lib/dns/python/rdata_python.cc Wed Aug 18 08:19:01 2010
@@ -174,9 +174,9 @@
static PyObject*
Rdata_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
Modified: branches/trac296/src/lib/dns/python/rrclass_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/rrclass_python.cc (original)
+++ branches/trac296/src/lib/dns/python/rrclass_python.cc Wed Aug 18 08:19:01 2010
@@ -188,7 +188,7 @@
}
// Incomplete is never thrown, a type error would have already been raised
//when we try to read the 2 bytes above
- } catch (InvalidRRClass ic) {
+ } catch (const InvalidRRClass& ic) {
PyErr_Clear();
PyErr_SetString(po_InvalidRRClass, ic.what());
return (-1);
@@ -215,9 +215,9 @@
static PyObject*
RRClass_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
Modified: branches/trac296/src/lib/dns/python/rrset_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/rrset_python.cc (original)
+++ branches/trac296/src/lib/dns/python/rrset_python.cc Wed Aug 18 08:19:01 2010
@@ -284,7 +284,7 @@
RRset_toText(s_RRset* self) {
try {
return (Py_BuildValue("s", self->rrset->toText().c_str()));
- } catch (EmptyRRset ers) {
+ } catch (const EmptyRRset& ers) {
PyErr_SetString(po_EmptyRRset, ers.what());
return (NULL);
}
@@ -293,9 +293,9 @@
static PyObject*
RRset_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
@@ -321,7 +321,7 @@
// None returns
Py_RETURN_NONE;
}
- } catch (EmptyRRset ers) {
+ } catch (const EmptyRRset& ers) {
PyErr_Clear();
PyErr_SetString(po_EmptyRRset, ers.what());
return (NULL);
@@ -341,7 +341,7 @@
try {
self->rrset->addRdata(*rdata->rdata);
Py_RETURN_NONE;
- } catch (std::bad_cast) {
+ } catch (const std::bad_cast&) {
PyErr_Clear();
PyErr_SetString(PyExc_TypeError,
"Rdata type to add must match type of RRset");
Modified: branches/trac296/src/lib/dns/python/rrttl_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/rrttl_python.cc (original)
+++ branches/trac296/src/lib/dns/python/rrttl_python.cc Wed Aug 18 08:19:01 2010
@@ -177,7 +177,7 @@
PyErr_Clear();
return (0);
}
- } catch (IncompleteRRTTL icc) {
+ } catch (const IncompleteRRTTL& icc) {
// Ok so one of our functions has thrown a C++ exception.
// We need to translate that to a Python Exception
// First clear any existing error that was set
@@ -186,7 +186,7 @@
PyErr_SetString(po_IncompleteRRTTL, icc.what());
// And return negative
return (-1);
- } catch (InvalidRRTTL ic) {
+ } catch (const InvalidRRTTL& ic) {
PyErr_Clear();
PyErr_SetString(po_InvalidRRTTL, ic.what());
return (-1);
@@ -213,9 +213,9 @@
static PyObject*
RRTTL_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self,
+ return (PyObject_CallMethod(self,
const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ const_cast<char*>("")));
}
static PyObject*
Modified: branches/trac296/src/lib/dns/python/rrtype_python.cc
==============================================================================
--- branches/trac296/src/lib/dns/python/rrtype_python.cc (original)
+++ branches/trac296/src/lib/dns/python/rrtype_python.cc Wed Aug 18 08:19:01 2010
@@ -217,7 +217,7 @@
PyErr_Clear();
return (0);
}
- } catch (IncompleteRRType icc) {
+ } catch (const IncompleteRRType& icc) {
// Ok so one of our functions has thrown a C++ exception.
// We need to translate that to a Python Exception
// First clear any existing error that was set
@@ -226,7 +226,7 @@
PyErr_SetString(po_IncompleteRRType, icc.what());
// And return negative
return (-1);
- } catch (InvalidRRType ic) {
+ } catch (const InvalidRRType& ic) {
PyErr_Clear();
PyErr_SetString(po_InvalidRRType, ic.what());
return (-1);
@@ -253,8 +253,8 @@
static PyObject*
RRType_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, const_cast<char*>("to_text"),
- const_cast<char*>(""));
+ return (PyObject_CallMethod(self, const_cast<char*>("to_text"),
+ const_cast<char*>("")));
}
static PyObject*
Modified: branches/trac296/src/lib/dns/rdata/generic/ds_43.cc
==============================================================================
--- branches/trac296/src/lib/dns/rdata/generic/ds_43.cc (original)
+++ branches/trac296/src/lib/dns/rdata/generic/ds_43.cc Wed Aug 18 08:19:01 2010
@@ -173,7 +173,7 @@
uint16_t
DS::getTag() const {
- return impl_->tag_;
+ return (impl_->tag_);
}
// END_RDATA_NAMESPACE
Modified: branches/trac296/src/lib/dns/rdata/generic/nsec3_50.cc
==============================================================================
--- branches/trac296/src/lib/dns/rdata/generic/nsec3_50.cc (original)
+++ branches/trac296/src/lib/dns/rdata/generic/nsec3_50.cc Wed Aug 18 08:19:01 2010
@@ -323,22 +323,22 @@
uint8_t
NSEC3::getHashalg() const {
- return impl_->hashalg_;
+ return (impl_->hashalg_);
}
uint8_t
NSEC3::getFlags() const {
- return impl_->flags_;
+ return (impl_->flags_);
}
uint16_t
NSEC3::getIterations() const {
- return impl_->iterations_;
+ return (impl_->iterations_);
}
vector<uint8_t>&
NSEC3::getSalt() const {
- return impl_->salt_;
+ return (impl_->salt_);
}
// END_RDATA_NAMESPACE
Modified: branches/trac296/src/lib/dns/rdata/generic/txt_16.cc
==============================================================================
--- branches/trac296/src/lib/dns/rdata/generic/txt_16.cc (original)
+++ branches/trac296/src/lib/dns/rdata/generic/txt_16.cc Wed Aug 18 08:19:01 2010
@@ -21,6 +21,7 @@
#include <vector>
#include <dns/buffer.h>
+#include <dns/exceptions.h>
#include <dns/messagerenderer.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
Modified: branches/trac296/src/lib/dns/rrsetlist.cc
==============================================================================
--- branches/trac296/src/lib/dns/rrsetlist.cc (original)
+++ branches/trac296/src/lib/dns/rrsetlist.cc Wed Aug 18 08:19:01 2010
@@ -53,10 +53,10 @@
BOOST_FOREACH(RRsetPtr rrsetptr, rrsets_) {
if ((rrsetptr->getClass() == rrclass) &&
(rrsetptr->getType() == rrtype)) {
- return rrsetptr;
+ return (rrsetptr);
}
}
- return RRsetPtr();
+ return (RRsetPtr());
}
}
Modified: branches/trac296/src/lib/dns/rrtype-placeholder.h
==============================================================================
--- branches/trac296/src/lib/dns/rrtype-placeholder.h (original)
+++ branches/trac296/src/lib/dns/rrtype-placeholder.h Wed Aug 18 08:19:01 2010
@@ -221,7 +221,7 @@
bool equals(const RRType& other) const
{ return (typecode_ == other.typecode_); }
/// \brief Same as \c equals().
- bool operator==(const RRType& other) const { return equals(other); }
+ bool operator==(const RRType& other) const { return (equals(other)); }
/// \brief Return true iff two RRTypes are equal.
///
@@ -232,7 +232,7 @@
bool nequals(const RRType& other) const
{ return (typecode_ != other.typecode_); }
/// \brief Same as \c nequals().
- bool operator!=(const RRType& other) const { return nequals(other); }
+ bool operator!=(const RRType& other) const { return (nequals(other)); }
/// \brief Less-than comparison for RRType against \c other
///
Modified: branches/trac296/src/lib/dns/tests/Makefile.am
==============================================================================
--- branches/trac296/src/lib/dns/tests/Makefile.am (original)
+++ branches/trac296/src/lib/dns/tests/Makefile.am Wed Aug 18 08:19:01 2010
@@ -2,6 +2,10 @@
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
AM_CXXFLAGS = $(B10_CXXFLAGS)
+
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
+endif
CLEANFILES = *.gcno *.gcda
@@ -40,8 +44,8 @@
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
run_unittests_LDADD = $(GTEST_LDADD)
-run_unittests_LDADD += $(top_builddir)/src/lib/dns/.libs/libdns++.a
-run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/.libs/libexceptions.a
+run_unittests_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
+run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
endif
noinst_PROGRAMS = $(TESTS)
Modified: branches/trac296/src/lib/dns/tests/rrparamregistry_unittest.cc
==============================================================================
--- branches/trac296/src/lib/dns/tests/rrparamregistry_unittest.cc (original)
+++ branches/trac296/src/lib/dns/tests/rrparamregistry_unittest.cc Wed Aug 18 08:19:01 2010
@@ -107,11 +107,11 @@
class TestRdataFactory : public AbstractRdataFactory {
public:
virtual RdataPtr create(const string& rdata_str) const
- { return RdataPtr(new in::A(rdata_str)); }
+ { return (RdataPtr(new in::A(rdata_str))); }
virtual RdataPtr create(InputBuffer& buffer, size_t rdata_len) const
- { return RdataPtr(new in::A(buffer, rdata_len)); }
+ { return (RdataPtr(new in::A(buffer, rdata_len))); }
virtual RdataPtr create(const Rdata& source) const
- { return RdataPtr(new in::A(dynamic_cast<const in::A&>(source))); }
+ { return (RdataPtr(new in::A(dynamic_cast<const in::A&>(source)))); }
};
TEST_F(RRParamRegistryTest, addRemoveFactory)
Modified: branches/trac296/src/lib/dns/tests/unittest_util.cc
==============================================================================
--- branches/trac296/src/lib/dns/tests/unittest_util.cc (original)
+++ branches/trac296/src/lib/dns/tests/unittest_util.cc Wed Aug 18 08:19:01 2010
@@ -158,7 +158,7 @@
<< "Expected: " << len2 << "\n";
return (::testing::AssertionFailure(msg));
}
- return ::testing::AssertionSuccess();
+ return (::testing::AssertionSuccess());
}
::testing::AssertionResult
@@ -177,5 +177,5 @@
<< "Other: " << name2 << "\n";
return (::testing::AssertionFailure(msg));
}
- return ::testing::AssertionSuccess();
+ return (::testing::AssertionSuccess());
}
Modified: branches/trac296/src/lib/dns/util/base16_from_binary.h
==============================================================================
--- branches/trac296/src/lib/dns/util/base16_from_binary.h (original)
+++ branches/trac296/src/lib/dns/util/base16_from_binary.h Wed Aug 18 08:19:01 2010
@@ -46,7 +46,7 @@
"0123456789"
"ABCDEF";
assert(t < 16);
- return lookup_table[static_cast<size_t>(t)];
+ return (lookup_table[static_cast<size_t>(t)]);
}
};
Modified: branches/trac296/src/lib/dns/util/base32hex_from_binary.h
==============================================================================
--- branches/trac296/src/lib/dns/util/base32hex_from_binary.h (original)
+++ branches/trac296/src/lib/dns/util/base32hex_from_binary.h Wed Aug 18 08:19:01 2010
@@ -48,7 +48,7 @@
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUV";
assert(t < 32);
- return lookup_table[static_cast<size_t>(t)];
+ return (lookup_table[static_cast<size_t>(t)]);
}
};
Modified: branches/trac296/src/lib/dns/util/binary_from_base16.h
==============================================================================
--- branches/trac296/src/lib/dns/util/binary_from_base16.h (original)
+++ branches/trac296/src/lib/dns/util/binary_from_base16.h Wed Aug 18 08:19:01 2010
@@ -56,7 +56,7 @@
isc_throw(isc::BadValue,
"attempt to decode a value not in base16 char set");
}
- return value;
+ return (value);
}
};
Modified: branches/trac296/src/lib/dns/util/binary_from_base32hex.h
==============================================================================
--- branches/trac296/src/lib/dns/util/binary_from_base32hex.h (original)
+++ branches/trac296/src/lib/dns/util/binary_from_base32hex.h Wed Aug 18 08:19:01 2010
@@ -59,7 +59,7 @@
isc_throw(isc::BadValue,
"attempt to decode a value not in base32hex char set");
}
- return value;
+ return (value);
}
};
Modified: branches/trac296/src/lib/dns/util/sha1.cc
==============================================================================
--- branches/trac296/src/lib/dns/util/sha1.cc (original)
+++ branches/trac296/src/lib/dns/util/sha1.cc Wed Aug 18 08:19:01 2010
@@ -85,9 +85,9 @@
uint32_t addTemp = context->Length_Low;
context->Length_Low += length;
if (context->Length_Low < addTemp && ++context->Length_High == 0) {
- return true;
+ return (true);
} else {
- return false;
+ return (false);
}
}
Modified: branches/trac296/src/lib/exceptions/Makefile.am
==============================================================================
--- branches/trac296/src/lib/exceptions/Makefile.am (original)
+++ branches/trac296/src/lib/exceptions/Makefile.am Wed Aug 18 08:19:01 2010
@@ -1,3 +1,5 @@
+SUBDIRS = . tests
+
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CXXFLAGS=$(B10_CXXFLAGS)
@@ -6,17 +8,5 @@
CLEANFILES = *.gcno *.gcda
-TESTS =
-if HAVE_GTEST
-TESTS += run_unittests
-run_unittests_SOURCES = run_unittests.cc
-run_unittests_SOURCES += exceptions_unittest.cc
-run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
-run_unittests_LDFLAGS = $(GTEST_LDFLAGS)
-run_unittests_LDADD = .libs/libexceptions.a $(GTEST_LDADD)
-endif
-
-noinst_PROGRAMS = $(TESTS)
-
libexceptions_includedir = $(includedir)/exceptions
libexceptions_include_HEADERS = exceptions.h
Modified: branches/trac296/src/lib/python/isc/Makefile.am
==============================================================================
--- branches/trac296/src/lib/python/isc/Makefile.am (original)
+++ branches/trac296/src/lib/python/isc/Makefile.am Wed Aug 18 08:19:01 2010
@@ -1,4 +1,4 @@
-SUBDIRS = datasrc cc config log # Util
+SUBDIRS = datasrc cc config log notify # Util
python_PYTHON = __init__.py
Modified: branches/trac296/src/lib/python/isc/config/ccsession.py
==============================================================================
--- branches/trac296/src/lib/python/isc/config/ccsession.py (original)
+++ branches/trac296/src/lib/python/isc/config/ccsession.py Wed Aug 18 08:19:01 2010
@@ -37,7 +37,7 @@
"""
from isc.cc import Session
-from isc.config.config_data import ConfigData, MultiConfigData
+from isc.config.config_data import ConfigData, MultiConfigData, BIND10_CONFIG_DATA_VERSION
import isc
class ModuleCCSessionError(Exception): pass
@@ -333,7 +333,7 @@
"""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'] != 1:
+ if 'version' not in config or config['version'] != BIND10_CONFIG_DATA_VERSION:
raise ModuleCCSessionError("Bad config version")
self._set_current_config(config)
Modified: branches/trac296/src/lib/python/isc/config/cfgmgr.py
==============================================================================
--- branches/trac296/src/lib/python/isc/config/cfgmgr.py (original)
+++ branches/trac296/src/lib/python/isc/config/cfgmgr.py Wed Aug 18 08:19:01 2010
@@ -27,7 +27,7 @@
import tempfile
import json
from isc.cc import data
-from isc.config import ccsession
+from isc.config import ccsession, config_data
class ConfigManagerDataReadError(Exception):
"""This exception is thrown when there is an error while reading
@@ -42,8 +42,6 @@
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
@@ -51,7 +49,7 @@
this does not yet read the database, a call to
read_from_file is needed for that."""
self.data = {}
- self.data['version'] = ConfigManagerData.CONFIG_VERSION
+ self.data['version'] = config_data.BIND10_CONFIG_DATA_VERSION
self.data_path = data_path
self.db_filename = data_path + os.sep + file_name
@@ -65,21 +63,36 @@
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())
- if 'version' in file_config and \
- file_config['version'] == ConfigManagerData.CONFIG_VERSION:
- config.data = file_config
- else:
- # We can put in a migration path here for old data
- raise ConfigManagerDataReadError("[b10-cfgmgr] Old version of data found")
- file.close()
+ # 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'])
+ else:
+ raise ConfigManagerDataReadError("No version information in configuration file " + config.db_filename)
except IOError as ioe:
- raise ConfigManagerDataEmpty("No config file found")
- except:
- raise ConfigManagerDataReadError("Config file unreadable")
-
+ 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();
return config
def write_to_file(self, output_file_name = None):
@@ -102,11 +115,11 @@
os.rename(filename, self.db_filename)
except IOError as ioe:
# TODO: log this (level critical)
- print("[b10-cfgmgr] Unable to write config file; configuration not stored: " + str(ioe))
+ print("[b10-cfgmgr] Unable to write configuration 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 config file; configuration not stored: " + str(ose))
+ print("[b10-cfgmgr] Unable to write configuration file; configuration not stored: " + str(ose))
try:
if filename and os.path.exists(filename):
os.remove(filename)
@@ -243,7 +256,7 @@
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': self.config.CONFIG_VERSION })
+ return ccsession.create_answer(0, { 'version': config_data.BIND10_CONFIG_DATA_VERSION })
else:
return ccsession.create_answer(1, "Bad module_name in get_config command")
Modified: branches/trac296/src/lib/python/isc/config/config_data.py
==============================================================================
--- branches/trac296/src/lib/python/isc/config/config_data.py (original)
+++ branches/trac296/src/lib/python/isc/config/config_data.py Wed Aug 18 08:19:01 2010
@@ -24,6 +24,8 @@
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
@@ -250,6 +252,11 @@
"""Removes the specification with the given module name. Does nothing if it wasn't there."""
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.
Modified: branches/trac296/src/lib/python/isc/config/tests/ccsession_test.py
==============================================================================
--- branches/trac296/src/lib/python/isc/config/tests/ccsession_test.py (original)
+++ branches/trac296/src/lib/python/isc/config/tests/ccsession_test.py Wed Aug 18 08:19:01 2010
@@ -22,6 +22,7 @@
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):
@@ -442,20 +443,20 @@
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': 1 })
+ fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
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': 1 })
+ fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
uccs = UIModuleCCSession(fake_conn)
self.assertEqual({}, uccs._specifications)
- self.assertEqual({ 'version': 1}, uccs._current_config)
+ self.assertEqual({ 'version': BIND10_CONFIG_DATA_VERSION}, 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': 1 })
+ fake_conn.set_get_answer('/config_data', { 'version': BIND10_CONFIG_DATA_VERSION })
uccs = UIModuleCCSession(fake_conn)
self.assertEqual(module_spec._module_spec, uccs._specifications['Spec2']._module_spec)
Modified: branches/trac296/src/lib/python/isc/config/tests/cfgmgr_test.py
==============================================================================
--- branches/trac296/src/lib/python/isc/config/tests/cfgmgr_test.py (original)
+++ branches/trac296/src/lib/python/isc/config/tests/cfgmgr_test.py Wed Aug 18 08:19:01 2010
@@ -22,6 +22,7 @@
import unittest
import os
from isc.config.cfgmgr import *
+from isc.config import config_data
from unittest_fakesession import FakeModuleCCSession
class TestConfigManagerData(unittest.TestCase):
@@ -32,7 +33,7 @@
def test_init(self):
self.assertEqual(self.config_manager_data.data['version'],
- ConfigManagerData.CONFIG_VERSION)
+ config_data.BIND10_CONFIG_DATA_VERSION)
self.assertEqual(self.config_manager_data.data_path,
self.data_path)
self.assertEqual(self.config_manager_data.db_filename,
@@ -52,12 +53,16 @@
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";
+ output_file_name = "b10-config-write-test"
self.config_manager_data.write_to_file(output_file_name)
new_config = ConfigManagerData(self.data_path, output_file_name)
self.assertEqual(self.config_manager_data, new_config)
+ os.remove(output_file_name)
def test_equality(self):
# tests the __eq__ function. Equality is only defined
@@ -161,13 +166,13 @@
self.assertEqual(commands_spec['Spec2'], module_spec.get_commands_spec())
def test_read_config(self):
- self.assertEqual(self.cm.config.data, {'version': 1})
+ self.assertEqual(self.cm.config.data, {'version': config_data.BIND10_CONFIG_DATA_VERSION})
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': 1})
+ self.assertEqual(self.cm.config.data, {'TestModule': {'test': 125}, 'version': config_data.BIND10_CONFIG_DATA_VERSION})
self.cm.data_path = "/no_such_path"
self.cm.read_config()
- self.assertEqual(self.cm.config.data, {'version': 1})
+ self.assertEqual(self.cm.config.data, {'version': config_data.BIND10_CONFIG_DATA_VERSION})
def test_write_config(self):
# tested in ConfigManagerData tests
@@ -190,9 +195,9 @@
{'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': 1} ]})
+ self._handle_msg_helper({ "command": [ "get_config" ] }, { 'result': [ 0, { 'version': config_data.BIND10_CONFIG_DATA_VERSION } ]})
self._handle_msg_helper({ "command": [ "get_config", { "module_name": "nosuchmodule" } ] },
- {'result': [0, { 'version': 1 }]})
+ {'result': [0, { 'version': config_data.BIND10_CONFIG_DATA_VERSION }]})
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", { } ] },
Modified: branches/trac296/src/lib/python/isc/config/tests/config_data_test.py
==============================================================================
--- branches/trac296/src/lib/python/isc/config/tests/config_data_test.py (original)
+++ branches/trac296/src/lib/python/isc/config/tests/config_data_test.py Wed Aug 18 08:19:01 2010
@@ -267,12 +267,16 @@
self.assertEqual({}, self.mcd._current_config)
self.assertEqual({}, self.mcd._local_changes)
- def test_set_specification(self):
+ def test_set_remove_specification(self):
module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec1.spec")
- self.mcd.set_specification(module_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")
Modified: branches/trac296/src/lib/python/isc/datasrc/sqlite3_ds.py
==============================================================================
--- branches/trac296/src/lib/python/isc/datasrc/sqlite3_ds.py (original)
+++ branches/trac296/src/lib/python/isc/datasrc/sqlite3_ds.py Wed Aug 18 08:19:01 2010
@@ -17,6 +17,13 @@
import sqlite3, re, random
import isc
+
+
+#define the index of different part of one record
+RR_TYPE_INDEX = 5
+RR_NAME_INDEX = 2
+RR_TTL_INDEX = 4
+RR_RDATA_INDEX = 7
#########################################################################
# define exceptions
@@ -86,10 +93,10 @@
return conn, cur
-
#########################################################################
# get_zone_datas
-# returns all the records for one zone with the given zone name.
+# a generator function producing an iterable set of
+# the records in the zone with the given zone name.
#########################################################################
def get_zone_datas(zonename, dbfile):
conn, cur = open(dbfile)
@@ -119,6 +126,39 @@
conn.close()
return datas
+
+
+#########################################################################
+# get_zone_rrset
+# returns the rrset of the zone with the given zone name, rrset name
+# and given rd type.
+# If the zone doesn't exist or rd type doesn't exist, return an empty list.
+#########################################################################
+def get_zone_rrset(zonename, rr_name, rdtype, dbfile):
+ conn, cur = open(dbfile)
+ id = get_zoneid(zonename, cur)
+ cur.execute("SELECT * FROM records WHERE name = ? and zone_id = ? and rdtype = ?",
+ [rr_name, id, rdtype])
+ datas = cur.fetchall()
+ cur.close()
+ conn.close()
+ return datas
+
+
+#########################################################################
+# get_zones_info:
+# returns all the zones' information.
+#########################################################################
+def get_zones_info(db_file):
+ conn, cur = open(db_file)
+ cur.execute("SELECT name, rdclass FROM zones")
+ info = cur.fetchone()
+ while info:
+ yield info
+ info = cur.fetchone()
+
+ cur.close()
+ conn.close()
#########################################################################
# get_zoneid:
@@ -132,7 +172,7 @@
return row[0]
else:
return ''
-
+
#########################################################################
# reverse_name:
# reverse the labels of a DNS name. (for example,
Modified: branches/trac296/src/lib/xfr/fdshare_python.cc
==============================================================================
--- branches/trac296/src/lib/xfr/fdshare_python.cc (original)
+++ branches/trac296/src/lib/xfr/fdshare_python.cc Wed Aug 18 08:19:01 2010
@@ -23,25 +23,23 @@
#include <xfr/fd_share.h>
static PyObject*
-fdshare_recv_fd(PyObject *self UNUSED_PARAM, PyObject *args)
-{
+fdshare_recv_fd(PyObject *self UNUSED_PARAM, PyObject *args) {
int sock, fd;
if (!PyArg_ParseTuple(args, "i", &sock)) {
- return NULL;
+ return (NULL);
}
fd = isc::xfr::recv_fd(sock);
- return Py_BuildValue("i", fd);
+ return (Py_BuildValue("i", fd));
}
static PyObject*
-fdshare_send_fd(PyObject *self UNUSED_PARAM, PyObject *args)
-{
+fdshare_send_fd(PyObject *self UNUSED_PARAM, PyObject *args) {
int sock, fd, result;
if (!PyArg_ParseTuple(args, "ii", &sock, &fd)) {
- return NULL;
+ return (NULL);
}
result = isc::xfr::send_fd(sock, fd);
- return Py_BuildValue("i", result);
+ return (Py_BuildValue("i", result));
}
static PyMethodDef fdshare_Methods[] = {
@@ -64,13 +62,12 @@
};
PyMODINIT_FUNC
-PyInit_libxfr_python(void)
-{
+PyInit_libxfr_python(void) {
PyObject *mod = PyModule_Create(&bind10_fdshare_python);
if (mod == NULL) {
- return NULL;
+ return (NULL);
}
- return mod;
+ return (mod);
}
Modified: branches/trac296/src/lib/xfr/xfrout_client.cc
==============================================================================
--- branches/trac296/src/lib/xfr/xfrout_client.cc (original)
+++ branches/trac296/src/lib/xfr/xfrout_client.cc Wed Aug 18 08:19:01 2010
@@ -77,11 +77,13 @@
{
if (-1 == send_fd(impl_->socket_.native(), tcp_sock)) {
isc_throw(XfroutError,
- "Fail to send the socket file descriptor to xfrout module");
+ "Failed to send the socket file descriptor "
+ "to xfrout module");
}
- // XXX: this shouldn't be blocking send, even though it's unlikely to
+ // TODO: this shouldn't be blocking send, even though it's unlikely to
// block.
+ // converting the 16-bit word to network byte order.
const uint8_t lenbuf[2] = { msg_len >> 8, msg_len & 0xff };
if (send(impl_->socket_.native(), lenbuf, sizeof(lenbuf), 0) !=
sizeof(lenbuf)) {
@@ -99,7 +101,7 @@
"xfr query hasn't been processed properly by xfrout module");
}
- return 0;
+ return (0);
}
} // End for xfr
More information about the bind10-changes
mailing list