Browse Source

sync with trunk

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac256@2547 e5f2f494-b856-4b98-b285-d166d9295462
JINMEI Tatuya 14 years ago
parent
commit
5fd8a22cee
100 changed files with 408 additions and 422 deletions
  1. 15 0
      ChangeLog
  2. 1 0
      src/bin/auth/Makefile.am
  3. 3 3
      src/bin/auth/asio_link.cc
  4. 1 1
      src/bin/auth/auth.spec.pre.in
  5. 2 2
      src/bin/auth/auth_srv.cc
  6. 5 5
      src/bin/auth/main.cc
  7. 2 2
      src/bin/bindctl/bindcmd.py
  8. 2 1
      src/bin/cmdctl/TODO
  9. 17 10
      src/bin/cmdctl/cmdctl.py.in
  10. 7 7
      src/bin/cmdctl/cmdctl.spec.pre.in
  11. 19 0
      src/bin/cmdctl/tests/cmdctl_test.py
  12. 8 8
      src/bin/host/host.cc
  13. 9 9
      src/bin/xfrin/xfrin.spec.pre.in
  14. 7 7
      src/bin/xfrout/xfrout.spec.pre.in
  15. 2 2
      src/lib/cc/data.cc
  16. 2 2
      src/lib/cc/session.h
  17. 1 1
      src/lib/cc/session_unittests.cc
  18. 1 0
      src/lib/config/Makefile.am
  19. 14 9
      src/lib/config/ccsession.cc
  20. 1 1
      src/lib/config/config_data.cc
  21. 1 1
      src/lib/config/module_spec.cc
  22. 1 1
      src/lib/config/testdata/b10-config.db
  23. 2 2
      src/lib/config/testdata/data22_1.data
  24. 2 2
      src/lib/config/testdata/data22_2.data
  25. 3 3
      src/lib/config/testdata/data22_3.data
  26. 2 2
      src/lib/config/testdata/data22_4.data
  27. 1 1
      src/lib/config/testdata/data22_5.data
  28. 3 3
      src/lib/config/testdata/data22_6.data
  29. 2 2
      src/lib/config/testdata/data22_7.data
  30. 2 2
      src/lib/config/testdata/data22_8.data
  31. 1 1
      src/lib/config/testdata/spec10.spec
  32. 1 1
      src/lib/config/testdata/spec11.spec
  33. 1 1
      src/lib/config/testdata/spec12.spec
  34. 1 1
      src/lib/config/testdata/spec13.spec
  35. 1 1
      src/lib/config/testdata/spec14.spec
  36. 1 1
      src/lib/config/testdata/spec15.spec
  37. 1 1
      src/lib/config/testdata/spec17.spec
  38. 11 11
      src/lib/config/testdata/spec2.spec
  39. 1 1
      src/lib/config/testdata/spec20.spec
  40. 21 21
      src/lib/config/testdata/spec22.spec
  41. 1 1
      src/lib/config/testdata/spec23.spec
  42. 2 2
      src/lib/config/testdata/spec24.spec
  43. 23 23
      src/lib/config/testdata/spec27.spec
  44. 7 0
      src/lib/config/testdata/spec28.spec
  45. 1 1
      src/lib/config/testdata/spec3.spec
  46. 1 1
      src/lib/config/testdata/spec4.spec
  47. 1 1
      src/lib/config/testdata/spec6.spec
  48. 1 1
      src/lib/config/testdata/spec9.spec
  49. 1 1
      src/lib/config/tests/Makefile.am
  50. 37 1
      src/lib/config/tests/ccsession_unittests.cc
  51. 1 1
      src/lib/config/tests/config_data_unittests.cc
  52. 2 2
      src/lib/config/tests/fake_session.cc
  53. 1 1
      src/lib/config/tests/module_spec_unittests.cc
  54. 1 2
      src/lib/datasrc/cache.cc
  55. 1 1
      src/lib/datasrc/data_source.cc
  56. 1 1
      src/lib/datasrc/query.cc
  57. 11 8
      src/lib/datasrc/sqlite3_datasrc.cc
  58. 1 1
      src/lib/datasrc/sqlite3_datasrc.h
  59. 3 3
      src/lib/datasrc/static_datasrc.cc
  60. 1 1
      src/lib/datasrc/static_datasrc.h
  61. 0 21
      src/lib/datasrc/tests/Makefile.am
  62. 59 44
      src/lib/datasrc/tests/datasrc_unittest.cc
  63. 14 18
      src/lib/datasrc/tests/query_unittest.cc
  64. 1 1
      src/lib/datasrc/tests/static_unittest.cc
  65. 2 2
      src/lib/datasrc/tests/test_datasrc.cc
  66. 0 4
      src/lib/datasrc/tests/testdata/q_cname
  67. 0 4
      src/lib/datasrc/tests/testdata/q_cname_ext
  68. 0 4
      src/lib/datasrc/tests/testdata/q_cname_int
  69. 0 4
      src/lib/datasrc/tests/testdata/q_dname
  70. 0 3
      src/lib/datasrc/tests/testdata/q_example_dnskey
  71. 0 3
      src/lib/datasrc/tests/testdata/q_example_ns
  72. 0 3
      src/lib/datasrc/tests/testdata/q_example_ptr
  73. 0 4
      src/lib/datasrc/tests/testdata/q_glork
  74. 0 3
      src/lib/datasrc/tests/testdata/q_spork
  75. 0 4
      src/lib/datasrc/tests/testdata/q_sql1
  76. 0 4
      src/lib/datasrc/tests/testdata/q_subzone
  77. 0 4
      src/lib/datasrc/tests/testdata/q_subzone_any
  78. 0 4
      src/lib/datasrc/tests/testdata/q_subzone_dname
  79. 0 4
      src/lib/datasrc/tests/testdata/q_subzone_ds
  80. 0 4
      src/lib/datasrc/tests/testdata/q_subzone_ns
  81. 0 4
      src/lib/datasrc/tests/testdata/q_subzone_nsec
  82. 0 4
      src/lib/datasrc/tests/testdata/q_wild2_a
  83. 0 4
      src/lib/datasrc/tests/testdata/q_wild2_aaaa
  84. 0 4
      src/lib/datasrc/tests/testdata/q_wild3_a
  85. 0 4
      src/lib/datasrc/tests/testdata/q_wild_a
  86. 0 4
      src/lib/datasrc/tests/testdata/q_wild_aaaa
  87. 12 12
      src/lib/dns/python/libdns_python.cc
  88. 1 1
      src/lib/dns/tests/message_unittest.cc
  89. 1 1
      src/lib/dns/tests/messagerenderer_unittest.cc
  90. 1 1
      src/lib/dns/tests/name_unittest.cc
  91. 1 1
      src/lib/dns/tests/question_unittest.cc
  92. 2 2
      src/lib/dns/tests/rdata_cname_unittest.cc
  93. 2 2
      src/lib/dns/tests/rdata_dname_unittest.cc
  94. 14 22
      src/lib/dns/tests/rdata_dnskey_unittest.cc
  95. 2 2
      src/lib/dns/tests/rdata_ds_unittest.cc
  96. 2 2
      src/lib/dns/tests/rdata_in_a_unittest.cc
  97. 2 2
      src/lib/dns/tests/rdata_in_aaaa_unittest.cc
  98. 14 24
      src/lib/dns/tests/rdata_mx_unittest.cc
  99. 2 2
      src/lib/dns/tests/rdata_ns_unittest.cc
  100. 0 0
      src/lib/dns/tests/rdata_nsec3_unittest.cc

