]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2536] Remove "using namespace" from headers (DNS code)
authorMukund Sivaraman <muks@isc.org>
Tue, 4 Feb 2014 20:07:12 +0000 (01:37 +0530)
committerMukund Sivaraman <muks@isc.org>
Tue, 4 Feb 2014 20:47:58 +0000 (02:17 +0530)
20 files changed:
src/lib/cache/message_cache.h
src/lib/cache/message_entry.cc
src/lib/cache/message_entry.h
src/lib/cache/rrset_cache.h
src/lib/cache/rrset_entry.cc
src/lib/cache/rrset_entry.h
src/lib/cache/tests/cache_test_messagefromfile.h
src/lib/cache/tests/cache_test_sectioncount.h
src/lib/cache/tests/message_cache_unittest.cc
src/lib/dns/tests/rdata_nsec3param_like_unittest.cc
src/lib/dns/tests/rdata_nsecbitmap_unittest.cc
src/lib/dns/tests/rdata_unittest.h
src/lib/nsas/tests/hash_unittest.cc
src/lib/nsas/tests/nameserver_address_store_unittest.cc
src/lib/nsas/tests/nameserver_address_unittest.cc
src/lib/nsas/tests/nameserver_entry_unittest.cc
src/lib/nsas/tests/nsas_entry_compare_unittest.cc
src/lib/nsas/tests/nsas_test.h
src/lib/nsas/tests/zone_entry_unittest.cc
src/lib/resolve/recursive_query.cc

index 0c191390881b2ad45de4a288d461a9a2044953cf..0df23ede37e4d010331d9e6f0a760e58d9d881f2 100644 (file)
@@ -73,8 +73,8 @@ protected:
     /// \param name query name of the message.
     /// \param type query type of the message.
     /// \return return the hash key.
-    HashKey getEntryHashKey(const isc::dns::Name& name,
-                            const isc::dns::RRType& type) const;
+    isc::nsas::HashKey getEntryHashKey(const isc::dns::Name& name,
+                                       const isc::dns::RRType& type) const;
 
     // Make these variants be protected for easy unittest.
 protected:
@@ -91,4 +91,3 @@ typedef boost::shared_ptr<MessageCache> MessageCachePtr;
 } // namespace isc
 
 #endif // MESSAGE_CACHE_H
-
index b6af869d28a8f0f10500acd1ac2e4eeda3bf3cfc..36e76915db452b9e4977fbe492997f4ede84b451 100644 (file)
@@ -23,6 +23,7 @@
 #include "logger.h"
 
 using namespace isc::dns;
+using namespace isc::nsas;
 using namespace std;
 
 // Put file scope functions in unnamed namespace.
index 206e601c1bb2f7a33c53010433a520d1d55a21a9..5b55fbbf3cb1c3227a720f0ef5119f9a173086be 100644 (file)
@@ -22,8 +22,6 @@
 #include "rrset_cache.h"
 #include "rrset_entry.h"
 
