[svn] commit: r2562 - in /branches/trac221b: ./ src/bin/auth/ src/bin/bindctl/ src/bin/cmdctl/ src/bin/cmdctl/tests/ src/bin/host/ src/bin/xfrin/ src/bin/xfrout/ src/lib/cc/ src/lib/config/ src/lib/config/testdata/ src/lib/config/tests/ src/lib/datasrc/ src/lib/datasrc/tests/ src/lib/datasrc/tests/testdata/ 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/python/isc/cc/ src/lib/python/isc/cc/tests/ src/lib/python/isc/config/ src/lib/python/isc/config/tests/ src/lib/xfr/
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jul 21 04:02:13 UTC 2010
Author: jinmei
Date: Wed Jul 21 04:02:13 2010
New Revision: 2562
Log:
sync with trunk
Added:
branches/trac221b/src/lib/config/testdata/spec28.spec
- copied unchanged from r2561, trunk/src/lib/config/testdata/spec28.spec
branches/trac221b/src/lib/dns/tests/base32hex_unittest.cc
- copied unchanged from r2561, trunk/src/lib/dns/tests/base32hex_unittest.cc
branches/trac221b/src/lib/dns/util/
- copied from r2561, trunk/src/lib/dns/util/
Removed:
branches/trac221b/src/lib/datasrc/tests/testdata/q_cname
branches/trac221b/src/lib/datasrc/tests/testdata/q_cname_ext
branches/trac221b/src/lib/datasrc/tests/testdata/q_cname_int
branches/trac221b/src/lib/datasrc/tests/testdata/q_dname
branches/trac221b/src/lib/datasrc/tests/testdata/q_example_dnskey
branches/trac221b/src/lib/datasrc/tests/testdata/q_example_ns
branches/trac221b/src/lib/datasrc/tests/testdata/q_example_ptr
branches/trac221b/src/lib/datasrc/tests/testdata/q_glork
branches/trac221b/src/lib/datasrc/tests/testdata/q_spork
branches/trac221b/src/lib/datasrc/tests/testdata/q_sql1
branches/trac221b/src/lib/datasrc/tests/testdata/q_subzone
branches/trac221b/src/lib/datasrc/tests/testdata/q_subzone_any
branches/trac221b/src/lib/datasrc/tests/testdata/q_subzone_dname
branches/trac221b/src/lib/datasrc/tests/testdata/q_subzone_ds
branches/trac221b/src/lib/datasrc/tests/testdata/q_subzone_ns
branches/trac221b/src/lib/datasrc/tests/testdata/q_subzone_nsec
branches/trac221b/src/lib/datasrc/tests/testdata/q_wild2_a
branches/trac221b/src/lib/datasrc/tests/testdata/q_wild2_aaaa
branches/trac221b/src/lib/datasrc/tests/testdata/q_wild3_a
branches/trac221b/src/lib/datasrc/tests/testdata/q_wild_a
branches/trac221b/src/lib/datasrc/tests/testdata/q_wild_aaaa
branches/trac221b/src/lib/dns/base32.cc
branches/trac221b/src/lib/dns/base32.h
branches/trac221b/src/lib/dns/base64.cc
branches/trac221b/src/lib/dns/base64.h
branches/trac221b/src/lib/dns/hex.cc
branches/trac221b/src/lib/dns/hex.h
branches/trac221b/src/lib/dns/sha1.cc
branches/trac221b/src/lib/dns/sha1.h
branches/trac221b/src/lib/dns/tests/base32_unittest.cc
Modified:
branches/trac221b/ (props changed)
branches/trac221b/ChangeLog
branches/trac221b/src/bin/auth/Makefile.am
branches/trac221b/src/bin/auth/asio_link.cc
branches/trac221b/src/bin/auth/auth.spec.pre.in
branches/trac221b/src/bin/auth/main.cc
branches/trac221b/src/bin/bindctl/bindcmd.py
branches/trac221b/src/bin/cmdctl/TODO
branches/trac221b/src/bin/cmdctl/cmdctl.py.in
branches/trac221b/src/bin/cmdctl/cmdctl.spec.pre.in
branches/trac221b/src/bin/cmdctl/tests/cmdctl_test.py
branches/trac221b/src/bin/host/host.cc
branches/trac221b/src/bin/xfrin/ (props changed)
branches/trac221b/src/bin/xfrin/xfrin.spec.pre.in
branches/trac221b/src/bin/xfrout/xfrout.spec.pre.in
branches/trac221b/src/lib/cc/ (props changed)
branches/trac221b/src/lib/cc/data.cc
branches/trac221b/src/lib/cc/session.h
branches/trac221b/src/lib/cc/session_unittests.cc
branches/trac221b/src/lib/config/Makefile.am
branches/trac221b/src/lib/config/ccsession.cc
branches/trac221b/src/lib/config/config_data.cc
branches/trac221b/src/lib/config/module_spec.cc
branches/trac221b/src/lib/config/testdata/b10-config.db
branches/trac221b/src/lib/config/testdata/data22_1.data
branches/trac221b/src/lib/config/testdata/data22_2.data
branches/trac221b/src/lib/config/testdata/data22_3.data
branches/trac221b/src/lib/config/testdata/data22_4.data
branches/trac221b/src/lib/config/testdata/data22_5.data
branches/trac221b/src/lib/config/testdata/data22_6.data
branches/trac221b/src/lib/config/testdata/data22_7.data
branches/trac221b/src/lib/config/testdata/data22_8.data
branches/trac221b/src/lib/config/testdata/spec10.spec
branches/trac221b/src/lib/config/testdata/spec11.spec
branches/trac221b/src/lib/config/testdata/spec12.spec
branches/trac221b/src/lib/config/testdata/spec13.spec
branches/trac221b/src/lib/config/testdata/spec14.spec
branches/trac221b/src/lib/config/testdata/spec15.spec
branches/trac221b/src/lib/config/testdata/spec17.spec
branches/trac221b/src/lib/config/testdata/spec2.spec
branches/trac221b/src/lib/config/testdata/spec20.spec
branches/trac221b/src/lib/config/testdata/spec22.spec
branches/trac221b/src/lib/config/testdata/spec23.spec
branches/trac221b/src/lib/config/testdata/spec24.spec
branches/trac221b/src/lib/config/testdata/spec27.spec
branches/trac221b/src/lib/config/testdata/spec3.spec
branches/trac221b/src/lib/config/testdata/spec4.spec
branches/trac221b/src/lib/config/testdata/spec6.spec
branches/trac221b/src/lib/config/testdata/spec9.spec
branches/trac221b/src/lib/config/tests/Makefile.am
branches/trac221b/src/lib/config/tests/ccsession_unittests.cc
branches/trac221b/src/lib/config/tests/config_data_unittests.cc
branches/trac221b/src/lib/config/tests/fake_session.cc
branches/trac221b/src/lib/config/tests/module_spec_unittests.cc
branches/trac221b/src/lib/datasrc/ (props changed)
branches/trac221b/src/lib/datasrc/cache.cc
branches/trac221b/src/lib/datasrc/data_source.cc
branches/trac221b/src/lib/datasrc/query.cc
branches/trac221b/src/lib/datasrc/sqlite3_datasrc.cc
branches/trac221b/src/lib/datasrc/sqlite3_datasrc.h
branches/trac221b/src/lib/datasrc/static_datasrc.cc
branches/trac221b/src/lib/datasrc/static_datasrc.h
branches/trac221b/src/lib/datasrc/tests/Makefile.am
branches/trac221b/src/lib/datasrc/tests/datasrc_unittest.cc
branches/trac221b/src/lib/datasrc/tests/query_unittest.cc
branches/trac221b/src/lib/datasrc/tests/static_unittest.cc
branches/trac221b/src/lib/datasrc/tests/test_datasrc.cc
branches/trac221b/src/lib/dns/ (props changed)
branches/trac221b/src/lib/dns/Makefile.am
branches/trac221b/src/lib/dns/python/libdns_python.cc
branches/trac221b/src/lib/dns/rdata/generic/dnskey_48.cc
branches/trac221b/src/lib/dns/rdata/generic/ds_43.cc
branches/trac221b/src/lib/dns/rdata/generic/nsec3_50.cc
branches/trac221b/src/lib/dns/rdata/generic/nsec3param_51.cc
branches/trac221b/src/lib/dns/rdata/generic/nsec_47.cc
branches/trac221b/src/lib/dns/rdata/generic/rrsig_46.cc (contents, props changed)
branches/trac221b/src/lib/dns/tests/ (props changed)
branches/trac221b/src/lib/dns/tests/Makefile.am
branches/trac221b/src/lib/dns/tests/base64_unittest.cc
branches/trac221b/src/lib/dns/tests/hex_unittest.cc
branches/trac221b/src/lib/dns/tests/message_unittest.cc
branches/trac221b/src/lib/dns/tests/messagerenderer_unittest.cc
branches/trac221b/src/lib/dns/tests/name_unittest.cc
branches/trac221b/src/lib/dns/tests/question_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_cname_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_dname_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_dnskey_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_ds_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_in_a_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_in_aaaa_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_mx_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_ns_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_nsec3_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_nsec3param_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_nsec_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_opt_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_ptr_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_rrsig_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_soa_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_txt_unittest.cc
branches/trac221b/src/lib/dns/tests/rdata_unittest.cc
branches/trac221b/src/lib/dns/tests/rrclass_unittest.cc
branches/trac221b/src/lib/dns/tests/rrset_unittest.cc
branches/trac221b/src/lib/dns/tests/rrttl_unittest.cc
branches/trac221b/src/lib/dns/tests/rrtype_unittest.cc
branches/trac221b/src/lib/dns/tests/run_unittests.cc
branches/trac221b/src/lib/dns/tests/sha1_unittest.cc
branches/trac221b/src/lib/dns/tests/tsig_unittest.cc
branches/trac221b/src/lib/dns/tests/unittest_util.cc
branches/trac221b/src/lib/exceptions/Makefile.am
branches/trac221b/src/lib/exceptions/exceptions.cc
branches/trac221b/src/lib/exceptions/exceptions.h
branches/trac221b/src/lib/exceptions/exceptions_unittest.cc
branches/trac221b/src/lib/python/isc/cc/data.py
branches/trac221b/src/lib/python/isc/cc/tests/data_test.py
branches/trac221b/src/lib/python/isc/config/ccsession.py
branches/trac221b/src/lib/python/isc/config/cfgmgr.py
branches/trac221b/src/lib/python/isc/config/module_spec.py
branches/trac221b/src/lib/python/isc/config/tests/ccsession_test.py
branches/trac221b/src/lib/python/isc/config/tests/module_spec_test.py
branches/trac221b/src/lib/xfr/fd_share.cc
branches/trac221b/src/lib/xfr/fdshare_python.cc
branches/trac221b/src/lib/xfr/python_xfr.cc
branches/trac221b/src/lib/xfr/xfrout_client.cc
Modified: branches/trac221b/ChangeLog
==============================================================================
--- branches/trac221b/ChangeLog (original)
+++ branches/trac221b/ChangeLog Wed Jul 21 04:02:13 2010
@@ -1,3 +1,29 @@
+ 78. [bug] jinmei
+ lib/dns: Fixed miscellaneous bugs in the base32 (hex) and hex
+ (base16) implementation, including incorrect padding handling,
+ parser failure in decoding with a SunStudio build, missing
+ validation on the length of encoded hex string. Test cases were
+ more detailed to identify these bugs and confirm the fix. Also
+ renamed the incorrect term of "base32" to "base32hex". This
+ changed the API, but they are not intended to be used outside
+ libdns++, so we don't consider it a backward incompatible change.
+ (Trac #256, r2549)
+
+ 77. [func] zhanglikun
+ Make error message be more friendly when running cmdctl and it's
+ already running(listening on same port)(Trac #277, r2540)
+
+ 76. [bug] jelte
+ Fixed a bug in the handling of 'remote' config modules (i.e.
+ modules that peek at the configuration of other modules), where
+ they answered 'unknown command' to commands for those other
+ modules. (Trac #278, r2506)
+
+ 75. [bug] jinmei
+ Fixed a bug in the sqlite3 data source where temporary strings
+ could be referenced after destruction. It caused various lookup
+ failures with SunStudio build. (Trac #288, r2494)
+
74. [func]* jinmei
Refactored the cc::Session class by introducing an abstract base
class. Test code can use their own derived mock class so that
Modified: branches/trac221b/src/bin/auth/Makefile.am
==============================================================================
--- branches/trac221b/src/bin/auth/Makefile.am (original)
+++ branches/trac221b/src/bin/auth/Makefile.am Wed Jul 21 04:02:13 2010
@@ -4,6 +4,7 @@
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc
+AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CXXFLAGS = $(B10_CXXFLAGS)
Modified: branches/trac221b/src/bin/auth/asio_link.cc
==============================================================================
--- branches/trac221b/src/bin/auth/asio_link.cc (original)
+++ branches/trac221b/src/bin/auth/asio_link.cc Wed Jul 21 04:02:13 2010
@@ -33,7 +33,7 @@
#include <asio_link.h>
#include <auth/auth_srv.h>
-#include "common.h"
+#include <auth/common.h>
using namespace asio;
using asio::ip::udp;
Modified: branches/trac221b/src/bin/auth/auth.spec.pre.in
==============================================================================
--- branches/trac221b/src/bin/auth/auth.spec.pre.in (original)
+++ branches/trac221b/src/bin/auth/auth.spec.pre.in Wed Jul 21 04:02:13 2010
@@ -5,7 +5,7 @@
"config_data": [
{ "item_name": "database_file",
"item_type": "string",
- "item_optional": True,
+ "item_optional": true,
"item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3"
}
],
Modified: branches/trac221b/src/bin/auth/main.cc
==============================================================================
--- branches/trac221b/src/bin/auth/main.cc (original)
+++ branches/trac221b/src/bin/auth/main.cc Wed Jul 21 04:02:13 2010
@@ -14,7 +14,7 @@
// $Id$
-#include "config.h"
+#include <config.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -101,7 +101,7 @@
const char* address = NULL;
bool use_ipv4 = true, use_ipv6 = true, cache = true;
- while ((ch = getopt(argc, argv, "a:46np:v")) != -1) {
+ while ((ch = getopt(argc, argv, "46a:np:v")) != -1) {
switch (ch) {
case '4':
// Note that -4 means "ipv4 only", we need to set "use_ipv6" here,
Modified: branches/trac221b/src/bin/bindctl/bindcmd.py
==============================================================================
--- branches/trac221b/src/bin/bindctl/bindcmd.py (original)
+++ branches/trac221b/src/bin/bindctl/bindcmd.py Wed Jul 21 04:02:13 2010
@@ -35,7 +35,7 @@
import getpass
from hashlib import sha1
import csv
-import ast
+import json
import pwd
import getpass
import traceback
@@ -568,7 +568,7 @@
else:
parsed_value = None
try:
- parsed_value = ast.literal_eval(cmd.params['value'])
+ parsed_value = json.loads(cmd.params['value'])
except Exception as exc:
# ok could be an unquoted string, interpret as such
parsed_value = cmd.params['value']
Modified: branches/trac221b/src/bin/cmdctl/TODO
==============================================================================
--- branches/trac221b/src/bin/cmdctl/TODO (original)
+++ branches/trac221b/src/bin/cmdctl/TODO Wed Jul 21 04:02:13 2010
@@ -3,4 +3,5 @@
. Add check for the content of key/certificate file
(when cmdctl starts or is configured by bindctl).
. Use only one msgq/session to communicate with other modules?
-
+. Add more test cases, especially about the cases where CmdctlException
+ is raised
Modified: branches/trac221b/src/bin/cmdctl/cmdctl.py.in
==============================================================================
--- branches/trac221b/src/bin/cmdctl/cmdctl.py.in (original)
+++ branches/trac221b/src/bin/cmdctl/cmdctl.py.in Wed Jul 21 04:02:13 2010
@@ -441,7 +441,11 @@
CommandControlClass,
idle_timeout = 1200, verbose = False):
'''idle_timeout: the max idle time for login'''
- http.server.HTTPServer.__init__(self, server_address, RequestHandlerClass)
+ try:
+ http.server.HTTPServer.__init__(self, server_address, RequestHandlerClass)
+ except socket.error as err:
+ raise CmdctlException("Error creating server, because: %s \n" % str(err))
+
self.user_sessions = {}
self.idle_timeout = idle_timeout
self.cmdctl = CommandControlClass(self, verbose)
@@ -587,20 +591,23 @@
help="display more about what is going on")
if __name__ == '__main__':
+ set_signal_handler()
+ parser = OptionParser(version = __version__)
+ set_cmd_options(parser)
+ (options, args) = parser.parse_args()
+ result = 1 # in case of failure
try:
- set_signal_handler()
- parser = OptionParser(version = __version__)
- set_cmd_options(parser)
- (options, args) = parser.parse_args()
run(options.addr, options.port, options.idle_timeout, options.verbose)
- except isc.cc.SessionError as se:
+ result = 0
+ except isc.cc.SessionError as err:
sys.stderr.write("[b10-cmdctl] Error creating b10-cmdctl, "
- "is the command channel daemon running?\n")
+ "is the command channel daemon running?\n")
except KeyboardInterrupt:
- sys.stderr.write("[b10-cmdctl] exit http server\n")
+ sys.stderr.write("[b10-cmdctl] exit from Cmdctl\n")
+ except CmdctlException as err:
+ sys.stderr.write("[b10-cmdctl] " + str(err) + "\n")
if httpd:
httpd.shutdown()
-
-
+ sys.exit(result)
Modified: branches/trac221b/src/bin/cmdctl/cmdctl.spec.pre.in
==============================================================================
--- branches/trac221b/src/bin/cmdctl/cmdctl.spec.pre.in (original)
+++ branches/trac221b/src/bin/cmdctl/cmdctl.spec.pre.in Wed Jul 21 04:02:13 2010
@@ -6,20 +6,20 @@
{
"item_name": "key_file",
"item_type": "string",
- "item_optional": False,
- "item_default": '@@SYSCONFDIR@@/@PACKAGE@/cmdctl-keyfile.pem'
+ "item_optional": false,
+ "item_default": "@@SYSCONFDIR@@/@PACKAGE@/cmdctl-keyfile.pem"
},
{
"item_name": "cert_file",
"item_type": "string",
- "item_optional": False,
- "item_default": '@@SYSCONFDIR@@/@PACKAGE@/cmdctl-certfile.pem'
+ "item_optional": false,
+ "item_default": "@@SYSCONFDIR@@/@PACKAGE@/cmdctl-certfile.pem"
},
{
"item_name": "accounts_file",
"item_type": "string",
- "item_optional": False,
- "item_default": '@@SYSCONFDIR@@/@PACKAGE@/cmdctl-accounts.csv'
+ "item_optional": false,
+ "item_default": "@@SYSCONFDIR@@/@PACKAGE@/cmdctl-accounts.csv"
}
],
"commands": [
@@ -32,7 +32,7 @@
"command_name": "shutdown",
"command_description": "shutdown cmdctl",
"command_args": []
- },
+ }
]
}
}
Modified: branches/trac221b/src/bin/cmdctl/tests/cmdctl_test.py
==============================================================================
--- branches/trac221b/src/bin/cmdctl/tests/cmdctl_test.py (original)
+++ branches/trac221b/src/bin/cmdctl/tests/cmdctl_test.py Wed Jul 21 04:02:13 2010
@@ -17,6 +17,7 @@
import unittest
import socket
import tempfile
+import sys
from cmdctl import *
SPEC_FILE_PATH = '..' + os.sep
@@ -383,13 +384,31 @@
class TestSecureHTTPServer(unittest.TestCase):
def setUp(self):
self.old_stdout = sys.stdout
+ self.old_stderr = sys.stderr
sys.stdout = open(os.devnull, 'w')
+ sys.stderr = sys.stdout
self.server = MySecureHTTPServer(('localhost', 8080),
MySecureHTTPRequestHandler,
MyCommandControl, verbose=True)
def tearDown(self):
sys.stdout = self.old_stdout
+ sys.stderr = self.old_stderr
+
+ def test_addr_in_use(self):
+ server_one = None
+ try:
+ server_one = SecureHTTPServer(('localhost', 53531),
+ MySecureHTTPRequestHandler,
+ MyCommandControl)
+ except CmdctlException:
+ pass
+ else:
+ self.assertRaises(CmdctlException, SecureHTTPServer,
+ ('localhost', 53531),
+ MySecureHTTPRequestHandler, MyCommandControl)
+ if server_one:
+ server_one.server_close()
def test_create_user_info(self):
self.server._create_user_info('/local/not-exist')
Modified: branches/trac221b/src/bin/host/host.cc
==============================================================================
--- branches/trac221b/src/bin/host/host.cc (original)
+++ branches/trac221b/src/bin/host/host.cc Wed Jul 21 04:02:13 2010
@@ -24,14 +24,14 @@
#include <string>
#include <iostream>
-#include "dns/buffer.h"
-#include "dns/name.h"
-#include "dns/message.h"
-#include "dns/messagerenderer.h"
-#include "dns/rrclass.h"
-#include "dns/rrtype.h"
-#include "dns/rrset.h"
-#include "dns/message.h"
+#include <dns/buffer.h>
+#include <dns/name.h>
+#include <dns/message.h>
+#include <dns/messagerenderer.h>
+#include <dns/rrclass.h>
+#include <dns/rrtype.h>
+#include <dns/rrset.h>
+#include <dns/message.h>
using namespace std;
using namespace isc::dns;
Modified: branches/trac221b/src/bin/xfrin/xfrin.spec.pre.in
==============================================================================
--- branches/trac221b/src/bin/xfrin/xfrin.spec.pre.in (original)
+++ branches/trac221b/src/bin/xfrin/xfrin.spec.pre.in Wed Jul 21 04:02:13 2010
@@ -6,37 +6,37 @@
{
"item_name": "transfers_in",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 10
}
],
"commands": [
{
- 'command_name': 'retransfer',
- "command_description": 'retransfer a single zone without checking zone serial number',
- 'command_args': [ {
+ "command_name": "retransfer",
+ "command_description": "retransfer a single zone without checking zone serial number",
+ "command_args": [ {
"item_name": "zone_name",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": ""
},
{
"item_name": "master",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": ""
},
{
"item_name": "port",
"item_type": "integer",
- "item_optional": True,
+ "item_optional": true,
"item_default": 53
},
{
"item_name": "db_file",
"item_type": "string",
- "item_optional": True,
- "item_default": '@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3'
+ "item_optional": true,
+ "item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3"
}
]
},
Modified: branches/trac221b/src/bin/xfrout/xfrout.spec.pre.in
==============================================================================
--- branches/trac221b/src/bin/xfrout/xfrout.spec.pre.in (original)
+++ branches/trac221b/src/bin/xfrout/xfrout.spec.pre.in Wed Jul 21 04:02:13 2010
@@ -5,43 +5,43 @@
{
"item_name": "transfers_out",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 10
},
{
"item_name": "db_file",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3"
},
{
"item_name": "log_name",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "Xfrout"
},
{
"item_name": "log_file",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/log/Xfrout.log"
},
{
"item_name": "log_severity",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "debug"
},
{
"item_name": "log_versions",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 5
},
{
"item_name": "log_max_bytes",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1048576
}
],
Modified: branches/trac221b/src/lib/cc/data.cc
==============================================================================
--- branches/trac221b/src/lib/cc/data.cc (original)
+++ branches/trac221b/src/lib/cc/data.cc Wed Jul 21 04:02:13 2010
@@ -14,9 +14,9 @@
// $Id$
-#include "config.h"
-
-#include "data.h"
+#include <config.h>
+
+#include <cc/data.h>
#include <cassert>
#include <climits>
Modified: branches/trac221b/src/lib/cc/session.h
==============================================================================
--- branches/trac221b/src/lib/cc/session.h (original)
+++ branches/trac221b/src/lib/cc/session.h Wed Jul 21 04:02:13 2010
@@ -23,8 +23,8 @@
#include <exceptions/exceptions.h>
-#include "data.h"
-#include "session_config.h"
+#include <cc/data.h>
+#include <cc/session_config.h>
namespace asio {
class io_service;
Modified: branches/trac221b/src/lib/cc/session_unittests.cc
==============================================================================
--- branches/trac221b/src/lib/cc/session_unittests.cc (original)
+++ branches/trac221b/src/lib/cc/session_unittests.cc Wed Jul 21 04:02:13 2010
@@ -14,7 +14,7 @@
// $Id: data_unittests.cc 1899 2010-05-21 12:03:59Z jelte $
-#include "config.h"
+#include <config.h>
// for some IPC/network system calls in asio/detail/pipe_select_interrupter.hpp
#include <unistd.h>
Modified: branches/trac221b/src/lib/config/Makefile.am
==============================================================================
--- branches/trac221b/src/lib/config/Makefile.am (original)
+++ branches/trac221b/src/lib/config/Makefile.am Wed Jul 21 04:02:13 2010
@@ -51,3 +51,4 @@
EXTRA_DIST += testdata/spec25.spec
EXTRA_DIST += testdata/spec26.spec
EXTRA_DIST += testdata/spec27.spec
+EXTRA_DIST += testdata/spec28.spec
Modified: branches/trac221b/src/lib/config/ccsession.cc
==============================================================================
--- branches/trac221b/src/lib/config/ccsession.cc (original)
+++ branches/trac221b/src/lib/config/ccsession.cc Wed Jul 21 04:02:13 2010
@@ -20,7 +20,7 @@
// react on config change announcements)
//
-#include "config.h"
+#include <config.h>
#include <stdexcept>
#include <stdlib.h>
@@ -40,8 +40,7 @@
#include <cc/session.h>
#include <exceptions/exceptions.h>
-#include "ccsession.h"
-#include "config.h"
+#include <config/ccsession.h>
using namespace std;
@@ -300,8 +299,8 @@
ElementPtr answer;
try {
std::string cmd_str = parseCommand(arg, data);
+ std::string target_module = routing->get("group")->stringValue();
if (cmd_str == "config_update") {
- std::string target_module = routing->get("group")->stringValue();
if (target_module == module_name_) {
answer = handleConfigUpdate(arg);
} else {
@@ -312,16 +311,22 @@
return 0;
}
} else {
- if (command_handler_) {
- answer = command_handler_(cmd_str, arg);
- } else {
- answer = createAnswer(1, "Command given but no command handler for module");
+ if (target_module == module_name_) {
+ if (command_handler_) {
+ answer = command_handler_(cmd_str, arg);
+ } else {
+ answer = createAnswer(1, "Command given but no command handler for module");
+ }
}
}
} catch (CCSessionError re) {
+ // TODO: Once we have logging and timeouts, we should not
+ // answer here (potential interference)
answer = createAnswer(1, re.what());
}
- session_.reply(routing, answer);
+ if (!isNull(answer)) {
+ session_.reply(routing, answer);
+ }
}
return 0;
Modified: branches/trac221b/src/lib/config/config_data.cc
==============================================================================
--- branches/trac221b/src/lib/config/config_data.cc (original)
+++ branches/trac221b/src/lib/config/config_data.cc Wed Jul 21 04:02:13 2010
@@ -14,7 +14,7 @@
// $Id$
-#include "config_data.h"
+#include <config/config_data.h>
#include <boost/foreach.hpp>
Modified: branches/trac221b/src/lib/config/module_spec.cc
==============================================================================
--- branches/trac221b/src/lib/config/module_spec.cc (original)
+++ branches/trac221b/src/lib/config/module_spec.cc Wed Jul 21 04:02:13 2010
@@ -13,7 +13,7 @@
// NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
// WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#include "module_spec.h"
+#include <config/module_spec.h>
#include <sstream>
#include <iostream>
Modified: branches/trac221b/src/lib/config/testdata/b10-config.db
==============================================================================
--- branches/trac221b/src/lib/config/testdata/b10-config.db (original)
+++ branches/trac221b/src/lib/config/testdata/b10-config.db Wed Jul 21 04:02:13 2010
@@ -1,1 +1,1 @@
-{'TestModule': {'test': 125}, 'version': 1}
+{"version": 1, "TestModule": {"test": 125}}
Modified: branches/trac221b/src/lib/config/testdata/data22_1.data
==============================================================================
--- branches/trac221b/src/lib/config/testdata/data22_1.data (original)
+++ branches/trac221b/src/lib/config/testdata/data22_1.data Wed Jul 21 04:02:13 2010
@@ -1,9 +1,9 @@
{
"value1": 1,
"value2": 2.3,
- "value3": True,
+ "value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
- "value6": { "v61": "bar", "v62": True },
+ "value6": { "v61": "bar", "v62": true },
"value9": { "v91": "hi", "v92": { "v92a": "Hi", "v92b": 3 } }
}
Modified: branches/trac221b/src/lib/config/testdata/data22_2.data
==============================================================================
--- branches/trac221b/src/lib/config/testdata/data22_2.data (original)
+++ branches/trac221b/src/lib/config/testdata/data22_2.data Wed Jul 21 04:02:13 2010
@@ -1,8 +1,8 @@
{
"value1": "asdf",
"value2": 2.3,
- "value3": True,
+ "value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
- "value6": { "v61": "bar", "v62": True }
+ "value6": { "v61": "bar", "v62": true }
}
Modified: branches/trac221b/src/lib/config/testdata/data22_3.data
==============================================================================
--- branches/trac221b/src/lib/config/testdata/data22_3.data (original)
+++ branches/trac221b/src/lib/config/testdata/data22_3.data Wed Jul 21 04:02:13 2010
@@ -1,8 +1,8 @@
{
"value1": 1,
- "value2": False,
- "value3": True,
+ "value2": false,
+ "value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
- "value6": { "v61": "bar", "v62": True }
+ "value6": { "v61": "bar", "v62": true }
}
Modified: branches/trac221b/src/lib/config/testdata/data22_4.data
==============================================================================
--- branches/trac221b/src/lib/config/testdata/data22_4.data (original)
+++ branches/trac221b/src/lib/config/testdata/data22_4.data Wed Jul 21 04:02:13 2010
@@ -1,8 +1,8 @@
{
"value1": 1,
"value2": 2.3,
- "value3": True,
+ "value3": true,
"value4": "foo",
"value5": [ 1, 2, "a" ],
- "value6": { "v61": "bar", "v62": True }
+ "value6": { "v61": "bar", "v62": true }
}
Modified: branches/trac221b/src/lib/config/testdata/data22_5.data
==============================================================================
--- branches/trac221b/src/lib/config/testdata/data22_5.data (original)
+++ branches/trac221b/src/lib/config/testdata/data22_5.data Wed Jul 21 04:02:13 2010
@@ -1,7 +1,7 @@
{
"value1": 1,
"value2": 2.3,
- "value3": True,
+ "value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
"value6": { "v61": "bar", "v62": "Break" }
Modified: branches/trac221b/src/lib/config/testdata/data22_6.data
==============================================================================
--- branches/trac221b/src/lib/config/testdata/data22_6.data (original)
+++ branches/trac221b/src/lib/config/testdata/data22_6.data Wed Jul 21 04:02:13 2010
@@ -1,10 +1,10 @@
{
"value1": 1,
"value2": 2.3,
- "value3": True,
+ "value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
- "value6": { "v61": "bar", "v62": True },
- "value7": [ 1, 2.2, "str", True ],
+ "value6": { "v61": "bar", "v62": true },
+ "value7": [ 1, 2.2, "str", true ],
"value9": { "v91": "hi", "v92": { "v92a": "Hi", "v92b": 3 } }
}
Modified: branches/trac221b/src/lib/config/testdata/data22_7.data
==============================================================================
--- branches/trac221b/src/lib/config/testdata/data22_7.data (original)
+++ branches/trac221b/src/lib/config/testdata/data22_7.data Wed Jul 21 04:02:13 2010
@@ -1,10 +1,10 @@
{
"value1": 1,
"value2": 2.3,
- "value3": True,
+ "value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
- "value6": { "v61": "bar", "v62": True },
+ "value6": { "v61": "bar", "v62": true },
"value8": [ { "a": "d" }, { "a": "e" } ],
"value9": { "v91": "hi", "v92": { "v92a": "Hi", "v92b": 3 } }
}
Modified: branches/trac221b/src/lib/config/testdata/data22_8.data
==============================================================================
--- branches/trac221b/src/lib/config/testdata/data22_8.data (original)
+++ branches/trac221b/src/lib/config/testdata/data22_8.data Wed Jul 21 04:02:13 2010
@@ -1,9 +1,9 @@
{
"value1": 1,
"value2": 2.3,
- "value3": True,
+ "value3": true,
"value4": "foo",
"value5": [ 1, 2, 3 ],
- "value6": { "v61": "bar", "v62": True },
+ "value6": { "v61": "bar", "v62": true },
"value8": [ { "a": "d" }, { "a": 1 } ]
}
Modified: branches/trac221b/src/lib/config/testdata/spec10.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec10.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec10.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "real",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec11.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec11.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec11.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "boolean",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec12.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec12.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec12.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec13.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec13.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec13.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "list",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec14.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec14.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec14.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "map",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec15.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec15.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec15.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "badname",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec17.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec17.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec17.spec Wed Jul 21 04:02:13 2010
@@ -7,7 +7,7 @@
"command_args": [ {
"item_name": "message",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": ""
} ]
}
Modified: branches/trac221b/src/lib/config/testdata/spec2.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec2.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec2.spec Wed Jul 21 04:02:13 2010
@@ -4,48 +4,48 @@
"config_data": [
{ "item_name": "item1",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
},
{ "item_name": "item2",
"item_type": "real",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1.1
},
{ "item_name": "item3",
"item_type": "boolean",
- "item_optional": False,
- "item_default": True
+ "item_optional": false,
+ "item_default": true
},
{ "item_name": "item4",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "test"
},
{ "item_name": "item5",
"item_type": "list",
- "item_optional": False,
+ "item_optional": false,
"item_default": [ "a", "b" ],
"list_item_spec": {
"item_name": "list_element",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": ""
}
},
{ "item_name": "item6",
"item_type": "map",
- "item_optional": False,
+ "item_optional": false,
"item_default": {},
"map_item_spec": [
{ "item_name": "value1",
"item_type": "string",
- "item_optional": True,
+ "item_optional": true,
"item_default": "default"
},
{ "item_name": "value2",
"item_type": "integer",
- "item_optional": True
+ "item_optional": true
}
]
}
@@ -57,7 +57,7 @@
"command_args": [ {
"item_name": "message",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": ""
} ]
},
Modified: branches/trac221b/src/lib/config/testdata/spec20.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec20.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec20.spec Wed Jul 21 04:02:13 2010
@@ -8,7 +8,7 @@
"command_args": [ {
"item_name": "message",
"item_type": "somethingbad",
- "item_optional": False,
+ "item_optional": false,
"item_default": ""
} ]
}
Modified: branches/trac221b/src/lib/config/testdata/spec22.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec22.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec22.spec Wed Jul 21 04:02:13 2010
@@ -4,75 +4,75 @@
"config_data": [
{ "item_name": "value1",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 9
},
{ "item_name": "value2",
"item_type": "real",
- "item_optional": False,
+ "item_optional": false,
"item_default": 9.9
},
{ "item_name": "value3",
"item_type": "boolean",
- "item_optional": False,
- "item_default": False
+ "item_optional": false,
+ "item_default": false
},
{ "item_name": "value4",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "default_string"
},
{ "item_name": "value5",
"item_type": "list",
- "item_optional": False,
+ "item_optional": false,
"item_default": [ "a", "b" ],
"list_item_spec": {
"item_name": "list_element",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 8
}
},
{ "item_name": "value6",
"item_type": "map",
- "item_optional": False,
+ "item_optional": false,
"item_default": {},
"map_item_spec": [
{ "item_name": "v61",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "def"
},
{ "item_name": "v62",
"item_type": "boolean",
- "item_optional": False,
- "item_default": False
+ "item_optional": false,
+ "item_default": false
}
]
},
{ "item_name": "value7",
"item_type": "list",
- "item_optional": True,
+ "item_optional": true,
"item_default": [ ],
"list_item_spec": {
"item_name": "list_element",
"item_type": "any",
- "item_optional": True
+ "item_optional": true
}
},
{ "item_name": "value8",
"item_type": "list",
- "item_optional": True,
+ "item_optional": true,
"item_default": [ ],
"list_item_spec": {
"item_name": "list_element",
"item_type": "map",
- "item_optional": True,
+ "item_optional": true,
"item_default": { "a": "b" },
"map_item_spec": [
{ "item_name": "a",
"item_type": "string",
- "item_optional": True,
+ "item_optional": true,
"item_default": "empty"
}
]
@@ -80,28 +80,28 @@
},
{ "item_name": "value9",
"item_type": "map",
- "item_optional": False,
+ "item_optional": false,
"item_default": {},
"map_item_spec": [
{ "item_name": "v91",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "def"
},
{ "item_name": "v92",
"item_type": "map",
- "item_optional": False,
+ "item_optional": false,
"item_default": {},
"map_item_spec": [
{ "item_name": "v92a",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "Hello"
} ,
{
"item_name": "v92b",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 47806
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec23.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec23.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec23.spec Wed Jul 21 04:02:13 2010
@@ -8,7 +8,7 @@
"command_args": [ {
"item_name": "message",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": ""
} ]
}
Modified: branches/trac221b/src/lib/config/testdata/spec24.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec24.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec24.spec Wed Jul 21 04:02:13 2010
@@ -4,11 +4,11 @@
"config_data": [
{ "item_name": "item",
"item_type": "list",
- "item_optional": True,
+ "item_optional": true,
"list_item_spec": {
"item_name": "list_element",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": ""
}
}
Modified: branches/trac221b/src/lib/config/testdata/spec27.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec27.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec27.spec Wed Jul 21 04:02:13 2010
@@ -3,81 +3,81 @@
"module_name": "Spec27",
"commands": [
{
- 'command_name': 'cmd1',
+ "command_name": "cmd1",
"command_description": "command_for_unittest",
- 'command_args': [
+ "command_args": [
{
"item_name": "value1",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 9
},
{ "item_name": "value2",
"item_type": "real",
- "item_optional": False,
+ "item_optional": false,
"item_default": 9.9
},
{ "item_name": "value3",
"item_type": "boolean",
- "item_optional": False,
- "item_default": False
+ "item_optional": false,
+ "item_default": false
},
{ "item_name": "value4",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "default_string"
},
{ "item_name": "value5",
"item_type": "list",
- "item_optional": False,
+ "item_optional": false,
"item_default": [ "a", "b" ],
"list_item_spec": {
"item_name": "list_element",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 8
}
},
{ "item_name": "value6",
"item_type": "map",
- "item_optional": False,
+ "item_optional": false,
"item_default": {},
"map_item_spec": [
{ "item_name": "v61",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "def"
},
{ "item_name": "v62",
"item_type": "boolean",
- "item_optional": False,
- "item_default": False
+ "item_optional": false,
+ "item_default": false
}
]
},
{ "item_name": "value7",
"item_type": "list",
- "item_optional": True,
+ "item_optional": true,
"item_default": [ ],
"list_item_spec": {
"item_name": "list_element",
"item_type": "any",
- "item_optional": True
+ "item_optional": true
}
},
{ "item_name": "value8",
"item_type": "list",
- "item_optional": True,
+ "item_optional": true,
"item_default": [ ],
"list_item_spec": {
"item_name": "list_element",
"item_type": "map",
- "item_optional": True,
+ "item_optional": true,
"item_default": { "a": "b" },
"map_item_spec": [
{ "item_name": "a",
"item_type": "string",
- "item_optional": True,
+ "item_optional": true,
"item_default": "empty"
}
]
@@ -85,28 +85,28 @@
},
{ "item_name": "value9",
"item_type": "map",
- "item_optional": False,
+ "item_optional": false,
"item_default": {},
"map_item_spec": [
{ "item_name": "v91",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "def"
},
{ "item_name": "v92",
"item_type": "map",
- "item_optional": False,
+ "item_optional": false,
"item_default": {},
"map_item_spec": [
{ "item_name": "v92a",
"item_type": "string",
- "item_optional": False,
+ "item_optional": false,
"item_default": "Hello"
} ,
{
"item_name": "v92b",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 47806
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec3.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec3.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec3.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec4.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec4.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec4.spec Wed Jul 21 04:02:13 2010
@@ -3,7 +3,7 @@
"module_name": "Spec2",
"config_data": [
{ "item_name": "item1",
- "item_optional": False,
+ "item_optional": false,
"item_default": 1
}
]
Modified: branches/trac221b/src/lib/config/testdata/spec6.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec6.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec6.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "integer",
- "item_optional": False
+ "item_optional": false
}
]
}
Modified: branches/trac221b/src/lib/config/testdata/spec9.spec
==============================================================================
--- branches/trac221b/src/lib/config/testdata/spec9.spec (original)
+++ branches/trac221b/src/lib/config/testdata/spec9.spec Wed Jul 21 04:02:13 2010
@@ -4,7 +4,7 @@
"config_data": [
{ "item_name": "item1",
"item_type": "integer",
- "item_optional": False,
+ "item_optional": false,
"item_default": "asdf"
}
]
Modified: branches/trac221b/src/lib/config/tests/Makefile.am
==============================================================================
--- branches/trac221b/src/lib/config/tests/Makefile.am (original)
+++ branches/trac221b/src/lib/config/tests/Makefile.am Wed Jul 21 04:02:13 2010
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src/lib
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CXXFLAGS = $(B10_CXXFLAGS)
# see src/lib/cc/Makefile.am for -Wno-unused-parameter
Modified: branches/trac221b/src/lib/config/tests/ccsession_unittests.cc
==============================================================================
--- branches/trac221b/src/lib/config/tests/ccsession_unittests.cc (original)
+++ branches/trac221b/src/lib/config/tests/ccsession_unittests.cc Wed Jul 21 04:02:13 2010
@@ -24,7 +24,7 @@
#include <fstream>
-#include "data_def_unittests_config.h"
+#include <config/tests/data_def_unittests_config.h>
using namespace isc::data;
using namespace isc::config;
@@ -383,4 +383,40 @@
session.getMessages()->add(createAnswer());
mccs.addRemoteConfig(ccspecfile("spec2.spec"));
}
-}
+
+TEST_F(CCSessionTest, ignoreRemoteConfigCommands) {
+ // client will ask for config
+ session.getMessages()->add(createAnswer(0, el("{ }")));
+
+ EXPECT_EQ(false, session.haveSubscription("Spec2", "*"));
+ ModuleCCSession mccs(ccspecfile("spec2.spec"), session, my_config_handler, my_command_handler);
+ EXPECT_EQ(true, session.haveSubscription("Spec2", "*"));
+
+ EXPECT_EQ(2, session.getMsgQueue()->size());
+ ElementPtr msg;
+ std::string group, to;
+ // drop the module_spec and config commands
+ session.getFirstMessage(group, to);
+ session.getFirstMessage(group, to);
+
+ session.getMessages()->add(createAnswer(0, el("{ }")));
+ mccs.addRemoteConfig(ccspecfile("spec1.spec"));
+ EXPECT_EQ(1, session.getMsgQueue()->size());
+ msg = session.getFirstMessage(group, to);
+
+ // Check if commands for the module are handled
+ session.addMessage(el("{ \"command\": [ \"good_command\" ] }"), "Spec2", "*");
+ int result = mccs.checkCommand();
+ EXPECT_EQ(1, session.getMsgQueue()->size());
+ msg = session.getFirstMessage(group, to);
+ EXPECT_EQ("{ \"result\": [ 0 ] }", msg->str());
+ EXPECT_EQ(0, result);
+
+ // Check if commands for the other module are ignored
+ session.addMessage(el("{ \"command\": [ \"good_command\" ] }"), "Spec1", "*");
+ EXPECT_EQ(1, session.getMsgQueue()->size());
+ result = mccs.checkCommand();
+ EXPECT_EQ(0, session.getMsgQueue()->size());
+}
+
+}
Modified: branches/trac221b/src/lib/config/tests/config_data_unittests.cc
==============================================================================
--- branches/trac221b/src/lib/config/tests/config_data_unittests.cc (original)
+++ branches/trac221b/src/lib/config/tests/config_data_unittests.cc Wed Jul 21 04:02:13 2010
@@ -17,7 +17,7 @@
#include <gtest/gtest.h>
-#include "data_def_unittests_config.h"
+#include <config/tests/data_def_unittests_config.h>
#include <config/config_data.h>
#include <iostream>
Modified: branches/trac221b/src/lib/config/tests/fake_session.cc
==============================================================================
--- branches/trac221b/src/lib/config/tests/fake_session.cc (original)
+++ branches/trac221b/src/lib/config/tests/fake_session.cc Wed Jul 21 04:02:13 2010
@@ -14,7 +14,7 @@
// $Id: session.cc 1250 2010-03-09 22:52:15Z jinmei $
-#include "config.h"
+#include <config.h>
#include <stdint.h>
@@ -28,7 +28,7 @@
#include <exceptions/exceptions.h>
#include <cc/data.h>
-#include "fake_session.h"
+#include <config/tests/fake_session.h>
using namespace std;
using namespace isc::cc;
Modified: branches/trac221b/src/lib/config/tests/module_spec_unittests.cc
==============================================================================
--- branches/trac221b/src/lib/config/tests/module_spec_unittests.cc (original)
+++ branches/trac221b/src/lib/config/tests/module_spec_unittests.cc Wed Jul 21 04:02:13 2010
@@ -20,7 +20,7 @@
#include <fstream>
-#include "data_def_unittests_config.h"
+#include <config/tests/data_def_unittests_config.h>
using namespace isc::data;
using namespace isc::config;
Modified: branches/trac221b/src/lib/datasrc/cache.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/cache.cc (original)
+++ branches/trac221b/src/lib/datasrc/cache.cc Wed Jul 21 04:02:13 2010
@@ -240,8 +240,7 @@
if (node->lru_entry_ == lru_.begin()) {
return;
}
- lru_.erase(node->lru_entry_);
- lru_.push_front(node);
+ lru_.splice(lru_.begin(), lru_, node->lru_entry_); // move node to front
node->lru_entry_ = lru_.begin();
}
Modified: branches/trac221b/src/lib/datasrc/data_source.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/data_source.cc (original)
+++ branches/trac221b/src/lib/datasrc/data_source.cc Wed Jul 21 04:02:13 2010
@@ -14,7 +14,7 @@
// $Id$
-#include "config.h"
+#include <config.h>
#include <cassert>
#include <iomanip>
@@ -28,14 +28,14 @@
#include <datasrc/data_source.h>
#include <datasrc/query.h>
-#include <dns/base32.h>
+#include <dns/util/base32hex.h>
#include <dns/buffer.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/rrset.h>
#include <dns/rrsetlist.h>
-#include <dns/sha1.h>
+#include <dns/util/sha1.h>
#include <cc/data.h>
@@ -1234,7 +1234,7 @@
inlength = SHA1_HASHSIZE;
} while (n++ < iterations_);
- return (encodeBase32(vector<uint8_t>(digest, digest + SHA1_HASHSIZE)));
+ return (encodeBase32Hex(vector<uint8_t>(digest, digest + SHA1_HASHSIZE)));
}
//
Modified: branches/trac221b/src/lib/datasrc/query.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/query.cc (original)
+++ branches/trac221b/src/lib/datasrc/query.cc Wed Jul 21 04:02:13 2010
@@ -21,7 +21,7 @@
#include <cc/data.h>
-#include "query.h"
+#include <datasrc/query.h>
using namespace isc::dns;
Modified: branches/trac221b/src/lib/datasrc/sqlite3_datasrc.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/sqlite3_datasrc.cc (original)
+++ branches/trac221b/src/lib/datasrc/sqlite3_datasrc.cc Wed Jul 21 04:02:13 2010
@@ -19,7 +19,7 @@
#include <sqlite3.h>
-#include "sqlite3_datasrc.h"
+#include <datasrc/sqlite3_datasrc.h>
#include <dns/rrttl.h>
#include <dns/rdata.h>
@@ -263,15 +263,16 @@
isc_throw(Sqlite3Error, "Could not bind zone ID " << zone_id <<
" to SQL statement (query)");
}
- const string s_name = name.toText();
- rc = sqlite3_bind_text(query, 2, s_name.c_str(), -1, SQLITE_STATIC);
- if (rc != SQLITE_OK) {
- isc_throw(Sqlite3Error, "Could not bind name " << s_name <<
+ const string name_text = name.toText();
+ rc = sqlite3_bind_text(query, 2, name_text.c_str(), -1, SQLITE_STATIC);
+ if (rc != SQLITE_OK) {
+ isc_throw(Sqlite3Error, "Could not bind name " << name_text <<
" to SQL statement (query)");
}
+ const string rdtype_text = rdtype.toText();
if (query == dbparameters->q_record_) {
- rc = sqlite3_bind_text(query, 3, rdtype.toText().c_str(), -1,
+ rc = sqlite3_bind_text(query, 3, rdtype_text.c_str(), -1,
SQLITE_STATIC);
if (rc != SQLITE_OK) {
isc_throw(Sqlite3Error, "Could not bind RR type " <<
@@ -300,8 +301,9 @@
" to SQL statement (qcount)");
}
- rc = sqlite3_bind_text(dbparameters->q_count_, 2,
- name.reverse().toText().c_str(), -1, SQLITE_STATIC);
+ const string revname_text = name.reverse().toText();
+ rc = sqlite3_bind_text(dbparameters->q_count_, 2, revname_text.c_str(),
+ -1, SQLITE_STATIC);
if (rc != SQLITE_OK) {
isc_throw(Sqlite3Error, "Could not bind name " << name.reverse() <<
" to SQL statement (qcount)");
@@ -376,8 +378,9 @@
isc_throw(Sqlite3Error, "Could not bind zone ID " << zone_id <<
" to SQL statement (qprevious)");
}
+ const string revname_text = qname.reverse().toText();
rc = sqlite3_bind_text(dbparameters->q_previous_, 2,
- qname.reverse().toText().c_str(), -1, SQLITE_STATIC);
+ revname_text.c_str(), -1, SQLITE_STATIC);
if (rc != SQLITE_OK) {
isc_throw(Sqlite3Error, "Could not bind name " << qname <<
" to SQL statement (qprevious)");
Modified: branches/trac221b/src/lib/datasrc/sqlite3_datasrc.h
==============================================================================
--- branches/trac221b/src/lib/datasrc/sqlite3_datasrc.h (original)
+++ branches/trac221b/src/lib/datasrc/sqlite3_datasrc.h Wed Jul 21 04:02:13 2010
@@ -21,7 +21,7 @@
#include <exceptions/exceptions.h>
-#include "data_source.h"
+#include <datasrc/data_source.h>
namespace isc {
Modified: branches/trac221b/src/lib/datasrc/static_datasrc.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/static_datasrc.cc (original)
+++ branches/trac221b/src/lib/datasrc/static_datasrc.cc Wed Jul 21 04:02:13 2010
@@ -14,7 +14,7 @@
// $Id$
-#include "config.h"
+#include <config.h>
#include <cassert>
@@ -26,8 +26,8 @@
#include <dns/rrtype.h>
#include <dns/rrttl.h>
-#include "data_source.h"
-#include "static_datasrc.h"
+#include <datasrc/data_source.h>
+#include <datasrc/static_datasrc.h>
using namespace std;
using namespace isc::dns;
Modified: branches/trac221b/src/lib/datasrc/static_datasrc.h
==============================================================================
--- branches/trac221b/src/lib/datasrc/static_datasrc.h (original)
+++ branches/trac221b/src/lib/datasrc/static_datasrc.h Wed Jul 21 04:02:13 2010
@@ -25,7 +25,7 @@
#ifndef __STATIC_DATA_SOURCE_H
#define __STATIC_DATA_SOURCE_H
-#include "data_source.h"
+#include <datasrc/data_source.h>
namespace isc {
Modified: branches/trac221b/src/lib/datasrc/tests/Makefile.am
==============================================================================
--- branches/trac221b/src/lib/datasrc/tests/Makefile.am (original)
+++ branches/trac221b/src/lib/datasrc/tests/Makefile.am Wed Jul 21 04:02:13 2010
@@ -37,27 +37,6 @@
EXTRA_DIST += testdata/example2.com
EXTRA_DIST += testdata/example2.com.sqlite3
EXTRA_DIST += testdata/mkbrokendb.c
-EXTRA_DIST += testdata/q_cname
-EXTRA_DIST += testdata/q_cname_ext
-EXTRA_DIST += testdata/q_cname_int
-EXTRA_DIST += testdata/q_dname
-EXTRA_DIST += testdata/q_example_dnskey
-EXTRA_DIST += testdata/q_example_ns
-EXTRA_DIST += testdata/q_example_ptr
-EXTRA_DIST += testdata/q_glork
-EXTRA_DIST += testdata/q_spork
-EXTRA_DIST += testdata/q_sql1
-EXTRA_DIST += testdata/q_subzone
-EXTRA_DIST += testdata/q_subzone_any
-EXTRA_DIST += testdata/q_subzone_dname
-EXTRA_DIST += testdata/q_subzone_ds
-EXTRA_DIST += testdata/q_subzone_ns
-EXTRA_DIST += testdata/q_subzone_nsec
-EXTRA_DIST += testdata/q_wild2_a
-EXTRA_DIST += testdata/q_wild2_aaaa
-EXTRA_DIST += testdata/q_wild3_a
-EXTRA_DIST += testdata/q_wild_a
-EXTRA_DIST += testdata/q_wild_aaaa
EXTRA_DIST += testdata/root.zone
EXTRA_DIST += testdata/sql1.example.com.signed
EXTRA_DIST += testdata/sql2.example.com.signed
Modified: branches/trac221b/src/lib/datasrc/tests/datasrc_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/tests/datasrc_unittest.cc (original)
+++ branches/trac221b/src/lib/datasrc/tests/datasrc_unittest.cc Wed Jul 21 04:02:13 2010
@@ -39,7 +39,7 @@
#include <datasrc/static_datasrc.h>
#include <dns/tests/unittest_util.h>
-#include "test_datasrc.h"
+#include <datasrc/tests/test_datasrc.h>
using isc::UnitTestUtil;
using namespace std;
@@ -65,7 +65,6 @@
meta_source.addDataSrc(static_source);
}
void QueryCommon(const RRClass& qclass);
- void readAndProcessQuery(const char* datafile);
void createAndProcessQuery(const Name& qname, const RRClass& qclass,
const RRType& qtype);
@@ -82,18 +81,6 @@
message.setRcode(Rcode::NOERROR());
Query q(message, cache, true);
data_source.doQuery(q);
-}
-
-void
-DataSrcTest::readAndProcessQuery(const char* datafile) {
- std::vector<unsigned char> data;
- UnitTestUtil::readWireData(datafile, data);
-
- InputBuffer buffer(&data[0], data.size());
- msg.fromWire(buffer);
-
- msg.makeResponse();
- performQuery(meta_source, cache, msg);
}
void
@@ -193,8 +180,8 @@
}
TEST_F(DataSrcTest, NSQuery) {
- readAndProcessQuery("q_example_ns");
-
+ createAndProcessQuery(Name("example.com"), RRClass::IN(),
+ RRType::NS());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 0, 6);
RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -216,7 +203,8 @@
// Make sure two successive queries have the same result
TEST_F(DataSrcTest, DuplicateQuery) {
- readAndProcessQuery("q_example_ns");
+ createAndProcessQuery(Name("example.com"), RRClass::IN(),
+ RRType::NS());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 0, 6);
RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -236,7 +224,8 @@
EXPECT_TRUE(it->isLast());
msg.clear(Message::PARSE);
- readAndProcessQuery("q_example_ns");
+ createAndProcessQuery(Name("example.com"), RRClass::IN(),
+ RRType::NS());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 0, 6);
rit = msg.beginSection(Section::ANSWER());
@@ -257,7 +246,8 @@
}
TEST_F(DataSrcTest, DNSKEYQuery) {
- readAndProcessQuery("q_example_dnskey");
+ createAndProcessQuery(Name("example.com"), RRClass::IN(),
+ RRType::DNSKEY());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -271,7 +261,8 @@
// We query for a record at a zone cut to ensure the REFERRAL flag doesn't
// cause incorrect behavior.
TEST_F(DataSrcTest, DNSKEYDuplicateQuery) {
- readAndProcessQuery("q_example_dnskey");
+ createAndProcessQuery(Name("example.com"), RRClass::IN(),
+ RRType::DNSKEY());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -281,9 +272,8 @@
EXPECT_EQ(RRClass::IN(), rrset->getClass());
msg.clear(Message::PARSE);
- readAndProcessQuery("q_example_dnskey");
- headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
-
+ createAndProcessQuery(Name("example.com"), RRClass::IN(),
+ RRType::DNSKEY());
rit = msg.beginSection(Section::ANSWER());
rrset = *rit;
EXPECT_EQ(Name("example.com"), rrset->getName());
@@ -292,7 +282,8 @@
}
TEST_F(DataSrcTest, NxRRset) {
- readAndProcessQuery("q_example_ptr");
+ createAndProcessQuery(Name("example.com"), RRClass::IN(),
+ RRType::PTR());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 4, 0);
@@ -303,7 +294,8 @@
}
TEST_F(DataSrcTest, Nxdomain) {
- readAndProcessQuery("q_glork");
+ createAndProcessQuery(Name("glork.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NXDOMAIN(), true, true, true, 0, 6, 0);
@@ -316,7 +308,8 @@
}
TEST_F(DataSrcTest, NxZone) {
- readAndProcessQuery("q_spork");
+ createAndProcessQuery(Name("spork.example"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::REFUSED(), true, false, true, 0, 0, 0);
@@ -327,7 +320,8 @@
}
TEST_F(DataSrcTest, Wildcard) {
- readAndProcessQuery("q_wild_a");
+ createAndProcessQuery(Name("www.wild.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 6, 6);
@@ -380,17 +374,26 @@
}
TEST_F(DataSrcTest, WildcardNodata) {
-
// Check that a query for a data type not covered by the wildcard
// returns NOERROR
- readAndProcessQuery("q_wild_aaaa");
+ createAndProcessQuery(Name("www.wild.example.com"), RRClass::IN(),
+ RRType::AAAA());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 2, 0);
+}
+
+TEST_F(DataSrcTest, DISABLED_WildcardAgainstMultiLabel) {
+ // this qname shouldn't match *.wild.com.com (because * can only match
+ // a single label), and it should result in NXDOMAIN.
+ createAndProcessQuery(Name("www.xxx.wild.example.com"), RRClass::IN(),
+ RRType::A());
+ headerCheck(msg, Rcode::NXDOMAIN(), true, true, true, 0, 1, 0);
}
TEST_F(DataSrcTest, WildcardCname) {
// Check that wildcard answers containing CNAMES are followed
// correctly
- readAndProcessQuery("q_wild2_a");
+ createAndProcessQuery(Name("www.wild2.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 6, 6);
@@ -458,7 +461,8 @@
TEST_F(DataSrcTest, WildcardCnameNodata) {
// A wildcard containing a CNAME whose target does not include
// data of this type.
- readAndProcessQuery("q_wild2_aaaa");
+ createAndProcessQuery(Name("www.wild2.example.com"), RRClass::IN(),
+ RRType::AAAA());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 0);
RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -489,7 +493,8 @@
TEST_F(DataSrcTest, WildcardCnameNxdomain) {
// A wildcard containing a CNAME whose target does not exist
- readAndProcessQuery("q_wild3_a");
+ createAndProcessQuery(Name("www.wild3.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 6, 0);
RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -525,7 +530,8 @@
EXPECT_EQ(RRClass::IN(), rrset->getClass());
}
TEST_F(DataSrcTest, AuthDelegation) {
- readAndProcessQuery("q_sql1");
+ createAndProcessQuery(Name("www.sql1.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
@@ -571,7 +577,8 @@
}
TEST_F(DataSrcTest, Dname) {
- readAndProcessQuery("q_dname");
+ createAndProcessQuery(Name("www.dname.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 5, 4, 6);
@@ -628,7 +635,8 @@
}
TEST_F(DataSrcTest, Cname) {
- readAndProcessQuery("q_cname");
+ createAndProcessQuery(Name("foo.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 0, 0);
@@ -646,7 +654,8 @@
}
TEST_F(DataSrcTest, CnameInt) {
- readAndProcessQuery("q_cname_int");
+ createAndProcessQuery(Name("cname-int.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
@@ -672,7 +681,8 @@
}
TEST_F(DataSrcTest, CnameExt) {
- readAndProcessQuery("q_cname_ext");
+ createAndProcessQuery(Name("cname-ext.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
@@ -696,7 +706,8 @@
}
TEST_F(DataSrcTest, Delegation) {
- readAndProcessQuery("q_subzone");
+ createAndProcessQuery(Name("www.subzone.example.com"), RRClass::IN(),
+ RRType::A());
headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
@@ -726,7 +737,8 @@
}
TEST_F(DataSrcTest, NSDelegation) {
- readAndProcessQuery("q_subzone_ns");
+ createAndProcessQuery(Name("subzone.example.com"), RRClass::IN(),
+ RRType::NS());
headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
@@ -758,12 +770,13 @@
TEST_F(DataSrcTest, ANYZonecut) {
// An ANY query at a zone cut should behave the same as any other
// delegation
- readAndProcessQuery("q_subzone_any");
-
+ createAndProcessQuery(Name("subzone.example.com"), RRClass::IN(),
+ RRType::ANY());
}
TEST_F(DataSrcTest, NSECZonecut) {
- readAndProcessQuery("q_subzone_nsec");
+ createAndProcessQuery(Name("subzone.example.com"), RRClass::IN(),
+ RRType::NSEC());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
@@ -791,7 +804,8 @@
}
TEST_F(DataSrcTest, DNAMEZonecut) {
- readAndProcessQuery("q_subzone_dname");
+ createAndProcessQuery(Name("subzone.example.com"), RRClass::IN(),
+ RRType::DNAME());
headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
RRsetIterator rit = msg.beginSection(Section::AUTHORITY());
@@ -820,7 +834,8 @@
}
TEST_F(DataSrcTest, DS) {
- readAndProcessQuery("q_subzone_ds");
+ createAndProcessQuery(Name("subzone.example.com"), RRClass::IN(),
+ RRType::DS());
headerCheck(msg, Rcode::NOERROR(), true, true, true, 3, 4, 6);
Modified: branches/trac221b/src/lib/datasrc/tests/query_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/tests/query_unittest.cc (original)
+++ branches/trac221b/src/lib/datasrc/tests/query_unittest.cc Wed Jul 21 04:02:13 2010
@@ -32,20 +32,13 @@
namespace {
-class QueryTest : public ::testing::Test {
-protected:
- void readQuery(Message& m, const char* datafile);
-
- HotCache cache;
-};
-
void
-QueryTest::readQuery(Message& m, const char* datafile) {
- std::vector<unsigned char> data;
- UnitTestUtil::readWireData(datafile, data);
-
- InputBuffer buffer(&data[0], data.size());
- m.fromWire(buffer);
+createQuery(Message& m, const Name& qname, const RRClass& qclass,
+ const RRType& qtype)
+{
+ m.setOpcode(Opcode::QUERY());
+ m.setHeaderFlag(MessageFlag::RD());
+ m.addQuestion(Question(qname, qclass, qtype));
}
QueryTaskPtr
@@ -58,15 +51,18 @@
// Check the QueryTask created using a temporary RRType object will remain
// valid.
-TEST_F(QueryTest, constructWithTemporary) {
- Message m1(Message::PARSE);
- readQuery(m1, "q_wild_a");
+TEST(QueryTest, constructWithTemporary) {
+ HotCache cache;
+
+ Message m1(Message::RENDER);
+ createQuery(m1, Name("www.wild.example.com"), RRClass::IN(), RRType::A());
QueryTaskPtr task_a = createTask(m1, Name("www.wild.example.com"),
RRType::A(), cache);
EXPECT_EQ(RRType::A(), task_a->qtype);
- Message m2(Message::PARSE);
- readQuery(m2, "q_wild_aaaa");
+ Message m2(Message::RENDER);
+ createQuery(m2, Name("www.wild.example.com"), RRClass::IN(),
+ RRType::AAAA());
QueryTaskPtr task_aaaa = createTask(m2, Name("www.wild.example.com"),
RRType::AAAA(), cache);
EXPECT_EQ(RRType::AAAA(), task_aaaa->qtype);
Modified: branches/trac221b/src/lib/datasrc/tests/static_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/tests/static_unittest.cc (original)
+++ branches/trac221b/src/lib/datasrc/tests/static_unittest.cc Wed Jul 21 04:02:13 2010
@@ -18,7 +18,7 @@
#include <string>
#include <vector>
-#include "config.h"
+#include <config.h>
#include <gtest/gtest.h>
Modified: branches/trac221b/src/lib/datasrc/tests/test_datasrc.cc
==============================================================================
--- branches/trac221b/src/lib/datasrc/tests/test_datasrc.cc (original)
+++ branches/trac221b/src/lib/datasrc/tests/test_datasrc.cc Wed Jul 21 04:02:13 2010
@@ -14,14 +14,14 @@
// $Id$
-#include "config.h"
+#include <config.h>
#include <cassert>
#include <algorithm>
#include <dns/tests/unittest_util.h>
-#include "test_datasrc.h"
+#include <datasrc/tests/test_datasrc.h>
#include <datasrc/data_source.h>
Modified: branches/trac221b/src/lib/dns/Makefile.am
==============================================================================
--- branches/trac221b/src/lib/dns/Makefile.am (original)
+++ branches/trac221b/src/lib/dns/Makefile.am Wed Jul 21 04:02:13 2010
@@ -57,12 +57,14 @@
lib_LTLIBRARIES = libdns++.la
-libdns___la_SOURCES = base32.h base32.cc
-libdns___la_SOURCES += base64.h base64.cc
+libdns___la_SOURCES = util/base32hex.h util/base64.h util/base_n.cc
+libdns___la_SOURCES += util/base32hex_from_binary.h
+libdns___la_SOURCES += util/binary_from_base32hex.h
+libdns___la_SOURCES += util/base16_from_binary.h util/binary_from_base16.h
libdns___la_SOURCES += buffer.h
libdns___la_SOURCES += dnssectime.h dnssectime.cc
libdns___la_SOURCES += exceptions.h exceptions.cc
-libdns___la_SOURCES += hex.h hex.cc
+libdns___la_SOURCES += util/hex.h
libdns___la_SOURCES += message.h message.cc
libdns___la_SOURCES += messagerenderer.h messagerenderer.cc
libdns___la_SOURCES += name.h name.cc
@@ -74,7 +76,7 @@
libdns___la_SOURCES += rrttl.h rrttl.cc
libdns___la_SOURCES += rrtype.cc
libdns___la_SOURCES += question.h question.cc
-libdns___la_SOURCES += sha1.h sha1.cc
+libdns___la_SOURCES += util/sha1.h util/sha1.cc
libdns___la_SOURCES += tsig.h tsig.cc
nodist_libdns___la_SOURCES = rdataclass.cc rrclass.h rrtype.h
@@ -105,9 +107,6 @@
rrtype.h \
tsig.h
# Purposely not installing these headers:
-# base32.h # used only internally, and not actually DNS specific
-# base64.h # used only internally, and not actually DNS specific
-# hex.h # used only internally, and not actually DNS specific
-# sha1.h # used only internally, and not actually DNS specific
+# util/*.h: used only internally, and not actually DNS specific
# rrclass-placeholder.h
# rrtype-placeholder.h
Modified: branches/trac221b/src/lib/dns/python/libdns_python.cc
==============================================================================
--- branches/trac221b/src/lib/dns/python/libdns_python.cc (original)
+++ branches/trac221b/src/lib/dns/python/libdns_python.cc Wed Jul 21 04:02:13 2010
@@ -27,7 +27,7 @@
#include <Python.h>
#include <structmember.h>
-#include "config.h"
+#include <config.h>
#include <exceptions/exceptions.h>
@@ -36,22 +36,22 @@
#include <dns/name.h>
#include <dns/messagerenderer.h>
-#include "libdns_python_common.h"
+#include <dns/python/libdns_python_common.h>
// For our 'general' isc::Exception
static PyObject* po_IscException;
// order is important here!
-#include "messagerenderer_python.cc"
-#include "name_python.cc" // needs Messagerenderer
-#include "rrclass_python.cc" // needs Messagerenderer
-#include "rrtype_python.cc" // needs Messagerenderer
-#include "rrttl_python.cc" // needs Messagerenderer
-#include "rdata_python.cc" // needs Type, Class
-#include "rrset_python.cc" // needs Rdata, RRTTL
-#include "question_python.cc" // needs RRClass, RRType, RRTTL,
- // Name
-#include "message_python.cc" // needs RRset, Question
+#include <dns/python/messagerenderer_python.cc>
+#include <dns/python/name_python.cc> // needs Messagerenderer
+#include <dns/python/rrclass_python.cc> // needs Messagerenderer
+#include <dns/python/rrtype_python.cc> // needs Messagerenderer
+#include <dns/python/rrttl_python.cc> // needs Messagerenderer
+#include <dns/python/rdata_python.cc> // needs Type, Class
+#include <dns/python/rrset_python.cc> // needs Rdata, RRTTL
+#include <dns/python/question_python.cc> // needs RRClass, RRType, RRTTL,
+ // Name
+#include <dns/python/message_python.cc> // needs RRset, Question
//
// Definition of the module
Modified: branches/trac221b/src/lib/dns/rdata/generic/dnskey_48.cc
==============================================================================
--- branches/trac221b/src/lib/dns/rdata/generic/dnskey_48.cc (original)
+++ branches/trac221b/src/lib/dns/rdata/generic/dnskey_48.cc Wed Jul 21 04:02:13 2010
@@ -22,7 +22,7 @@
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
-#include <dns/base64.h>
+#include <dns/util/base64.h>
#include <dns/buffer.h>
#include <dns/messagerenderer.h>
#include <dns/name.h>
Modified: branches/trac221b/src/lib/dns/rdata/generic/ds_43.cc
==============================================================================
--- branches/trac221b/src/lib/dns/rdata/generic/ds_43.cc (original)
+++ branches/trac221b/src/lib/dns/rdata/generic/ds_43.cc Wed Jul 21 04:02:13 2010
@@ -22,7 +22,7 @@
#include <boost/lexical_cast.hpp>
#include <dns/buffer.h>
-#include <dns/hex.h>
+#include <dns/util/hex.h>
#include <dns/messagerenderer.h>
#include <dns/name.h>
#include <dns/rdata.h>
Modified: branches/trac221b/src/lib/dns/rdata/generic/nsec3_50.cc
==============================================================================
--- branches/trac221b/src/lib/dns/rdata/generic/nsec3_50.cc (original)
+++ branches/trac221b/src/lib/dns/rdata/generic/nsec3_50.cc Wed Jul 21 04:02:13 2010
@@ -22,10 +22,10 @@
#include <boost/lexical_cast.hpp>
-#include <dns/base32.h>
+#include <dns/util/base32hex.h>
#include <dns/buffer.h>
#include <dns/exceptions.h>
-#include <dns/hex.h>
+#include <dns/util/hex.h>
#include <dns/messagerenderer.h>
#include <dns/name.h>
#include <dns/rrtype.h>
@@ -88,7 +88,7 @@
if (iss.bad() || iss.fail()) {
isc_throw(InvalidRdataText, "Invalid NSEC3 hash algorithm");
}
- decodeBase32(nextstr, next);
+ decodeBase32Hex(nextstr, next);
uint8_t bitmap[8 * 1024]; // 64k bits
vector<uint8_t> typebits;
@@ -237,7 +237,7 @@
" " + lexical_cast<string>(static_cast<int>(impl_->flags_)) +
" " + lexical_cast<string>(static_cast<int>(impl_->iterations_)) +
" " + encodeHex(impl_->salt_) +
- " " + encodeBase32(impl_->next_) + s.str());
+ " " + encodeBase32Hex(impl_->next_) + s.str());
}
void
Modified: branches/trac221b/src/lib/dns/rdata/generic/nsec3param_51.cc
==============================================================================
--- branches/trac221b/src/lib/dns/rdata/generic/nsec3param_51.cc (original)
+++ branches/trac221b/src/lib/dns/rdata/generic/nsec3param_51.cc Wed Jul 21 04:02:13 2010
@@ -22,7 +22,7 @@
#include <boost/lexical_cast.hpp>
#include <dns/buffer.h>
-#include <dns/hex.h>
+#include <dns/util/hex.h>
#include <dns/messagerenderer.h>
#include <dns/name.h>
#include <dns/rdata.h>
Modified: branches/trac221b/src/lib/dns/rdata/generic/nsec_47.cc
==============================================================================
--- branches/trac221b/src/lib/dns/rdata/generic/nsec_47.cc (original)
+++ branches/trac221b/src/lib/dns/rdata/generic/nsec_47.cc Wed Jul 21 04:02:13 2010
@@ -19,7 +19,7 @@
#include <sstream>
#include <vector>
-#include <dns/base64.h>
+#include <dns/util/base64.h>
#include <dns/buffer.h>
#include <dns/exceptions.h>
#include <dns/messagerenderer.h>
Modified: branches/trac221b/src/lib/dns/rdata/generic/rrsig_46.cc
==============================================================================
--- branches/trac221b/src/lib/dns/rdata/generic/rrsig_46.cc (original)
+++ branches/trac221b/src/lib/dns/rdata/generic/rrsig_46.cc Wed Jul 21 04:02:13 2010
@@ -22,7 +22,7 @@
#include <boost/lexical_cast.hpp>
-#include <dns/base64.h>
+#include <dns/util/base64.h>
#include <dns/buffer.h>
#include <dns/dnssectime.h>
#include <dns/messagerenderer.h>
Modified: branches/trac221b/src/lib/dns/tests/Makefile.am
==============================================================================
--- branches/trac221b/src/lib/dns/tests/Makefile.am (original)
+++ branches/trac221b/src/lib/dns/tests/Makefile.am Wed Jul 21 04:02:13 2010
@@ -31,7 +31,7 @@
run_unittests_SOURCES += question_unittest.cc
run_unittests_SOURCES += rrparamregistry_unittest.cc
run_unittests_SOURCES += message_unittest.cc
-run_unittests_SOURCES += base32_unittest.cc
+run_unittests_SOURCES += base32hex_unittest.cc
run_unittests_SOURCES += base64_unittest.cc
run_unittests_SOURCES += hex_unittest.cc
run_unittests_SOURCES += sha1_unittest.cc
Modified: branches/trac221b/src/lib/dns/tests/base64_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/base64_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/base64_unittest.cc Wed Jul 21 04:02:13 2010
@@ -18,11 +18,14 @@
#include <utility>
#include <vector>
-#include <dns/base64.h>
+#include <exceptions/exceptions.h>
+
+#include <dns/util/base64.h>
#include <gtest/gtest.h>
using namespace std;
+using namespace isc;
using namespace isc::dns;
namespace {
@@ -67,18 +70,18 @@
decodeCheck("Zm9vYmE=\n", decoded_data, "fooba");
// only up to 2 padding characters are allowed
- EXPECT_THROW(decodeBase64("A===", decoded_data), BadBase64String);
- EXPECT_THROW(decodeBase64("A= ==", decoded_data), BadBase64String);
+ EXPECT_THROW(decodeBase64("A===", decoded_data), BadValue);
+ EXPECT_THROW(decodeBase64("A= ==", decoded_data), BadValue);
// intermediate padding isn't allowed
- EXPECT_THROW(decodeBase64("YmE=YmE=", decoded_data), BadBase64String);
+ EXPECT_THROW(decodeBase64("YmE=YmE=", decoded_data), BadValue);
// Non canonical form isn't allowed.
// Z => 25(011001), m => 38(100110), 9 => 60(111101), so the padding
// byte would be 0100 0000.
- EXPECT_THROW(decodeBase64("Zm9=", decoded_data), BadBase64String);
+ EXPECT_THROW(decodeBase64("Zm9=", decoded_data), BadValue);
// Same for the 1st padding byte. This would make it 01100000.
- EXPECT_THROW(decodeBase64("Zm==", decoded_data), BadBase64String);
+ EXPECT_THROW(decodeBase64("Zm==", decoded_data), BadValue);
}
TEST_F(Base64Test, encode) {
Modified: branches/trac221b/src/lib/dns/tests/hex_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/hex_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/hex_unittest.cc Wed Jul 21 04:02:13 2010
@@ -19,25 +19,27 @@
#include <vector>
#include <string>
-#include <dns/hex.h>
+#include <exceptions/exceptions.h>
+
+#include <dns/util/hex.h>
#include <gtest/gtest.h>
-#include "unittest_util.h"
-
-using isc::UnitTestUtil;
using namespace std;
+using namespace isc;
using namespace isc::dns;
namespace {
+const string hex_txt("DEADBEEFDECADE");
+const string hex_txt_space("DEAD BEEF DECADE");
+const string hex_txt_lower("deadbeefdecade");
+
class HexTest : public ::testing::Test {
protected:
- HexTest() {}
+ HexTest() : encoding_chars("0123456789ABCDEF") {}
+ vector<uint8_t> decoded_data;
+ const string encoding_chars;
};
-
-const std::string hex_txt("DEADBEEFDECADE");
-const std::string hex_txt_space("DEAD BEEF DECADE");
-const std::string hex_txt_lower("deadbeefdecade");
TEST_F(HexTest, encodeHex) {
std::vector<uint8_t> data;
@@ -53,8 +55,7 @@
}
void
-compareData(const std::vector<uint8_t>& data)
-{
+compareData(const std::vector<uint8_t>& data) {
EXPECT_EQ(0xde, data[0]);
EXPECT_EQ(0xad, data[1]);
EXPECT_EQ(0xbe, data[2]);
@@ -82,7 +83,40 @@
// Bogus input: should fail
result.clear();
- EXPECT_THROW(decodeHex("1x", result), BadHexString);
+ EXPECT_THROW(decodeHex("1x", result), BadValue);
+
+ // Bogus input: encoded string must have an even number of characters.
+ result.clear();
+ EXPECT_THROW(decodeHex("dea", result), BadValue);
+}
+
+// For Hex encode/decode we use handmade mappings, so it's prudent to test the
+// entire mapping table explicitly.
+TEST_F(HexTest, decodeMap) {
+ string input("00"); // input placeholder
+
+ // See Base32HexTest.decodeMap for details of the following tests.
+ for (int i = 0; i < 256; ++i) {
+ input[1] = i;
+
+ const char ch = toupper(i);
+ const size_t pos = encoding_chars.find(ch);
+ if (pos == string::npos) {
+ EXPECT_THROW(decodeHex(input, decoded_data), BadValue);
+ } else {
+ decodeHex(input, decoded_data);
+ EXPECT_EQ(1, decoded_data.size());
+ EXPECT_EQ(pos, decoded_data[0]);
+ }
+ }
+}
+
+TEST_F(HexTest, encodeMap) {
+ for (int i = 0; i < 16; ++i) {
+ decoded_data.clear();
+ decoded_data.push_back(i);
+ EXPECT_EQ(encoding_chars[i], encodeHex(decoded_data)[1]);
+ }
}
}
Modified: branches/trac221b/src/lib/dns/tests/message_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/message_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/message_unittest.cc Wed Jul 21 04:02:13 2010
@@ -28,7 +28,7 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/messagerenderer_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/messagerenderer_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/messagerenderer_unittest.cc Wed Jul 21 04:02:13 2010
@@ -20,7 +20,7 @@
#include <dns/name.h>
#include <dns/messagerenderer.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
#include <gtest/gtest.h>
Modified: branches/trac221b/src/lib/dns/tests/name_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/name_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/name_unittest.cc Wed Jul 21 04:02:13 2010
@@ -26,7 +26,7 @@
#include <dns/name.h>
#include <dns/messagerenderer.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
#include <gtest/gtest.h>
Modified: branches/trac221b/src/lib/dns/tests/question_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/question_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/question_unittest.cc Wed Jul 21 04:02:13 2010
@@ -29,7 +29,7 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_cname_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_cname_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_cname_unittest.cc Wed Jul 21 04:02:13 2010
@@ -24,8 +24,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_dname_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_dname_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_dname_unittest.cc Wed Jul 21 04:02:13 2010
@@ -24,8 +24,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_dnskey_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_dnskey_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_dnskey_unittest.cc Wed Jul 21 04:02:13 2010
@@ -16,7 +16,8 @@
#include <string>
-#include <dns/base64.h>
+#include <exceptions/exceptions.h>
+
#include <dns/buffer.h>
#include <dns/messagerenderer.h>
#include <dns/rdata.h>
@@ -26,11 +27,12 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
+using namespace isc;
using namespace isc::dns;
using namespace isc::dns::rdata;
@@ -48,21 +50,18 @@
"7+ysyLKOOedS39Z7SDmsn2eA0FKtQpwA6LXeG2w+jxmw3oA"
"8lVUgEf/rzeC/bByBNsO70aEFTd");
-TEST_F(Rdata_DNSKEY_Test, fromText)
-{
+TEST_F(Rdata_DNSKEY_Test, fromText) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(dnskey_txt, rdata_dnskey.toText());
}
-TEST_F(Rdata_DNSKEY_Test, assign)
-{
+TEST_F(Rdata_DNSKEY_Test, assign) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
generic::DNSKEY rdata_dnskey2 = rdata_dnskey;
EXPECT_EQ(0, rdata_dnskey.compare(rdata_dnskey2));
}
-TEST_F(Rdata_DNSKEY_Test, badText)
-{
+TEST_F(Rdata_DNSKEY_Test, badText) {
EXPECT_THROW(generic::DNSKEY("257 3 5"),
InvalidRdataText);
EXPECT_THROW(generic::DNSKEY("99999 3 5 BAAAAAAAAAAAD"),
@@ -71,9 +70,10 @@
InvalidRdataText);
EXPECT_THROW(generic::DNSKEY("257 3 500 BAAAAAAAAAAAD"),
InvalidRdataText);
- EXPECT_THROW(generic::DNSKEY("257 3 5 BAAAAAAAAAAAD"),
- BadBase64String);
-#if 0
+ EXPECT_THROW(generic::DNSKEY("257 3 5 BAAAAAAAAAAAD"), BadValue);
+}
+
+TEST_F(Rdata_DNSKEY_Test, DISABLED_badText) {
// Should this be allowed? Probably not. But the test currently fails.
EXPECT_THROW(generic::DNSKEY("257 3 5BEAAEFTd"),
InvalidRdataText);
@@ -81,11 +81,9 @@
// it could be ambiguous '51 EAAA' vs '5 1EAA..'
EXPECT_THROW(generic::DNSKEY("257 3 51EAAEFTd"),
InvalidRdataText);
-#endif
}
-TEST_F(Rdata_DNSKEY_Test, toWireRenderer)
-{
+TEST_F(Rdata_DNSKEY_Test, toWireRenderer) {
renderer.skip(2);
generic::DNSKEY rdata_dnskey(dnskey_txt);
rdata_dnskey.toWire(renderer);
@@ -97,34 +95,29 @@
obuffer.getLength() - 2, &data[2], data.size() - 2);
}
-TEST_F(Rdata_DNSKEY_Test, toWireBuffer)
-{
+TEST_F(Rdata_DNSKEY_Test, toWireBuffer) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
rdata_dnskey.toWire(obuffer);
}
-TEST_F(Rdata_DNSKEY_Test, createFromWire)
-{
+TEST_F(Rdata_DNSKEY_Test, createFromWire) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(0, rdata_dnskey.compare(
*rdataFactoryFromFile(RRType("DNSKEY"), RRClass("IN"),
"rdata_dnskey_fromWire")));
}
-TEST_F(Rdata_DNSKEY_Test, getTag)
-{
+TEST_F(Rdata_DNSKEY_Test, getTag) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(12892, rdata_dnskey.getTag());
}
-TEST_F(Rdata_DNSKEY_Test, getAlgorithm)
-{
+TEST_F(Rdata_DNSKEY_Test, getAlgorithm) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(5, rdata_dnskey.getAlgorithm());
}
-TEST_F(Rdata_DNSKEY_Test, getFlags)
-{
+TEST_F(Rdata_DNSKEY_Test, getFlags) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(257, rdata_dnskey.getFlags());
}
Modified: branches/trac221b/src/lib/dns/tests/rdata_ds_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_ds_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_ds_unittest.cc Wed Jul 21 04:02:13 2010
@@ -25,8 +25,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_in_a_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_in_a_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_in_a_unittest.cc Wed Jul 21 04:02:13 2010
@@ -24,8 +24,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_in_aaaa_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_in_aaaa_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_in_aaaa_unittest.cc Wed Jul 21 04:02:13 2010
@@ -24,8 +24,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_mx_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_mx_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_mx_unittest.cc Wed Jul 21 04:02:13 2010
@@ -23,8 +23,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
@@ -38,14 +38,12 @@
const generic::MX rdata_mx(10, Name("mx.example.com"));
-TEST_F(Rdata_MX_Test, createFromText)
-{
+TEST_F(Rdata_MX_Test, createFromText) {
const generic::MX rdata_mx2("10 mx.example.com");
EXPECT_EQ(0, rdata_mx2.compare(rdata_mx));
}
-TEST_F(Rdata_MX_Test, badText)
-{
+TEST_F(Rdata_MX_Test, badText) {
EXPECT_THROW(const generic::MX rdata_mx("99999999 mx."), InvalidRdataText);
EXPECT_THROW(const generic::MX rdata_mx("10"), InvalidRdataText);
EXPECT_THROW(const generic::MX rdata_mx("SPOON"), InvalidRdataText);
@@ -53,22 +51,19 @@
InvalidRdataText);
}
-TEST_F(Rdata_MX_Test, copy)
-{
+TEST_F(Rdata_MX_Test, copy) {
const generic::MX rdata_mx2(rdata_mx);
EXPECT_EQ(0, rdata_mx.compare(rdata_mx2));
}
-TEST_F(Rdata_MX_Test, createFromWire)
-{
+TEST_F(Rdata_MX_Test, createFromWire) {
EXPECT_EQ(0, rdata_mx.compare(
*rdataFactoryFromFile(RRType("MX"), RRClass("IN"),
"rdata_mx_fromWire")));
// TBD: more tests
}
-TEST_F(Rdata_MX_Test, toWireRenderer)
-{
+TEST_F(Rdata_MX_Test, toWireRenderer) {
renderer.writeName(Name("example.com"));
rdata_mx.toWire(renderer);
@@ -78,37 +73,32 @@
obuffer.getLength(), &data[0], data.size());
}
-TEST_F(Rdata_MX_Test, toWireBuffer)
-{
+TEST_F(Rdata_MX_Test, toWireBuffer) {
renderer.writeName(Name("example.com"));
rdata_mx.toWire(obuffer);
+}
-#if 0
+TEST_F(Rdata_MX_Test, DISABLED_toWireBuffer) {
// XXX: does not pass
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_mx_toWire1", data);
EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
obuffer.getLength(), &data[0], data.size());
-#endif
}
-TEST_F(Rdata_MX_Test, toText)
-{
+TEST_F(Rdata_MX_Test, toText) {
EXPECT_EQ("10 mx.example.com.", rdata_mx.toText());
}
-TEST_F(Rdata_MX_Test, getMXName)
-{
+TEST_F(Rdata_MX_Test, getMXName) {
EXPECT_EQ(Name("mx.example.com."), rdata_mx.getMXName());
}
-TEST_F(Rdata_MX_Test, getMXPref)
-{
+TEST_F(Rdata_MX_Test, getMXPref) {
EXPECT_EQ(10, rdata_mx.getMXPref());
}
-TEST_F(Rdata_MX_Test, compare)
-{
+TEST_F(Rdata_MX_Test, compare) {
generic::MX small1(1, Name("mx.example.com"));
generic::MX small2(10, Name("mx.example.com"));
generic::MX large1(65535, Name("mx.example.com"));
Modified: branches/trac221b/src/lib/dns/tests/rdata_ns_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_ns_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_ns_unittest.cc Wed Jul 21 04:02:13 2010
@@ -24,8 +24,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_nsec3_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_nsec3_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_nsec3_unittest.cc Wed Jul 21 04:02:13 2010
@@ -16,10 +16,11 @@
#include <string>
-#include <dns/base32.h>
+#include <exceptions/exceptions.h>
+
#include <dns/buffer.h>
#include <dns/exceptions.h>
-#include <dns/hex.h>
+#include <dns/util/hex.h>
#include <dns/messagerenderer.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
@@ -28,60 +29,64 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
+using namespace isc;
using namespace isc::dns;
using namespace isc::dns::rdata;
namespace {
class Rdata_NSEC3_Test : public RdataTest {
// there's nothing to specialize
+public:
+ Rdata_NSEC3_Test() :
+ nsec3_txt("1 1 1 D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 "
+ "NS SOA RRSIG DNSKEY NSEC3PARAM") {}
+ string nsec3_txt;
};
-string nsec3_txt("1 1 1 D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 "
- "NS SOA RRSIG DNSKEY NSEC3PARAM");
-
-TEST_F(Rdata_NSEC3_Test, toText)
-{
+TEST_F(Rdata_NSEC3_Test, toText) {
const generic::NSEC3 rdata_nsec3(nsec3_txt);
EXPECT_EQ(nsec3_txt, rdata_nsec3.toText());
}
-TEST_F(Rdata_NSEC3_Test, badText)
-{
- EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1 ADDAFEE "
+TEST_F(Rdata_NSEC3_Test, badText) {
+ EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1 ADDAFEEE "
"0123456789ABCDEFGHIJKLMNOPQRSTUV "
"BIFF POW SPOON"),
InvalidRdataText);
EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1 ADDAFEE "
"WXYZWXYZWXYZ=WXYZWXYZ==WXYZWXYZW "
"A NS SOA"),
- BadBase32String);
- EXPECT_THROW(generic::NSEC3 rdata_nsec3("1000000 1 1 ADDAFEE "
+ BadValue); // bad hex
+ EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1 ADDAFEEE "
+ "WXYZWXYZWXYZ=WXYZWXYZ==WXYZWXYZW "
+ "A NS SOA"),
+ BadValue); // bad base32hex
+ EXPECT_THROW(generic::NSEC3 rdata_nsec3("1000000 1 1 ADDAFEEE "
"0123456789ABCDEFGHIJKLMNOPQRSTUV "
"A NS SOA"),
InvalidRdataText);
- EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1000000 1 ADDAFEE "
+ EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1000000 1 ADDAFEEE "
"0123456789ABCDEFGHIJKLMNOPQRSTUV "
"A NS SOA"),
InvalidRdataText);
- EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1000000 ADDAFEE "
+ EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1000000 ADDAFEEE "
"0123456789ABCDEFGHIJKLMNOPQRSTUV "
"A NS SOA"),
InvalidRdataText);
+}
-#if 0 // this currently fails
+TEST_F(Rdata_NSEC3_Test, DISABLED_badText) { // this currently fails
EXPECT_THROW(generic::NSEC3(
"1 1 1D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 "
"NS SOA RRSIG DNSKEY NSEC3PARAM"), InvalidRdataText);
-#endif
}
-TEST_F(Rdata_NSEC3_Test, createFromWire)
-{
+TEST_F(Rdata_NSEC3_Test, createFromWire) {
const generic::NSEC3 rdata_nsec3(nsec3_txt);
EXPECT_EQ(0, rdata_nsec3.compare(
*rdataFactoryFromFile(RRType::NSEC3(), RRClass::IN(),
@@ -98,8 +103,7 @@
DNSMessageFORMERR);
}
-TEST_F(Rdata_NSEC3_Test, toWireRenderer)
-{
+TEST_F(Rdata_NSEC3_Test, toWireRenderer) {
renderer.skip(2);
const generic::NSEC3 rdata_nsec3(nsec3_txt);
rdata_nsec3.toWire(renderer);
@@ -111,14 +115,12 @@
obuffer.getLength() - 2, &data[2], data.size() - 2);
}
-TEST_F(Rdata_NSEC3_Test, toWireBuffer)
-{
+TEST_F(Rdata_NSEC3_Test, toWireBuffer) {
const generic::NSEC3 rdata_nsec3(nsec3_txt);
rdata_nsec3.toWire(obuffer);
}
-TEST_F(Rdata_NSEC3_Test, assign)
-{
+TEST_F(Rdata_NSEC3_Test, assign) {
generic::NSEC3 rdata_nsec3(nsec3_txt);
generic::NSEC3 other_nsec3 = rdata_nsec3;
EXPECT_EQ(0, rdata_nsec3.compare(other_nsec3));
Modified: branches/trac221b/src/lib/dns/tests/rdata_nsec3param_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_nsec3param_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_nsec3param_unittest.cc Wed Jul 21 04:02:13 2010
@@ -16,9 +16,11 @@
#include <string>
-#include <dns/base32.h>
+#include <exceptions/exceptions.h>
+
+#include <dns/util/base32hex.h>
#include <dns/buffer.h>
-#include <dns/hex.h>
+#include <dns/util/hex.h>
#include <dns/messagerenderer.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
@@ -27,11 +29,12 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
+using namespace isc;
using namespace isc::dns;
using namespace isc::dns::rdata;
@@ -41,35 +44,32 @@
};
string nsec3param_txt("1 0 1 D399EAAB");
-TEST_F(Rdata_NSEC3PARAM_Test, toText)
-{
+TEST_F(Rdata_NSEC3PARAM_Test, toText) {
const generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
EXPECT_EQ(nsec3param_txt, rdata_nsec3param.toText());
}
-TEST_F(Rdata_NSEC3PARAM_Test, badText)
-{
- EXPECT_THROW(generic::NSEC3PARAM("1 1 1 SPORK"), BadHexString);
+TEST_F(Rdata_NSEC3PARAM_Test, badText) {
+ EXPECT_THROW(generic::NSEC3PARAM("1 1 1 SPORK"), BadValue); // bad hex
EXPECT_THROW(generic::NSEC3PARAM("100000 1 1 ADDAFEE"), InvalidRdataText);
EXPECT_THROW(generic::NSEC3PARAM("1 100000 1 ADDAFEE"), InvalidRdataText);
EXPECT_THROW(generic::NSEC3PARAM("1 1 100000 ADDAFEE"), InvalidRdataText);
EXPECT_THROW(generic::NSEC3PARAM("1"), InvalidRdataText);
-
-#if 0 // this currently fails
- EXPECT_THROW(generic::NSEC3PARAM("1 0 1D399EAAB"), InvalidRdataText);
-#endif
}
-TEST_F(Rdata_NSEC3PARAM_Test, createFromWire)
-{
+TEST_F(Rdata_NSEC3PARAM_Test, DISABLED_badText) {
+ // this currently fails
+ EXPECT_THROW(generic::NSEC3PARAM("1 0 1D399EAAB"), InvalidRdataText);
+}
+
+TEST_F(Rdata_NSEC3PARAM_Test, createFromWire) {
const generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
EXPECT_EQ(0, rdata_nsec3param.compare(
*rdataFactoryFromFile(RRType::NSEC3PARAM(), RRClass::IN(),
"rdata_nsec3param_fromWire1")));
}
-TEST_F(Rdata_NSEC3PARAM_Test, toWireRenderer)
-{
+TEST_F(Rdata_NSEC3PARAM_Test, toWireRenderer) {
renderer.skip(2);
const generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
rdata_nsec3param.toWire(renderer);
@@ -81,14 +81,12 @@
obuffer.getLength() - 2, &data[2], data.size() - 2);
}
-TEST_F(Rdata_NSEC3PARAM_Test, toWireBuffer)
-{
+TEST_F(Rdata_NSEC3PARAM_Test, toWireBuffer) {
const generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
rdata_nsec3param.toWire(obuffer);
}
-TEST_F(Rdata_NSEC3PARAM_Test, assign)
-{
+TEST_F(Rdata_NSEC3PARAM_Test, assign) {
generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
generic::NSEC3PARAM other_nsec3param = rdata_nsec3param;
EXPECT_EQ(0, rdata_nsec3param.compare(other_nsec3param));
Modified: branches/trac221b/src/lib/dns/tests/rdata_nsec_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_nsec_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_nsec_unittest.cc Wed Jul 21 04:02:13 2010
@@ -26,8 +26,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_opt_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_opt_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_opt_unittest.cc Wed Jul 21 04:02:13 2010
@@ -23,8 +23,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_ptr_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_ptr_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_ptr_unittest.cc Wed Jul 21 04:02:13 2010
@@ -24,8 +24,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_rrsig_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_rrsig_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_rrsig_unittest.cc Wed Jul 21 04:02:13 2010
@@ -14,7 +14,8 @@
// $Id$
-#include <dns/base64.h>
+#include <exceptions/exceptions.h>
+
#include <dns/buffer.h>
#include <dns/dnssectime.h>
#include <dns/messagerenderer.h>
@@ -25,11 +26,12 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
+using namespace isc;
using namespace isc::dns;
using namespace isc::dns::rdata;
@@ -38,8 +40,7 @@
// there's nothing to specialize
};
-TEST_F(Rdata_RRSIG_Test, fromText)
-{
+TEST_F(Rdata_RRSIG_Test, fromText) {
string rrsig_txt("A 5 4 43200 20100223214617 20100222214617 8496 isc.org. "
"evxhlGx13mpKLVkKsjpGzycS5twtIoxOmlN14w9t5AgzGBmz"
"diGdLIrFabqr72af2rUq+UDBKMWXujwZTZUTws32sVldDPk/"
@@ -50,8 +51,7 @@
}
-TEST_F(Rdata_RRSIG_Test, badText)
-{
+TEST_F(Rdata_RRSIG_Test, badText) {
EXPECT_THROW(const generic::RRSIG sig("SPORK"), InvalidRdataText);
EXPECT_THROW(const generic::RRSIG sig("A 555 4 43200 "
"20100223214617 20100222214617 8496 isc.org. "
@@ -83,20 +83,21 @@
"diGdLIrFabqr72af2rUq+UDBKMWXujwZTZUTws32sVldDPk/"
"NbuacJM25fQXfv5mO3Af7TOoow3AjMaVG9icjCW0V55WcWQU"
"f49t+sXKPzbipN9g+s1ZPiIyofc="), InvalidRdataText);
- EXPECT_THROW(const generic::RRSIG sig("A 5 4 43200 "
+ EXPECT_THROW(const generic::RRSIG sig(
+ "A 5 4 43200 "
"20100223214617 20100222214617 8496 isc.org. "
"EEeeeeeeEEEeeeeeeGaaahAAAAAAAAHHHHHHHHHHH!="),
- BadBase64String);
+ BadValue); // bad base64 input
+}
-#if 0 // this currently fails
+TEST_F(Rdata_RRSIG_Test, DISABLED_badText) {
+ // this currently fails
// no space between the tag and signer
EXPECT_THROW(generic::RRSIG("A 5 4 43200 20100223214617 20100222214617 "
"8496isc.org. ofc="), InvalidRdataText);
-#endif
}
-TEST_F(Rdata_RRSIG_Test, toWireRenderer)
-{
+TEST_F(Rdata_RRSIG_Test, toWireRenderer) {
string rrsig_txt("A 5 4 43200 20100223214617 20100222214617 8496 isc.org. "
"evxhlGx13mpKLVkKsjpGzycS5twtIoxOmlN14w9t5AgzGBmz"
"diGdLIrFabqr72af2rUq+UDBKMWXujwZTZUTws32sVldDPk/"
@@ -106,8 +107,7 @@
rdata_rrsig.toWire(renderer);
}
-TEST_F(Rdata_RRSIG_Test, toWireBuffer)
-{
+TEST_F(Rdata_RRSIG_Test, toWireBuffer) {
string rrsig_txt("A 5 4 43200 20100223214617 20100222214617 8496 isc.org. "
"evxhlGx13mpKLVkKsjpGzycS5twtIoxOmlN14w9t5AgzGBmz"
"diGdLIrFabqr72af2rUq+UDBKMWXujwZTZUTws32sVldDPk/"
@@ -117,8 +117,7 @@
rdata_rrsig.toWire(obuffer);
}
-TEST_F(Rdata_RRSIG_Test, createFromWire)
-{
+TEST_F(Rdata_RRSIG_Test, createFromWire) {
string rrsig_txt("A 5 2 43200 20100327070149 20100225070149 2658 isc.org. "
"HkJk/xZTvzePU8NENl/ley8bbUumhk1hXciyqhLnz1VQFzkDooej6neX"
"ZgWZzQKeTKPOYWrnYtdZW4PnPQFeUl3orgLev7F8J6FZlDn0y/J/ThR5"
Modified: branches/trac221b/src/lib/dns/tests/rdata_soa_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_soa_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_soa_unittest.cc Wed Jul 21 04:02:13 2010
@@ -23,8 +23,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_txt_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_txt_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_txt_unittest.cc Wed Jul 21 04:02:13 2010
@@ -24,8 +24,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rdata_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rdata_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rdata_unittest.cc Wed Jul 21 04:02:13 2010
@@ -27,8 +27,8 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
-#include "rdata_unittest.h"
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/rrclass_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rrclass_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rrclass_unittest.cc Wed Jul 21 04:02:13 2010
@@ -20,7 +20,7 @@
#include <dns/messagerenderer.h>
#include <dns/rrclass.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using namespace std;
using namespace isc;
Modified: branches/trac221b/src/lib/dns/tests/rrset_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rrset_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rrset_unittest.cc Wed Jul 21 04:02:13 2010
@@ -28,7 +28,7 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using isc::UnitTestUtil;
Modified: branches/trac221b/src/lib/dns/tests/rrttl_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rrttl_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rrttl_unittest.cc Wed Jul 21 04:02:13 2010
@@ -20,7 +20,7 @@
#include <dns/messagerenderer.h>
#include <dns/rrttl.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using namespace std;
using namespace isc;
Modified: branches/trac221b/src/lib/dns/tests/rrtype_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/rrtype_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/rrtype_unittest.cc Wed Jul 21 04:02:13 2010
@@ -20,7 +20,7 @@
#include <dns/messagerenderer.h>
#include <dns/rrtype.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using namespace std;
using namespace isc;
Modified: branches/trac221b/src/lib/dns/tests/run_unittests.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/run_unittests.cc (original)
+++ branches/trac221b/src/lib/dns/tests/run_unittests.cc Wed Jul 21 04:02:13 2010
@@ -16,7 +16,7 @@
#include <gtest/gtest.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
int
main(int argc, char* argv[]) {
Modified: branches/trac221b/src/lib/dns/tests/sha1_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/sha1_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/sha1_unittest.cc Wed Jul 21 04:02:13 2010
@@ -17,11 +17,11 @@
#include <stdint.h>
#include <string>
-#include <dns/sha1.h>
+#include <dns/util/sha1.h>
#include <gtest/gtest.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/tsig_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/tsig_unittest.cc (original)
+++ branches/trac221b/src/lib/dns/tests/tsig_unittest.cc Wed Jul 21 04:02:13 2010
@@ -18,7 +18,7 @@
#include <dns/tsig.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using isc::UnitTestUtil;
using namespace std;
Modified: branches/trac221b/src/lib/dns/tests/unittest_util.cc
==============================================================================
--- branches/trac221b/src/lib/dns/tests/unittest_util.cc (original)
+++ branches/trac221b/src/lib/dns/tests/unittest_util.cc Wed Jul 21 04:02:13 2010
@@ -26,7 +26,7 @@
#include <gtest/gtest.h>
#include <dns/name.h>
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
using namespace std;
Modified: branches/trac221b/src/lib/exceptions/Makefile.am
==============================================================================
--- branches/trac221b/src/lib/exceptions/Makefile.am (original)
+++ branches/trac221b/src/lib/exceptions/Makefile.am Wed Jul 21 04:02:13 2010
@@ -1,3 +1,4 @@
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CXXFLAGS=$(B10_CXXFLAGS)
lib_LTLIBRARIES = libexceptions.la
@@ -10,7 +11,7 @@
TESTS += run_unittests
run_unittests_SOURCES = run_unittests.cc
run_unittests_SOURCES += exceptions_unittest.cc
-run_unittests_CPPFLAGS = $(GTEST_INCLUDES)
+run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(GTEST_LDFLAGS)
run_unittests_LDADD = .libs/libexceptions.a $(GTEST_LDADD)
endif
Modified: branches/trac221b/src/lib/exceptions/exceptions.cc
==============================================================================
--- branches/trac221b/src/lib/exceptions/exceptions.cc (original)
+++ branches/trac221b/src/lib/exceptions/exceptions.cc Wed Jul 21 04:02:13 2010
@@ -16,7 +16,7 @@
#include <string>
-#include "exceptions.h"
+#include <exceptions/exceptions.h>
using isc::Exception;
Modified: branches/trac221b/src/lib/exceptions/exceptions.h
==============================================================================
--- branches/trac221b/src/lib/exceptions/exceptions.h (original)
+++ branches/trac221b/src/lib/exceptions/exceptions.h Wed Jul 21 04:02:13 2010
@@ -104,7 +104,7 @@
};
///
-/// \brief A standard DNS module exception that is thrown if a parameter give
+/// \brief A generic exception that is thrown if a parameter given
/// to a method would refer to or modify out-of-range data.
///
class OutOfRange : public Exception {
@@ -114,7 +114,17 @@
};
///
-/// \brief A standard DNS module exception that is thrown when an unexpected
+/// \brief A generic exception that is thrown if a parameter given
+/// to a method is considered invalid in that context.
+///
+class BadValue : public Exception {
+public:
+ BadValue(const char* file, size_t line, const char* what) :
+ isc::Exception(file, line, what) {}
+};
+
+///
+/// \brief A generic exception that is thrown when an unexpected
/// error condition occurs.
///
class Unexpected : public Exception {
Modified: branches/trac221b/src/lib/exceptions/exceptions_unittest.cc
==============================================================================
--- branches/trac221b/src/lib/exceptions/exceptions_unittest.cc (original)
+++ branches/trac221b/src/lib/exceptions/exceptions_unittest.cc Wed Jul 21 04:02:13 2010
@@ -17,7 +17,7 @@
#include <stdexcept>
#include <string>
-#include "exceptions.h"
+#include <exceptions/exceptions.h>
#include <gtest/gtest.h>
Modified: branches/trac221b/src/lib/python/isc/cc/data.py
==============================================================================
--- branches/trac221b/src/lib/python/isc/cc/data.py (original)
+++ branches/trac221b/src/lib/python/isc/cc/data.py Wed Jul 21 04:02:13 2010
@@ -20,7 +20,7 @@
# (int, real, bool, string, list and dict respectively)
#
-import ast
+import json
class DataNotFoundError(Exception): pass
class DataTypeError(Exception): pass
@@ -134,7 +134,7 @@
if type(value_str) != str:
return None
try:
- return ast.literal_eval(value_str)
+ return json.loads(value_str)
except ValueError as ve:
# simply return the string itself
return value_str
Modified: branches/trac221b/src/lib/python/isc/cc/tests/data_test.py
==============================================================================
--- branches/trac221b/src/lib/python/isc/cc/tests/data_test.py (original)
+++ branches/trac221b/src/lib/python/isc/cc/tests/data_test.py Wed Jul 21 04:02:13 2010
@@ -137,13 +137,13 @@
def test_parse_value_str(self):
self.assertEqual(data.parse_value_str("1"), 1)
- self.assertEqual(data.parse_value_str("True"), True)
- self.assertEqual(data.parse_value_str("None"), None)
+ self.assertEqual(data.parse_value_str("true"), True)
+ self.assertEqual(data.parse_value_str("null"), None)
self.assertEqual(data.parse_value_str("1.1"), 1.1)
self.assertEqual(data.parse_value_str("[]"), [])
- self.assertEqual(data.parse_value_str("[ 1, None, 'asdf' ]"), [ 1, None, "asdf" ])
+ self.assertEqual(data.parse_value_str("[ 1, null, \"asdf\" ]"), [ 1, None, "asdf" ])
self.assertEqual(data.parse_value_str("{}"), {})
- self.assertEqual(data.parse_value_str("{ 'a': 'b', 'c': 1 }"), { 'a': 'b', 'c': 1 })
+ self.assertEqual(data.parse_value_str("{ \"a\": \"b\", \"c\": 1 }"), { 'a': 'b', 'c': 1 })
self.assertEqual(data.parse_value_str("[ a c"), "[ a c")
if __name__ == '__main__':
Modified: branches/trac221b/src/lib/python/isc/config/ccsession.py
==============================================================================
--- branches/trac221b/src/lib/python/isc/config/ccsession.py (original)
+++ branches/trac221b/src/lib/python/isc/config/ccsession.py Wed Jul 21 04:02:13 2010
@@ -183,10 +183,10 @@
if msg and not 'result' in msg:
answer = None
try:
+ module_name = env['group']
cmd, arg = isc.config.ccsession.parse_command(msg)
if cmd == COMMAND_CONFIG_UPDATE:
new_config = arg
- module_name = env['group']
# If the target channel was not this module
# it might be in the remote_module_configs
if module_name != self._module_name:
@@ -213,10 +213,12 @@
isc.cc.data.merge(newc, new_config)
self.set_local_config(newc)
else:
- if self._command_handler:
- answer = self._command_handler(cmd, arg)
- else:
- answer = create_answer(2, self._module_name + " has no command handler")
+ # ignore commands for 'remote' modules
+ if module_name == self._module_name:
+ if self._command_handler:
+ answer = self._command_handler(cmd, arg)
+ else:
+ answer = create_answer(2, self._module_name + " has no command handler")
except Exception as exc:
answer = create_answer(1, str(exc))
if answer:
Modified: branches/trac221b/src/lib/python/isc/config/cfgmgr.py
==============================================================================
--- branches/trac221b/src/lib/python/isc/config/cfgmgr.py (original)
+++ branches/trac221b/src/lib/python/isc/config/cfgmgr.py Wed Jul 21 04:02:13 2010
@@ -22,10 +22,10 @@
import isc
import signal
import ast
-import pprint
import os
import copy
import tempfile
+import json
from isc.cc import data
from isc.config import ccsession
@@ -67,7 +67,7 @@
config = ConfigManagerData(data_path, file_name)
try:
file = open(config.db_filename, 'r')
- file_config = ast.literal_eval(file.read())
+ file_config = json.loads(file.read())
if 'version' in file_config and \
file_config['version'] == ConfigManagerData.CONFIG_VERSION:
config.data = file_config
@@ -93,9 +93,7 @@
dir=self.data_path,
delete=False)
filename = file.name
- pp = pprint.PrettyPrinter(indent=4)
- s = pp.pformat(self.data)
- file.write(s)
+ file.write(json.dumps(self.data))
file.write("\n")
file.close()
if output_file_name:
Modified: branches/trac221b/src/lib/python/isc/config/module_spec.py
==============================================================================
--- branches/trac221b/src/lib/python/isc/config/module_spec.py (original)
+++ branches/trac221b/src/lib/python/isc/config/module_spec.py Wed Jul 21 04:02:13 2010
@@ -21,7 +21,8 @@
set of data against the specification
"""
-import ast
+import json
+import sys
import isc.cc.data
@@ -37,19 +38,29 @@
def module_spec_from_file(spec_file, check = True):
"""Returns a ModuleSpec object defined by the file at spec_file.
If check is True, the contents are verified. If there is an error
- in those contents, a ModuleSpecError is raised."""
+ in those contents, a ModuleSpecError is raised.
+ A ModuleSpecError is also raised if the file cannot be read, or
+ if it is not valid JSON."""
module_spec = None
- if hasattr(spec_file, 'read'):
- module_spec = ast.literal_eval(spec_file.read(-1))
- elif type(spec_file) == str:
- file = open(spec_file)
- module_spec = ast.literal_eval(file.read(-1))
- file.close()
- else:
- raise ModuleSpecError("spec_file not a str or file-like object")
+ try:
+ if hasattr(spec_file, 'read'):
+ json_str = spec_file.read()
+ module_spec = json.loads(json_str)
+ elif type(spec_file) == str:
+ file = open(spec_file)
+ json_str = file.read()
+ module_spec = json.loads(json_str)
+ file.close()
+ else:
+ raise ModuleSpecError("spec_file not a str or file-like object")
+ except ValueError as ve:
+ raise ModuleSpecError("JSON parse error: " + str(ve))
+ except IOError as ioe:
+ raise ModuleSpecError("JSON read error: " + str(ioe))
+
if 'module_spec' not in module_spec:
raise ModuleSpecError("Data definition has no module_spec element")
-
+
result = ModuleSpec(module_spec['module_spec'], check)
return result
Modified: branches/trac221b/src/lib/python/isc/config/tests/ccsession_test.py
==============================================================================
--- branches/trac221b/src/lib/python/isc/config/tests/ccsession_test.py (original)
+++ branches/trac221b/src/lib/python/isc/config/tests/ccsession_test.py Wed Jul 21 04:02:13 2010
@@ -377,7 +377,34 @@
mccs = None
self.assertFalse("Spec2" in fake_session.subscriptions)
-
+ def test_ignore_command_remote_module(self):
+ # Create a Spec1 module and subscribe to remote config for Spec2
+ fake_session = FakeModuleCCSession()
+ mccs = self.create_session("spec1.spec", None, None, fake_session)
+ mccs.set_command_handler(self.my_command_handler_ok)
+ rmodname = mccs.add_remote_config(self.spec_file("spec2.spec"))
+
+ # remove the 'get config' from the queue
+ self.assertEqual(len(fake_session.message_queue), 1)
+ fake_session.get_message("ConfigManager")
+
+ # check if the command for the module itself is received
+ cmd = isc.config.ccsession.create_command("just_some_command", { 'foo': 'a' })
+ fake_session.group_sendmsg(cmd, 'Spec1')
+ self.assertEqual(len(fake_session.message_queue), 1)
+ mccs.check_command()
+ self.assertEqual(len(fake_session.message_queue), 1)
+ self.assertEqual({'result': [ 0 ]},
+ fake_session.get_message('Spec1', None))
+
+ # check if the command for the other module is ignored
+ cmd = isc.config.ccsession.create_command("just_some_command", { 'foo': 'a' })
+ fake_session.group_sendmsg(cmd, 'Spec2')
+ self.assertEqual(len(fake_session.message_queue), 1)
+ mccs.check_command()
+ self.assertEqual(len(fake_session.message_queue), 0)
+
+
class fakeUIConn():
def __init__(self):
self.get_answers = {}
Modified: branches/trac221b/src/lib/python/isc/config/tests/module_spec_test.py
==============================================================================
--- branches/trac221b/src/lib/python/isc/config/tests/module_spec_test.py (original)
+++ branches/trac221b/src/lib/python/isc/config/tests/module_spec_test.py Wed Jul 21 04:02:13 2010
@@ -54,6 +54,13 @@
def test_open_bad_file_obj(self):
self.assertRaises(ModuleSpecError, isc.config.module_spec_from_file, 1)
+ # contains single quotes which json parser does not accept
+
+ self.assertRaises(ModuleSpecError, isc.config.module_spec_from_file, self.spec_file("spec28.spec"), False)
+ my_spec_file = open(self.spec_file("spec28.spec"))
+ self.assertRaises(ModuleSpecError, isc.config.module_spec_from_file, my_spec_file, False)
+
+ self.assertRaises(ModuleSpecError, isc.config.module_spec_from_file, self.spec_file("does_not_exist"), False)
def test_bad_specfiles(self):
self.assertRaises(ModuleSpecError, self.read_spec_file, "spec3.spec")
Modified: branches/trac221b/src/lib/xfr/fd_share.cc
==============================================================================
--- branches/trac221b/src/lib/xfr/fd_share.cc (original)
+++ branches/trac221b/src/lib/xfr/fd_share.cc Wed Jul 21 04:02:13 2010
@@ -21,7 +21,7 @@
#include <sys/socket.h>
#include <sys/uio.h>
#include <stdlib.h> // for malloc and free
-#include "fd_share.h"
+#include <xfr/fd_share.h>
namespace isc {
namespace xfr {
Modified: branches/trac221b/src/lib/xfr/fdshare_python.cc
==============================================================================
--- branches/trac221b/src/lib/xfr/fdshare_python.cc (original)
+++ branches/trac221b/src/lib/xfr/fdshare_python.cc Wed Jul 21 04:02:13 2010
@@ -18,9 +18,9 @@
#include <Python.h>
#include <structmember.h>
-#include "config.h"
+#include <config.h>
-#include "fd_share.h"
+#include <xfr/fd_share.h>
static PyObject*
fdshare_recv_fd(PyObject *self UNUSED_PARAM, PyObject *args)
Modified: branches/trac221b/src/lib/xfr/python_xfr.cc
==============================================================================
--- branches/trac221b/src/lib/xfr/python_xfr.cc (original)
+++ branches/trac221b/src/lib/xfr/python_xfr.cc Wed Jul 21 04:02:13 2010
@@ -23,7 +23,7 @@
#include <boost/python/copy_const_reference.hpp>
#include <boost/shared_ptr.hpp>
-#include "fd_share.h"
+#include <xfr/fd_share.h>
using namespace isc::xfr;
using namespace boost::python;
Modified: branches/trac221b/src/lib/xfr/xfrout_client.cc
==============================================================================
--- branches/trac221b/src/lib/xfr/xfrout_client.cc (original)
+++ branches/trac221b/src/lib/xfr/xfrout_client.cc Wed Jul 21 04:02:13 2010
@@ -22,8 +22,8 @@
#include <unistd.h>
#include <asio.hpp>
-#include "fd_share.h"
-#include "xfrout_client.h"
+#include <xfr/fd_share.h>
+#include <xfr/xfrout_client.h>
using namespace std;
using asio::local::stream_protocol;
More information about the bind10-changes
mailing list