+ 15 - 0
ChangeLog

@@ -1,3 +1,18 @@
+  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

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

@@ -3,6 +3,7 @@ SUBDIRS = . tests
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
 AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc
+AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
 
 AM_CXXFLAGS = $(B10_CXXFLAGS)
 

+ 3 - 3
src/bin/auth/asio_link.cc

@@ -29,9 +29,9 @@
 
 #include <asio_link.h>
 
-#include "spec_config.h"        // for XFROUT.  should not be here.
-#include "auth_srv.h"
-#include "common.h"
+#include <auth/spec_config.h>   // for XFROUT.  should not be here.
+#include <auth/auth_srv.h>
+#include <auth/common.h>
 
 using namespace asio;
 using ip::udp;

+ 1 - 1
src/bin/auth/auth.spec.pre.in

@@ -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"
       }
     ],

+ 2 - 2
src/bin/auth/auth_srv.cc

@@ -40,8 +40,8 @@
 
 #include <cc/data.h>
 
-#include "common.h"
-#include "auth_srv.h"
+#include <auth/common.h>
+#include <auth/auth_srv.h>
 
 #include <boost/lexical_cast.hpp>
 

+ 5 - 5
src/bin/auth/main.cc

@@ -14,7 +14,7 @@
 
 // $Id$
 
