diff --git a/configure.ac b/configure.ac index ee0790359ad5fe571276bf253a3f4f24302fb5eb..64db689e0193c7e437efec107b395647715e647c 100644 --- a/configure.ac +++ b/configure.ac @@ -643,6 +643,7 @@ AC_CONFIG_FILES([Makefile src/lib/asiolink/Makefile src/lib/asiolink/tests/Makefile src/lib/asiodns/Makefile + src/lib/asiodns/tests/Makefile src/lib/bench/Makefile src/lib/bench/example/Makefile src/lib/bench/tests/Makefile diff --git a/src/lib/asiodns/.deps/libasiodns_la-dns_service.Plo b/src/lib/asiodns/.deps/libasiodns_la-dns_service.Plo deleted file mode 100644 index 9ce06a81ea45b2883a6faf07a0d2136bb2a4e647..0000000000000000000000000000000000000000 --- a/src/lib/asiodns/.deps/libasiodns_la-dns_service.Plo +++ /dev/null @@ -1 +0,0 @@ -# dummy diff --git a/src/lib/asiodns/.deps/libasiodns_la-dns_service.Tpo b/src/lib/asiodns/.deps/libasiodns_la-dns_service.Tpo deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/lib/asiodns/Makefile.am b/src/lib/asiodns/Makefile.am index e17774d6edbfe882cd6ced385a37e5e93ee04c0f..ef0c32cf1ba6f6bc3f0f8696ef639357b7da4137 100644 --- a/src/lib/asiodns/Makefile.am +++ b/src/lib/asiodns/Makefile.am @@ -19,6 +19,7 @@ libasiodns_la_SOURCES += dns_server.h libasiodns_la_SOURCES += dns_service.cc dns_service.h libasiodns_la_SOURCES += tcp_server.cc tcp_server.h libasiodns_la_SOURCES += udp_server.cc udp_server.h +libasiodns_la_SOURCES += io_fetch.cc io_fetch.h # Note: the ordering matters: -Wno-... must follow -Wextra (defined in # B10_CXXFLAGS) diff --git a/src/lib/asiodns/dns_answer.h b/src/lib/asiodns/dns_answer.h index 84e1f6fd954c6343837b9b6612b26e39c55e33ea..f4d643e9485fffcecba2b396327c6f36242c41be 100644 --- a/src/lib/asiodns/dns_answer.h +++ b/src/lib/asiodns/dns_answer.h @@ -16,8 +16,11 @@ #define __ASIOLINK_DNS_ANSWER_H 1 #include +#include +#include -namespace asiolink { +namespace isc { +namespace asiodns { /// \brief The \c DNSAnswer class is an abstract base class for a DNS /// Answer provider function. @@ -63,11 +66,12 @@ public: /// \param answer_message The DNS MessagePtr of the answer we are /// building /// \param buffer Intermediate data results are put here - virtual void operator()(const IOMessage& io_message, + virtual void operator()(const asiolink::IOMessage& io_message, isc::dns::MessagePtr query_message, isc::dns::MessagePtr answer_message, isc::dns::OutputBufferPtr buffer) const = 0; }; -} // namespace asiolink +} // namespace asiodns +} // namespace isc #endif // __ASIOLINK_DNS_ANSWER_H diff --git a/src/lib/asiodns/dns_lookup.h b/src/lib/asiodns/dns_lookup.h index a79976f5266944e28c0ab8bd6cb63fca1861792b..a3b0b36ebec8741f9c41f4b3e12c387201b66c1a 100644 --- a/src/lib/asiodns/dns_lookup.h +++ b/src/lib/asiodns/dns_lookup.h @@ -16,11 +16,12 @@ #define __ASIOLINK_DNS_LOOKUP_H 1 #include -#include +#include #include #include -namespace asiolink { +namespace isc { +namespace asiodns { /// \brief The \c DNSLookup class is an abstract base class for a DNS /// Lookup provider function. @@ -67,7 +68,7 @@ public: /// this MessagePtr /// \param buffer The final answer is put here /// \param server DNSServer object to use - virtual void operator()(const IOMessage& io_message, + virtual void operator()(const asiolink::IOMessage& io_message, isc::dns::MessagePtr message, isc::dns::MessagePtr answer_message, isc::dns::OutputBufferPtr buffer, @@ -79,5 +80,6 @@ private: DNSLookup* self_; }; -} // namespace asiolink +} // namespace asiodns +} // namespace isc #endif // __ASIOLINK_DNS_LOOKUP_H diff --git a/src/lib/asiodns/dns_server.h b/src/lib/asiodns/dns_server.h index f15f808e6e442ed42e22990d5771fd66501ff914..f23586062cf9cdafa1ec619d81e9f79d9268a8d8 100644 --- a/src/lib/asiodns/dns_server.h +++ b/src/lib/asiodns/dns_server.h @@ -17,7 +17,8 @@ #include -namespace asiolink { +namespace isc { +namespace asiodns { /// \brief The \c DNSServer class is a wrapper (and base class) for /// classes which provide DNS server functionality. @@ -34,7 +35,7 @@ namespace asiolink { /// instantiated through a base class) are sometimes passed by /// reference (as this superclass); calls to methods in the base /// class are then rerouted via this pointer to methods in the derived -/// class. This allows code from outside asiolink, with no specific +/// class. This allows code from outside asiodns, with no specific /// knowledge of \c TCPServer or \c UDPServer, to access their methods. /// /// This class is both assignable and copy-constructable. Its subclasses @@ -151,5 +152,6 @@ private: }; -} // asiolink +} // namespace asiodns +} // namespace isc #endif // __ASIOLINK_DNS_SERVER_H diff --git a/src/lib/asiodns/dns_service.cc b/src/lib/asiodns/dns_service.cc index f17bb4483deb7d52629b367fb7c95b8e39f228e7..94510fe520a5da1b8740031df1c66cb6027d1bf6 100644 --- a/src/lib/asiodns/dns_service.cc +++ b/src/lib/asiodns/dns_service.cc @@ -23,11 +23,11 @@ #include #include -#include +#include #include #include -#include -#include +#include +#include #include @@ -36,9 +36,11 @@ using isc::log::dlog; -namespace asiolink { +using namespace isc::asiolink; + +namespace isc { +namespace asiodns { -class SimpleCallback; class DNSLookup; class DNSAnswer; @@ -195,6 +197,5 @@ DNSService::clearServers() { impl_->servers_.clear(); } - - -} // namespace asiolink +} // namespace asiodns +} // namespace isc diff --git a/src/lib/asiodns/dns_service.h b/src/lib/asiodns/dns_service.h index 9a3fb4c44f3c1674986838ab93d30a1f54534e31..6b6a6c07f4a5a75db3405ff533ad68a9cab7ca12 100644 --- a/src/lib/asiodns/dns_service.h +++ b/src/lib/asiodns/dns_service.h @@ -18,10 +18,11 @@ #include #include +#include -namespace asiolink { +namespace isc { +namespace asiodns { -class SimpleCallback; class DNSLookup; class DNSAnswer; class DNSServiceImpl; @@ -54,8 +55,8 @@ public: /// \param checkin Provider for cc-channel events (see \c SimpleCallback) /// \param lookup The lookup provider (see \c DNSLookup) /// \param answer The answer provider (see \c DNSAnswer) - DNSService(IOService& io_service, const char& port, - const char& address, SimpleCallback* checkin, + DNSService(asiolink::IOService& io_service, const char& port, + const char& address, isc::asiolink::SimpleCallback* checkin, DNSLookup* lookup, DNSAnswer* answer); /// \brief The constructor with a specific port on which the services /// listen on. @@ -71,14 +72,14 @@ public: /// \param checkin Provider for cc-channel events (see \c SimpleCallback) /// \param lookup The lookup provider (see \c DNSLookup) /// \param answer The answer provider (see \c DNSAnswer) - DNSService(IOService& io_service, const char& port, + DNSService(asiolink::IOService& io_service, const char& port, const bool use_ipv4, const bool use_ipv6, - SimpleCallback* checkin, DNSLookup* lookup, + isc::asiolink::SimpleCallback* checkin, DNSLookup* lookup, DNSAnswer* answer); /// \brief The constructor without any servers. /// /// Use addServer() to add some servers. - DNSService(IOService& io_service, SimpleCallback* checkin, + DNSService(asiolink::IOService& io_service, isc::asiolink::SimpleCallback* checkin, DNSLookup* lookup, DNSAnswer* answer); /// \brief The destructor. ~DNSService(); @@ -105,8 +106,9 @@ public: private: DNSServiceImpl* impl_; - IOService& io_service_; + asiolink::IOService& io_service_; }; -} // namespace asiolink +} // namespace asiodns +} // namespace isc #endif // __ASIOLINK_DNS_SERVICE_H diff --git a/src/lib/asiolink/io_fetch.cc b/src/lib/asiodns/io_fetch.cc similarity index 98% rename from src/lib/asiolink/io_fetch.cc rename to src/lib/asiodns/io_fetch.cc index fdc1f2e9b1eed55ff4336061ea5b93f7fb5f0207..a51d11592ab356a05cf899d96bf964ebaa637dc4 100644 --- a/src/lib/asiolink/io_fetch.cc +++ b/src/lib/asiodns/io_fetch.cc @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -45,18 +44,22 @@ #include #include +#include "io_fetch.h" + #include using namespace asio; +using namespace isc::asiolink; using namespace isc::dns; using namespace isc::log; using namespace std; -namespace asiolink { +namespace isc { +namespace asiodns { /// Use the ASIO logger -isc::log::Logger logger("asiolink"); +isc::log::Logger logger("asiodns"); /// \brief IOFetch Data /// @@ -376,5 +379,6 @@ void IOFetch::logIOFailure(asio::error_code ec) { static_cast(data_->remote_snd->getPort())); } -} // namespace asiolink +} // namespace asiodns +} // namespace isc diff --git a/src/lib/asiolink/io_fetch.h b/src/lib/asiodns/io_fetch.h similarity index 95% rename from src/lib/asiolink/io_fetch.h rename to src/lib/asiodns/io_fetch.h index 0723777e1143ae1d2d46d76ccc2b7578919a2ea1..0a11fb799830c7d37717b50ba9531944e2aaf6d2 100644 --- a/src/lib/asiolink/io_fetch.h +++ b/src/lib/asiodns/io_fetch.h @@ -24,16 +24,17 @@ #include #include +#include +#include #include #include -namespace asiolink { +namespace isc { +namespace asiodns { // Forward declarations -class IOAddress; class IOFetchData; -class IOService; /// \brief Upstream Fetch Processing /// @@ -132,8 +133,9 @@ public: /// (default = 53) /// \param wait Timeout for the fetch (in ms). The default value of /// -1 indicates no timeout. - IOFetch(Protocol protocol, IOService& service, - const isc::dns::Question& question, const IOAddress& address, + IOFetch(Protocol protocol, isc::asiolink::IOService& service, + const isc::dns::Question& question, + const isc::asiolink::IOAddress& address, uint16_t port, isc::dns::OutputBufferPtr& buff, Callback* cb, int wait = -1); @@ -174,6 +176,7 @@ private: }; -} // namespace asiolink +} // namespace asiodns +} // namespace isc #endif // __IO_FETCH_H diff --git a/src/lib/asiodns/tcp_server.cc b/src/lib/asiodns/tcp_server.cc index db59551c3bd0d2a8978f17a252ac7544bcdac473..7655df0b49c36e5947f59127b3004e22e9e23882 100644 --- a/src/lib/asiodns/tcp_server.cc +++ b/src/lib/asiodns/tcp_server.cc @@ -27,7 +27,7 @@ #include #include #include -#include +#include using namespace asio; @@ -36,8 +36,10 @@ using asio::ip::tcp; using namespace std; using namespace isc::dns; +using namespace isc::asiolink; -namespace asiolink { +namespace isc { +namespace asiodns { /// The following functions implement the \c TCPServer class. /// @@ -235,5 +237,5 @@ TCPServer::resume(const bool done) { io_.post(*this); } -} // namespace asiolink - +} // namespace asiodns +} // namespace isc diff --git a/src/lib/asiodns/tcp_server.h b/src/lib/asiodns/tcp_server.h index 2fe0d371dcf40a4d91387e8b20d041f07bba4acf..3b002935196e24363988be6b66df9f1b997840b6 100644 --- a/src/lib/asiodns/tcp_server.h +++ b/src/lib/asiodns/tcp_server.h @@ -24,9 +24,12 @@ #include #include +#include "dns_server.h" +#include "dns_lookup.h" +#include "dns_answer.h" - -namespace asiolink { +namespace isc { +namespace asiodns { /// \brief A TCP-specific \c DNSServer object. /// @@ -36,7 +39,7 @@ class TCPServer : public virtual DNSServer, public virtual coroutine { public: explicit TCPServer(asio::io_service& io_service, const asio::ip::address& addr, const uint16_t port, - const SimpleCallback* checkin = NULL, + const isc::asiolink::SimpleCallback* checkin = NULL, const DNSLookup* lookup = NULL, const DNSAnswer* answer = NULL); @@ -95,7 +98,7 @@ private: // \c IOMessage and \c Message objects to be passed to the // DNS lookup and answer providers - boost::shared_ptr io_message_; + boost::shared_ptr io_message_; isc::dns::MessagePtr query_message_; isc::dns::MessagePtr answer_message_; @@ -108,13 +111,14 @@ private: bool done_; // Callback functions provided by the caller - const SimpleCallback* checkin_callback_; + const isc::asiolink::SimpleCallback* checkin_callback_; const DNSLookup* lookup_callback_; const DNSAnswer* answer_callback_; - boost::shared_ptr peer_; - boost::shared_ptr iosock_; + boost::shared_ptr peer_; + boost::shared_ptr iosock_; }; -} // namespace asiolink +} // namespace asiodns +} // namespace isc #endif // __TCP_SERVER_H diff --git a/src/lib/asiodns/tests/Makefile.am b/src/lib/asiodns/tests/Makefile.am index bb29074923a9da9d4275afe3e28de0c7b4721d8b..215375571b86fe8034fdea2454e6f24deb939f24 100644 --- a/src/lib/asiodns/tests/Makefile.am +++ b/src/lib/asiodns/tests/Makefile.am @@ -16,8 +16,11 @@ TESTS = if HAVE_GTEST TESTS += run_unittests run_unittests_SOURCES = run_unittests.cc +run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.h +run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.cc run_unittests_SOURCES += io_service_unittest.cc run_unittests_SOURCES += dns_server_unittest.cc +run_unittests_SOURCES += io_fetch_unittest.cc run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) @@ -27,6 +30,7 @@ run_unittests_LDADD += $(top_builddir)/src/lib/dns/libdns++.la run_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libasiolink.la run_unittests_LDADD += $(top_builddir)/src/lib/log/liblog.la run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la +run_unittests_LDADD += $(top_builddir)/src/lib/asiodns/libasiodns.la run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) diff --git a/src/lib/asiodns/tests/dns_server_unittest.cc b/src/lib/asiodns/tests/dns_server_unittest.cc index 5b8b683276363326f4077f481d668cdc5925fc66..0d5a5540c2ddc1a37dfc1fd2a1685feb685f1891 100644 --- a/src/lib/asiodns/tests/dns_server_unittest.cc +++ b/src/lib/asiodns/tests/dns_server_unittest.cc @@ -18,10 +18,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include //for alarm @@ -65,7 +65,8 @@ /// involved so the message sending between client and server is plain text /// And the valid checker, question lookup and answer composition are dummy. -using namespace asiolink; +using namespace isc::asiolink; +using namespace isc::asiodns; using namespace asio; namespace { static const std::string server_ip = "127.0.0.1"; diff --git a/src/lib/asiolink/tests/io_fetch_unittest.cc b/src/lib/asiodns/tests/io_fetch_unittest.cc similarity index 99% rename from src/lib/asiolink/tests/io_fetch_unittest.cc rename to src/lib/asiodns/tests/io_fetch_unittest.cc index 2b258b87b197b086ff8aff23c15679fd45e30a76..eba58092f899b263a711c1300e5e280931f748f7 100644 --- a/src/lib/asiolink/tests/io_fetch_unittest.cc +++ b/src/lib/asiodns/tests/io_fetch_unittest.cc @@ -37,15 +37,17 @@ #include #include #include -#include #include +#include using namespace asio; using namespace isc::dns; using namespace asio::ip; using namespace std; +using namespace isc::asiolink; -namespace asiolink { +namespace isc { +namespace asiodns { const asio::ip::address TEST_HOST(asio::ip::address::from_string("127.0.0.1")); const uint16_t TEST_PORT(5301); @@ -720,4 +722,5 @@ TEST_F(IOFetchTest, TcpSendReceive8192ShortSend) { } -} // namespace asiolink +} // namespace asiodns +} // namespace isc diff --git a/src/lib/asiodns/tests/io_service_unittest.cc b/src/lib/asiodns/tests/io_service_unittest.cc index 779d03e88ef24e097ade8b1d1142236b636c6552..cc64022606ce74eaa585f3a70701d94b3d070217 100644 --- a/src/lib/asiodns/tests/io_service_unittest.cc +++ b/src/lib/asiodns/tests/io_service_unittest.cc @@ -17,8 +17,10 @@ #include #include +#include -using namespace asiolink; +using namespace isc::asiolink; +using namespace isc::asiodns; const char* const TEST_SERVER_PORT = "53535"; const char* const TEST_CLIENT_PORT = "53536"; diff --git a/src/lib/asiodns/udp_server.cc b/src/lib/asiodns/udp_server.cc index 5b48f288d06ce498221999516ea5694afe79c60b..4d2a0ed8511471c3f689c620398452fb2a4b3c9c 100644 --- a/src/lib/asiodns/udp_server.cc +++ b/src/lib/asiodns/udp_server.cc @@ -27,8 +27,8 @@ #include #include #include -#include #include +#include "udp_server.h" #include @@ -38,8 +38,10 @@ using isc::log::dlog; using namespace std; using namespace isc::dns; +using namespace isc::asiolink; -namespace asiolink { +namespace isc { +namespace asiodns { /* * Some of the member variables here are shared_ptrs and some are @@ -318,4 +320,5 @@ UDPServer::hasAnswer() { return (data_->done_); } -} // namespace asiolink +} // namespace asiodns +} // namespace isc diff --git a/src/lib/asiodns/udp_server.h b/src/lib/asiodns/udp_server.h index 1d374717efcd188cf6448234297e367b416539bb..4c195443655dd03240dee9a25f4ef2a994276461 100644 --- a/src/lib/asiodns/udp_server.h +++ b/src/lib/asiodns/udp_server.h @@ -19,14 +19,15 @@ #error "asio.hpp must be included before including this, see asiolink.h as to why" #endif -#include #include -#include -#include +#include +#include +#include #include -namespace asiolink { +namespace isc { +namespace asiodns { // // Asynchronous UDP server coroutine @@ -47,7 +48,7 @@ public: /// \param answer the callbackprovider for DNS answer events explicit UDPServer(asio::io_service& io_service, const asio::ip::address& addr, const uint16_t port, - SimpleCallback* checkin = NULL, + isc::asiolink::SimpleCallback* checkin = NULL, DNSLookup* lookup = NULL, DNSAnswer* answer = NULL); @@ -102,5 +103,6 @@ private: boost::shared_ptr data_; }; -} // namespace asiolink +} // namespace asiodns +} // namespace isc #endif // __UDP_SERVER_H diff --git a/src/lib/asiolink/Makefile.am b/src/lib/asiolink/Makefile.am index 745b0df4639e98b3c3eea0ce35aa10829fc1127c..f1afe6987ef76a313c0762a5a0707c1f1333a6c9 100644 --- a/src/lib/asiolink/Makefile.am +++ b/src/lib/asiolink/Makefile.am @@ -21,7 +21,6 @@ libasiolink_la_SOURCES += io_address.cc io_address.h libasiolink_la_SOURCES += io_asio_socket.h libasiolink_la_SOURCES += io_endpoint.cc io_endpoint.h libasiolink_la_SOURCES += io_error.h -libasiolink_la_SOURCES += io_fetch.cc io_fetch.h libasiolink_la_SOURCES += io_message.h libasiolink_la_SOURCES += qid_gen.cc qid_gen.h libasiolink_la_SOURCES += io_service.h io_service.cc diff --git a/src/lib/asiolink/asiodef.cc b/src/lib/asiolink/asiodef.cc index 94c71b5f46b56c62784de6389cd0b3998c7ff6dd..8e105c2a3a6d7408d560fffe774f333e40296f28 100644 --- a/src/lib/asiolink/asiodef.cc +++ b/src/lib/asiolink/asiodef.cc @@ -4,6 +4,7 @@ #include #include +namespace isc { namespace asiolink { extern const isc::log::MessageID ASIO_FETCHCOMP = "FETCHCOMP"; @@ -16,6 +17,7 @@ extern const isc::log::MessageID ASIO_UNKORIGIN = "UNKORIGIN"; extern const isc::log::MessageID ASIO_UNKRESULT = "UNKRESULT"; } // namespace asiolink +} // namespace isc namespace { diff --git a/src/lib/asiolink/asiodef.h b/src/lib/asiolink/asiodef.h index ba77817974164a6a4b5f4b0bd3b71b9f3f30b2cd..fdac74109de769fb70703eb674869d7b005b351c 100644 --- a/src/lib/asiolink/asiodef.h +++ b/src/lib/asiolink/asiodef.h @@ -5,6 +5,7 @@ #include +namespace isc { namespace asiolink { extern const isc::log::MessageID ASIO_FETCHCOMP; @@ -17,5 +18,6 @@ extern const isc::log::MessageID ASIO_UNKORIGIN; extern const isc::log::MessageID ASIO_UNKRESULT; } // namespace asiolink +} // namespace isc #endif // __ASIODEF_H diff --git a/src/lib/asiolink/asiolink_utilities.h b/src/lib/asiolink/asiolink_utilities.h index 659e6a0908727bb0653cd0f8b81f126c0fdd653c..6ac423efb2e9be652388f1f8b6b487dac35d62f8 100644 --- a/src/lib/asiolink/asiolink_utilities.h +++ b/src/lib/asiolink/asiolink_utilities.h @@ -17,6 +17,7 @@ #include +namespace isc { namespace asiolink { /// \brief Read Unsigned 16-Bit Integer from Buffer @@ -57,5 +58,6 @@ writeUint16(uint16_t value, void* buffer) { } } // namespace asiolink +} // namespace isc #endif // __ASIOLINK_UTILITIES_H diff --git a/src/lib/asiolink/dummy_io_cb.h b/src/lib/asiolink/dummy_io_cb.h index 0006b95cfcbc131bed5714b778f01c1416c54fe4..2081906dd3a04f2e5f357239a330ac1ef870e7d5 100644 --- a/src/lib/asiolink/dummy_io_cb.h +++ b/src/lib/asiolink/dummy_io_cb.h @@ -20,6 +20,7 @@ #include #include +namespace isc { namespace asiolink { /// \brief Asynchronous I/O Completion Callback @@ -55,5 +56,6 @@ public: }; } // namespace asiolink +} // namespace isc #endif // __DUMMY_IO_CB_H diff --git a/src/lib/asiolink/interval_timer.cc b/src/lib/asiolink/interval_timer.cc index 8efb102cd9efb67367b8da889afce7eec0482d45..0ed06eb98509202de138f9ec4f7af8b151ea066a 100644 --- a/src/lib/asiolink/interval_timer.cc +++ b/src/lib/asiolink/interval_timer.cc @@ -26,6 +26,7 @@ #include #include +namespace isc { namespace asiolink { class IntervalTimerImpl { @@ -133,4 +134,5 @@ IntervalTimer::getInterval() const { return (impl_->getInterval()); } -} +} // namespace asiolink +} // namespace isc diff --git a/src/lib/asiolink/interval_timer.h b/src/lib/asiolink/interval_timer.h index 6c4332764d71567fa9eff4ebd7ace93b731d8b6f..0831d449f5553e40be425f94192eace95fc2bcb4 100644 --- a/src/lib/asiolink/interval_timer.h +++ b/src/lib/asiolink/interval_timer.h @@ -19,6 +19,7 @@ #include +namespace isc { namespace asiolink { struct IntervalTimerImpl; @@ -129,5 +130,6 @@ private: IntervalTimerImpl* impl_; }; -} // namespace asiolink +} // namespace asiolink +} // namespace isc #endif // __ASIOLINK_INTERVAL_TIMER_H diff --git a/src/lib/asiolink/io_address.cc b/src/lib/asiolink/io_address.cc index 70e837456d2e00d8665884e95f6d7a6ed2d2dce2..7f7a6fc2b322ec6eeaaf01594e1420c92b2f5858 100644 --- a/src/lib/asiolink/io_address.cc +++ b/src/lib/asiolink/io_address.cc @@ -31,6 +31,7 @@ using asio::ip::tcp; using namespace std; +namespace isc { namespace asiolink { // XXX: we cannot simply construct the address in the initialization list, @@ -62,4 +63,5 @@ IOAddress::getFamily() const { } } -} +} // namespace asiolink +} // namespace isc diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h index 53c1a7a13a6543153ab15bb0abd815b5780e4a9c..655b727896f689ec07e3467b54a07ca51a3d6abc 100644 --- a/src/lib/asiolink/io_address.h +++ b/src/lib/asiolink/io_address.h @@ -26,6 +26,7 @@ #include +namespace isc { namespace asiolink { /// \brief The \c IOAddress class represents an IP addresses (version @@ -119,5 +120,6 @@ private: asio::ip::address asio_address_; }; -} // asiolink +} // namespace asiolink +} // namespace isc #endif // __IO_ADDRESS_H diff --git a/src/lib/asiolink/io_asio_socket.h b/src/lib/asiolink/io_asio_socket.h index ac793a6af7a5f455b303f8d2ebef92a773f1e370..d618ff8222aec310ef201f2507a5d01d0596b94d 100644 --- a/src/lib/asiolink/io_asio_socket.h +++ b/src/lib/asiolink/io_asio_socket.h @@ -31,7 +31,7 @@ #include #include - +namespace isc { namespace asiolink { /// \brief Socket not open @@ -395,5 +395,6 @@ private: }; } // namespace asiolink +} // namespace isc #endif // __IO_ASIO_SOCKET_H diff --git a/src/lib/asiolink/io_endpoint.cc b/src/lib/asiolink/io_endpoint.cc index e0b1a9eb2cebbc08ee53553fd7a8839ff2e703a1..63830a5b5ea3f988fbba6f7c3f6cb411a4305342 100644 --- a/src/lib/asiolink/io_endpoint.cc +++ b/src/lib/asiolink/io_endpoint.cc @@ -28,6 +28,7 @@ using namespace std; +namespace isc { namespace asiolink { const IOEndpoint* @@ -57,4 +58,5 @@ IOEndpoint::operator!=(const IOEndpoint& other) const { return (!operator==(other)); } -} +} // namespace asiolink +} // namespace isc diff --git a/src/lib/asiolink/io_endpoint.h b/src/lib/asiolink/io_endpoint.h index d21da96ea9d0117d5dbe5db60c872bc29ed64889..756fa3b4ce6a7f54aa79f4b4d9597669f7095ca8 100644 --- a/src/lib/asiolink/io_endpoint.h +++ b/src/lib/asiolink/io_endpoint.h @@ -26,6 +26,7 @@ #include #include +namespace isc { namespace asiolink { /// \brief The \c IOEndpoint class is an abstract base class to represent @@ -117,5 +118,6 @@ public: const unsigned short port); }; -} // asiolink +} // namespace asiolink +} // namespace isc #endif // __IO_ENDPOINT_H diff --git a/src/lib/asiolink/io_error.h b/src/lib/asiolink/io_error.h index 2869e0bd1a031fe6ddb757f81f2bd429e3453745..c19d91c693711dfc4e999214d28b1d12503f916d 100644 --- a/src/lib/asiolink/io_error.h +++ b/src/lib/asiolink/io_error.h @@ -18,6 +18,7 @@ #include +namespace isc { namespace asiolink { /// \brief An exception that is thrown if an error occurs within the IO @@ -30,6 +31,7 @@ public: }; -} // asiolink +} // namespace asiolink +} // namespace isc #endif // __IO_ERROR_H diff --git a/src/lib/asiolink/io_message.h b/src/lib/asiolink/io_message.h index e857bd9f1cf3f5bea873deb596c851255b03e13a..81f6da1cf0663a6cf4e850baf005e2c4dba44fa2 100644 --- a/src/lib/asiolink/io_message.h +++ b/src/lib/asiolink/io_message.h @@ -28,6 +28,7 @@ #include #include +namespace isc { namespace asiolink { /// \brief The \c IOMessage class encapsulates an incoming message received @@ -96,5 +97,6 @@ private: }; -} // asiolink +} // namespace asiolink +} // namespace isc #endif // __IO_MESSAGE_H diff --git a/src/lib/asiolink/io_service.cc b/src/lib/asiolink/io_service.cc index 55fc4b3560fce4678d2030b9bd1ad2b9c1d0fea7..70cc18b0fa184d109b6cd70363db4144202fff5c 100644 --- a/src/lib/asiolink/io_service.cc +++ b/src/lib/asiolink/io_service.cc @@ -21,6 +21,7 @@ #include #include +namespace isc { namespace asiolink { class IOServiceImpl { @@ -95,4 +96,5 @@ IOService::get_io_service() { return (io_impl_->get_io_service()); } -} // namepsace asiolink +} // namespace asiolink +} // namespace isc diff --git a/src/lib/asiolink/io_service.h b/src/lib/asiolink/io_service.h index 66558b7e26734988af7e3ad61e26ca39f84d9ac2..438667c92720e7a004bdca4bc0248c74ee6f4cd9 100644 --- a/src/lib/asiolink/io_service.h +++ b/src/lib/asiolink/io_service.h @@ -19,6 +19,7 @@ namespace asio { class io_service; } +namespace isc { namespace asiolink { struct IOServiceImpl; @@ -73,5 +74,6 @@ private: IOServiceImpl* io_impl_; }; -} // namespace asiolink +} // namespace asiolink +} // namespace isc #endif // __ASIOLINK_IO_SERVICE_H diff --git a/src/lib/asiolink/io_socket.cc b/src/lib/asiolink/io_socket.cc index c386ca159a9eeeac45e3ad49482c1d1a0c82e84a..e1498dc9739c68cb04c748050395e8d6b33da2a6 100644 --- a/src/lib/asiolink/io_socket.cc +++ b/src/lib/asiolink/io_socket.cc @@ -16,8 +16,7 @@ #include -using namespace asio; - +namespace isc { namespace asiolink { /// \brief The \c DummySocket class is a concrete derived class of @@ -62,4 +61,5 @@ IOSocket::getDummyTCPSocket() { return (socket); } -} +} // namespace asiolink +} // namespace isc diff --git a/src/lib/asiolink/io_socket.h b/src/lib/asiolink/io_socket.h index bebc8b6bf8fc8a0d6224537ac29904d167ccc160..ab6479c62ae84f9418d379797f395f60696435cb 100644 --- a/src/lib/asiolink/io_socket.h +++ b/src/lib/asiolink/io_socket.h @@ -25,6 +25,7 @@ #include +namespace isc { namespace asiolink { /// \brief The \c IOSocket class is an abstract base class to represent @@ -120,5 +121,6 @@ public: }; } // namespace asiolink +} // namespace isc #endif // __IO_SOCKET_H diff --git a/src/lib/asiolink/qid_gen.cc b/src/lib/asiolink/qid_gen.cc index 4063b39511ed22f8457be4e564d1bf90ee92e078..7088a11bdbb8216e4f1711113b7a7eeae320ea9b 100644 --- a/src/lib/asiolink/qid_gen.cc +++ b/src/lib/asiolink/qid_gen.cc @@ -23,9 +23,10 @@ #include namespace { - asiolink::QidGenerator qid_generator_instance; + isc::asiolink::QidGenerator qid_generator_instance; } +namespace isc { namespace asiolink { QidGenerator& @@ -52,3 +53,4 @@ QidGenerator::generateQid() { } } // namespace asiolink +} // namespace isc diff --git a/src/lib/asiolink/qid_gen.h b/src/lib/asiolink/qid_gen.h index a5caa17d83ef7d7dd69ce8d6696ec28f5818ef97..466e78f353118e8fd67ad49d5a17ff66c1c7b5ec 100644 --- a/src/lib/asiolink/qid_gen.h +++ b/src/lib/asiolink/qid_gen.h @@ -27,6 +27,7 @@ #include +namespace isc { namespace asiolink { /// This class generates Qids for outgoing queries @@ -81,5 +82,6 @@ private: } // namespace asiolink +} // namespace isc #endif // __QID_GEN_H diff --git a/src/lib/asiolink/simple_callback.h b/src/lib/asiolink/simple_callback.h index ab5deaf12f65f2b93d0b535c9876638e64595294..92093ec5943dfa5b119056439a083fbed4b60d8f 100644 --- a/src/lib/asiolink/simple_callback.h +++ b/src/lib/asiolink/simple_callback.h @@ -17,6 +17,7 @@ #include +namespace isc { namespace asiolink { /// \brief The \c SimpleCallback class is an abstract base class for a @@ -67,5 +68,6 @@ private: SimpleCallback* self_; }; -} // namespace asiolink +} // namespace asiolink +} // namespace isc #endif // __ASIOLINK_SIMPLE_CALLBACK_H diff --git a/src/lib/asiolink/tcp_endpoint.h b/src/lib/asiolink/tcp_endpoint.h index 158ca4a97e93655ec8714f15961a6d1d4922fa69..3e420f3276ef9f866ad5b96ca8b8c903d9e53d98 100644 --- a/src/lib/asiolink/tcp_endpoint.h +++ b/src/lib/asiolink/tcp_endpoint.h @@ -21,6 +21,7 @@ #include +namespace isc { namespace asiolink { /// \brief The \c TCPEndpoint class is a concrete derived class of @@ -109,5 +110,6 @@ private: asio::ip::tcp::endpoint& asio_endpoint_; }; -} // namespace asiolink +} // namespace asiolink +} // namespace isc #endif // __TCP_ENDPOINT_H diff --git a/src/lib/asiolink/tcp_socket.h b/src/lib/asiolink/tcp_socket.h index e6e0863b197c8a3496c6672aa58487d3ff7a8219..bf1e909e1856fd87e3a58d5238c6bd855097eb4c 100644 --- a/src/lib/asiolink/tcp_socket.h +++ b/src/lib/asiolink/tcp_socket.h @@ -41,6 +41,7 @@ #include #include +namespace isc { namespace asiolink { /// \brief Buffer Too Large @@ -412,5 +413,6 @@ TCPSocket::close() { } } // namespace asiolink +} // namespace isc #endif // __TCP_SOCKET_H diff --git a/src/lib/asiolink/tests/Makefile.am b/src/lib/asiolink/tests/Makefile.am index d52e8bf452ae8875a9a90a10c8de2aeada5a5a03..cec9d4d8d15cd10662a89797d8d306c7409089a0 100644 --- a/src/lib/asiolink/tests/Makefile.am +++ b/src/lib/asiolink/tests/Makefile.am @@ -21,7 +21,6 @@ run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.cc run_unittests_SOURCES += asiolink_utilities_unittest.cc run_unittests_SOURCES += io_address_unittest.cc run_unittests_SOURCES += io_endpoint_unittest.cc -run_unittests_SOURCES += io_fetch_unittest.cc run_unittests_SOURCES += io_socket_unittest.cc run_unittests_SOURCES += interval_timer_unittest.cc run_unittests_SOURCES += tcp_endpoint_unittest.cc diff --git a/src/lib/asiolink/tests/asiolink_utilities_unittest.cc b/src/lib/asiolink/tests/asiolink_utilities_unittest.cc index 51f565f87f177d6a9fe13971c3b1637ef267d8af..369b0f9f7f23727afa5dfb818d2c587113d7a08c 100644 --- a/src/lib/asiolink/tests/asiolink_utilities_unittest.cc +++ b/src/lib/asiolink/tests/asiolink_utilities_unittest.cc @@ -24,7 +24,7 @@ #include #include -using namespace asiolink; +using namespace isc::asiolink; using namespace isc::dns; TEST(asioutil, readUint16) { diff --git a/src/lib/asiolink/tests/interval_timer_unittest.cc b/src/lib/asiolink/tests/interval_timer_unittest.cc index 7e0e7bcc1b68c4843675c86a036026110889ca5f..c24e60effa630a062025855a67599c862d83ecd3 100644 --- a/src/lib/asiolink/tests/interval_timer_unittest.cc +++ b/src/lib/asiolink/tests/interval_timer_unittest.cc @@ -26,7 +26,7 @@ const boost::posix_time::time_duration TIMER_MARGIN_MSEC = boost::posix_time::milliseconds(50); } -using namespace asiolink; +using namespace isc::asiolink; // This fixture is for testing IntervalTimer. Some callback functors are // registered as callback function of the timer to test if they are called diff --git a/src/lib/asiolink/tests/io_address_unittest.cc b/src/lib/asiolink/tests/io_address_unittest.cc index 894f1433cc009fd445148dc1d28cb10588d2c6ce..18b181e8b6efa4c91d012a4bc55a52116f185dba 100644 --- a/src/lib/asiolink/tests/io_address_unittest.cc +++ b/src/lib/asiolink/tests/io_address_unittest.cc @@ -18,7 +18,7 @@ #include #include -using namespace asiolink; +using namespace isc::asiolink; TEST(IOAddressTest, fromText) { IOAddress io_address_v4("192.0.2.1"); diff --git a/src/lib/asiolink/tests/io_endpoint_unittest.cc b/src/lib/asiolink/tests/io_endpoint_unittest.cc index 5170f7d105ee6409000ee5192f5e42ae767201b4..ce21fde111d34c65bc68e385b388cdf06f396318 100644 --- a/src/lib/asiolink/tests/io_endpoint_unittest.cc +++ b/src/lib/asiolink/tests/io_endpoint_unittest.cc @@ -18,7 +18,7 @@ #include #include -using namespace asiolink; +using namespace isc::asiolink; TEST(IOEndpointTest, createUDPv4) { const IOEndpoint* ep; diff --git a/src/lib/asiolink/tests/io_socket_unittest.cc b/src/lib/asiolink/tests/io_socket_unittest.cc index 6538550bc89e6c62153a168dae652e3372b17a79..15afc170b9bf71941ebd812596df3e85274d5522 100644 --- a/src/lib/asiolink/tests/io_socket_unittest.cc +++ b/src/lib/asiolink/tests/io_socket_unittest.cc @@ -20,7 +20,7 @@ #include #include -using namespace asiolink; +using namespace isc::asiolink; TEST(IOSocketTest, dummySockets) { EXPECT_EQ(IPPROTO_UDP, IOSocket::getDummyUDPSocket().getProtocol()); diff --git a/src/lib/asiolink/tests/qid_gen_unittest.cc b/src/lib/asiolink/tests/qid_gen_unittest.cc index 3ad8a03c512201721ff4a9cf0f0f417854b55408..346e6f4f01088656c7146f720e7dc32df4d73a57 100644 --- a/src/lib/asiolink/tests/qid_gen_unittest.cc +++ b/src/lib/asiolink/tests/qid_gen_unittest.cc @@ -39,8 +39,8 @@ // Check that getInstance returns a singleton TEST(QidGenerator, singleton) { - asiolink::QidGenerator& g1 = asiolink::QidGenerator::getInstance(); - asiolink::QidGenerator& g2 = asiolink::QidGenerator::getInstance(); + isc::asiolink::QidGenerator& g1 = isc::asiolink::QidGenerator::getInstance(); + isc::asiolink::QidGenerator& g2 = isc::asiolink::QidGenerator::getInstance(); EXPECT_TRUE(&g1 == &g2); } @@ -51,7 +51,7 @@ TEST(QidGenerator, generate) { // test (http://xkcd.com/221/), and check if three consecutive // generates are not all the same. isc::dns::qid_t one, two, three; - asiolink::QidGenerator& gen = asiolink::QidGenerator::getInstance(); + isc::asiolink::QidGenerator& gen = isc::asiolink::QidGenerator::getInstance(); one = gen.generateQid(); two = gen.generateQid(); three = gen.generateQid(); diff --git a/src/lib/asiolink/tests/tcp_endpoint_unittest.cc b/src/lib/asiolink/tests/tcp_endpoint_unittest.cc index 3787e1c152e42dde55d97ed5002dea0188d01d7b..6988082edc88d3997b2a0e34c8aeb9b38786a53f 100644 --- a/src/lib/asiolink/tests/tcp_endpoint_unittest.cc +++ b/src/lib/asiolink/tests/tcp_endpoint_unittest.cc @@ -22,7 +22,7 @@ #include #include -using namespace asiolink; +using namespace isc::asiolink; using namespace std; // This test checks that the endpoint can manage its own internal diff --git a/src/lib/asiolink/tests/tcp_socket_unittest.cc b/src/lib/asiolink/tests/tcp_socket_unittest.cc index f0a45eeaa4f7d72411e86174231b2dbc6b873492..e2d23653f4b7c52b2bce0e75c97430851cfc89b0 100644 --- a/src/lib/asiolink/tests/tcp_socket_unittest.cc +++ b/src/lib/asiolink/tests/tcp_socket_unittest.cc @@ -46,7 +46,7 @@ using namespace asio; using namespace asio::ip; -using namespace asiolink; +using namespace isc::asiolink; using namespace isc::dns; using namespace std; diff --git a/src/lib/asiolink/tests/udp_endpoint_unittest.cc b/src/lib/asiolink/tests/udp_endpoint_unittest.cc index 18135ec26b4b12d0df4cfa4be317c368004bf60f..03de6b8ae8eab2d60d2da6fad3d963c0557b382f 100644 --- a/src/lib/asiolink/tests/udp_endpoint_unittest.cc +++ b/src/lib/asiolink/tests/udp_endpoint_unittest.cc @@ -22,7 +22,7 @@ #include #include -using namespace asiolink; +using namespace isc::asiolink; using namespace std; // This test checks that the endpoint can manage its own internal diff --git a/src/lib/asiolink/tests/udp_socket_unittest.cc b/src/lib/asiolink/tests/udp_socket_unittest.cc index 8563d22b79da6ab5af8caed1696f3850f8b07491..a98ed30bb6736ad2246976c39691fecadd7e0c2d 100644 --- a/src/lib/asiolink/tests/udp_socket_unittest.cc +++ b/src/lib/asiolink/tests/udp_socket_unittest.cc @@ -45,7 +45,7 @@ #include using namespace asio; -using namespace asiolink; +using namespace isc::asiolink; using namespace isc::dns; using namespace std; diff --git a/src/lib/asiolink/udp_endpoint.h b/src/lib/asiolink/udp_endpoint.h index 99dc27ffee95614558a0ce1ec13e2083e11edd18..5c8a1fe18cdf0f50128e7b7091cf13e0ab4fd0ed 100644 --- a/src/lib/asiolink/udp_endpoint.h +++ b/src/lib/asiolink/udp_endpoint.h @@ -21,6 +21,7 @@ #include +namespace isc { namespace asiolink { /// \brief The \c UDPEndpoint class is a concrete derived class of @@ -109,5 +110,6 @@ private: asio::ip::udp::endpoint& asio_endpoint_; }; -} // namespace asiolink +} // namespace asiolink +} // namespace isc #endif // __UDP_ENDPOINT_H diff --git a/src/lib/asiolink/udp_socket.h b/src/lib/asiolink/udp_socket.h index 35fc7b1841984147454911156a9c9b5ab9d34483..d26d04c233eaba4360014818c541874423e0acb2 100644 --- a/src/lib/asiolink/udp_socket.h +++ b/src/lib/asiolink/udp_socket.h @@ -33,6 +33,7 @@ #include #include +namespace isc { namespace asiolink { /// \brief The \c UDPSocket class is a concrete derived class of \c IOAsioSocket @@ -318,5 +319,6 @@ UDPSocket::close() { } } // namespace asiolink +} // namespace isc #endif // __UDP_SOCKET_H