}
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) {
/// @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);
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
/// 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;
// 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) ||
///
/// \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
///
/// 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
/// 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)
{
/// \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;
/// 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_) {
/// \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_) {
/// 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
/// 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
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;
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.
}
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.
///
/// 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);
/// 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.
///
// 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 '"
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);
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
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
///
/// \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());
///
/// \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
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
///
/// \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);
///
/// \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
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() &&
}
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.
// 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());
}
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
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.
// 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());
}
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
}
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());
///
/// 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
///
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.
/// 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
}
/// @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;
}