-#include "config.h"
+#include <config.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -39,10 +39,10 @@
 #include <cc/data.h>
 #include <config/ccsession.h>
 
-#include "spec_config.h"
-#include "common.h"
-#include "auth_srv.h"
-#include "asio_link.h"
+#include <auth/spec_config.h>
+#include <auth/common.h>
+#include <auth/auth_srv.h>
+#include <auth/asio_link.h>
 
 using namespace std;
 using namespace isc::data;

+ 2 - 2
src/bin/bindctl/bindcmd.py

@@ -35,7 +35,7 @@ import os, time, random, re
 import getpass
 from hashlib import sha1
 import csv
-import ast
+import json
 import pwd
 import getpass
 import traceback
@@ -568,7 +568,7 @@ class BindCmdInterpreter(Cmd):
                 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']

+ 2 - 1
src/bin/cmdctl/TODO

@@ -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

+ 17 - 10
src/bin/cmdctl/cmdctl.py.in

@@ -441,7 +441,11 @@ class SecureHTTPServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
                  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 @@ def set_cmd_options(parser):
             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)

+ 7 - 7
src/bin/cmdctl/cmdctl.spec.pre.in

@@ -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": []
-      },
+      }
     ]
   }
 }

+ 19 - 0
src/bin/cmdctl/tests/cmdctl_test.py

@@ -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 MySecureHTTPServer(SecureHTTPServer):
 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')

+ 8 - 8
src/bin/host/host.cc

@@ -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;

+ 9 - 9
src/bin/xfrin/xfrin.spec.pre.in

@@ -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"
           }
         ]
       },

+ 7 - 7
src/bin/xfrout/xfrout.spec.pre.in

@@ -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
        }
       ],

+ 2 - 2
src/lib/cc/data.cc

@@ -14,9 +14,9 @@
 
 // $Id$
 
-#include "config.h"
+#include <config.h>
 
-#include "data.h"
+#include <cc/data.h>
 
 #include <cassert>
 #include <climits>

+ 2 - 2
src/lib/cc/session.h

@@ -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;

+ 1 - 1
src/lib/cc/session_unittests.cc

@@ -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>

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

@@ -51,3 +51,4 @@ EXTRA_DIST += testdata/spec24.spec
 EXTRA_DIST += testdata/spec25.spec
 EXTRA_DIST += testdata/spec26.spec
 EXTRA_DIST += testdata/spec27.spec
+EXTRA_DIST += testdata/spec28.spec

+ 14 - 9
src/lib/config/ccsession.cc

@@ -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 @@ ModuleCCSession::checkCommand()
         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 @@ ModuleCCSession::checkCommand()
                     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;

+ 1 - 1
src/lib/config/config_data.cc

@@ -14,7 +14,7 @@
 
 // $Id$
 
-#include "config_data.h"
+#include <config/config_data.h>
 
 #include <boost/foreach.hpp>
 

+ 1 - 1
src/lib/config/module_spec.cc

@@ -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>

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

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

+ 2 - 2
src/lib/config/testdata/data22_1.data

@@ -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 } }
 }

+ 2 - 2
src/lib/config/testdata/data22_2.data

@@ -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 }
 }

+ 3 - 3
src/lib/config/testdata/data22_3.data

@@ -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 }
 }

+ 2 - 2
src/lib/config/testdata/data22_4.data

@@ -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 }
 }

+ 1 - 1
src/lib/config/testdata/data22_5.data

@@ -1,7 +1,7 @@
 {
     "value1": 1,
     "value2": 2.3,
-    "value3": True,
+    "value3": true,
     "value4": "foo",
     "value5": [ 1, 2, 3 ],
     "value6": { "v61": "bar", "v62": "Break" }

+ 3 - 3
src/lib/config/testdata/data22_6.data

@@ -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 } }
 }

+ 2 - 2
src/lib/config/testdata/data22_7.data

@@ -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 } }
 }

+ 2 - 2
src/lib/config/testdata/data22_8.data