-using namespace isc::nsas;
-
 namespace isc {
 namespace cache {
 
@@ -33,7 +31,7 @@ class RRsetEntry;
 ///
 /// The object of MessageEntry represents one response message
 /// answered to the resolver client.
-class MessageEntry : public NsasEntry<MessageEntry> {
+class MessageEntry : public isc::nsas::NsasEntry<MessageEntry> {
 // Noncopyable
 private:
     MessageEntry(const MessageEntry& source);
@@ -92,7 +90,7 @@ public:
     /// \brief Get the hash key of the message entry.
     ///
     /// \return return hash key
-    virtual HashKey hashKey() const {
+    virtual isc::nsas::HashKey hashKey() const {
         return (*hash_key_ptr_);
     }
 
@@ -173,7 +171,7 @@ protected:
 
 private:
     std::string entry_name_; // The name for this entry(name + type)
-    HashKey* hash_key_ptr_;  // the key for messag entry in hash table.
+    isc::nsas::HashKey* hash_key_ptr_;  // the key for messag entry in hash table.
 
     std::vector<RRsetRef> rrsets_;
     RRsetCachePtr rrset_cache_; //Normal rrset cache
index 304c6e89079298ab7f2bb7e4609aaebca0f6556d..8587ec7ab5b4e3f3de2bb8749963f957681b5dcf 100644 (file)
@@ -20,8 +20,6 @@
 
 #include <util/lru_list.h>
 
-using namespace isc::nsas;
-
 namespace isc {
 namespace cache {
 
index 359fd686ec5d027d315827d6606f1ec58d8c0213..2e5bf930493ea55f0a7c61031bb1b659f06599e7 100644 (file)
@@ -21,6 +21,7 @@
 #include "rrset_copy.h"
 
 using namespace isc::dns;
+using namespace isc::nsas;
 
 namespace isc {
 namespace cache {
index 0efda3660f671b7115beab8005904872dac6dce5..71b5e4b1fe74586e784e462a94e4a16ea8e0d62e 100644 (file)
@@ -22,8 +22,6 @@
 #include <nsas/fetchable.h>
 #include "cache_entry_key.h"
 
-using namespace isc::nsas;
-
 namespace isc {
 namespace cache {
 
@@ -60,7 +58,7 @@ enum RRsetTrustLevel {
 /// The object of RRsetEntry represents one cached RRset.
 /// Each RRset entry may be refered using shared_ptr by several message
 /// entries.
-class RRsetEntry : public NsasEntry<RRsetEntry>
+class RRsetEntry : public isc::nsas::NsasEntry<RRsetEntry>
 {
     ///
     /// \name Constructors and Destructor
@@ -105,7 +103,7 @@ public:
     /// \brief Get the hash key
     ///
     /// \return return hash key
-    HashKey hashKey() const {
+    isc::nsas::HashKey hashKey() const {
         return (hash_key_);
     }
 
@@ -124,7 +122,7 @@ private:
     time_t expire_time_;     // Expiration time of rrset.
     RRsetTrustLevel trust_level_; // RRset trustworthiness.
     boost::shared_ptr<isc::dns::RRset> rrset_;
-    HashKey hash_key_;       // RRsetEntry hash key
+    isc::nsas::HashKey hash_key_; // RRsetEntry hash key
 };
 
 typedef boost::shared_ptr<RRsetEntry> RRsetEntryPtr;
index 7d55f08c71dcb744417bb3af6a002f14ebe71ceb..85bc0d9c8da9cee0d609441e4b2194effb93b4c9 100644 (file)
@@ -17,9 +17,6 @@
 #include <util/buffer.h>
 #include <dns/message.h>
 
-using namespace isc;
-using namespace isc::dns;
-
 namespace {
 
 /// \brief Reads a Message from a data file
@@ -27,13 +24,12 @@ namespace {
 /// \param message Message to put the read data in
 /// \param datafile The file to read from
 void
-messageFromFile(Message& message, const char* datafile) {
+messageFromFile(isc::dns::Message& message, const char* datafile) {
     std::vector<unsigned char> data;
-    UnitTestUtil::readWireData(datafile, data);
+    isc::UnitTestUtil::readWireData(datafile, data);
 
     isc::util::InputBuffer buffer(&data[0], data.size());
     message.fromWire(buffer);
 }
 
 }   // namespace
-
index df7cb5258dad0780eead5d7fba250f9d88a572bb..0dcdaee804ebc58c76f26cbdc5836b15e9e46127 100644 (file)
@@ -17,9 +17,6 @@
 #include <util/buffer.h>
 #include <dns/message.h>
 
-using namespace isc;
-using namespace isc::dns;
-
 namespace {
 
 /// \brief Counts the number of rrsets in the given section
@@ -29,9 +26,9 @@ namespace {
 ///
 /// \return The number of RRsets in the given section
 int
-sectionRRsetCount(Message& msg, Message::Section section) {
+sectionRRsetCount(isc::dns::Message& msg, isc::dns::Message::Section section) {
     int count = 0;
-    for (RRsetIterator rrset_iter = msg.beginSection(section);
+    for (isc::dns::RRsetIterator rrset_iter = msg.beginSection(section);
          rrset_iter != msg.endSection(section);
          ++rrset_iter) {
         ++count;
@@ -41,4 +38,3 @@ sectionRRsetCount(Message& msg, Message::Section section) {
 }
 
 }   // namespace
-
index 60ae0371a28caa81ba4fa64b2fb4b8e337a9179e..c26b3cb6a61dc4316695513ed1cc8124b82e0237 100644 (file)
@@ -23,6 +23,7 @@
 #include "cache_test_messagefromfile.h"
 
 using namespace isc::cache;
+using namespace isc::nsas;
 using namespace isc;
 using namespace isc::dns;
 using namespace isc::util;
index 23d6d0ed6849bbb73a49b15d68007cef8fb50886..23461805af554b73533a24a1781876827a2f569e 100644 (file)
@@ -30,6 +30,7 @@ using namespace std;
 using isc::UnitTestUtil;
 using namespace isc::dns;
 using namespace isc::dns::rdata;
+using namespace isc::util;
 
 namespace {
 
index fbb256a1517a4dfcf1dc0bde7c821b55c410df9d..0af1a12f9ab5e471d9e404a4882307b37304c060 100644 (file)
@@ -34,6 +34,7 @@ using boost::lexical_cast;
 using isc::UnitTestUtil;
 using namespace isc::dns;
 using namespace isc::dns::rdata;
+using namespace isc::util;
 
 namespace {
 
index 04af07c2fedb89e89eb16684329ca4dc4995a19f..8c7f954eebcc248164888c1f84322be6d40f0518 100644 (file)
@@ -27,8 +27,6 @@
 #include <string>
 #include <sstream>
 
-using namespace isc::util;
-
 namespace isc {
 namespace dns {
 namespace rdata {
@@ -77,7 +75,7 @@ protected:
         }
     }
 
-    OutputBuffer obuffer;
+    isc::util::OutputBuffer obuffer;
     MessageRenderer renderer;
     /// This is an RDATA object of some "unknown" RR type so that it can be
     /// used to test the compare() method against a well-known RR type.
index f71d4b35e52acd1766587fc62c21009a8099a90a..fe43bfabcd57a19865d71baa1f8f6ef335a68089 100644 (file)
@@ -26,6 +26,7 @@
 #include "nsas_test.h"
 
 using namespace std;
+using namespace isc::dns;
 
 namespace isc {
 namespace nsas {
index a606f2614ca44c65a03513873c4d7c92dbe9e521..3bde33bffb7b0d9ac9f7d80c28aaa73dd6c1f48c 100644 (file)
 #include "nsas_test.h"
 
 using namespace isc::dns;
+using namespace isc::dns::rdata;
 using namespace isc::util;
 using namespace std;
+using isc::util::unittests::TestResolver;
 
 namespace isc {
 namespace nsas {
index 1b211e9e3e6ba01497825cff039184692c3c38e4..f8512bf3ff6cae75989fa1e7e88b53b3eb794d7b 100644 (file)
 #include "../nameserver_entry.h"
 #include "nsas_test.h"
 
+using namespace isc::dns;
+using namespace isc::dns::rdata;
+using isc::util::unittests::TestResolver;
+
 namespace isc {
 namespace nsas {
 
-using namespace dns;
-using namespace rdata;
-
 #define TEST_ADDRESS_INDEX 1
 
 /// \brief NameserverEntry sample class for testing
index 10f0c20b803e2bf9c52ea27a2cc432bd46cbea0f..dd7f3b970de20c60a50c9e2f75cb63ced6199f11 100644 (file)
@@ -41,7 +41,7 @@ using namespace isc::nsas;
 using namespace isc::asiolink;
 using namespace std;
 using namespace isc::dns;
-using namespace rdata;
+using isc::util::unittests::TestResolver;
 
 namespace {
 
index 33e41b80cc75daa48cd0f2c8131d3927c3daaed9..9bc5b9c3a75a781e1ec9928a04cea335dddb46b8 100644 (file)
@@ -25,6 +25,7 @@
 #include "../nsas_entry_compare.h"
 #include "nsas_test.h"
 
+using namespace isc::dns;
 using namespace std;
 
 namespace isc {
index 9f92149891bc2cfeca70f2ab2dd7e32ab5e3ed50..54e5d45d6f796fbf6c6be3962098cdbe54119e76 100644 (file)
 #include <dns/rdataclass.h>
 #include "../nsas_entry.h"
 
-using namespace isc::dns::rdata;
-using namespace isc::dns;
-using namespace isc::util;
-using isc::util::unittests::TestResolver;
-
 namespace isc {
 namespace dns {
 
@@ -77,15 +72,15 @@ public:
 /// For this reason, a single class definition
 
 template <typename T>
-class RdataTest: public Rdata {
+class RdataTest: public rdata::Rdata {
 public:
 
     /// \brief Constructor
     ///
     /// Set the data in the object.
     ///
-    /// \param v4address IPV4 address to store.  (The format of this address is
-    /// not checked.)
+    /// \param v4address IPV4 address to store.  (The format of this
+    /// address is not checked.)
     RdataTest(const std::string& data) : data_(data)
     {}
 
@@ -99,8 +94,9 @@ public:
 
     /// \brief Return type of Rdata
     ///
-    /// Returns the type of the data.  May be useful in the tests, although this
-    /// will not appear in the main code as this interface is not defined.
+    /// Returns the type of the data.  May be useful in the tests,
+    /// although this will not appear in the main code as this interface
+    /// is not defined.
     virtual uint16_t getType() const {
         return (type_.getType());
     }
@@ -111,13 +107,13 @@ public:
     ///
     //@{
     /// \brief Render the \c Rdata in the wire format to a buffer
-    virtual void toWire(OutputBuffer& buffer) const;
+    virtual void toWire(isc::util::OutputBuffer& buffer) const;
 
     /// \brief render the \Rdata in the wire format to a \c MessageRenderer
     virtual void toWire(AbstractMessageRenderer& renderer) const;
     
     /// \brief Comparison Method
-    virtual int compare(const Rdata& other) const;
+    virtual int compare(const rdata::Rdata& other) const;
     //@}
 
 private:
@@ -126,7 +122,7 @@ private:
 };
 
 template <typename T>
-void RdataTest<T>::toWire(OutputBuffer&) const {
+void RdataTest<T>::toWire(isc::util::OutputBuffer&) const {
 }
 
 template <typename T>
@@ -134,7 +130,7 @@ void RdataTest<T>::toWire(AbstractMessageRenderer&) const {
 }
 
 template <typename T>
-int RdataTest<T>::compare(const Rdata&) const {
+int RdataTest<T>::compare(const rdata::Rdata&) const {
     return 0;
 }
 
@@ -210,7 +206,8 @@ private:
 ///
 /// Some constants used in the various tests.
 
-static const uint32_t HASHTABLE_DEFAULT_SIZE = 1009; ///< First prime above 1000
+static const uint32_t HASHTABLE_DEFAULT_SIZE = 1009; ///< First prime
+                                                     ///above 1000
 
 // String constants.  These should end in a dot.
 static const std::string EXAMPLE_CO_UK("example.co.uk.");
@@ -219,63 +216,92 @@ static const std::string MIXED_EXAMPLE_CO_UK("EXAmple.co.uk.");
 
 class TestWithRdata : public ::testing::Test {
 protected:
-    typedef boost::shared_ptr<RRset> RRsetPtr;
+    typedef boost::shared_ptr<isc::dns::RRset> RRsetPtr;
     /// \brief Constructor
     ///
-    /// Initializes the RRsets used in the tests.  The RRsets themselves have to
-    /// be initialized with the basic data on their construction. The Rdata for
-    /// them is added in SetUp().
+    /// Initializes the RRsets used in the tests.  The RRsets themselves
+    /// have to be initialized with the basic data on their
+    /// construction. The Rdata for them is added in SetUp().
     TestWithRdata() :
-        rrv4_(new RRset(Name(EXAMPLE_CO_UK), RRClass::IN(), RRType::A(),
-            RRTTL(1200))),
-        rrcase_(new RRset(Name(MIXED_EXAMPLE_CO_UK), RRClass::IN(),
-            RRType::A(), RRTTL(1200))),
-        rrch_(new RRset(Name(EXAMPLE_CO_UK), RRClass::CH(), RRType::A(),
-            RRTTL(1200))),
-        rrns_(new RRset(Name(EXAMPLE_CO_UK), RRClass::IN(), RRType::NS(),
-            RRTTL(1200))),
-        rr_single_(new RRset(Name(EXAMPLE_CO_UK), RRClass::IN(),
-            RRType::NS(), RRTTL(600))),
-        rr_empty_(new RRset(Name(EXAMPLE_CO_UK), RRClass::IN(),
-            RRType::NS(), RRTTL(600))),
-        rrv6_(new RRset(Name(EXAMPLE_CO_UK), RRClass::IN(),
-            RRType::AAAA(), RRTTL(900))),
-        rrnet_(new RRset(Name(EXAMPLE_NET), RRClass::IN(), RRType::A(),
-            RRTTL(600))),
+        rrv4_(new isc::dns::RRset(isc::dns::Name(EXAMPLE_CO_UK),
+                                  isc::dns::RRClass::IN(),
+                                  isc::dns::RRType::A(),
+                                  isc::dns::RRTTL(1200))),
+        rrcase_(new isc::dns::RRset(isc::dns::Name(MIXED_EXAMPLE_CO_UK),
+                                    isc::dns::RRClass::IN(),
+                                    isc::dns::RRType::A(),
+                                    isc::dns::RRTTL(1200))),
+        rrch_(new isc::dns::RRset(isc::dns::Name(EXAMPLE_CO_UK),
+                                  isc::dns::RRClass::CH(),
+                                  isc::dns::RRType::A(),
+                                  isc::dns::RRTTL(1200))),
+        rrns_(new isc::dns::RRset(isc::dns::Name(EXAMPLE_CO_UK),
+                                  isc::dns::RRClass::IN(),
+                                  isc::dns::RRType::NS(),
+                                  isc::dns::RRTTL(1200))),
+        rr_single_(new isc::dns::RRset(isc::dns::Name(EXAMPLE_CO_UK),
+                                       isc::dns::RRClass::IN(),
+                                       isc::dns::RRType::NS(),
+                                       isc::dns::RRTTL(600))),
+        rr_empty_(new isc::dns::RRset(isc::dns::Name(EXAMPLE_CO_UK),
+                                      isc::dns::RRClass::IN(),
+                                      isc::dns::RRType::NS(),
+                                      isc::dns::RRTTL(600))),
+        rrv6_(new isc::dns::RRset(isc::dns::Name(EXAMPLE_CO_UK),
+                                  isc::dns::RRClass::IN(),
+                                  isc::dns::RRType::AAAA(),
+                                  isc::dns::RRTTL(900))),
+        rrnet_(new isc::dns::RRset(isc::dns::Name(EXAMPLE_NET),
+                                   isc::dns::RRClass::IN(),
+                                   isc::dns::RRType::A(),
+                                   isc::dns::RRTTL(600))),
         ns_name_("ns.example.net.")
     {}
 
     /// \brief Add Rdata to RRsets
     ///
-    /// The data are added as const pointers to avoid the stricter type checking
-    /// applied by the Rdata code.  There is no need for it in these tests.
+    /// The data are added as const pointers to avoid the stricter type
+    /// checking applied by the Rdata code.  There is no need for it in
+    /// these tests.
     virtual void SetUp() {
 
         // A records
-        rrv4_->addRdata(ConstRdataPtr(new RdataTest<A>("1.2.3.4")));
-        rrv4_->addRdata(ConstRdataPtr(new RdataTest<A>("5.6.7.8")));
-        rrv4_->addRdata(ConstRdataPtr(new RdataTest<A>("9.10.11.12")));
+        rrv4_->addRdata(isc::dns::rdata::ConstRdataPtr
+                        (new isc::dns::RdataTest<isc::dns::A>("1.2.3.4")));
+        rrv4_->addRdata(isc::dns::rdata::ConstRdataPtr
+                        (new isc::dns::RdataTest<isc::dns::A>("5.6.7.8")));
+        rrv4_->addRdata(isc::dns::rdata::ConstRdataPtr
+                        (new isc::dns::RdataTest<isc::dns::A>("9.10.11.12")));
 
         // A records
-        rrcase_->addRdata(ConstRdataPtr(new RdataTest<A>("13.14.15.16")));
+        rrcase_->addRdata(isc::dns::rdata::ConstRdataPtr
+                          (new isc::dns::RdataTest<isc::dns::A>
+                           ("13.14.15.16")));
 
         // No idea what Chaosnet address look like other than they are 16 bits
         // The fact that they are type A is probably also incorrect.
-        rrch_->addRdata(ConstRdataPtr(new RdataTest<A>("1324")));
+        rrch_->addRdata(isc::dns::rdata::ConstRdataPtr
+                        (new isc::dns::RdataTest<isc::dns::A>("1324")));
 
         // NS records take a single name
-        rrns_->addRdata(rdata::generic::NS("example.fr."));
-        rrns_->addRdata(rdata::generic::NS("example.de."));
+        rrns_->addRdata(isc::dns::rdata::generic::NS("example.fr."));
+        rrns_->addRdata(isc::dns::rdata::generic::NS("example.de."));
 
         // Single NS record with 0 TTL
-        rr_single_->addRdata(rdata::generic::NS(ns_name_));
+        rr_single_->addRdata(isc::dns::rdata::generic::NS(ns_name_));
 
         // AAAA records
-        rrv6_->addRdata(ConstRdataPtr(new RdataTest<AAAA>("2001::1002")));
-        rrv6_->addRdata(ConstRdataPtr(new RdataTest<AAAA>("dead:beef:feed::")));
+        rrv6_->addRdata(isc::dns::rdata::ConstRdataPtr
+                        (new isc::dns::RdataTest<isc::dns::AAAA>
+                         ("2001::1002")));
+        rrv6_->addRdata(isc::dns::rdata::ConstRdataPtr
+                        (new isc::dns::RdataTest<isc::dns::AAAA>
+                         ("dead:beef:feed::")));
 
         // A record for example.net
-        rrnet_->addRdata(ConstRdataPtr(new RdataTest<A>("17.18.18.20")));
+        rrnet_->addRdata(isc::dns::rdata::ConstRdataPtr
+                         (new isc::dns::RdataTest<isc::dns::A>
+                          ("17.18.18.20")));
     }
 
     /// \brief Data for the tests
@@ -287,7 +313,7 @@ protected:
     RRsetPtr rr_empty_;       ///< NS RRset without any nameservers
     RRsetPtr rrv6_;           ///< Standard RRset, IN, AAAA, lowercase name
     RRsetPtr rrnet_;          ///< example.net A RRset
-    Name ns_name_;  ///< Nameserver name of ns.example.net
+    isc::dns::Name ns_name_;  ///< Nameserver name of ns.example.net
 };
 
 } // namespace nsas
index d685fbb3901f235e33c953331fcaa85a9d8c8ad9..04a6d4da8fb73f3fafb6ebd45cbb7f8dec0e5718 100644 (file)
 
 using namespace isc::nsas;
 using namespace isc::asiolink;
-using namespace std;
 using namespace isc::dns;
+using namespace isc::dns::rdata;
 using namespace isc::util;
+using namespace std;
+using isc::util::unittests::TestResolver;
 
 namespace {
 
index 3c54a781c11e8da2db0015275c821508b8a0decd..e0c5a30034267a117c1f2f96e2c218cd531f20d4 100644 (file)
@@ -43,6 +43,7 @@
 #include <resolve/recursive_query.h>
 
 using namespace isc::dns;
+using namespace isc::nsas;
 using namespace isc::util;
 using namespace isc::asiolink;
 using namespace isc::resolve;