]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[trac1069] use isc::acl::dns::RequestACL directly instead of a separate
authorJINMEI Tatuya <jinmei@isc.org>
Fri, 1 Jul 2011 17:30:03 +0000 (10:30 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Fri, 1 Jul 2011 17:30:03 +0000 (10:30 -0700)
typedef.  RequestACL is itself a shortcut, so it doesn't make sense to
define another one.

src/bin/resolver/resolver.cc
src/bin/resolver/resolver.h
src/bin/resolver/tests/resolver_unittest.cc

index 1a481c2adbccffa177727eb70d3f1e3f991e9ca7..75e3d52a520126deae22a2461aec34d8d410c6ff 100644 (file)
@@ -62,6 +62,7 @@ using boost::shared_ptr;
 using namespace isc;
 using namespace isc::util;
 using namespace isc::acl;
+using isc::acl::dns::RequestACL;
 using namespace isc::dns;
 using namespace isc::data;
 using namespace isc::config;
@@ -162,11 +163,11 @@ public:
                                          OutputBufferPtr buffer,
                                          DNSServer* server);
 
-    const Resolver::QueryACL& getQueryACL() const {
+    const RequestACL& getQueryACL() const {
         return (*query_acl_);
     }
 
-    void setQueryACL(shared_ptr<const Resolver::QueryACL> new_acl) {
+    void setQueryACL(shared_ptr<const RequestACL> new_acl) {
         query_acl_ = new_acl;
     }
 
@@ -194,7 +195,7 @@ public:
 
 private:
     /// ACL on incoming queries
-    shared_ptr<const Resolver::QueryACL> query_acl_;
+    shared_ptr<const RequestACL> query_acl_;
 
     /// Object to handle upstream queries
     RecursiveQuery* rec_query_;
@@ -595,9 +596,9 @@ Resolver::updateConfig(ConstElementPtr config) {
         AddressList listenAddresses(parseAddresses(listenAddressesE,
                                                       "listen_on"));
         const ConstElementPtr query_acl_cfg(config->get("query_acl"));
-        const shared_ptr<const QueryACL> query_acl =
+        const shared_ptr<const RequestACL> query_acl =
             query_acl_cfg ? acl::dns::getLoader().load(query_acl_cfg) :
-            shared_ptr<const QueryACL>();
+            shared_ptr<const RequestACL>();
         bool set_timeouts(false);
         int qtimeout = impl_->query_timeout_;
         int ctimeout = impl_->client_timeout_;
@@ -757,13 +758,13 @@ Resolver::getListenAddresses() const {
     return (impl_->listen_);
 }
 
-const Resolver::QueryACL&
+const RequestACL&
 Resolver::getQueryACL() const {
     return (impl_->getQueryACL());
 }
 
 void
-Resolver::setQueryACL(shared_ptr<const QueryACL> new_acl) {
+Resolver::setQueryACL(shared_ptr<const RequestACL> new_acl) {
     if (!new_acl) {
         isc_throw(InvalidParameter, "NULL pointer is passed to setQueryACL");
     }
index 656723d316af8910cd9a03314ea6d584806be0a7..4b9c773c7fb24cfd3b982d3e172f2875fc5dedfd 100644 (file)
@@ -239,13 +239,10 @@ public:
      */
     int getRetries() const;
 
-    // Shortcut typedef used for query ACL.
-    typedef isc::acl::ACL<isc::acl::dns::RequestContext> QueryACL;
-
     /// Get the query ACL.
     ///
     /// \exception None
-    const QueryACL& getQueryACL() const;
+    const isc::acl::dns::RequestACL& getQueryACL() const;
 
     /// Set the new query ACL.
     ///
@@ -258,7 +255,8 @@ public:
     /// \exception InvalidParameter The given pointer is NULL
     ///
     /// \param new_acl The new ACL to replace the existing one.
-    void setQueryACL(boost::shared_ptr<const QueryACL> new_acl);
+    void setQueryACL(boost::shared_ptr<const isc::acl::dns::RequestACL>
+                     new_acl);
 
 private:
     ResolverImpl* impl_;
index 6eda44268ca1e36e2b62268fa020f00db6b8f386..71474dd17ae708c418e33208fd73730fbeaf7f3d 100644 (file)
@@ -27,6 +27,7 @@
 using namespace std;
 using namespace isc::dns;
 using namespace isc::data;
+using isc::acl::dns::RequestACL;
 using namespace isc::testutils;
 using isc::UnitTestUtil;
 
@@ -156,8 +157,7 @@ TEST_F(ResolverTest, notifyFail) {
 TEST_F(ResolverTest, setQueryACL) {
     // valid cases are tested through other tests.  We only explicitly check
     // an invalid case: passing a NULL shared pointer.
-    EXPECT_THROW(server.setQueryACL(
-                     boost::shared_ptr<const Resolver::QueryACL>()),
+    EXPECT_THROW(server.setQueryACL(boost::shared_ptr<const RequestACL>()),
                  isc::InvalidParameter);
 }