@@ -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 } ]
 }

+ 1 - 1
src/lib/config/testdata/spec10.spec

@@ -4,7 +4,7 @@
     "config_data": [
       { "item_name": "item1",
         "item_type": "real",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": 1
       }
     ]

+ 1 - 1
src/lib/config/testdata/spec11.spec

@@ -4,7 +4,7 @@
     "config_data": [
       { "item_name": "item1",
         "item_type": "boolean",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": 1
       }
     ]

+ 1 - 1
src/lib/config/testdata/spec12.spec

@@ -4,7 +4,7 @@
     "config_data": [
       { "item_name": "item1",
         "item_type": "string",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": 1
       }
     ]

+ 1 - 1
src/lib/config/testdata/spec13.spec

@@ -4,7 +4,7 @@
     "config_data": [
       { "item_name": "item1",
         "item_type": "list",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": 1
       }
     ]

+ 1 - 1
src/lib/config/testdata/spec14.spec

@@ -4,7 +4,7 @@
     "config_data": [
       { "item_name": "item1",
         "item_type": "map",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": 1
       }
     ]

+ 1 - 1
src/lib/config/testdata/spec15.spec

@@ -4,7 +4,7 @@
     "config_data": [
       { "item_name": "item1",
         "item_type": "badname",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": 1
       }
     ]

+ 1 - 1
src/lib/config/testdata/spec17.spec

@@ -7,7 +7,7 @@
         "command_args": [ {
           "item_name": "message",
           "item_type": "string",
-          "item_optional": False,
+          "item_optional": false,
           "item_default": ""
         } ]
       }

+ 11 - 11
src/lib/config/testdata/spec2.spec

@@ -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": ""
         } ]
       },

+ 1 - 1
src/lib/config/testdata/spec20.spec

@@ -8,7 +8,7 @@
         "command_args": [ {
           "item_name": "message",
           "item_type": "somethingbad",
-          "item_optional": False,
+          "item_optional": false,
           "item_default": ""
         } ]
       }

+ 21 - 21
src/lib/config/testdata/spec22.spec

@@ -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
               }
             ]

+ 1 - 1
src/lib/config/testdata/spec23.spec

@@ -8,7 +8,7 @@
         "command_args": [ {
           "item_name": "message",
           "item_type": "string",
-          "item_optional": False,
+          "item_optional": false,
           "item_default": ""
         } ]
       }

+ 2 - 2
src/lib/config/testdata/spec24.spec

@@ -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": ""
         }
       }

+ 23 - 23
src/lib/config/testdata/spec27.spec

@@ -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
                   }
                 ]

+ 7 - 0
src/lib/config/testdata/spec28.spec

@@ -0,0 +1,7 @@
+{
+  "module_spec": {
+    "module_name": "Spec28",
+    'commands': [ ]
+  }
+}
+

+ 1 - 1
src/lib/config/testdata/spec3.spec

@@ -4,7 +4,7 @@
     "config_data": [
       {
         "item_type": "integer",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": 1
       }
     ]

+ 1 - 1
src/lib/config/testdata/spec4.spec

@@ -3,7 +3,7 @@
     "module_name": "Spec2",
     "config_data": [
       { "item_name": "item1",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": 1
       }
     ]

+ 1 - 1
src/lib/config/testdata/spec6.spec

@@ -4,7 +4,7 @@
     "config_data": [
       { "item_name": "item1",
         "item_type": "integer",
-        "item_optional": False
+        "item_optional": false
       }
     ]
   }

+ 1 - 1
src/lib/config/testdata/spec9.spec

@@ -4,7 +4,7 @@
     "config_data": [
       { "item_name": "item1",
         "item_type": "integer",
-        "item_optional": False,
+        "item_optional": false,
         "item_default": "asdf"
       }
     ]

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

@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib/cc
+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

+ 37 - 1
src/lib/config/tests/ccsession_unittests.cc

@@ -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 @@ TEST_F(CCSessionTest, remoteConfig) {
     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());
+}
+
 }

+ 1 - 1
src/lib/config/tests/config_data_unittests.cc

@@ -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>

+ 2 - 2
src/lib/config/tests/fake_session.cc

@@ -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;

+ 1 - 1
src/lib/config/tests/module_spec_unittests.cc

@@ -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;

+ 1 - 2
src/lib/datasrc/cache.cc

