]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4009] error_ and system_code in system (vs asio) namespace
authorFrancis Dupont <fdupont@isc.org>
Wed, 2 Sep 2015 19:15:14 +0000 (21:15 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 2 Sep 2015 19:15:14 +0000 (21:15 +0200)
16 files changed:
src/bin/d2/tests/nc_test_utils.cc
src/bin/d2/tests/nc_test_utils.h
src/lib/asiodns/README
src/lib/asiodns/io_fetch.cc
src/lib/asiodns/io_fetch.h
src/lib/asiodns/tests/io_fetch_unittest.cc
src/lib/asiolink/dummy_io_cb.h
src/lib/asiolink/interval_timer.cc
src/lib/asiolink/interval_timer.h
src/lib/asiolink/io_address.cc
src/lib/asiolink/tests/dummy_io_callback_unittest.cc
src/lib/asiolink/tests/tcp_socket_unittest.cc
src/lib/asiolink/tests/udp_socket_unittest.cc
src/lib/dhcp/iface_mgr.cc
src/lib/dhcp_ddns/ncr_udp.cc
src/lib/dhcp_ddns/ncr_udp.h

index 3e93425b8839e741ff9182d27ab5d7ce78ba9960..0cb021bb53fd47f0ef828302ef15bac463e2c64c 100644 (file)
@@ -87,7 +87,7 @@ FauxServer::receive (const ResponseMode& response_mode,
 }
 
 void
-FauxServer::requestHandler(const boost::asio::error_code& error,
+FauxServer::requestHandler(const boost::system::error_code& error,
                            std::size_t bytes_recvd,
                            const ResponseMode& response_mode,
                            const dns::Rcode& response_rcode) {
index 9e4057d3fe9362bd3cbb71a6356d0e81337817eb..b5e5e1b6e583c0332895e3d494d4fa5075d0d7a9 100644 (file)
@@ -110,7 +110,7 @@ public:
     /// @param response_mode type of response the handler should produce
     /// @param response_rcode value of Rcode in the response constructed by
     /// handler
-    void requestHandler(const boost::asio::error_code& error,
+    void requestHandler(const boost::system::error_code& error,
                         std::size_t bytes_recvd,
                         const ResponseMode& response_mode,
                         const dns::Rcode& response_rcode);
index 5f44341a93ebd0e2aff7cd8ba19a2d0e0a9f8047..e47b166638e7ecb9723b54289f0a2f9c6941e9d4 100644 (file)
@@ -102,7 +102,7 @@ argument the class of the object that will be used as the callback when the
 asynchronous operation completes. This object can be of any type, but must
 include an operator() method with the signature:
 
-   operator()(boost::asio::error_code ec, size_t length)
+   operator()(boost::system::error_code ec, size_t length)
 
 ... the two arguments being the status of the completed I/O operation and
 the number of bytes transferred. (In the case of the open method, the second
index 65192a889a6097054124fd1b9b60318f651090df..33ae3c838afb093c28c0fa76f843d7a153074559 100644 (file)
@@ -243,7 +243,7 @@ IOFetch::getProtocol() const {
 /// pattern; see internal/coroutine.h for details.
 
 void
-IOFetch::operator()(boost::asio::error_code ec, size_t length) {
+IOFetch::operator()(boost::system::error_code ec, size_t length) {
 
     if (data_->stopped) {
         return;
@@ -402,7 +402,7 @@ IOFetch::stop(Result result) {
 
 // Log an error - called on I/O failure
 
-void IOFetch::logIOFailure(boost::asio::error_code ec) {
+void IOFetch::logIOFailure(boost::system::error_code ec) {
 
     // Should only get here with a known error code.
     assert((data_->origin == ASIODNS_OPEN_SOCKET) ||
index 4b0032b1cba1614d1a76b480d71c3edbe3fa2281..f95fb0765ce362b26f176cfb3fe97e27b8f9bfa2 100644 (file)
@@ -189,7 +189,7 @@ public:
     ///
     /// \param ec Error code, the result of the last asynchronous I/O operation.
     /// \param length Amount of data received on the last asynchronous read
-    void operator()(boost::asio::error_code ec = boost::asio::error_code(), size_t length = 0);
+    void operator()(boost::system::error_code ec = boost::system::error_code(), size_t length = 0);
 
     /// \brief Terminate query
     ///
@@ -215,7 +215,7 @@ private:
     /// Records an I/O failure to the log file
     ///
     /// \param ec ASIO error code
-    void logIOFailure(boost::asio::error_code ec);
+    void logIOFailure(boost::system::error_code ec);
 
     // Member variables.  All data is in a structure pointed to by a shared
     // pointer.  The IOFetch object is copied a number of times during its
index de83b830dcd36feee4bc5f49e7ba32c2dd27fae6..ba6556f59523c7ddf94ef7ce7a868225ab6f1335 100644 (file)
@@ -176,7 +176,7 @@ public:
     ///        sent with the correct QID.
     /// \param length Amount of data received.
     void udpReceiveHandler(udp::endpoint* remote, udp::socket* socket,
-                           boost::asio::error_code ec = boost::asio::error_code(),
+                           boost::system::error_code ec = boost::system::error_code(),
                            size_t length = 0, bool bad_qid = false,
                            bool second_send = false)
     {
@@ -228,7 +228,7 @@ public:
     /// \param socket Socket on which data will be received
     /// \param ec Boost error code, value should be zero.
     void tcpAcceptHandler(tcp::socket* socket,
-                          boost::asio::error_code ec = boost::asio::error_code())
+                          boost::system::error_code ec = boost::system::error_code())
     {
         if (debug_) {
             cout << "tcpAcceptHandler(): error = " << ec.value() << endl;
@@ -268,7 +268,7 @@ public:
     ///        by the "server" to receive data.
     /// \param length Amount of data received.
     void tcpReceiveHandler(tcp::socket* socket,
-                           boost::asio::error_code ec = boost::asio::error_code(),
+                           boost::system::error_code ec = boost::system::error_code(),
                            size_t length = 0)
     {
         if (debug_) {
@@ -401,7 +401,7 @@ public:
     /// \param ec Boost error code, value should be zero.
     /// \param length Number of bytes sent.
     void tcpSendHandler(size_t expected, tcp::socket* socket,
-                        boost::asio::error_code ec = boost::asio::error_code(),
+                        boost::system::error_code ec = boost::system::error_code(),
                         size_t length = 0)
     {
         if (debug_) {
index 9b2cb170b8236cacd3d16a0c09157770f2472642..c1ce5b2b60a5eed45efa2a03764e3a3f1f5301b2 100644 (file)
@@ -44,7 +44,7 @@ public:
     /// Should never be called, as this class is a convenience class provided
     /// for instances where a socket is required but it is known that no
     /// asynchronous operations will be carried out.
-    void operator()(boost::asio::error_code) {
+    void operator()(boost::system::error_code) {
         // If the function is called, there is a serious logic error in
         // the program (this class should not be used as the callback
         // class).  As the asiolink module is too low-level for logging
@@ -58,7 +58,7 @@ public:
     /// Should never be called, as this class is a convenience class provided
     /// for instances where a socket is required but it is known that no
     /// asynchronous operations will be carried out.
-    void operator()(boost::asio::error_code, size_t) {
+    void operator()(boost::system::error_code, size_t) {
         // If the function is called, there is a serious logic error in
         // the program (this class should not be used as the callback
         // class).  As the asiolink module is too low-level for logging
index 317a61ac0330df719712f159cd598cb63678c318..68f5a791e58afdf7ee99b99311edfc4a4aafe5f4 100644 (file)
@@ -47,7 +47,7 @@ public:
     void setup(const IntervalTimer::Callback& cbfunc, const long interval,
                const IntervalTimer::Mode& interval_mode
                = IntervalTimer::REPEATING);
-    void callback(const boost::asio::error_code& error);
+    void callback(const boost::system::error_code& error);
     void cancel() {
         timer_.cancel();
         interval_ = 0;
@@ -114,7 +114,7 @@ IntervalTimerImpl::update() {
         timer_.async_wait(boost::bind(&IntervalTimerImpl::callback,
                                       shared_from_this(),
                                       boost::asio::placeholders::error));
-    } catch (const boost::asio::system_error& e) {
+    } catch (const boost::system::system_error& e) {
         isc_throw(isc::Unexpected, "Failed to update timer: " << e.what());
     } catch (const boost::bad_weak_ptr&) {
         // Can't happen. It means a severe internal bug.
@@ -123,7 +123,7 @@ IntervalTimerImpl::update() {
 }
 
 void
-IntervalTimerImpl::callback(const boost::asio::error_code& ec) {
+IntervalTimerImpl::callback(const boost::system::error_code& ec) {
     assert(interval_ != INVALIDATED_INTERVAL);
     if (interval_ == 0 || ec) {
         // timer has been canceled. Do nothing.
index 40e7a7c27fdc01bfcc52a848126eb92d47663bd9..e60751636ab5d91049b638eb981a1006ea9e8932 100644 (file)
@@ -85,7 +85,7 @@ public:
     ///
     /// This constructor may throw a standard exception if
     /// memory allocation fails inside the method.
-    /// This constructor may also throw \c boost::asio::system_error.
+    /// This constructor may also throw \c boost::system::system_error.
     ///
     /// \param io_service A reference to an instance of IOService
     IntervalTimer(IOService& io_service);
@@ -111,7 +111,7 @@ public:
     /// each expiration (the default) or behave as a one-shot which will run
     /// for a single interval and not reschedule.
     ///
-    /// Note: IntervalTimer will not pass \c boost::asio::error_code to
+    /// Note: IntervalTimer will not pass \c boost::system::error_code to
     /// call back function. In case the timer is canceled, the function
     /// will not be called.
     ///
index 286e69ad942060b72cc81d3140bea4203aa838a9..918c26ae3e3fba5d78ae693afa853cf6cc0d1102 100644 (file)
@@ -38,7 +38,7 @@ namespace asiolink {
 // XXX: we cannot simply construct the address in the initialization list,
 // because we'd like to throw our own exception on failure.
 IOAddress::IOAddress(const std::string& address_str) {
-    boost::asio::error_code err;
+    boost::system::error_code err;
     asio_address_ = ip::address::from_string(address_str, err);
     if (err) {
         isc_throw(IOError, "Failed to convert string to address '"
index e7b7ef2420e24f79d9d6c336ed19c3da93d7cfbc..22bd4b12a6b431087b03004346227a6c96c0e017 100644 (file)
@@ -26,7 +26,7 @@ namespace { // begin unnamed namespace
 
 TEST(DummyIOCallbackTest, throws) {
     DummyIOCallback cb;
-    boost::asio::error_code error_code;
+    boost::system::error_code error_code;
 
     // All methods should throw isc::Unexpected.
     EXPECT_THROW(cb(error_code), isc::Unexpected);
index 6a4d4dfe47f4b664929ec64f973fad2f0dca4f92..80584cee4885427c4baa23c8fd0e42d78eada181 100644 (file)
@@ -87,7 +87,7 @@ public:
             name_(""), queued_(NONE), called_(NONE), data_(MIN_SIZE, 0)
         {}
 
-        boost::asio::error_code    error_code_;    ///< Completion error code
+        boost::system::error_code  error_code_;    ///< Completion error code
         size_t                     length_;        ///< Bytes transferred in this I/O
         size_t                     cumulative_;    ///< Cumulative bytes transferred
         size_t                     expected_;      ///< Expected amount of data
@@ -95,7 +95,7 @@ public:
         std::string                name_;          ///< Which of the objects this is
         Operation                  queued_;        ///< Queued operation
         Operation                  called_;        ///< Which callback called
-        std::vector<uint8_t>        data_;         ///< Receive buffer
+        std::vector<uint8_t>       data_;          ///< Receive buffer
     };
 
     /// \brief Constructor
@@ -128,7 +128,7 @@ public:
     ///
     /// \param ec I/O completion error code passed to callback function.
     /// \param length Number of bytes transferred
-    void operator()(boost::asio::error_code ec = boost::asio::error_code(),
+    void operator()(boost::system::error_code ec = boost::system::error_code(),
                             size_t length = 0)
     {
         setCode(ec.value());
@@ -145,7 +145,7 @@ public:
     ///
     /// \param code New value of completion code
     void setCode(int code) {
-        ptr_->error_code_ = boost::asio::error_code(code, boost::asio::error_code().category());
+        ptr_->error_code_ = boost::system::error_code(code, boost::system::error_code().category());
     }
 
     /// \brief Get number of bytes transferred in I/O
index 8e72051bf59b03b0b435a230b38d412be19815df..04c00ab53b9fadabf9dc9f313fe86440541c5331 100644 (file)
@@ -74,7 +74,7 @@ public:
             error_code_(), length_(0), called_(false), name_("")
         {}
 
-        boost::asio::error_code    error_code_;    ///< Completion error code
+        boost::system::error_code  error_code_;    ///< Completion error code
         size_t                     length_;        ///< Number of bytes transferred
         bool                       called_;        ///< Set true when callback called
         std::string                name_;          ///< Which of the objects this is
@@ -110,7 +110,7 @@ public:
     ///
     /// \param ec I/O completion error code passed to callback function.
     /// \param length Number of bytes transferred
-    virtual void operator()(boost::asio::error_code ec, size_t length = 0) {
+    virtual void operator()(boost::system::error_code ec, size_t length = 0) {
         ptr_->error_code_ = ec;
         setLength(length);
         setCalled(true);
@@ -125,7 +125,7 @@ public:
     ///
     /// \param code New value of completion code
     void setCode(int code) {
-        ptr_->error_code_ = boost::asio::error_code(code, boost::asio::error_code().category());
+        ptr_->error_code_ = boost::system::error_code(code, boost::system::error_code().category());
     }
 
     /// \brief Get number of bytes transferred in I/O
index f9ab91c440a2c6d1e854af928b4a82a9523d5cb7..a2dbccae71158b30235bfd89d9740548abb54ec5 100644 (file)
@@ -798,7 +798,7 @@ IfaceMgr::getLocalAddress(const IOAddress& remote_addr, const uint16_t port) {
     boost::asio::io_service io_service;
     boost::asio::ip::udp::socket sock(io_service);
 
-    boost::asio::error_code err_code;
+    boost::system::error_code err_code;
     // If remote address is broadcast address we have to
     // allow this on the socket.
     if (remote_addr.isV4() &&
index 528c382627fa4554229ee6d57b0fd4cd449d7ce7..397618a384323014447e690d625f36826497b12c 100644 (file)
@@ -39,7 +39,7 @@ UDPCallback::UDPCallback (RawBufferPtr& buffer, const size_t buf_size,
 }
 
 void
-UDPCallback::operator ()(const boost::asio::error_code error_code,
+UDPCallback::operator ()(const boost::system::error_code error_code,
                          const size_t bytes_transferred) {
 
     // Save the result state and number of bytes transferred.
@@ -112,7 +112,7 @@ NameChangeUDPListener::open(isc::asiolink::IOService& io_service) {
 
         // Bind the low level socket to our endpoint.
         asio_socket_->bind(endpoint.getASIOEndpoint());
-    } catch (boost::asio::system_error& ex) {
+    } catch (boost::system::system_error& ex) {
         asio_socket_.reset();
         isc_throw (NcrUDPError, ex.code().message());
     }
@@ -142,7 +142,7 @@ NameChangeUDPListener::close() {
         if (asio_socket_->is_open()) {
             try {
                 asio_socket_->close();
-            } catch (boost::asio::system_error& ex) {
+            } catch (boost::system::system_error& ex) {
                 // It is really unlikely that this will occur.
                 // If we do reopen later it will be with a new socket
                 // instance. Repackage exception as one that is conformant
@@ -180,7 +180,7 @@ NameChangeUDPListener::receiveCompletionHandler(const bool successful,
             return;
         }
     } else {
-        boost::asio::error_code error_code = callback->getErrorCode();
+        boost::system::error_code error_code = callback->getErrorCode();
         if (error_code.value() == boost::asio::error::operation_aborted) {
             // A shutdown cancels all outstanding reads.  For this reason,
             // it can be an expected event, so log it as a debug message.
@@ -247,7 +247,7 @@ NameChangeUDPSender::open(isc::asiolink::IOService& io_service) {
 
         // Bind the low leve socket to our endpoint.
         asio_socket_->bind(endpoint.getASIOEndpoint());
-    } catch (boost::asio::system_error& ex) {
+    } catch (boost::system::system_error& ex) {
         isc_throw (NcrUDPError, ex.code().message());
     }
 
@@ -274,7 +274,7 @@ NameChangeUDPSender::close() {
         if (asio_socket_->is_open()) {
             try {
                 asio_socket_->close();
-            } catch (boost::asio::system_error& ex) {
+            } catch (boost::system::system_error& ex) {
                 // It is really unlikely that this will occur.
                 // If we do reopen later it will be with a new socket
                 // instance. Repackage exception as one that is conformant
@@ -337,7 +337,7 @@ NameChangeUDPSender::sendCompletionHandler(const bool successful,
     }
     else {
         // On a failure, log the error and set the result to ERROR.
-        boost::asio::error_code error_code = send_callback->getErrorCode();
+        boost::system::error_code error_code = send_callback->getErrorCode();
         if (error_code.value() == boost::asio::error::operation_aborted) {
             LOG_ERROR(dhcp_ddns_logger, DHCP_DDNS_NCR_UDP_SEND_CANCELED)
                       .arg(error_code.message());
index 90eb3a9539aed0b78ce81b04c835fbbf67f5d33a..b14afafb3ec0a1b7962990953e872a24da615485 100644 (file)
@@ -56,7 +56,7 @@
 ///
 /// The callback class must provide an operator() with the following signature:
 /// @code
-///    void operator ()(const boost::asio::error_code error_code,
+///    void operator ()(const boost::system::error_code error_code,
 ///                     const size_t bytes_transferred);
 /// @endcode
 ///
@@ -190,7 +190,7 @@ public:
         size_t put_len_;
 
         /// @brief Stores the IO layer result code of the completed IO service.
-        boost::asio::error_code error_code_;
+        boost::system::error_code error_code_;
 
         /// @brief Stores the number of bytes transferred by completed IO
         /// service.
@@ -226,7 +226,7 @@ public:
     /// For a read it is the number of bytes written into the
     /// buffer.  For a write it is the number of bytes read from the
     /// buffer.
-    void operator ()(const boost::asio::error_code error_code,
+    void operator ()(const boost::system::error_code error_code,
                      const size_t bytes_transferred);
 
     /// @brief Returns the number of bytes transferred by the completed IO
@@ -247,14 +247,14 @@ public:
     }
 
     /// @brief Returns the completed IO layer service outcome status.
-    boost::asio::error_code getErrorCode() const {
+    boost::system::error_code getErrorCode() const {
         return (data_->error_code_);
     }
 
     /// @brief Sets the completed IO layer service outcome status.
     ///
     /// @param value is the new value to assign to outcome status.
-    void setErrorCode(const boost::asio::error_code value) {
+    void setErrorCode(const boost::system::error_code value) {
         data_->error_code_  = value;
     }