diff options
author | Marcin Siodelski <marcin@isc.org> | 2015-01-12 18:06:41 +0100 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2015-01-12 18:06:41 +0100 |
commit | cc6e80a4646489b605fd8dcf827b8ff632e2c0ad (patch) | |
tree | b2d3c1f06e8599d96885c7c230a3981477ff7d84 | |
parent | [master] Minor fix in kea-admin (password is now handled properly) (diff) | |
download | kea-cc6e80a4646489b605fd8dcf827b8ff632e2c0ad.tar.xz kea-cc6e80a4646489b605fd8dcf827b8ff632e2c0ad.zip |
[3668] Moved the definition of IOServicePtr to asiolink/io_service.h
32 files changed, 104 insertions, 121 deletions
diff --git a/src/bin/d2/Makefile.am b/src/bin/d2/Makefile.am index e1ba538653..b90e6fd490 100644 --- a/src/bin/d2/Makefile.am +++ b/src/bin/d2/Makefile.am @@ -53,7 +53,6 @@ libd2_la_SOURCES = libd2_la_SOURCES += d_process.h libd2_la_SOURCES += d_controller.cc d_controller.h libd2_la_SOURCES += d_cfg_mgr.cc d_cfg_mgr.h -libd2_la_SOURCES += d2_asio.h libd2_la_SOURCES += d2_log.cc d2_log.h libd2_la_SOURCES += d2_process.cc d2_process.h libd2_la_SOURCES += d2_config.cc d2_config.h diff --git a/src/bin/d2/bundy_d2_controller.h b/src/bin/d2/bundy_d2_controller.h index 0c8831da20..8ea0337f57 100644 --- a/src/bin/d2/bundy_d2_controller.h +++ b/src/bin/d2/bundy_d2_controller.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -15,10 +15,10 @@ #ifndef BUNDY_D2_CONTROLLER_H #define BUNDY_D2_CONTROLLER_H +#include <asiolink/io_service.h> #include <cc/data.h> #include <cc/session.h> #include <config/ccsession.h> -#include <d2/d2_asio.h> #include <d2/d2_log.h> #include <d2/d_controller.h> #include <d2/d_process.h> diff --git a/src/bin/d2/d2_asio.h b/src/bin/d2/d2_asio.h deleted file mode 100644 index c9458f6db0..0000000000 --- a/src/bin/d2/d2_asio.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -// PERFORMANCE OF THIS SOFTWARE. - -#ifndef D2_ASIO_H -#define D2_ASIO_H - -#include <asiolink/asiolink.h> - -#include <boost/shared_ptr.hpp> - -namespace isc { -namespace d2 { - -/// @brief Defines a smart pointer to an IOService instance. -typedef boost::shared_ptr<isc::asiolink::IOService> IOServicePtr; - -}; // namespace isc::d2 -}; // namespace isc - -#endif diff --git a/src/bin/d2/d2_cfg_mgr.h b/src/bin/d2/d2_cfg_mgr.h index e1afa6778e..75333bff56 100644 --- a/src/bin/d2/d2_cfg_mgr.h +++ b/src/bin/d2/d2_cfg_mgr.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -15,9 +15,9 @@ #ifndef D2_CFG_MGR_H #define D2_CFG_MGR_H +#include <asiolink/io_service.h> #include <cc/data.h> #include <exceptions/exceptions.h> -#include <d2/d2_asio.h> #include <d2/d_cfg_mgr.h> #include <d2/d2_config.h> diff --git a/src/bin/d2/d2_config.h b/src/bin/d2/d2_config.h index bde1217b31..5e4f204f69 100644 --- a/src/bin/d2/d2_config.h +++ b/src/bin/d2/d2_config.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -15,8 +15,8 @@ #ifndef D2_CONFIG_H #define D2_CONFIG_H +#include <asiolink/io_service.h> #include <cc/data.h> -#include <d2/d2_asio.h> #include <d2/d_cfg_mgr.h> #include <dhcpsrv/parsers/dhcp_parsers.h> #include <dns/tsig.h> diff --git a/src/bin/d2/d2_process.cc b/src/bin/d2/d2_process.cc index c31dc674e0..970543bccd 100644 --- a/src/bin/d2/d2_process.cc +++ b/src/bin/d2/d2_process.cc @@ -26,7 +26,7 @@ namespace d2 { // be configurable. const unsigned int D2Process::QUEUE_RESTART_PERCENT = 80; -D2Process::D2Process(const char* name, IOServicePtr io_service) +D2Process::D2Process(const char* name, asiolink::IOServicePtr io_service) : DProcessBase(name, io_service, DCfgMgrBasePtr(new D2CfgMgr())), reconf_queue_flag_(false), shutdown_type_(SD_NORMAL) { @@ -101,7 +101,7 @@ D2Process::runIO() { // service. Secondly, asiolink::IOService does not provide the poll // method. This is a handy method which runs all ready handlers without // blocking. - IOServicePtr& io = getIoService(); + asiolink::IOServicePtr& io = getIoService(); asio::io_service& asio_io_service = io->get_io_service(); // Poll runs all that are ready. If none are ready it returns immediately diff --git a/src/bin/d2/d2_process.h b/src/bin/d2/d2_process.h index 5c76af572c..96d860e299 100644 --- a/src/bin/d2/d2_process.h +++ b/src/bin/d2/d2_process.h @@ -66,7 +66,7 @@ public: /// asynchronous event handling. /// /// @throw DProcessBaseError is io_service is NULL. - D2Process(const char* name, IOServicePtr io_service); + D2Process(const char* name, asiolink::IOServicePtr io_service); /// @brief Called after instantiation to perform initialization unique to /// D2. diff --git a/src/bin/d2/d2_queue_mgr.cc b/src/bin/d2/d2_queue_mgr.cc index 54c88a0e81..25f792ec91 100644 --- a/src/bin/d2/d2_queue_mgr.cc +++ b/src/bin/d2/d2_queue_mgr.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -22,7 +22,7 @@ namespace d2 { // Makes constant visible to Google test macros. const size_t D2QueueMgr::MAX_QUEUE_DEFAULT; -D2QueueMgr::D2QueueMgr(IOServicePtr& io_service, const size_t max_queue_size) +D2QueueMgr::D2QueueMgr(asiolink::IOServicePtr& io_service, const size_t max_queue_size) : io_service_(io_service), max_queue_size_(max_queue_size), mgr_state_(NOT_INITTED), target_stop_state_(NOT_INITTED) { if (!io_service_) { diff --git a/src/bin/d2/d2_queue_mgr.h b/src/bin/d2/d2_queue_mgr.h index c9b0298c86..58ddce1c36 100644 --- a/src/bin/d2/d2_queue_mgr.h +++ b/src/bin/d2/d2_queue_mgr.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -17,8 +17,8 @@ /// @file d2_queue_mgr.h This file defines the class D2QueueMgr. +#include <asiolink/io_service.h> #include <exceptions/exceptions.h> -#include <d2/d2_asio.h> #include <dhcp_ddns/ncr_msg.h> #include <dhcp_ddns/ncr_io.h> @@ -165,7 +165,7 @@ public: /// This value must be greater than zero. It defaults to MAX_QUEUE_DEFAULT. /// /// @throw D2QueueMgrError if max_queue_size is zero. - D2QueueMgr(IOServicePtr& io_service, + D2QueueMgr(asiolink::IOServicePtr& io_service, const size_t max_queue_size = MAX_QUEUE_DEFAULT); /// @brief Destructor @@ -327,7 +327,7 @@ public: void updateStopState(); /// @brief IOService that our listener should use for IO management. - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; /// @brief Dictates the maximum number of entries allowed in the queue. size_t max_queue_size_; diff --git a/src/bin/d2/d2_update_mgr.cc b/src/bin/d2/d2_update_mgr.cc index 7b0438dc96..da84945b26 100644 --- a/src/bin/d2/d2_update_mgr.cc +++ b/src/bin/d2/d2_update_mgr.cc @@ -26,7 +26,7 @@ namespace d2 { const size_t D2UpdateMgr::MAX_TRANSACTIONS_DEFAULT; D2UpdateMgr::D2UpdateMgr(D2QueueMgrPtr& queue_mgr, D2CfgMgrPtr& cfg_mgr, - IOServicePtr& io_service, + asiolink::IOServicePtr& io_service, const size_t max_transactions) :queue_mgr_(queue_mgr), cfg_mgr_(cfg_mgr), io_service_(io_service) { if (!queue_mgr_) { diff --git a/src/bin/d2/d2_update_mgr.h b/src/bin/d2/d2_update_mgr.h index 740efa8019..f5f0023bdc 100644 --- a/src/bin/d2/d2_update_mgr.h +++ b/src/bin/d2/d2_update_mgr.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -17,8 +17,8 @@ /// @file d2_update_mgr.h This file defines the class D2UpdateMgr. +#include <asiolink/io_service.h> #include <exceptions/exceptions.h> -#include <d2/d2_asio.h> #include <d2/d2_log.h> #include <d2/d2_queue_mgr.h> #include <d2/d2_cfg_mgr.h> @@ -100,7 +100,7 @@ public: /// @throw D2UpdateMgrError if either the queue manager or configuration /// managers are NULL, or max transactions is less than one. D2UpdateMgr(D2QueueMgrPtr& queue_mgr, D2CfgMgrPtr& cfg_mgr, - IOServicePtr& io_service, + asiolink::IOServicePtr& io_service, const size_t max_transactions = MAX_TRANSACTIONS_DEFAULT); /// @brief Destructor @@ -173,7 +173,7 @@ public: /// @brief Gets the D2UpdateMgr's IOService. /// /// @return returns a reference to the IOService - const IOServicePtr& getIOService() { + const asiolink::IOServicePtr& getIOService() { return (io_service_); } @@ -246,7 +246,7 @@ private: /// passed into transactions to manager their IO events. /// (For future reference, multi-threaded transactions would each use their /// own IOService instance.) - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; /// @brief Maximum number of concurrent transactions. size_t max_transactions_; diff --git a/src/bin/d2/d_controller.h b/src/bin/d2/d_controller.h index c1e35c9e0d..574162d140 100644 --- a/src/bin/d2/d_controller.h +++ b/src/bin/d2/d_controller.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -15,8 +15,8 @@ #ifndef D_CONTROLLER_H #define D_CONTROLLER_H +#include <asiolink/io_service.h> #include <cc/data.h> -#include <d2/d2_asio.h> #include <d2/d2_log.h> #include <d2/d_process.h> #include <d2/io_service_signal.h> @@ -320,7 +320,7 @@ protected: /// @brief Getter for fetching the controller's IOService /// /// @return returns a pointer reference to the IOService. - IOServicePtr& getIOService() { + asiolink::IOServicePtr& getIOService() { return (io_service_); } @@ -481,7 +481,7 @@ private: DProcessBasePtr process_; /// @brief Shared pointer to an IOService object, used for ASIO operations. - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; /// @brief Set of registered signals to handle. util::SignalSetPtr signal_set_; diff --git a/src/bin/d2/d_process.h b/src/bin/d2/d_process.h index 7ba74f9d1a..c24b70e5b3 100644 --- a/src/bin/d2/d_process.h +++ b/src/bin/d2/d_process.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -15,8 +15,8 @@ #ifndef D_PROCESS_H #define D_PROCESS_H +#include <asiolink/io_service.h> #include <cc/data.h> -#include <d2/d2_asio.h> #include <d2/d_cfg_mgr.h> #include <boost/shared_ptr.hpp> @@ -69,7 +69,7 @@ public: /// configuration parsing. /// /// @throw DProcessBaseError is io_service is NULL. - DProcessBase(const char* app_name, IOServicePtr io_service, + DProcessBase(const char* app_name, asiolink::IOServicePtr io_service, DCfgMgrBasePtr cfg_mgr) : app_name_(app_name), io_service_(io_service), shut_down_flag_(false), cfg_mgr_(cfg_mgr) { @@ -174,7 +174,7 @@ public: /// @brief Fetches the controller's IOService. /// /// @return a reference to the controller's IOService. - IOServicePtr& getIoService() { + asiolink::IOServicePtr& getIoService() { return (io_service_); } @@ -199,7 +199,7 @@ private: std::string app_name_; /// @brief The IOService to be used for asynchronous event handling. - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; /// @brief Boolean flag set when shutdown has been requested. bool shut_down_flag_; diff --git a/src/bin/d2/io_service_signal.cc b/src/bin/d2/io_service_signal.cc index d5ea2e8e4a..e4c835d934 100644 --- a/src/bin/d2/io_service_signal.cc +++ b/src/bin/d2/io_service_signal.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -65,7 +65,7 @@ IOSignal::TimerCallback::operator()() { return; } -IOSignalQueue::IOSignalQueue(IOServicePtr& io_service) +IOSignalQueue::IOSignalQueue(asiolink::IOServicePtr& io_service) : io_service_(io_service), signals_() { if (!io_service_) { isc_throw(IOSignalError, "IOSignalQueue - io_serivce cannot be NULL"); diff --git a/src/bin/d2/io_service_signal.h b/src/bin/d2/io_service_signal.h index 4b5fad8ea9..8b440d9e8c 100644 --- a/src/bin/d2/io_service_signal.h +++ b/src/bin/d2/io_service_signal.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,8 @@ #ifndef IO_SERVICE_SIGNAL_H #define IO_SERVICE_SIGNAL_H -#include <d2/d2_asio.h> +#include <asiolink/io_service.h> +#include <asiolink/interval_timer.h> #include <exceptions/exceptions.h> #include <map> @@ -202,7 +203,7 @@ public: /// /// @param io_service the IOService to which to send signals. /// @throw IOSignalError if io_service is NULL. - IOSignalQueue (IOServicePtr& io_service); + IOSignalQueue (asiolink::IOServicePtr& io_service); /// @brief Destructor. ~IOSignalQueue(); @@ -248,7 +249,7 @@ public: private: /// @brief Pointer to the IOService which will receive the signals. - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; /// @brief A map of the IOSignals pushed through this queue. IOSignalMap signals_; diff --git a/src/bin/d2/nc_add.cc b/src/bin/d2/nc_add.cc index 70fff23c99..9135b7ee72 100644 --- a/src/bin/d2/nc_add.cc +++ b/src/bin/d2/nc_add.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -35,7 +35,7 @@ const int NameAddTransaction::FQDN_IN_USE_EVT; const int NameAddTransaction::FQDN_NOT_IN_USE_EVT; NameAddTransaction:: -NameAddTransaction(IOServicePtr& io_service, +NameAddTransaction(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, diff --git a/src/bin/d2/nc_add.h b/src/bin/d2/nc_add.h index 7fcdf1f98d..f9b92d57d9 100644 --- a/src/bin/d2/nc_add.h +++ b/src/bin/d2/nc_add.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -91,7 +91,7 @@ public: /// /// @throw NameAddTransaction error if given request is not a CHG_ADD, /// NameChangeTransaction error for base class construction errors. - NameAddTransaction(IOServicePtr& io_service, + NameAddTransaction(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, diff --git a/src/bin/d2/nc_remove.cc b/src/bin/d2/nc_remove.cc index 224974ad2d..325289b4da 100644 --- a/src/bin/d2/nc_remove.cc +++ b/src/bin/d2/nc_remove.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -32,7 +32,7 @@ const int NameRemoveTransaction::REMOVING_REV_PTRS_ST; // Currently NameRemoveTransaction does not define any events. NameRemoveTransaction:: -NameRemoveTransaction(IOServicePtr& io_service, +NameRemoveTransaction(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, diff --git a/src/bin/d2/nc_remove.h b/src/bin/d2/nc_remove.h index fb79eb495d..96a18677bb 100644 --- a/src/bin/d2/nc_remove.h +++ b/src/bin/d2/nc_remove.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -87,7 +87,7 @@ public: /// /// @throw NameRemoveTransaction error if given request is not a CHG_REMOVE, /// NameChangeTransaction error for base class construction errors. - NameRemoveTransaction(IOServicePtr& io_service, + NameRemoveTransaction(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, diff --git a/src/bin/d2/nc_trans.cc b/src/bin/d2/nc_trans.cc index da82ab7160..4640eda492 100644 --- a/src/bin/d2/nc_trans.cc +++ b/src/bin/d2/nc_trans.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -44,7 +44,7 @@ const int NameChangeTransaction::NCT_DERIVED_EVENT_MIN; const unsigned int NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER; NameChangeTransaction:: -NameChangeTransaction(IOServicePtr& io_service, +NameChangeTransaction(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, diff --git a/src/bin/d2/nc_trans.h b/src/bin/d2/nc_trans.h index 7f1b62ae68..384b76703a 100644 --- a/src/bin/d2/nc_trans.h +++ b/src/bin/d2/nc_trans.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -17,8 +17,8 @@ /// @file nc_trans.h This file defines the class NameChangeTransaction. +#include <asiolink/io_service.h> #include <exceptions/exceptions.h> -#include <d2/d2_asio.h> #include <d2/d2_cfg_mgr.h> #include <d2/dns_client.h> #include <d2/state_model.h> @@ -174,7 +174,7 @@ public: /// @throw NameChangeTransactionError if given an null request, /// if forward change is enabled but forward domain is null, if /// reverse change is enabled but reverse domain is null. - NameChangeTransaction(IOServicePtr& io_service, + NameChangeTransaction(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, @@ -359,7 +359,7 @@ protected: /// @brief Fetches the IOService the transaction uses for IO processing. /// /// @return returns a const pointer to the IOService. - const IOServicePtr& getIOService() { + const asiolink::IOServicePtr& getIOService() { return (io_service_); } @@ -523,7 +523,7 @@ public: private: /// @brief The IOService which should be used to for IO processing. - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; /// @brief The NameChangeRequest that the transaction is to fulfill. dhcp_ddns::NameChangeRequestPtr ncr_; diff --git a/src/bin/d2/tests/d2_process_unittests.cc b/src/bin/d2/tests/d2_process_unittests.cc index 8f7b188c8e..60ae635e03 100644 --- a/src/bin/d2/tests/d2_process_unittests.cc +++ b/src/bin/d2/tests/d2_process_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. +#include <asiolink/io_service.h> #include <config/ccsession.h> #include <d2/d2_process.h> #include <dhcp_ddns/ncr_io.h> @@ -64,8 +65,9 @@ class D2ProcessTest : public D2Process, public ConfigParseTest { public: /// @brief Constructor - D2ProcessTest() : D2Process("d2test", - IOServicePtr(new isc::asiolink::IOService())) { + D2ProcessTest() : + D2Process("d2test", + asiolink::IOServicePtr(new isc::asiolink::IOService())) { } /// @brief Destructor @@ -143,7 +145,7 @@ public: TEST(D2Process, construction) { // Verify that the constructor will fail if given an empty // io service. - IOServicePtr lcl_io_service; + asiolink::IOServicePtr lcl_io_service; EXPECT_THROW (D2Process("TestProcess", lcl_io_service), DProcessBaseError); // Verify that the constructor succeeds with a valid io_service diff --git a/src/bin/d2/tests/d2_queue_mgr_unittests.cc b/src/bin/d2/tests/d2_queue_mgr_unittests.cc index a49ab65754..bb8a93c376 100644 --- a/src/bin/d2/tests/d2_queue_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_queue_mgr_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -12,7 +12,8 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include <d2/d2_asio.h> +#include <asiolink/io_service.h> +#include <asiolink/interval_timer.h> #include <d2/d2_queue_mgr.h> #include <dhcp_ddns/ncr_udp.h> #include <util/time_utilities.h> @@ -78,7 +79,7 @@ const long TEST_TIMEOUT = 5 * 1000; /// @brief Tests that construction with max queue size of zero is not allowed. TEST(D2QueueMgrBasicTest, construction1) { - IOServicePtr io_service; + asiolink::IOServicePtr io_service; // Verify that constructing with null IOServicePtr is not allowed. EXPECT_THROW((D2QueueMgr(io_service)), D2QueueMgrError); @@ -90,7 +91,7 @@ TEST(D2QueueMgrBasicTest, construction1) { /// @brief Tests default construction works. TEST(D2QueueMgrBasicTest, construction2) { - IOServicePtr io_service(new isc::asiolink::IOService()); + asiolink::IOServicePtr io_service(new isc::asiolink::IOService()); // Verify that valid constructor works. D2QueueMgrPtr queue_mgr; @@ -101,7 +102,7 @@ TEST(D2QueueMgrBasicTest, construction2) { /// @brief Tests construction with custom queue size works properly TEST(D2QueueMgrBasicTest, construction3) { - IOServicePtr io_service(new isc::asiolink::IOService()); + asiolink::IOServicePtr io_service(new isc::asiolink::IOService()); // Verify that custom queue size constructor works. D2QueueMgrPtr queue_mgr; @@ -118,7 +119,7 @@ TEST(D2QueueMgrBasicTest, construction3) { /// 4. Peek returns the first entry on the queue without altering queue content /// 5. Dequeue removes the first entry on the queue TEST(D2QueueMgrBasicTest, basicQueue) { - IOServicePtr io_service(new isc::asiolink::IOService()); + asiolink::IOServicePtr io_service(new isc::asiolink::IOService()); // Construct the manager with max queue size set to number of messages // we'll use. @@ -210,7 +211,7 @@ bool checkSendVsReceived(NameChangeRequestPtr sent_ncr, class QueueMgrUDPTest : public virtual ::testing::Test, NameChangeSender::RequestSendHandler { public: - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; NameChangeSenderPtr sender_; isc::asiolink::IntervalTimer test_timer_; D2QueueMgrPtr queue_mgr_; diff --git a/src/bin/d2/tests/d2_update_mgr_unittests.cc b/src/bin/d2/tests/d2_update_mgr_unittests.cc index 9718a4ae88..fd96bc54f3 100644 --- a/src/bin/d2/tests/d2_update_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_update_mgr_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -12,7 +12,7 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include <d2/d2_asio.h> +#include <asiolink/io_service.h> #include <d2/d2_update_mgr.h> #include <util/time_utilities.h> #include <d_test_stubs.h> @@ -42,7 +42,7 @@ public: /// /// Parameters match those needed by D2UpdateMgr. D2UpdateMgrWrapper(D2QueueMgrPtr& queue_mgr, D2CfgMgrPtr& cfg_mgr, - IOServicePtr& io_service, + asiolink::IOServicePtr& io_service, const size_t max_transactions = MAX_TRANSACTIONS_DEFAULT) : D2UpdateMgr(queue_mgr, cfg_mgr, io_service, max_transactions) { } @@ -250,7 +250,7 @@ public: /// 4. Default construction works and max transactions is defaulted properly /// 5. Construction with custom max transactions works properly TEST(D2UpdateMgr, construction) { - IOServicePtr io_service(new isc::asiolink::IOService()); + asiolink::IOServicePtr io_service(new isc::asiolink::IOService()); D2QueueMgrPtr queue_mgr; D2CfgMgrPtr cfg_mgr; D2UpdateMgrPtr update_mgr; diff --git a/src/bin/d2/tests/d_test_stubs.cc b/src/bin/d2/tests/d_test_stubs.cc index 1cc215255f..1a317ebffd 100644 --- a/src/bin/d2/tests/d_test_stubs.cc +++ b/src/bin/d2/tests/d_test_stubs.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -12,6 +12,7 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include <asiolink/io_service.h> #include <d2/d2_log.h> #include <d2/spec_config.h> #include <d2/tests/d_test_stubs.h> @@ -51,7 +52,7 @@ SimFailure::FailureType SimFailure::failure_type_ = SimFailure::ftNoFailure; // Define custom process command supported by DStubProcess. const char* DStubProcess::stub_proc_command_("cool_proc_cmd"); -DStubProcess::DStubProcess(const char* name, IOServicePtr io_service) +DStubProcess::DStubProcess(const char* name, asiolink::IOServicePtr io_service) : DProcessBase(name, io_service, DCfgMgrBasePtr(new DStubCfgMgr())) { }; @@ -72,7 +73,7 @@ DStubProcess::run() { // To use run(), the "managing" layer must issue an io_service::stop // or the call to run will continue to block, and shutdown will not // occur. - IOServicePtr& io_service = getIoService(); + asiolink::IOServicePtr& io_service = getIoService(); while (!shouldShutdown()) { try { io_service->run_one(); diff --git a/src/bin/d2/tests/d_test_stubs.h b/src/bin/d2/tests/d_test_stubs.h index f45b8fc35e..23d4efcd29 100644 --- a/src/bin/d2/tests/d_test_stubs.h +++ b/src/bin/d2/tests/d_test_stubs.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -15,11 +15,12 @@ #ifndef D_TEST_STUBS_H #define D_TEST_STUBS_H +#include <asiolink/io_service.h> + #include <cc/data.h> #include <cc/session.h> #include <config/ccsession.h> -#include <d2/d2_asio.h> #include <d2/d_controller.h> #include <d2/d_cfg_mgr.h> @@ -128,7 +129,7 @@ public: /// asynchronous event handling. /// /// @throw DProcessBaseError is io_service is NULL. - DStubProcess(const char* name, IOServicePtr io_service); + DStubProcess(const char* name, asiolink::IOServicePtr io_service); /// @brief Invoked after process instantiation to perform initialization. /// This implementation supports simulating an error initializing the @@ -423,7 +424,7 @@ public: /// @brief Gets the Controller's IOService. /// /// @return returns a reference to the IOService - IOServicePtr& getIOService() { + asiolink::IOServicePtr& getIOService() { return (getController()->io_service_); } diff --git a/src/bin/d2/tests/io_service_signal_unittests.cc b/src/bin/d2/tests/io_service_signal_unittests.cc index cd2cba5cc8..4d06c2122a 100644 --- a/src/bin/d2/tests/io_service_signal_unittests.cc +++ b/src/bin/d2/tests/io_service_signal_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -12,6 +12,7 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include <asiolink/io_service.h> #include <d_test_stubs.h> #include <d2/io_service_signal.h> @@ -29,7 +30,7 @@ namespace d2 { class IOSignalTest : public ::testing::Test { public: /// @brief IOService instance to process IO. - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; /// @brief Failsafe timer to ensure test(s) do not hang. isc::asiolink::IntervalTimer test_timer_; /// @brief Maximum time should be allowed to run. @@ -137,7 +138,7 @@ void dummyHandler(IOSignalId) { // Tests IOSignal constructor. TEST(IOSignal, construction) { - IOServicePtr io_service(new asiolink::IOService()); + asiolink::IOServicePtr io_service(new asiolink::IOService()); IOSignalPtr signal; IOSignalPtr signal2; @@ -169,7 +170,7 @@ TEST(IOSignal, construction) { // Tests IOSignalQueue constructors and exercises queuing methods. TEST(IOSignalQueue, constructionAndQueuing) { IOSignalQueuePtr queue; - IOServicePtr io_service; + asiolink::IOServicePtr io_service; // Verify constructing with an empty IOService will throw. ASSERT_THROW(queue.reset(new IOSignalQueue(io_service)), IOSignalError); diff --git a/src/bin/d2/tests/nc_add_unittests.cc b/src/bin/d2/tests/nc_add_unittests.cc index 51950a9e1a..dc506dea9f 100644 --- a/src/bin/d2/tests/nc_add_unittests.cc +++ b/src/bin/d2/tests/nc_add_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -12,6 +12,7 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include <asiolink/io_service.h> #include <d2/d2_cfg_mgr.h> #include <d2/d2_cfg_mgr.h> #include <d2/nc_add.h> @@ -32,7 +33,7 @@ namespace { // to protected methods. class NameAddStub : public NameAddTransaction { public: - NameAddStub(IOServicePtr& io_service, + NameAddStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, @@ -266,7 +267,7 @@ public: /// 1. Construction with invalid type of request /// 2. Valid construction functions properly TEST(NameAddTransaction, construction) { - IOServicePtr io_service(new isc::asiolink::IOService()); + asiolink::IOServicePtr io_service(new isc::asiolink::IOService()); D2CfgMgrPtr cfg_mgr(new D2CfgMgr()); const char* msg_str = diff --git a/src/bin/d2/tests/nc_remove_unittests.cc b/src/bin/d2/tests/nc_remove_unittests.cc index 234ca8cf5d..61fa394e9c 100644 --- a/src/bin/d2/tests/nc_remove_unittests.cc +++ b/src/bin/d2/tests/nc_remove_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -12,6 +12,7 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include <asiolink/io_service.h> #include <d2/d2_cfg_mgr.h> #include <d2/d2_cfg_mgr.h> #include <d2/nc_remove.h> @@ -32,7 +33,7 @@ namespace { // to protected methods. class NameRemoveStub : public NameRemoveTransaction { public: - NameRemoveStub(IOServicePtr& io_service, + NameRemoveStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, @@ -268,7 +269,7 @@ public: /// 1. Construction with invalid type of request /// 2. Valid construction functions properly TEST(NameRemoveTransaction, construction) { - IOServicePtr io_service(new isc::asiolink::IOService()); + asiolink::IOServicePtr io_service(new isc::asiolink::IOService()); D2CfgMgrPtr cfg_mgr(new D2CfgMgr()); const char* msg_str = diff --git a/src/bin/d2/tests/nc_test_utils.h b/src/bin/d2/tests/nc_test_utils.h index 96f14522e3..04c741fa7c 100644 --- a/src/bin/d2/tests/nc_test_utils.h +++ b/src/bin/d2/tests/nc_test_utils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -17,6 +17,8 @@ /// @file nc_test_utils.h prototypes for functions related transaction testing. +#include <asiolink/io_service.h> +#include <asiolink/interval_timer.h> #include <d2/nc_trans.h> #include <asio/ip/udp.hpp> @@ -138,7 +140,7 @@ public: /// valve so tests do not hang. class TimedIO { public: - IOServicePtr io_service_; + asiolink::IOServicePtr io_service_; asiolink::IntervalTimer timer_; int run_time_; diff --git a/src/bin/d2/tests/nc_trans_unittests.cc b/src/bin/d2/tests/nc_trans_unittests.cc index 1165cfc9ed..2c480cafed 100644 --- a/src/bin/d2/tests/nc_trans_unittests.cc +++ b/src/bin/d2/tests/nc_trans_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -12,6 +12,7 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include <asiolink/io_service.h> #include <asiolink/interval_timer.h> #include <d2/nc_trans.h> #include <dns/opcode.h> @@ -59,7 +60,7 @@ public: /// @brief Constructor /// /// Parameters match those needed by NameChangeTransaction. - NameChangeStub(IOServicePtr& io_service, + NameChangeStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, DdnsDomainPtr& reverse_domain, @@ -367,7 +368,7 @@ public: /// requires reverse change. /// 4. Valid construction functions properly TEST(NameChangeTransaction, construction) { - IOServicePtr io_service(new isc::asiolink::IOService()); + asiolink::IOServicePtr io_service(new isc::asiolink::IOService()); D2CfgMgrPtr cfg_mgr(new D2CfgMgr()); const char* msg_str = @@ -396,7 +397,7 @@ TEST(NameChangeTransaction, construction) { // Verify that construction with a null IOServicePtr fails. // @todo Subject to change if multi-threading is implemented. - IOServicePtr empty; + asiolink::IOServicePtr empty; EXPECT_THROW(NameChangeTransaction(empty, ncr, forward_domain, reverse_domain, cfg_mgr), NameChangeTransactionError); diff --git a/src/lib/asiolink/io_service.h b/src/lib/asiolink/io_service.h index aeec2287d9..2b7e4d6f95 100644 --- a/src/lib/asiolink/io_service.h +++ b/src/lib/asiolink/io_service.h @@ -87,6 +87,9 @@ private: IOServiceImpl* io_impl_; }; +/// @brief Defines a smart pointer to an IOService instance. +typedef boost::shared_ptr<IOService> IOServicePtr; + } // namespace asiolink } // namespace isc #endif // ASIOLINK_IO_SERVICE_H |