@@ -240,8 +240,7 @@ HotCacheImpl::promote(CacheNodePtr node) {
     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();
 }
 

+ 1 - 1
src/lib/datasrc/data_source.cc

@@ -14,7 +14,7 @@
 
 // $Id$
 
-#include "config.h"
+#include <config.h>
 
 #include <cassert>
 #include <iomanip>

+ 1 - 1
src/lib/datasrc/query.cc

@@ -21,7 +21,7 @@
 
 #include <cc/data.h>
 
-#include "query.h"
+#include <datasrc/query.h>
 
 using namespace isc::dns;
 

+ 11 - 8
src/lib/datasrc/sqlite3_datasrc.cc

@@ -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 @@ Sqlite3DataSrc::findRecords(const Name& name, const RRType& rdtype,
         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);
+    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 " << s_name <<
+        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 @@ Sqlite3DataSrc::findRecords(const Name& name, const RRType& rdtype,
                   " 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 @@ Sqlite3DataSrc::findPreviousName(const Name& qname,
         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)");

+ 1 - 1
src/lib/datasrc/sqlite3_datasrc.h

@@ -21,7 +21,7 @@
 
 #include <exceptions/exceptions.h>
 
-#include "data_source.h"
+#include <datasrc/data_source.h>
 
 namespace isc {
 

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

@@ -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;

+ 1 - 1
src/lib/datasrc/static_datasrc.h

@@ -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 {
 

+ 0 - 21
src/lib/datasrc/tests/Makefile.am

@@ -37,27 +37,6 @@ EXTRA_DIST += testdata/example.org.sqlite3
 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

+ 59 - 44
src/lib/datasrc/tests/datasrc_unittest.cc

@@ -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 @@ protected:
         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);
 
@@ -85,18 +84,6 @@ performQuery(DataSrc& data_source, HotCache& cache, Message& message) {
 }
 
 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
 DataSrcTest::createAndProcessQuery(const Name& qname, const RRClass& qclass,
                                    const RRType& qtype)
 {
@@ -193,8 +180,8 @@ TEST_F(DataSrcTest, QueryClassAny) {
 }
 
 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 @@ TEST_F(DataSrcTest, NSQuery) {
 
 // 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 @@ TEST_F(DataSrcTest, DuplicateQuery) {
     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, DuplicateQuery) {
 }
 
 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 @@ TEST_F(DataSrcTest, DNSKEYQuery) {
 // 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 @@ TEST_F(DataSrcTest, DNSKEYDuplicateQuery) {
     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, DNSKEYDuplicateQuery) {
 }
 
 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, NxRRset) {
 }
 
 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, Nxdomain) {
 }
 
 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, NxZone) {
 }
 
 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, Wildcard) {
 }
 
 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, WildcardCname) {
 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, WildcardCnameNodata) {
 
 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 @@ TEST_F(DataSrcTest, WildcardCnameNxdomain) {
     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, AuthDelegation) {
 }
 
 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, DnameExact) {
 }
 
 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, Cname) {
 }
 
 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, CnameInt) {
 }
 
 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, CnameExt) {
 }
 
 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, Delegation) {
 }
 
 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, NSDelegation) {
 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, NSECZonecut) {
 }
 
 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, DNAMEZonecut) {
 }
 
 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);
 

+ 14 - 18
src/lib/datasrc/tests/query_unittest.cc

