From: Mukund Sivaraman Date: Tue, 4 Feb 2014 21:06:38 +0000 (+0530) Subject: [2536] Remove "using namespace" from headers (DHCP code) X-Git-Tag: bind10-1.2.0beta1-release~56^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b0297a13fcbfd7309cdc41b8fe314de7201ed264;p=thirdparty%2Fkea.git [2536] Remove "using namespace" from headers (DHCP code) --- diff --git a/src/bin/dhcp4/tests/callout_library_common.h b/src/bin/dhcp4/tests/callout_library_common.h index cbabcda094..6db761dcc2 100644 --- a/src/bin/dhcp4/tests/callout_library_common.h +++ b/src/bin/dhcp4/tests/callout_library_common.h @@ -34,9 +34,6 @@ #include -using namespace isc::hooks; -using namespace std; - extern "C" { /// @brief Append digit to marker file @@ -51,7 +48,7 @@ extern "C" { int appendDigit(const char* name) { // Open the file and check if successful. - fstream file(name, fstream::out | fstream::app); + std::fstream file(name, std::fstream::out | std::fstream::app); if (!file.good()) { return (1); } @@ -70,7 +67,7 @@ version() { } int -load(LibraryHandle&) { +load(isc::hooks::LibraryHandle&) { return (appendDigit(LOAD_MARKER_FILE)); } diff --git a/src/bin/dhcp6/tests/callout_library_common.h b/src/bin/dhcp6/tests/callout_library_common.h index cbabcda094..6db761dcc2 100644 --- a/src/bin/dhcp6/tests/callout_library_common.h +++ b/src/bin/dhcp6/tests/callout_library_common.h @@ -34,9 +34,6 @@ #include -using namespace isc::hooks; -using namespace std; - extern "C" { /// @brief Append digit to marker file @@ -51,7 +48,7 @@ extern "C" { int appendDigit(const char* name) { // Open the file and check if successful. - fstream file(name, fstream::out | fstream::app); + std::fstream file(name, std::fstream::out | std::fstream::app); if (!file.good()) { return (1); } @@ -70,7 +67,7 @@ version() { } int -load(LibraryHandle&) { +load(isc::hooks::LibraryHandle&) { return (appendDigit(LOAD_MARKER_FILE)); } diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index b26a7a301c..92af8283dd 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc @@ -47,6 +47,8 @@ #include using namespace isc; +using namespace isc::data; +using namespace isc::config; using namespace isc::test; using namespace isc::asiolink; using namespace isc::dhcp; diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.cc b/src/bin/dhcp6/tests/dhcp6_test_utils.cc index 88dee363b4..75a2ced863 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.cc +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.cc @@ -15,6 +15,9 @@ #include #include +using namespace isc::dhcp; +using namespace isc::asiolink; + namespace isc { namespace test { diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.h b/src/bin/dhcp6/tests/dhcp6_test_utils.h index 17cd9e8cc7..beac1ef3e9 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.h +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.h @@ -37,24 +37,16 @@ #include -using namespace isc::dhcp; -using namespace isc::config; -using namespace isc::data; -using namespace isc::hooks; -using namespace isc::asiolink; -using namespace isc::util; -using namespace isc::hooks; - namespace isc { namespace test { /// @brief "naked" Dhcpv6Srv class that exposes internal members class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { public: - NakedDhcpv6Srv(uint16_t port) : Dhcpv6Srv(port) { + NakedDhcpv6Srv(uint16_t port) : isc::dhcp::Dhcpv6Srv(port) { // Open the "memfile" database for leases std::string memfile = "type=memfile"; - LeaseMgrFactory::create(memfile); + isc::dhcp::LeaseMgrFactory::create(memfile); } /// @brief fakes packet reception @@ -70,7 +62,7 @@ public: // If there is anything prepared as fake incoming // traffic, use it if (!fake_received_.empty()) { - Pkt6Ptr pkt = fake_received_.front(); + isc::dhcp::Pkt6Ptr pkt = fake_received_.front(); fake_received_.pop_front(); return (pkt); } @@ -78,7 +70,7 @@ public: // If not, just trigger shutdown and // return immediately shutdown(); - return (Pkt6Ptr()); + return (isc::dhcp::Pkt6Ptr()); } /// @brief fake packet sending @@ -86,20 +78,20 @@ public: /// Pretend to send a packet, but instead just store /// it in fake_send_ list where test can later inspect /// server's response. - virtual void sendPacket(const Pkt6Ptr& pkt) { + virtual void sendPacket(const isc::dhcp::Pkt6Ptr& pkt) { fake_sent_.push_back(pkt); } /// @brief adds a packet to fake receive queue /// /// See fake_received_ field for description - void fakeReceive(const Pkt6Ptr& pkt) { + void fakeReceive(const isc::dhcp::Pkt6Ptr& pkt) { fake_received_.push_back(pkt); } virtual ~NakedDhcpv6Srv() { // Close the lease database - LeaseMgrFactory::destroy(); + isc::dhcp::LeaseMgrFactory::destroy(); } using Dhcpv6Srv::processSolicit; @@ -121,13 +113,14 @@ public: /// @brief packets we pretend to receive /// - /// Instead of setting up sockets on interfaces that change between OSes, it - /// is much easier to fake packet reception. This is a list of packets that - /// we pretend to have received. You can schedule new packets to be received - /// using fakeReceive() and NakedDhcpv6Srv::receivePacket() methods. - std::list fake_received_; - - std::list fake_sent_; + /// Instead of setting up sockets on interfaces that change between + /// OSes, it is much easier to fake packet reception. This is a list + /// of packets that we pretend to have received. You can schedule + /// new packets to be received using fakeReceive() and + /// NakedDhcpv6Srv::receivePacket() methods. + std::list fake_received_; + + std::list fake_sent_; }; static const char* DUID_FILE = "server-id-test.txt"; @@ -141,7 +134,8 @@ public: // it's ok if that fails. There should not be such a file anyway unlink(DUID_FILE); - const IfaceMgr::IfaceCollection& ifaces = IfaceMgr::instance().getIfaces(); + const isc::dhcp::IfaceMgr::IfaceCollection& ifaces = + isc::dhcp::IfaceMgr::instance().getIfaces(); // There must be some interface detected if (ifaces.empty()) { @@ -153,47 +147,56 @@ public: } // Generate IA_NA or IA_PD option with specified parameters - boost::shared_ptr generateIA(uint16_t type, uint32_t iaid, - uint32_t t1, uint32_t t2); + boost::shared_ptr generateIA + (uint16_t type, uint32_t iaid, uint32_t t1, uint32_t t2); /// @brief generates interface-id option, based on text /// /// @param iface_id textual representation of the interface-id content /// /// @return pointer to the option object - OptionPtr generateInterfaceId(const std::string& iface_id) { - OptionBuffer tmp(iface_id.begin(), iface_id.end()); - return OptionPtr(new Option(Option::V6, D6O_INTERFACE_ID, tmp)); + isc::dhcp::OptionPtr generateInterfaceId(const std::string& iface_id) { + isc::dhcp::OptionBuffer tmp(iface_id.begin(), iface_id.end()); + return (isc::dhcp::OptionPtr + (new isc::dhcp::Option(isc::dhcp::Option::V6, + D6O_INTERFACE_ID, tmp))); } // Generate client-id option - OptionPtr generateClientId(size_t duid_size = 32) { + isc::dhcp::OptionPtr generateClientId(size_t duid_size = 32) { - OptionBuffer clnt_duid(duid_size); + isc::dhcp::OptionBuffer clnt_duid(duid_size); for (int i = 0; i < duid_size; i++) { clnt_duid[i] = 100 + i; } - duid_ = DuidPtr(new DUID(clnt_duid)); + duid_ = isc::dhcp::DuidPtr(new isc::dhcp::DUID(clnt_duid)); - return (OptionPtr(new Option(Option::V6, D6O_CLIENTID, - clnt_duid.begin(), - clnt_duid.begin() + duid_size))); + return (isc::dhcp::OptionPtr + (new isc::dhcp::Option(isc::dhcp::Option::V6, D6O_CLIENTID, + clnt_duid.begin(), + clnt_duid.begin() + duid_size))); } - // Checks if server response (ADVERTISE or REPLY) includes proper server-id. - void checkServerId(const Pkt6Ptr& rsp, const OptionPtr& expected_srvid) { + // Checks if server response (ADVERTISE or REPLY) includes proper + // server-id. + void checkServerId(const isc::dhcp::Pkt6Ptr& rsp, + const isc::dhcp::OptionPtr& expected_srvid) + { // check that server included its server-id - OptionPtr tmp = rsp->getOption(D6O_SERVERID); + isc::dhcp::OptionPtr tmp = rsp->getOption(D6O_SERVERID); EXPECT_EQ(tmp->getType(), expected_srvid->getType() ); ASSERT_EQ(tmp->len(), expected_srvid->len() ); EXPECT_TRUE(tmp->getData() == expected_srvid->getData()); } - // Checks if server response (ADVERTISE or REPLY) includes proper client-id. - void checkClientId(const Pkt6Ptr& rsp, const OptionPtr& expected_clientid) { + // Checks if server response (ADVERTISE or REPLY) includes proper + // client-id. + void checkClientId(const isc::dhcp::Pkt6Ptr& rsp, + const isc::dhcp::OptionPtr& expected_clientid) + { // check that server included our own client-id - OptionPtr tmp = rsp->getOption(D6O_CLIENTID); + isc::dhcp::OptionPtr tmp = rsp->getOption(D6O_CLIENTID); ASSERT_TRUE(tmp); EXPECT_EQ(expected_clientid->getType(), tmp->getType()); ASSERT_EQ(expected_clientid->len(), tmp->len()); @@ -203,18 +206,21 @@ public: } // Checks if server response is a NAK - void checkNakResponse(const Pkt6Ptr& rsp, uint8_t expected_message_type, + void checkNakResponse(const isc::dhcp::Pkt6Ptr& rsp, + uint8_t expected_message_type, uint32_t expected_transid, - uint16_t expected_status_code) { + uint16_t expected_status_code) + { // Check if we get response at all checkResponse(rsp, expected_message_type, expected_transid); // Check that IA_NA was returned - OptionPtr option_ia_na = rsp->getOption(D6O_IA_NA); + isc::dhcp::OptionPtr option_ia_na = rsp->getOption(D6O_IA_NA); ASSERT_TRUE(option_ia_na); // check that the status is no address available - boost::shared_ptr ia = boost::dynamic_pointer_cast(option_ia_na); + boost::shared_ptr ia = + boost::dynamic_pointer_cast(option_ia_na); ASSERT_TRUE(ia); checkIA_NAStatusCode(ia, expected_status_code); @@ -228,8 +234,10 @@ public: // Status code indicates type of error encountered (in theory it can also // indicate success, but servers typically don't send success status // as this is the default result and it saves bandwidth) - void checkIA_NAStatusCode(const boost::shared_ptr& ia, - uint16_t expected_status_code) { + void checkIA_NAStatusCode + (const boost::shared_ptr& ia, + uint16_t expected_status_code) + { // Make sure there is no address assigned. EXPECT_FALSE(ia->getOption(D6O_IAADDR)); @@ -237,10 +245,12 @@ public: EXPECT_EQ(0, ia->getT1()); EXPECT_EQ(0, ia->getT2()); - OptionCustomPtr status = - boost::dynamic_pointer_cast(ia->getOption(D6O_STATUS_CODE)); + isc::dhcp::OptionCustomPtr status = + boost::dynamic_pointer_cast + (ia->getOption(D6O_STATUS_CODE)); - // It is ok to not include status success as this is the default behavior + // It is ok to not include status success as this is the default + // behavior if (expected_status_code == STATUS_Success && !status) { return; } @@ -248,35 +258,42 @@ public: EXPECT_TRUE(status); if (status) { - // We don't have dedicated class for status code, so let's just interpret - // first 2 bytes as status. Remainder of the status code option content is - // just a text explanation what went wrong. + // We don't have dedicated class for status code, so let's + // just interpret first 2 bytes as status. Remainder of the + // status code option content is just a text explanation + // what went wrong. EXPECT_EQ(static_cast(expected_status_code), status->readInteger(0)); } } - void checkMsgStatusCode(const Pkt6Ptr& msg, uint16_t expected_status) { - OptionCustomPtr status = - boost::dynamic_pointer_cast(msg->getOption(D6O_STATUS_CODE)); + void checkMsgStatusCode(const isc::dhcp::Pkt6Ptr& msg, + uint16_t expected_status) + { + isc::dhcp::OptionCustomPtr status = + boost::dynamic_pointer_cast + (msg->getOption(D6O_STATUS_CODE)); - // It is ok to not include status success as this is the default behavior + // It is ok to not include status success as this is the default + // behavior if (expected_status == STATUS_Success && !status) { return; } EXPECT_TRUE(status); if (status) { - // We don't have dedicated class for status code, so let's just interpret - // first 2 bytes as status. Remainder of the status code option content is - // just a text explanation what went wrong. + // We don't have dedicated class for status code, so let's + // just interpret first 2 bytes as status. Remainder of the + // status code option content is just a text explanation + // what went wrong. EXPECT_EQ(static_cast(expected_status), status->readInteger(0)); } } // Basic checks for generated response (message type and transaction-id). - void checkResponse(const Pkt6Ptr& rsp, uint8_t expected_message_type, + void checkResponse(const isc::dhcp::Pkt6Ptr& rsp, + uint8_t expected_message_type, uint32_t expected_transid) { ASSERT_TRUE(rsp); EXPECT_EQ(expected_message_type, rsp->getType()); @@ -286,28 +303,27 @@ public: virtual ~NakedDhcpv6SrvTest() { // Let's clean up if there is such a file. unlink(DUID_FILE); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "buffer6_receive"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "buffer6_send"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "lease6_renew"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "lease6_release"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "pkt6_receive"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "pkt6_send"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "subnet6_select"); - + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("buffer6_receive"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("buffer6_send"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("lease6_renew"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("lease6_release"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("pkt6_receive"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("pkt6_send"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("subnet6_select"); }; // A DUID used in most tests (typically as client-id) - DuidPtr duid_; + isc::dhcp::DuidPtr duid_; int rcode_; - ConstElementPtr comment_; + isc::data::ConstElementPtr comment_; // Name of a valid network interface std::string valid_iface_; @@ -324,18 +340,23 @@ public: /// Sets up a single subnet6 with one pool for addresses and second /// pool for prefixes. Dhcpv6SrvTest() { - subnet_ = Subnet6Ptr(new Subnet6(IOAddress("2001:db8:1::"), 48, 1000, - 2000, 3000, 4000)); - pool_ = Pool6Ptr(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), - 64)); + subnet_ = isc::dhcp::Subnet6Ptr + (new isc::dhcp::Subnet6(isc::asiolink::IOAddress("2001:db8:1::"), + 48, 1000, 2000, 3000, 4000)); + pool_ = isc::dhcp::Pool6Ptr + (new isc::dhcp::Pool6(isc::dhcp::Lease::TYPE_NA, + isc::asiolink::IOAddress("2001:db8:1:1::"), + 64)); subnet_->addPool(pool_); - CfgMgr::instance().deleteSubnets6(); - CfgMgr::instance().addSubnet6(subnet_); + isc::dhcp::CfgMgr::instance().deleteSubnets6(); + isc::dhcp::CfgMgr::instance().addSubnet6(subnet_); // configure PD pool - pd_pool_ = Pool6Ptr(new Pool6(Lease::TYPE_PD, - IOAddress("2001:db8:1:2::"), 64, 80)); + pd_pool_ = isc::dhcp::Pool6Ptr + (new isc::dhcp::Pool6(isc::dhcp::Lease::TYPE_PD, + isc::asiolink::IOAddress("2001:db8:1:2::"), + 64, 80)); subnet_->addPool(pd_pool_); } @@ -343,7 +364,7 @@ public: /// /// Removes existing configuration. ~Dhcpv6SrvTest() { - CfgMgr::instance().deleteSubnets6(); + isc::dhcp::CfgMgr::instance().deleteSubnets6(); }; /// @brief Checks that server response (ADVERTISE or REPLY) contains proper @@ -354,8 +375,8 @@ public: /// @param expected_t1 expected T1 value /// @param expected_t2 expected T2 value /// @return IAADDR option for easy chaining with checkIAAddr method - boost::shared_ptr - checkIA_NA(const Pkt6Ptr& rsp, uint32_t expected_iaid, + boost::shared_ptr + checkIA_NA(const isc::dhcp::Pkt6Ptr& rsp, uint32_t expected_iaid, uint32_t expected_t1, uint32_t expected_t2); /// @brief Checks that server response (ADVERTISE or REPLY) contains proper @@ -366,15 +387,15 @@ public: /// @param expected_t1 expected T1 value /// @param expected_t2 expected T2 value /// @return IAPREFIX option for easy chaining with checkIAAddr method - boost::shared_ptr - checkIA_PD(const Pkt6Ptr& rsp, uint32_t expected_iaid, + boost::shared_ptr + checkIA_PD(const isc::dhcp::Pkt6Ptr& rsp, uint32_t expected_iaid, uint32_t expected_t1, uint32_t expected_t2); // Check that generated IAADDR option contains expected address // and lifetime values match the configured subnet - void checkIAAddr(const boost::shared_ptr& addr, - const IOAddress& expected_addr, - Lease::Type type) { + void checkIAAddr(const boost::shared_ptr& addr, + const isc::asiolink::IOAddress& expected_addr, + isc::dhcp::Lease::Type type) { // Check that the assigned address is indeed from the configured pool. // Note that when comparing addresses, we compare the textual @@ -388,8 +409,9 @@ public: // Checks if the lease sent to client is present in the database // and is valid when checked agasint the configured subnet - Lease6Ptr checkLease(const DuidPtr& duid, const OptionPtr& ia_na, - boost::shared_ptr addr); + isc::dhcp::Lease6Ptr checkLease + (const isc::dhcp::DuidPtr& duid, const isc::dhcp::OptionPtr& ia_na, + boost::shared_ptr addr); /// @brief Verifies received IAPrefix option /// @@ -400,8 +422,9 @@ public: /// @param ia_pd IA_PD option that contains the IAPRefix option /// @param prefix pointer to the IAPREFIX option /// @return corresponding IPv6 lease (if found) - Lease6Ptr checkPdLease(const DuidPtr& duid, const OptionPtr& ia_pd, - boost::shared_ptr prefix); + isc::dhcp::Lease6Ptr checkPdLease + (const isc::dhcp::DuidPtr& duid, const isc::dhcp::OptionPtr& ia_pd, + boost::shared_ptr prefix); /// @brief Creates a message with specified IA /// @@ -415,10 +438,10 @@ public: /// @param prefix_len length of the prefix (used for prefixes only) /// @param iaid IA identifier (used in IA_XX option) /// @return created message - Pkt6Ptr - createMessage(uint8_t message_type, Lease::Type lease_type, - const IOAddress& addr, const uint8_t prefix_len, - uint32_t iaid); + isc::dhcp::Pkt6Ptr + createMessage(uint8_t message_type, isc::dhcp::Lease::Type lease_type, + const isc::asiolink::IOAddress& addr, + const uint8_t prefix_len, uint32_t iaid); /// @brief Performs basic (positive) RENEW test /// @@ -432,7 +455,8 @@ public: /// @param renew_addr address being sent in RENEW /// @param prefix_len length of the prefix (128 for addresses) void - testRenewBasic(Lease::Type type, const std::string& existing_addr, + testRenewBasic(isc::dhcp::Lease::Type type, + const std::string& existing_addr, const std::string& renew_addr, const uint8_t prefix_len); /// @brief Performs negative RENEW test @@ -445,7 +469,8 @@ public: /// @param type type (TYPE_NA or TYPE_PD) /// @param addr address being sent in RENEW void - testRenewReject(Lease::Type type, const IOAddress& addr); + testRenewReject(isc::dhcp::Lease::Type type, + const isc::asiolink::IOAddress& addr); /// @brief Performs basic (positive) RELEASE test /// @@ -458,44 +483,47 @@ public: /// @param existing address to be preinserted into the database /// @param release_addr address being sent in RELEASE void - testReleaseBasic(Lease::Type type, const IOAddress& existing, - const IOAddress& release_addr); + testReleaseBasic(isc::dhcp::Lease::Type type, + const isc::asiolink::IOAddress& existing, + const isc::asiolink::IOAddress& release_addr); /// @brief Performs negative RELEASE test /// - /// See releaseReject and pdReleaseReject tests for detailed explanation. - /// In essence the test attempts to perform couple failed RELEASE scenarios. + /// See releaseReject and pdReleaseReject tests for detailed + /// explanation. In essence the test attempts to perform couple + /// failed RELEASE scenarios. /// /// This method does not throw, but uses gtest macros to signify failures. /// /// @param type type (TYPE_NA or TYPE_PD) /// @param addr address being sent in RELEASE void - testReleaseReject(Lease::Type type, const IOAddress& addr); + testReleaseReject(isc::dhcp::Lease::Type type, + const isc::asiolink::IOAddress& addr); // see wireshark.cc for descriptions // The descriptions are too large and too closely related to the // code, so it is kept in .cc rather than traditionally in .h - Pkt6Ptr captureSimpleSolicit(); - Pkt6Ptr captureRelayedSolicit(); - Pkt6Ptr captureDocsisRelayedSolicit(); - Pkt6Ptr captureeRouterRelayedSolicit(); + isc::dhcp::Pkt6Ptr captureSimpleSolicit(); + isc::dhcp::Pkt6Ptr captureRelayedSolicit(); + isc::dhcp::Pkt6Ptr captureDocsisRelayedSolicit(); + isc::dhcp::Pkt6Ptr captureeRouterRelayedSolicit(); /// @brief Auxiliary method that sets Pkt6 fields /// /// Used to reconstruct captured packets. Sets UDP ports, interface names, /// and other fields to some believable values. /// @param pkt packet that will have its fields set - void captureSetDefaultFields(const Pkt6Ptr& pkt); + void captureSetDefaultFields(const isc::dhcp::Pkt6Ptr& pkt); /// A subnet used in most tests - Subnet6Ptr subnet_; + isc::dhcp::Subnet6Ptr subnet_; /// A normal, non-temporary pool used in most tests - Pool6Ptr pool_; + isc::dhcp::Pool6Ptr pool_; /// A prefix pool used in most tests - Pool6Ptr pd_pool_; + isc::dhcp::Pool6Ptr pd_pool_; }; }; // end of isc::test namespace diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index d4e8e5ebd1..d13ebb499b 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/src/bin/dhcp6/tests/hooks_unittest.cc @@ -36,6 +36,8 @@ #include using namespace isc; +using namespace isc::data; +using namespace isc::config; using namespace isc::test; using namespace isc::asiolink; using namespace isc::dhcp; diff --git a/src/bin/dhcp6/tests/wireshark.cc b/src/bin/dhcp6/tests/wireshark.cc index cd2909673e..5185e053ab 100644 --- a/src/bin/dhcp6/tests/wireshark.cc +++ b/src/bin/dhcp6/tests/wireshark.cc @@ -38,6 +38,8 @@ /// (Make sure that the packet is expanded in the view. The text file will /// contain whatever expansion level you have in the graphical tree.) +using namespace isc::dhcp; +using namespace isc::asiolink; using namespace std; namespace isc { diff --git a/src/hooks/dhcp/user_chk/user_chk.h b/src/hooks/dhcp/user_chk/user_chk.h index 1bc2fc3ae8..9f40c40483 100644 --- a/src/hooks/dhcp/user_chk/user_chk.h +++ b/src/hooks/dhcp/user_chk/user_chk.h @@ -18,14 +18,11 @@ #include #include -using namespace std; -using namespace user_chk; - // The following constants are used throughout the library. They are defined // in load_unload.cc /// @brief Pointer to the registry instance. -extern UserRegistryPtr user_registry; +extern user_chk::UserRegistryPtr user_registry; /// @brief Output filestream for recording user check outcomes. extern std::fstream user_chk_output; diff --git a/src/hooks/dhcp/user_chk/user_file.cc b/src/hooks/dhcp/user_chk/user_file.cc index 3ffc99ef83..45b62fe673 100644 --- a/src/hooks/dhcp/user_chk/user_file.cc +++ b/src/hooks/dhcp/user_chk/user_file.cc @@ -35,7 +35,7 @@ UserFile::~UserFile(){ void UserFile::open() { if (isOpen()) { - isc_throw (UserFileError, "file is already open"); + isc_throw(UserFileError, "file is already open"); } file_.open(fname_.c_str(), std::ifstream::in); diff --git a/src/hooks/dhcp/user_chk/user_file.h b/src/hooks/dhcp/user_chk/user_file.h index 873dddf159..e394b47614 100644 --- a/src/hooks/dhcp/user_chk/user_file.h +++ b/src/hooks/dhcp/user_chk/user_file.h @@ -23,17 +23,15 @@ #include #include -using namespace std; - namespace user_chk { /// @brief Thrown a UserFile encounters an error. /// Note that it derives from UserDataSourceError to comply with the interface. class UserFileError : public UserDataSourceError { public: - UserFileError(const char* file, size_t line, - const char* what) : - UserDataSourceError(file, line, what) { }; + UserFileError(const char* file, size_t line, const char* what) : + UserDataSourceError(file, line, what) + {} }; /// @brief Provides a UserDataSource implementation for JSON text files. @@ -125,7 +123,7 @@ public: private: /// @brief Pathname of the input text file. - string fname_; + std::string fname_; /// @brief Input file stream. std::ifstream file_; diff --git a/src/hooks/dhcp/user_chk/user_registry.h b/src/hooks/dhcp/user_chk/user_registry.h index 48dc32c423..3c8ee4c778 100644 --- a/src/hooks/dhcp/user_chk/user_registry.h +++ b/src/hooks/dhcp/user_chk/user_registry.h @@ -24,16 +24,14 @@ #include -using namespace std; - namespace user_chk { /// @brief Thrown UserRegistry encounters an error class UserRegistryError : public isc::Exception { public: - UserRegistryError(const char* file, size_t line, - const char* what) : - isc::Exception(file, line, what) { }; + UserRegistryError(const char* file, size_t line, const char* what) : + isc::Exception(file, line, what) + {} }; /// @brief Defines a map of unique Users keyed by UserId.