@@ -32,20 +32,13 @@ using namespace isc::datasrc;
 
 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 @@ createTask(Message& m, const Name& name, const RRType& rrtype0, HotCache& c) {
 
 // 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);

+ 1 - 1
src/lib/datasrc/tests/static_unittest.cc

@@ -18,7 +18,7 @@
 #include <string>
 #include <vector>
 
-#include "config.h"
+#include <config.h>
 
 #include <gtest/gtest.h>
 

+ 2 - 2
src/lib/datasrc/tests/test_datasrc.cc

@@ -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>
 

+ 0 - 4
src/lib/datasrc/tests/testdata/q_cname

@@ -1,4 +0,0 @@
-# foo.example.com/A (cname to outside zone)
-  9d 57 01 00 00 01 00 00 00 00 00 00 03 66 6f 6f
-  07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 00 01 00
-  01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_cname_ext

@@ -1,4 +0,0 @@
-# cname-ext.example.com/A (cname to local authoritative zone)
-  ed 42 01 00 00 01 00 00 00 00 00 00 09 63 6e 61
-  6d 65 2d 65 78 74 07 65 78 61 6d 70 6c 65 03 63
-  6f 6d 00 00 01 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_cname_int

@@ -1,4 +0,0 @@
-# cname-int.example.com/A (cname to same zone)
-  51 b2 01 00 00 01 00 00 00 00 00 00 09 63 6e 61
-  6d 65 2d 69 6e 74 07 65 78 61 6d 70 6c 65 03 63
-  6f 6d 00 00 01 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_dname

@@ -1,4 +0,0 @@
-# www.dname.example.com/A (dname)
-  3c 71 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  05 64 6e 61 6d 65 07 65 78 61 6d 70 6c 65 03 63
-  6f 6d 00 00 01 00 01

+ 0 - 3
src/lib/datasrc/tests/testdata/q_example_dnskey

@@ -1,3 +0,0 @@
-# example.com/DNSKEY (normal lookup, positive answer)
-  dd 6b 01 00 00 01 00 00 00 00 00 00 07 65 78 61
-  6d 70 6c 65 03 63 6f 6d 00 00 30 00 01

+ 0 - 3
src/lib/datasrc/tests/testdata/q_example_ns

@@ -1,3 +0,0 @@
-# example.com/NS (normal lookup, positive answer)
-  dd 6b 01 00 00 01 00 00 00 00 00 00 07 65 78 61
-  6d 70 6c 65 03 63 6f 6d 00 00 02 00 01

+ 0 - 3
src/lib/datasrc/tests/testdata/q_example_ptr

@@ -1,3 +0,0 @@
-# example.com/PTR (NOERROR/NODATA)
-  4d 2a 01 00 00 01 00 00 00 00 00 00 07 65 78 61
-  6d 70 6c 65 03 63 6f 6d 00 00 0c 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_glork

@@ -1,4 +0,0 @@
-# glork.example.com/A (NXDOMAIN)
-  c1 11 01 00 00 01 00 00 00 00 00 00 05 67 6c 6f
-  72 6b 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 00
-  01 00 01

+ 0 - 3
src/lib/datasrc/tests/testdata/q_spork

@@ -1,3 +0,0 @@
-# spork.com/a (REFUSED)
-  a8 8a 01 00 00 01 00 00 00 00 00 00 05 73 70 6f 72 6b 03 63
-  6f 6d 00 00 01 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_sql1

@@ -1,4 +0,0 @@
-# www.sql1.example.com/A (delegation to local authoritative zone)
-  75 b3 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  04 73 71 6c 31 07 65 78 61 6d 70 6c 65 03 63 6f
-  6d 00 00 01 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_subzone

@@ -1,4 +0,0 @@
-# www.subzone.example.com/A (delegation to non-local zone)
-  00 7c 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  07 73 75 62 7a 6f 6e 65 07 65 78 61 6d 70 6c 65
-  03 63 6f 6d 00 00 01 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_subzone_any

@@ -1,4 +0,0 @@
-# subzone.example.com/ANY (ANY query at zone cut)
-  14 f0 01 00 00 01 00 00 00 00 00 00 07 73 75 62
-  7a 6f 6e 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
-  00 00 ff 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_subzone_dname

@@ -1,4 +0,0 @@
-# subzone.example.com/DNAME (DNAME query at zone cut)
-  14 f0 01 00 00 01 00 00 00 00 00 00 07 73 75 62
-  7a 6f 6e 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
-  00 00 27 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_subzone_ds

@@ -1,4 +0,0 @@
-# subzone.example.com/DS (delegation signer)
-  14 f0 01 00 00 01 00 00 00 00 00 00 07 73 75 62
-  7a 6f 6e 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
-  00 00 2b 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_subzone_ns

@@ -1,4 +0,0 @@
-# subzone.example.com/NS (delegation to non-local zone)
-  14 f0 01 00 00 01 00 00 00 00 00 00 07 73 75 62
-  7a 6f 6e 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
-  00 00 02 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_subzone_nsec

@@ -1,4 +0,0 @@
-# subzone.example.com/NSEC (NSEC query at zone cut)
-  14 f0 01 00 00 01 00 00 00 00 00 00 07 73 75 62
-  7a 6f 6e 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
-  00 00 2f 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_wild2_a

@@ -1,4 +0,0 @@
-# www.wild2.example.com/A (wildcard)
-  d8 ef 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  05 77 69 6c 64 32 07 65 78 61 6d 70 6c 65 03 63
-  6f 6d 00 00 01 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_wild2_aaaa

@@ -1,4 +0,0 @@
-# www.wild2.example.com/AAAA (wildcard CNAME NXRRSET)
-  d8 ef 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  05 77 69 6c 64 32 07 65 78 61 6d 70 6c 65 03 63
-  6f 6d 00 00 1c 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_wild3_a

@@ -1,4 +0,0 @@
-# www.wild3.example.com/A (wildcard, CNAME, target does not exist)
-  d8 ef 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  05 77 69 6c 64 33 07 65 78 61 6d 70 6c 65 03 63
-  6f 6d 00 00 01 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_wild_a

@@ -1,4 +0,0 @@
-# www.wild.example.com/A (wildcard)
-  d8 ef 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  04 77 69 6c 64 07 65 78 61 6d 70 6c 65 03 63 6f
-  6d 00 00 01 00 01

+ 0 - 4
src/lib/datasrc/tests/testdata/q_wild_aaaa

@@ -1,4 +0,0 @@
-# www.wild.example.com/A (wildcard)
-  d8 ef 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  04 77 69 6c 64 07 65 78 61 6d 70 6c 65 03 63 6f
-  6d 00 00 1c 00 01

+ 12 - 12
src/lib/dns/python/libdns_python.cc

@@ -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

+ 1 - 1
src/lib/dns/tests/message_unittest.cc

@@ -28,7 +28,7 @@
 
 #include <gtest/gtest.h>
 
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
 
 using isc::UnitTestUtil;
 using namespace std;

+ 1 - 1
src/lib/dns/tests/messagerenderer_unittest.cc

@@ -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>
 

+ 1 - 1
src/lib/dns/tests/name_unittest.cc

@@ -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>
 

+ 1 - 1
src/lib/dns/tests/question_unittest.cc

@@ -29,7 +29,7 @@
 
 #include <gtest/gtest.h>
 
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
 
 using isc::UnitTestUtil;
 using namespace std;

+ 2 - 2
src/lib/dns/tests/rdata_cname_unittest.cc

@@ -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;

+ 2 - 2
src/lib/dns/tests/rdata_dname_unittest.cc

@@ -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;

+ 14 - 22
src/lib/dns/tests/rdata_dnskey_unittest.cc

@@ -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;
@@ -50,21 +50,18 @@ string dnskey_txt("257 3 5 BEAAAAOhHQDBrhQbtphgq2wQUpEQ5t4DtUHxoMV"
                   "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"),
@@ -74,7 +71,9 @@ TEST_F(Rdata_DNSKEY_Test, badText)
     EXPECT_THROW(generic::DNSKEY("257 3 500 BAAAAAAAAAAAD"),
                  InvalidRdataText);
     EXPECT_THROW(generic::DNSKEY("257 3 5 BAAAAAAAAAAAD"), BadValue);
-#if 0
+}
+
+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);
@@ -82,11 +81,9 @@ TEST_F(Rdata_DNSKEY_Test, badText)
     // 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);
@@ -98,34 +95,29 @@ TEST_F(Rdata_DNSKEY_Test, toWireRenderer)
                         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());
 }

+ 2 - 2
src/lib/dns/tests/rdata_ds_unittest.cc

@@ -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;

+ 2 - 2
src/lib/dns/tests/rdata_in_a_unittest.cc

@@ -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;

+ 2 - 2
src/lib/dns/tests/rdata_in_aaaa_unittest.cc

@@ -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;

+ 14 - 24
src/lib/dns/tests/rdata_mx_unittest.cc

@@ -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 @@ class Rdata_MX_Test : public RdataTest {
 
 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 @@ TEST_F(Rdata_MX_Test, badText)
                  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 @@ TEST_F(Rdata_MX_Test, toWireRenderer)
                         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"));

+ 2 - 2
src/lib/dns/tests/rdata_ns_unittest.cc

@@ -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;

+ 0 - 0
src/lib/dns/tests/rdata_nsec3_unittest.cc


Some files were not shown because too many files changed in this diff