-// Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <agent/ca_process.h>
#include <agent/ca_command_mgr.h>
#include <agent/parser_context.h>
-#include <boost/bind.hpp>
+#include <functional>
using namespace isc::process;
+using namespace std::placeholders;
namespace isc {
namespace agent {
void
CtrlAgentController::registerCommands() {
CtrlAgentCommandMgr::instance().registerCommand(BUILD_REPORT_COMMAND,
- boost::bind(&DControllerBase::buildReportHandler, this, _1, _2));
+ std::bind(&DControllerBase::buildReportHandler, this, _1, _2));
CtrlAgentCommandMgr::instance().registerCommand(CONFIG_GET_COMMAND,
- boost::bind(&DControllerBase::configGetHandler, this, _1, _2));
+ std::bind(&DControllerBase::configGetHandler, this, _1, _2));
CtrlAgentCommandMgr::instance().registerCommand(CONFIG_RELOAD_COMMAND,
- boost::bind(&DControllerBase::configReloadHandler, this, _1, _2));
+ std::bind(&DControllerBase::configReloadHandler, this, _1, _2));
CtrlAgentCommandMgr::instance().registerCommand(CONFIG_SET_COMMAND,
- boost::bind(&DControllerBase::configSetHandler, this, _1, _2));
+ std::bind(&DControllerBase::configSetHandler, this, _1, _2));
CtrlAgentCommandMgr::instance().registerCommand(CONFIG_TEST_COMMAND,
- boost::bind(&DControllerBase::configTestHandler, this, _1, _2));
+ std::bind(&DControllerBase::configTestHandler, this, _1, _2));
CtrlAgentCommandMgr::instance().registerCommand(CONFIG_WRITE_COMMAND,
- boost::bind(&DControllerBase::configWriteHandler, this, _1, _2));
+ std::bind(&DControllerBase::configWriteHandler, this, _1, _2));
CtrlAgentCommandMgr::instance().registerCommand(SHUT_DOWN_COMMAND,
- boost::bind(&DControllerBase::shutdownHandler, this, _1, _2));
+ std::bind(&DControllerBase::shutdownHandler, this, _1, _2));
CtrlAgentCommandMgr::instance().registerCommand(STATUS_GET_COMMAND,
- boost::bind(&DControllerBase::statusGetHandler, this, _1, _2));
+ std::bind(&DControllerBase::statusGetHandler, this, _1, _2));
CtrlAgentCommandMgr::instance().registerCommand(VERSION_GET_COMMAND,
- boost::bind(&DControllerBase::versionGetHandler, this, _1, _2));
+ std::bind(&DControllerBase::versionGetHandler, this, _1, _2));
}
void
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <cc/command_interpreter.h>
#include <cc/data.h>
#include <process/testutils/d_test_stubs.h>
-#include <boost/bind.hpp>
#include <boost/pointer_cast.hpp>
#include <gtest/gtest.h>
#include <testutils/sandbox.h>
#include <cstdlib>
+#include <functional>
#include <vector>
#include <thread>
// to this we need to run the server side socket at the same time as the
// client. Running IO service in a thread guarantees that the server
//responds as soon as it receives the control command.
- std::thread th(boost::bind(&IOService::run, getIOService().get()));
+ std::thread th(std::bind(&IOService::run, getIOService().get()));
// Wait for the IO service in thread to actually run.
// to this we need to run the server side socket at the same time.
// Running IO service in a thread guarantees that the server responds
// as soon as it receives the control command.
- std::thread th(boost::bind(&IOService::run, getIOService().get()));
+ std::thread th(std::bind(&IOService::run, getIOService().get()));
// Wait for the IO service in thread to actually run.
server_socket_->waitForRunning();
-// Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/interval_timer.h>
#include <asiolink/io_service.h>
#include <process/testutils/d_test_stubs.h>
-#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gtest/gtest.h>
+#include <functional>
using namespace boost::posix_time;
using namespace isc;
// Use an asiolink IntervalTimer and callback to generate the
// shutdown invocation. (Note IntervalTimer setup is in milliseconds).
IntervalTimer timer(*getIoService());
- timer.setup(boost::bind(&CtrlAgentProcessTest::genShutdownCallback, this),
+ timer.setup(std::bind(&CtrlAgentProcessTest::genShutdownCallback, this),
200);
// Record start time, and invoke run().
-// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <http/post_request_json.h>
#include <http/response_json.h>
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
#include <boost/pointer_cast.hpp>
+#include <functional>
using namespace isc::agent;
using namespace isc::config;
using namespace isc::data;
using namespace isc::http;
+using namespace std::placeholders;
namespace {
// Deregisters commands.
CtrlAgentCommandMgr::instance().deregisterAll();
CtrlAgentCommandMgr::instance().
- registerCommand("foo", boost::bind(&CtrlAgentResponseCreatorTest::
- fooCommandHandler,
- this, _1, _2));
+ registerCommand("foo", std::bind(&CtrlAgentResponseCreatorTest::
+ fooCommandHandler,
+ this, _1, _2));
// Make sure that the request has been initialized properly.
if (!request_) {
-// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
using namespace isc::config;
using namespace isc::process;
+using namespace std::placeholders;
namespace isc {
namespace d2 {
// These are the commands always supported by the D2 server.
// Please keep the list in alphabetic order.
CommandMgr::instance().registerCommand(BUILD_REPORT_COMMAND,
- boost::bind(&D2Controller::buildReportHandler, this, _1, _2));
+ std::bind(&D2Controller::buildReportHandler, this, _1, _2));
CommandMgr::instance().registerCommand(CONFIG_GET_COMMAND,
- boost::bind(&D2Controller::configGetHandler, this, _1, _2));
+ std::bind(&D2Controller::configGetHandler, this, _1, _2));
CommandMgr::instance().registerCommand(CONFIG_RELOAD_COMMAND,
- boost::bind(&D2Controller::configReloadHandler, this, _1, _2));
+ std::bind(&D2Controller::configReloadHandler, this, _1, _2));
CommandMgr::instance().registerCommand(CONFIG_SET_COMMAND,
- boost::bind(&D2Controller::configSetHandler, this, _1, _2));
+ std::bind(&D2Controller::configSetHandler, this, _1, _2));
CommandMgr::instance().registerCommand(CONFIG_TEST_COMMAND,
- boost::bind(&D2Controller::configTestHandler, this, _1, _2));
+ std::bind(&D2Controller::configTestHandler, this, _1, _2));
CommandMgr::instance().registerCommand(CONFIG_WRITE_COMMAND,
- boost::bind(&D2Controller::configWriteHandler, this, _1, _2));
+ std::bind(&D2Controller::configWriteHandler, this, _1, _2));
CommandMgr::instance().registerCommand(SHUT_DOWN_COMMAND,
- boost::bind(&D2Controller::shutdownHandler, this, _1, _2));
+ std::bind(&D2Controller::shutdownHandler, this, _1, _2));
CommandMgr::instance().registerCommand(STATUS_GET_COMMAND,
- boost::bind(&DControllerBase::statusGetHandler, this, _1, _2));
+ std::bind(&DControllerBase::statusGetHandler, this, _1, _2));
CommandMgr::instance().registerCommand(VERSION_GET_COMMAND,
- boost::bind(&D2Controller::versionGetHandler, this, _1, _2));
+ std::bind(&D2Controller::versionGetHandler, this, _1, _2));
}
void
-// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
isc::data::ConstElementPtr answer;
answer = getCfgMgr()->simpleParseConfig(config_set, check_only,
- boost::bind(&D2Process::reconfigureCommandChannel, this));
+ std::bind(&D2Process::reconfigureCommandChannel, this));
if (check_only) {
return (answer);
}
#include <d2/d2_cfg_mgr.h>
#include <d2/nc_add.h>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
-
#include <util/buffer.h>
#include <dns/rdataclass.h>
+#include <functional>
+
namespace isc {
namespace d2 {
// Define NameAddTransaction states.
defineState(READY_ST, "READY_ST",
- boost::bind(&NameAddTransaction::readyHandler, this));
+ std::bind(&NameAddTransaction::readyHandler, this));
defineState(SELECTING_FWD_SERVER_ST, "SELECTING_FWD_SERVER_ST",
- boost::bind(&NameAddTransaction::selectingFwdServerHandler, this));
+ std::bind(&NameAddTransaction::selectingFwdServerHandler, this));
defineState(SELECTING_REV_SERVER_ST, "SELECTING_REV_SERVER_ST",
- boost::bind(&NameAddTransaction::selectingRevServerHandler, this));
+ std::bind(&NameAddTransaction::selectingRevServerHandler, this));
defineState(ADDING_FWD_ADDRS_ST, "ADDING_FWD_ADDRS_ST",
- boost::bind(&NameAddTransaction::addingFwdAddrsHandler, this));
+ std::bind(&NameAddTransaction::addingFwdAddrsHandler, this));
defineState(REPLACING_FWD_ADDRS_ST, "REPLACING_FWD_ADDRS_ST",
- boost::bind(&NameAddTransaction::replacingFwdAddrsHandler, this));
+ std::bind(&NameAddTransaction::replacingFwdAddrsHandler, this));
defineState(REPLACING_REV_PTRS_ST, "REPLACING_REV_PTRS_ST",
- boost::bind(&NameAddTransaction::replacingRevPtrsHandler, this));
+ std::bind(&NameAddTransaction::replacingRevPtrsHandler, this));
defineState(PROCESS_TRANS_OK_ST, "PROCESS_TRANS_OK_ST",
- boost::bind(&NameAddTransaction::processAddOkHandler, this));
+ std::bind(&NameAddTransaction::processAddOkHandler, this));
defineState(PROCESS_TRANS_FAILED_ST, "PROCESS_TRANS_FAILED_ST",
- boost::bind(&NameAddTransaction::processAddFailedHandler, this));
-
+ std::bind(&NameAddTransaction::processAddFailedHandler, this));
}
+
void
NameAddTransaction::verifyStates() {
// Call superclass implementation first to verify its states. These are
#include <d2/d2_cfg_mgr.h>
#include <d2/nc_remove.h>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
+#include <functional>
namespace isc {
namespace d2 {
// Define NameRemoveTransaction states.
defineState(READY_ST, "READY_ST",
- boost::bind(&NameRemoveTransaction::readyHandler, this));
+ std::bind(&NameRemoveTransaction::readyHandler, this));
defineState(SELECTING_FWD_SERVER_ST, "SELECTING_FWD_SERVER_ST",
- boost::bind(&NameRemoveTransaction::selectingFwdServerHandler,
- this));
+ std::bind(&NameRemoveTransaction::selectingFwdServerHandler,
+ this));
defineState(SELECTING_REV_SERVER_ST, "SELECTING_REV_SERVER_ST",
- boost::bind(&NameRemoveTransaction::selectingRevServerHandler,
- this));
+ std::bind(&NameRemoveTransaction::selectingRevServerHandler,
+ this));
defineState(REMOVING_FWD_ADDRS_ST, "REMOVING_FWD_ADDRS_ST",
- boost::bind(&NameRemoveTransaction::removingFwdAddrsHandler,
- this));
+ std::bind(&NameRemoveTransaction::removingFwdAddrsHandler,
+ this));
defineState(REMOVING_FWD_RRS_ST, "REMOVING_FWD_RRS_ST",
- boost::bind(&NameRemoveTransaction::removingFwdRRsHandler,
- this));
+ std::bind(&NameRemoveTransaction::removingFwdRRsHandler,
+ this));
defineState(REMOVING_REV_PTRS_ST, "REMOVING_REV_PTRS_ST",
- boost::bind(&NameRemoveTransaction::removingRevPtrsHandler,
- this));
+ std::bind(&NameRemoveTransaction::removingRevPtrsHandler,
+ this));
defineState(PROCESS_TRANS_OK_ST, "PROCESS_TRANS_OK_ST",
- boost::bind(&NameRemoveTransaction::processRemoveOkHandler,
- this));
+ std::bind(&NameRemoveTransaction::processRemoveOkHandler,
+ this));
defineState(PROCESS_TRANS_FAILED_ST, "PROCESS_TRANS_FAILED_ST",
- boost::bind(&NameRemoveTransaction::processRemoveFailedHandler,
- this));
+ std::bind(&NameRemoveTransaction::processRemoveFailedHandler,
+ this));
}
void
#include <unistd.h>
using namespace std;
+using namespace std::placeholders;
using namespace isc;
using namespace isc::asiolink;
using namespace isc::config;
ASSERT_NO_THROW(
CommandMgr::instance().registerCommand("foo",
- boost::bind(&CtrlChannelD2Test::longCommandHandler,
- command.str(), _1, _2));
+ std::bind(&CtrlChannelD2Test::longCommandHandler,
+ command.str(), _1, _2));
);
createUnixChannelServer();
// of a desired size
ASSERT_NO_THROW(
CommandMgr::instance().registerCommand("foo",
- boost::bind(&CtrlChannelD2Test::longResponseHandler, _1, _2));
+ std::bind(&CtrlChannelD2Test::longResponseHandler, _1, _2));
);
createUnixChannelServer();
-// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <process/testutils/d_test_stubs.h>
#include <d2/tests/nc_test_utils.h>
-#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gtest/gtest.h>
+#include <functional>
#include <sstream>
using namespace std;
// Use an asiolink IntervalTimer and callback to generate the
// shutdown invocation. (Note IntervalTimer setup is in milliseconds).
isc::asiolink::IntervalTimer timer(*getIoService());
- timer.setup(boost::bind(&D2ProcessTest::genShutdownCallback, this),
+ timer.setup(std::bind(&D2ProcessTest::genShutdownCallback, this),
2 * 1000);
// Record start time, and invoke run().
// Use an asiolink IntervalTimer and callback to generate the
// the exception. (Note IntervalTimer setup is in milliseconds).
isc::asiolink::IntervalTimer timer(*getIoService());
- timer.setup(boost::bind(&D2ProcessTest::genFatalErrorCallback, this),
+ timer.setup(std::bind(&D2ProcessTest::genFatalErrorCallback, this),
2 * 1000);
// Record start time, and invoke run().
-// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dhcp_ddns/ncr_udp.h>
#include <util/time_utilities.h>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <algorithm>
+#include <functional>
#include <vector>
using namespace std;
FMT_JSON, *this, 100, true));
// Set the test timeout to break any running tasks if they hang.
- test_timer_.setup(boost::bind(&QueueMgrUDPTest::testTimeoutHandler,
- this),
+ test_timer_.setup(std::bind(&QueueMgrUDPTest::testTimeoutHandler,
+ this),
TEST_TIMEOUT);
}
-// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dns/messagerenderer.h>
#include <boost/asio/ip/udp.hpp>
#include <boost/asio/socket_base.hpp>
-#include <boost/bind.hpp>
#include <boost/scoped_ptr.hpp>
#include <gtest/gtest.h>
#include <nc_test_utils.h>
+#include <functional>
using namespace std;
+using namespace std::placeholders;
using namespace isc;
using namespace isc::asiolink;
using namespace isc::asiodns;
dns_client_.reset(new DNSClient(response_, this));
// Set the test timeout to break any running tasks if they hang.
- test_timer_.setup(boost::bind(&DNSClientTest::testTimeoutHandler, this),
+ test_timer_.setup(std::bind(&DNSClientTest::testTimeoutHandler, this),
TEST_TIMEOUT);
}
udp_socket.async_receive_from(boost::asio::buffer(receive_buffer_,
sizeof(receive_buffer_)),
remote,
- boost::bind(&DNSClientTest::udpReceiveHandler,
- this, &udp_socket, &remote, _2,
- corrupt_response));
+ std::bind(&DNSClientTest::udpReceiveHandler,
+ this, &udp_socket, &remote, _2,
+ corrupt_response));
// The socket is now ready to receive the data. Let's post some request
// message then. Set timeout to some reasonable value to make sure that
udp_socket.async_receive_from(boost::asio::buffer(receive_buffer_,
sizeof(receive_buffer_)),
remote,
- boost::bind(&DNSClientTest::
- TSIGReceiveHandler, this,
- &udp_socket, &remote, _2,
- client_key, server_key));
+ std::bind(&DNSClientTest::
+ TSIGReceiveHandler, this,
+ &udp_socket, &remote, _2,
+ client_key, server_key));
// The socket is now ready to receive the data. Let's post some request
// message then. Set timeout to some reasonable value to make sure that
-// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <gtest/gtest.h>
using namespace std;
+using namespace std::placeholders;
using namespace isc;
using namespace isc::d2;
server_socket_->async_receive_from(boost::asio::buffer(receive_buffer_,
sizeof(receive_buffer_)),
remote_,
- boost::bind(&FauxServer::requestHandler,
- this, _1, _2,
- response_mode,
- response_rcode));
+ std::bind(&FauxServer::requestHandler,
+ this, _1, _2,
+ response_mode,
+ response_rcode));
}
void
run_time_ = run_time;
int cnt = io_service_->get_io_service().poll();
if (cnt == 0) {
- timer_.setup(boost::bind(&TimedIO::timesUp, this), run_time_);
+ timer_.setup(std::bind(&TimedIO::timesUp, this), run_time_);
cnt = io_service_->get_io_service().run_one();
timer_.cancel();
}
#include <util/buffer.h>
#include <nc_test_utils.h>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gtest/gtest.h>
+#include <functional>
using namespace std;
using namespace isc;
// Define our states.
defineState(READY_ST, "READY_ST",
- boost::bind(&NameChangeStub::readyHandler, this));
+ std::bind(&NameChangeStub::readyHandler, this));
defineState(SELECTING_FWD_SERVER_ST, "SELECTING_FWD_SERVER_ST",
- boost::bind(&NameChangeStub::dummyHandler, this));
+ std::bind(&NameChangeStub::dummyHandler, this));
defineState(SELECTING_REV_SERVER_ST, "SELECTING_REV_SERVER_ST",
- boost::bind(&NameChangeStub::dummyHandler, this));
+ std::bind(&NameChangeStub::dummyHandler, this));
defineState(DOING_UPDATE_ST, "DOING_UPDATE_ST",
- boost::bind(&NameChangeStub::doingUpdateHandler,
- this));
+ std::bind(&NameChangeStub::doingUpdateHandler,
+ this));
defineState(PROCESS_TRANS_OK_ST, "PROCESS_TRANS_OK_ST",
- boost::bind(&NameChangeStub::
- processTransDoneHandler, this));
+ std::bind(&NameChangeStub::
+ processTransDoneHandler, this));
defineState(PROCESS_TRANS_FAILED_ST, "PROCESS_TRANS_FAILED_ST",
- boost::bind(&NameChangeStub::
- processTransDoneHandler, this));
+ std::bind(&NameChangeStub::
+ processTransDoneHandler, this));
}
/// @brief Verify the event dictionary.
using namespace isc::stats;
using namespace isc::util;
using namespace std;
+using namespace std::placeholders;
namespace {
// Re-open lease and host database with new parameters.
try {
DatabaseConnection::db_lost_callback =
- boost::bind(&ControlledDhcpv4Srv::dbLostCallback, srv, _1);
+ std::bind(&ControlledDhcpv4Srv::dbLostCallback, srv, _1);
CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
cfg_db->setAppendedParameters("universe=4");
cfg_db->createManagers();
boost::shared_ptr<unsigned> failure_count(new unsigned(0));
TimerMgr::instance()->
registerTimer("Dhcp4CBFetchTimer",
- boost::bind(&ControlledDhcpv4Srv::cbFetchUpdates,
- server_, CfgMgr::instance().getStagingCfg(),
- failure_count),
+ std::bind(&ControlledDhcpv4Srv::cbFetchUpdates,
+ server_, CfgMgr::instance().getStagingCfg(),
+ failure_count),
fetch_time,
asiolink::IntervalTimer::ONE_SHOT);
TimerMgr::instance()->setup("Dhcp4CBFetchTimer");
// These are the commands always supported by the DHCPv4 server.
// Please keep the list in alphabetic order.
CommandMgr::instance().registerCommand("build-report",
- boost::bind(&ControlledDhcpv4Srv::commandBuildReportHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandBuildReportHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-backend-pull",
- boost::bind(&ControlledDhcpv4Srv::commandConfigBackendPullHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandConfigBackendPullHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-get",
- boost::bind(&ControlledDhcpv4Srv::commandConfigGetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandConfigGetHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-reload",
- boost::bind(&ControlledDhcpv4Srv::commandConfigReloadHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandConfigReloadHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-set",
- boost::bind(&ControlledDhcpv4Srv::commandConfigSetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandConfigSetHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-test",
- boost::bind(&ControlledDhcpv4Srv::commandConfigTestHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandConfigTestHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-write",
- boost::bind(&ControlledDhcpv4Srv::commandConfigWriteHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandConfigWriteHandler, this, _1, _2));
CommandMgr::instance().registerCommand("dhcp-enable",
- boost::bind(&ControlledDhcpv4Srv::commandDhcpEnableHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandDhcpEnableHandler, this, _1, _2));
CommandMgr::instance().registerCommand("dhcp-disable",
- boost::bind(&ControlledDhcpv4Srv::commandDhcpDisableHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandDhcpDisableHandler, this, _1, _2));
CommandMgr::instance().registerCommand("libreload",
- boost::bind(&ControlledDhcpv4Srv::commandLibReloadHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandLibReloadHandler, this, _1, _2));
CommandMgr::instance().registerCommand("leases-reclaim",
- boost::bind(&ControlledDhcpv4Srv::commandLeasesReclaimHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandLeasesReclaimHandler, this, _1, _2));
CommandMgr::instance().registerCommand("server-tag-get",
- boost::bind(&ControlledDhcpv4Srv::commandServerTagGetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandServerTagGetHandler, this, _1, _2));
CommandMgr::instance().registerCommand("shutdown",
- boost::bind(&ControlledDhcpv4Srv::commandShutdownHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandShutdownHandler, this, _1, _2));
CommandMgr::instance().registerCommand("status-get",
- boost::bind(&ControlledDhcpv4Srv::commandStatusGetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandStatusGetHandler, this, _1, _2));
CommandMgr::instance().registerCommand("version-get",
- boost::bind(&ControlledDhcpv4Srv::commandVersionGetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandVersionGetHandler, this, _1, _2));
// Register statistic related commands
CommandMgr::instance().registerCommand("statistic-get",
- boost::bind(&StatsMgr::statisticGetHandler, _1, _2));
+ std::bind(&StatsMgr::statisticGetHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-reset",
- boost::bind(&StatsMgr::statisticResetHandler, _1, _2));
+ std::bind(&StatsMgr::statisticResetHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-remove",
- boost::bind(&StatsMgr::statisticRemoveHandler, _1, _2));
+ std::bind(&StatsMgr::statisticRemoveHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-get-all",
- boost::bind(&StatsMgr::statisticGetAllHandler, _1, _2));
+ std::bind(&StatsMgr::statisticGetAllHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-reset-all",
- boost::bind(&StatsMgr::statisticResetAllHandler, _1, _2));
+ std::bind(&StatsMgr::statisticResetAllHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-remove-all",
- boost::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2));
+ std::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-sample-age-set",
- boost::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, _1, _2));
+ std::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-sample-age-set-all",
- boost::bind(&ControlledDhcpv4Srv::commandStatisticSetMaxSampleAgeAllHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandStatisticSetMaxSampleAgeAllHandler, this, _1, _2));
CommandMgr::instance().registerCommand("statistic-sample-count-set",
- boost::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2));
+ std::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-sample-count-set-all",
- boost::bind(&ControlledDhcpv4Srv::commandStatisticSetMaxSampleCountAllHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv4Srv::commandStatisticSetMaxSampleCountAllHandler, this, _1, _2));
}
void ControlledDhcpv4Srv::shutdownServer(int exit_value) {
if (!TimerMgr::instance()->isTimerRegistered("Dhcp4DbReconnectTimer")) {
TimerMgr::instance()->registerTimer("Dhcp4DbReconnectTimer",
- boost::bind(&ControlledDhcpv4Srv::dbReconnect, this,
- db_reconnect_ctl),
+ std::bind(&ControlledDhcpv4Srv::dbReconnect, this,
+ db_reconnect_ctl),
db_reconnect_ctl->retryInterval(),
asiolink::IntervalTimer::ONE_SHOT);
}
#include <dhcpsrv/memfile_lease_mgr.h>
#include <boost/algorithm/string.hpp>
-#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/pointer_cast.hpp>
#include <boost/shared_ptr.hpp>
+#include <functional>
#include <iomanip>
#include <set>
#include <cstdlib>
using namespace isc::stats;
using namespace isc::util;
using namespace std;
+using namespace std::placeholders;
namespace {
// Updates are enabled, so lets start the sender, passing in
// our error handler.
// This may throw so wherever this is called needs to ready.
- d2_mgr.startSender(boost::bind(&Dhcpv4Srv::d2ClientErrorHandler,
- this, _1, _2));
+ d2_mgr.startSender(std::bind(&Dhcpv4Srv::d2ClientErrorHandler,
+ this, _1, _2));
}
}
#include <unistd.h>
using namespace std;
+using namespace std::placeholders;
using namespace isc;
using namespace isc::asiolink;
using namespace isc::config;
ASSERT_NO_THROW(
CommandMgr::instance().registerCommand("foo",
- boost::bind(&CtrlChannelDhcpv4SrvTest::longCommandHandler,
- command.str(), _1, _2));
+ std::bind(&CtrlChannelDhcpv4SrvTest::longCommandHandler,
+ command.str(), _1, _2));
);
createUnixChannelServer();
// of a desired size.
ASSERT_NO_THROW(
CommandMgr::instance().registerCommand("foo",
- boost::bind(&CtrlChannelDhcpv4SrvTest::longResponseHandler, _1, _2));
+ std::bind(&CtrlChannelDhcpv4SrvTest::longResponseHandler, _1, _2));
);
createUnixChannelServer();
callout_handle.getArgument("query4", callback_qry_pkt4_);
- io_service_->post(boost::bind(&HooksDhcpv4SrvTest::leases4_committed_unpark,
- callout_handle.getParkingLotHandlePtr(),
- callback_qry_pkt4_));
+ io_service_->post(std::bind(&HooksDhcpv4SrvTest::leases4_committed_unpark,
+ callout_handle.getParkingLotHandlePtr(),
+ callback_qry_pkt4_));
callout_handle.getParkingLotHandlePtr()->reference(callback_qry_pkt4_);
callout_handle.setStatus(CalloutHandle::NEXT_STEP_PARK);
using namespace isc::stats;
using namespace isc::util;
using namespace std;
+using namespace std::placeholders;
namespace {
// Re-open lease and host database with new parameters.
try {
DatabaseConnection::db_lost_callback =
- boost::bind(&ControlledDhcpv6Srv::dbLostCallback, srv, _1);
+ std::bind(&ControlledDhcpv6Srv::dbLostCallback, srv, _1);
CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
cfg_db->setAppendedParameters("universe=6");
cfg_db->createManagers();
boost::shared_ptr<unsigned> failure_count(new unsigned(0));
TimerMgr::instance()->
registerTimer("Dhcp6CBFetchTimer",
- boost::bind(&ControlledDhcpv6Srv::cbFetchUpdates,
- server_, CfgMgr::instance().getStagingCfg(),
- failure_count),
+ std::bind(&ControlledDhcpv6Srv::cbFetchUpdates,
+ server_, CfgMgr::instance().getStagingCfg(),
+ failure_count),
fetch_time,
asiolink::IntervalTimer::ONE_SHOT);
TimerMgr::instance()->setup("Dhcp6CBFetchTimer");
// These are the commands always supported by the DHCPv6 server.
// Please keep the list in alphabetic order.
CommandMgr::instance().registerCommand("build-report",
- boost::bind(&ControlledDhcpv6Srv::commandBuildReportHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandBuildReportHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-backend-pull",
- boost::bind(&ControlledDhcpv6Srv::commandConfigBackendPullHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandConfigBackendPullHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-get",
- boost::bind(&ControlledDhcpv6Srv::commandConfigGetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandConfigGetHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-reload",
- boost::bind(&ControlledDhcpv6Srv::commandConfigReloadHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandConfigReloadHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-test",
- boost::bind(&ControlledDhcpv6Srv::commandConfigTestHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandConfigTestHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-write",
- boost::bind(&ControlledDhcpv6Srv::commandConfigWriteHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandConfigWriteHandler, this, _1, _2));
CommandMgr::instance().registerCommand("dhcp-disable",
- boost::bind(&ControlledDhcpv6Srv::commandDhcpDisableHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandDhcpDisableHandler, this, _1, _2));
CommandMgr::instance().registerCommand("dhcp-enable",
- boost::bind(&ControlledDhcpv6Srv::commandDhcpEnableHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandDhcpEnableHandler, this, _1, _2));
CommandMgr::instance().registerCommand("leases-reclaim",
- boost::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler, this, _1, _2));
CommandMgr::instance().registerCommand("server-tag-get",
- boost::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler, this, _1, _2));
CommandMgr::instance().registerCommand("libreload",
- boost::bind(&ControlledDhcpv6Srv::commandLibReloadHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandLibReloadHandler, this, _1, _2));
CommandMgr::instance().registerCommand("config-set",
- boost::bind(&ControlledDhcpv6Srv::commandConfigSetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandConfigSetHandler, this, _1, _2));
CommandMgr::instance().registerCommand("shutdown",
- boost::bind(&ControlledDhcpv6Srv::commandShutdownHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandShutdownHandler, this, _1, _2));
CommandMgr::instance().registerCommand("status-get",
- boost::bind(&ControlledDhcpv6Srv::commandStatusGetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandStatusGetHandler, this, _1, _2));
CommandMgr::instance().registerCommand("version-get",
- boost::bind(&ControlledDhcpv6Srv::commandVersionGetHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandVersionGetHandler, this, _1, _2));
// Register statistic related commands
CommandMgr::instance().registerCommand("statistic-get",
- boost::bind(&StatsMgr::statisticGetHandler, _1, _2));
+ std::bind(&StatsMgr::statisticGetHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-get-all",
- boost::bind(&StatsMgr::statisticGetAllHandler, _1, _2));
+ std::bind(&StatsMgr::statisticGetAllHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-reset",
- boost::bind(&StatsMgr::statisticResetHandler, _1, _2));
+ std::bind(&StatsMgr::statisticResetHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-reset-all",
- boost::bind(&StatsMgr::statisticResetAllHandler, _1, _2));
+ std::bind(&StatsMgr::statisticResetAllHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-remove",
- boost::bind(&StatsMgr::statisticRemoveHandler, _1, _2));
+ std::bind(&StatsMgr::statisticRemoveHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-remove-all",
- boost::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2));
+ std::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-sample-age-set",
- boost::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, _1, _2));
+ std::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-sample-age-set-all",
- boost::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler, this, _1, _2));
CommandMgr::instance().registerCommand("statistic-sample-count-set",
- boost::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2));
+ std::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2));
CommandMgr::instance().registerCommand("statistic-sample-count-set-all",
- boost::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler, this, _1, _2));
+ std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler, this, _1, _2));
}
void ControlledDhcpv6Srv::shutdownServer(int exit_value) {
if (!TimerMgr::instance()->isTimerRegistered("Dhcp6DbReconnectTimer")) {
TimerMgr::instance()->registerTimer("Dhcp6DbReconnectTimer",
- boost::bind(&ControlledDhcpv6Srv::dbReconnect, this,
- db_reconnect_ctl),
+ std::bind(&ControlledDhcpv6Srv::dbReconnect, this,
+ db_reconnect_ctl),
db_reconnect_ctl->retryInterval(),
asiolink::IntervalTimer::ONE_SHOT);
}
#endif
#include <dhcpsrv/memfile_lease_mgr.h>
-#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
#include <boost/algorithm/string/erase.hpp>
#include <boost/algorithm/string/split.hpp>
#include <algorithm>
+#include <functional>
#include <stdlib.h>
#include <time.h>
#include <iomanip>
using namespace isc::stats;
using namespace isc::util;
using namespace std;
+using namespace std::placeholders;
namespace {
// Updates are enabled, so lets start the sender, passing in
// our error handler.
// This may throw so wherever this is called needs to ready.
- d2_mgr.startSender(boost::bind(&Dhcpv6Srv::d2ClientErrorHandler,
- this, _1, _2));
+ d2_mgr.startSender(std::bind(&Dhcpv6Srv::d2ClientErrorHandler,
+ this, _1, _2));
}
}
#include <unistd.h>
using namespace std;
+using namespace std::placeholders;
using namespace isc;
using namespace isc::asiolink;
using namespace isc::config;
ASSERT_NO_THROW(
CommandMgr::instance().registerCommand("foo",
- boost::bind(&CtrlChannelDhcpv6SrvTest::longCommandHandler,
- command.str(), _1, _2));
+ std::bind(&CtrlChannelDhcpv6SrvTest::longCommandHandler,
+ command.str(), _1, _2));
);
createUnixChannelServer();
// of a desired size.
ASSERT_NO_THROW(
CommandMgr::instance().registerCommand("foo",
- boost::bind(&CtrlChannelDhcpv6SrvTest::longResponseHandler, _1, _2));
+ std::bind(&CtrlChannelDhcpv6SrvTest::longResponseHandler, _1, _2));
);
createUnixChannelServer();
callout_handle.getArgument("query6", callback_qry_pkt6_);
- io_service_->post(boost::bind(&HooksDhcpv6SrvTest::leases6_committed_unpark,
- callout_handle.getParkingLotHandlePtr(),
- callback_qry_pkt6_));
+ io_service_->post(std::bind(&HooksDhcpv6SrvTest::leases6_committed_unpark,
+ callout_handle.getParkingLotHandlePtr(),
+ callback_qry_pkt6_));
callout_handle.getParkingLotHandlePtr()->reference(callback_qry_pkt6_);
callout_handle.setStatus(CalloutHandle::NEXT_STEP_PARK);
#include <dhcp6/tests/dhcp6_test_utils.h>
#include <dhcp6/tests/dhcp6_client.h>
#include <boost/algorithm/string/join.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
#include <boost/lexical_cast.hpp>
+#include <functional>
#include <list>
#include <sstream>
: Dhcpv6SrvTest(),
iface_mgr_test_config_(true),
client_(),
- do_solicit_(boost::bind(&Dhcp6Client::doSolicit, &client_, true)),
- do_solicit_request_(boost::bind(&Dhcp6Client::doSARR, &client_)) {
+ do_solicit_(std::bind(&Dhcp6Client::doSolicit, &client_, true)),
+ do_solicit_request_(std::bind(&Dhcp6Client::doSARR, &client_)) {
}
/// @brief Checks that specified option contains a desired address.
/// @param h4 Hint 4.
/// @param h5 Hint 5.
/// @param h6 Hint 6.
- void testMultipleIAs(const boost::function<void ()>& client_operation,
+ void testMultipleIAs(const std::function<void ()>& client_operation,
const Reservation& r1 = Reservation::UNSPEC(),
const Reservation& r2 = Reservation::UNSPEC(),
const Reservation& r3 = Reservation::UNSPEC(),
Dhcp6Client client_;
/// @brief Pointer to the Dhcp6Client::doSolicit method.
- boost::function<void() > do_solicit_;
+ std::function<void() > do_solicit_;
/// @brief Pointer to the Dhcp6Client::doSARR method.
- boost::function<void() > do_solicit_request_;
+ std::function<void() > do_solicit_request_;
};
void
}
void
-HostTest::testMultipleIAs(const boost::function<void ()>& client_operation,
+HostTest::testMultipleIAs(const std::function<void ()>& client_operation,
const Reservation& r1, const Reservation& r2,
const Reservation& r3, const Reservation& r4,
const Reservation& r5, const Reservation& r6,
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/interval_timer.h>
#include <asiolink/io_service.h>
#include <process/testutils/d_test_stubs.h>
-#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gtest/gtest.h>
+#include <functional>
using namespace boost::posix_time;
using namespace isc;
// Use an asiolink IntervalTimer and callback to generate the
// shutdown invocation. (Note IntervalTimer setup is in milliseconds).
IntervalTimer timer(*getIoService());
- timer.setup(boost::bind(&NetconfProcessTest::genShutdownCallback, this),
+ timer.setup(std::bind(&NetconfProcessTest::genShutdownCallback, this),
200);
// Record start time, and invoke run().
-// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dhcp/iface_mgr.h>
-#include <boost/bind.hpp>
+#include <functional>
using namespace std;
using namespace isc::dhcp;
run_flag_.clear();
isc_throw(isc::Unexpected, "run_flag_ should be false.");
}
- recv_thread_.reset(new std::thread(boost::bind(&Receiver::run, this)));
+ recv_thread_.reset(new std::thread(std::bind(&Receiver::run, this)));
}
void
#include <util/boost_time_utils.h>
#include <util/multi_threading_mgr.h>
-#include <boost/bind.hpp>
#include <boost/pointer_cast.hpp>
+#include <functional>
#include <sstream>
#include <utility>
void
CommunicationState::startHeartbeat(const long interval,
- const boost::function<void()>& heartbeat_impl) {
+ const std::function<void()>& heartbeat_impl) {
startHeartbeatInternal(interval, heartbeat_impl);
}
void
CommunicationState::startHeartbeatInternal(const long interval,
- const boost::function<void()>& heartbeat_impl) {
+ const std::function<void()>& heartbeat_impl) {
bool settings_modified = false;
// If we're setting the heartbeat for the first time, it should
#include <dhcp/pkt.h>
#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/function.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
+#include <functional>
#include <map>
#include <mutex>
#include <set>
/// @param heartbeat_impl pointer to the heartbeat implementation
/// function.
void startHeartbeat(const long interval,
- const boost::function<void()>& heartbeat_impl);
+ const std::function<void()>& heartbeat_impl);
protected:
/// @param heartbeat_impl pointer to the heartbeat implementation
/// function.
void startHeartbeatInternal(const long interval = 0,
- const boost::function<void()>& heartbeat_impl = 0);
+ const std::function<void()>& heartbeat_impl = 0);
public:
boost::posix_time::ptime poke_time_;
/// @brief Pointer to the function providing heartbeat implementation.
- boost::function<void()> heartbeat_impl_;
+ std::function<void()> heartbeat_impl_;
/// @brief Last known state of the partner server.
///
#include <util/multi_threading_mgr.h>
#include <util/stopwatch.h>
#include <boost/pointer_cast.hpp>
-#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <boost/weak_ptr.hpp>
+#include <functional>
#include <sstream>
using namespace isc::asiolink;
using namespace isc::http;
using namespace isc::log;
using namespace isc::util;
+using namespace std::placeholders;
namespace isc {
namespace ha {
StateModel::defineStates();
defineState(HA_BACKUP_ST, stateToString(HA_BACKUP_ST),
- boost::bind(&HAService::backupStateHandler, this),
+ std::bind(&HAService::backupStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_BACKUP_ST)->getPausing());
defineState(HA_HOT_STANDBY_ST, stateToString(HA_HOT_STANDBY_ST),
- boost::bind(&HAService::normalStateHandler, this),
+ std::bind(&HAService::normalStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_HOT_STANDBY_ST)->getPausing());
defineState(HA_LOAD_BALANCING_ST, stateToString(HA_LOAD_BALANCING_ST),
- boost::bind(&HAService::normalStateHandler, this),
+ std::bind(&HAService::normalStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_LOAD_BALANCING_ST)->getPausing());
defineState(HA_IN_MAINTENANCE_ST, stateToString(HA_IN_MAINTENANCE_ST),
- boost::bind(&HAService::inMaintenanceStateHandler, this),
+ std::bind(&HAService::inMaintenanceStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_IN_MAINTENANCE_ST)->getPausing());
defineState(HA_PARTNER_DOWN_ST, stateToString(HA_PARTNER_DOWN_ST),
- boost::bind(&HAService::partnerDownStateHandler, this),
+ std::bind(&HAService::partnerDownStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_PARTNER_DOWN_ST)->getPausing());
defineState(HA_PARTNER_IN_MAINTENANCE_ST, stateToString(HA_PARTNER_IN_MAINTENANCE_ST),
- boost::bind(&HAService::partnerInMaintenanceStateHandler, this),
+ std::bind(&HAService::partnerInMaintenanceStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_PARTNER_IN_MAINTENANCE_ST)->getPausing());
defineState(HA_PASSIVE_BACKUP_ST, stateToString(HA_PASSIVE_BACKUP_ST),
- boost::bind(&HAService::passiveBackupStateHandler, this),
+ std::bind(&HAService::passiveBackupStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_PASSIVE_BACKUP_ST)->getPausing());
defineState(HA_READY_ST, stateToString(HA_READY_ST),
- boost::bind(&HAService::readyStateHandler, this),
+ std::bind(&HAService::readyStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_READY_ST)->getPausing());
defineState(HA_SYNCING_ST, stateToString(HA_SYNCING_ST),
- boost::bind(&HAService::syncingStateHandler, this),
+ std::bind(&HAService::syncingStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_SYNCING_ST)->getPausing());
defineState(HA_TERMINATED_ST, stateToString(HA_TERMINATED_ST),
- boost::bind(&HAService::terminatedStateHandler, this),
+ std::bind(&HAService::terminatedStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_TERMINATED_ST)->getPausing());
defineState(HA_WAITING_ST, stateToString(HA_WAITING_ST),
- boost::bind(&HAService::waitingStateHandler, this),
+ std::bind(&HAService::waitingStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_WAITING_ST)->getPausing());
}
}
},
HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST),
- boost::bind(&HAService::clientConnectHandler, this, _1, _2),
- boost::bind(&HAService::clientCloseHandler, this, _1)
+ std::bind(&HAService::clientConnectHandler, this, _1, _2),
+ std::bind(&HAService::clientCloseHandler, this, _1)
);
// The number of pending requests is the number of requests for which we
runModel(HA_HEARTBEAT_COMPLETE_EVT);
},
HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST),
- boost::bind(&HAService::clientConnectHandler, this, _1, _2),
- boost::bind(&HAService::clientCloseHandler, this, _1)
+ std::bind(&HAService::clientConnectHandler, this, _1, _2),
+ std::bind(&HAService::clientCloseHandler, this, _1)
);
}
HAService::startHeartbeat() {
if (config_->getHeartbeatDelay() > 0) {
communication_state_->startHeartbeat(config_->getHeartbeatDelay(),
- boost::bind(&HAService::asyncSendHeartbeat,
- this));
+ std::bind(&HAService::asyncSendHeartbeat,
+ this));
}
}
}
},
HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST),
- boost::bind(&HAService::clientConnectHandler, this, _1, _2),
- boost::bind(&HAService::clientCloseHandler, this, _1)
+ std::bind(&HAService::clientConnectHandler, this, _1, _2),
+ std::bind(&HAService::clientCloseHandler, this, _1)
);
}
}
},
HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST),
- boost::bind(&HAService::clientConnectHandler, this, _1, _2),
- boost::bind(&HAService::clientCloseHandler, this, _1)
+ std::bind(&HAService::clientConnectHandler, this, _1, _2),
+ std::bind(&HAService::clientCloseHandler, this, _1)
);
}
}
},
HttpClient::RequestTimeout(config_->getSyncTimeout()),
- boost::bind(&HAService::clientConnectHandler, this, _1, _2),
- boost::bind(&HAService::clientCloseHandler, this, _1)
+ std::bind(&HAService::clientConnectHandler, this, _1, _2),
+ std::bind(&HAService::clientCloseHandler, this, _1)
);
}
captured_error_message = error_message;
},
HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST),
- boost::bind(&HAService::clientConnectHandler, this, _1, _2),
- boost::bind(&HAService::clientCloseHandler, this, _1)
+ std::bind(&HAService::clientConnectHandler, this, _1, _2),
+ std::bind(&HAService::clientCloseHandler, this, _1)
);
// Run the IO service until it is stopped by any of the callbacks. This
}
},
HttpClient::RequestTimeout(TIMEOUT_DEFAULT_HTTP_CLIENT_REQUEST),
- boost::bind(&HAService::clientConnectHandler, this, _1, _2),
- boost::bind(&HAService::clientCloseHandler, this, _1)
+ std::bind(&HAService::clientConnectHandler, this, _1, _2),
+ std::bind(&HAService::clientCloseHandler, this, _1)
);
// Run the IO service until it is stopped by any of the callbacks. This
// We are registerin the socket only to interrupt main-thread
// select().
IfaceMgr::instance().addExternalSocket(tcp_native_fd,
- boost::bind(&HAService::socketReadyHandler, this, _1)
+ std::bind(&HAService::socketReadyHandler, this, _1)
);
}
#include <http/date_time.h>
#include <util/multi_threading_mgr.h>
-
#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
#include <gtest/gtest.h>
+#include <functional>
using namespace isc;
using namespace isc::asiolink;
/// @brief Returns test heartbeat implementation.
///
/// @return Pointer to heartbeat implementation function under test.
- boost::function<void()> getHeartbeatImpl() {
- return (boost::bind(&CommunicationStateTest::heartbeatImpl, this));
+ std::function<void()> getHeartbeatImpl() {
+ return (std::bind(&CommunicationStateTest::heartbeatImpl, this));
}
/// @brief Test heartbeat implementation.
#include <hooks/hooks.h>
#include <hooks/hooks_manager.h>
#include <util/range_utilities.h>
-#include <boost/bind.hpp>
+#include <functional>
#include <utility>
#include <vector>
HATest::runIOService(long ms) {
io_service_->get_io_service().reset();
IntervalTimer timer(*io_service_);
- timer.setup(boost::bind(&IOService::stop, io_service_), ms,
+ timer.setup(std::bind(&IOService::stop, io_service_), ms,
IntervalTimer::ONE_SHOT);
io_service_->run();
timer.cancel();
io_service_->get_io_service().reset();
IntervalTimer timer(*io_service_);
bool timeout = false;
- timer.setup(boost::bind(&HATest::stopIOServiceHandler, this, boost::ref(timeout)),
+ timer.setup(std::bind(&HATest::stopIOServiceHandler, this, std::ref(timeout)),
ms, IntervalTimer::ONE_SHOT);
while (!stop_condition() && !timeout) {
std::mutex mutex;
std::condition_variable condvar;
- io_service_->post(boost::bind(&HATest::signalServiceRunning, this, boost::ref(running),
- boost::ref(mutex), boost::ref(condvar)));
+ io_service_->post(std::bind(&HATest::signalServiceRunning, this, std::ref(running),
+ std::ref(mutex), std::ref(condvar)));
boost::shared_ptr<std::thread>
- th(new std::thread(boost::bind(&IOService::run, io_service_.get())));
+ th(new std::thread(std::bind(&IOService::run, io_service_.get())));
std::unique_lock<std::mutex> lock(mutex);
while (!running) {
#include <set>
using namespace std;
+using namespace std::placeholders;
using namespace isc;
using namespace isc::hooks;
using namespace isc::config;
D2ClientConfigPtr cfg(new D2ClientConfig());
ASSERT_NO_THROW(cfg->enableUpdates(true));
ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(cfg));
- d2_mgr_.startSender(boost::bind(&LeaseCmdsTest::d2ErrorHandler, this,
- _1, _2));
+ d2_mgr_.startSender(std::bind(&LeaseCmdsTest::d2ErrorHandler, this,
+ _1, _2));
}
/// @brief Disables DHCP-DDNS updates.
-// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <util/buffer.h>
#include <util/random/qid_gen.h>
-#include <boost/bind.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <functional>
#include <unistd.h> // for some IPC/network system calls
#include <netinet/in.h>
#include <stdint.h>
// first two bytes of the packet).
data_->msgbuf->writeUint16At(data_->qid, 0);
- }
+ }
}
// If we timeout, we stop, which will can cancel outstanding I/Os and
if (data_->timeout != -1) {
data_->timer.expires_from_now(boost::posix_time::milliseconds(
data_->timeout));
- data_->timer.async_wait(boost::bind(&IOFetch::stop, *this,
+ data_->timer.async_wait(std::bind(&IOFetch::stop, *this,
TIME_OUT));
}
data_->origin = ASIODNS_SEND_DATA;
BOOST_ASIO_CORO_YIELD data_->socket->asyncSend(data_->msgbuf->getData(),
data_->msgbuf->getLength(), data_->remote_snd.get(), *this);
-
+
// Now receive the response. Since TCP may not receive the entire
// message in one operation, we need to loop until we have received
// it. (This can't be done within the asyncReceive() method because
// the expected amount of data. Then we need to loop until we have
// received all the data before copying it back to the user's buffer.
// And we want to minimize the amount of copying...
-
+
data_->origin = ASIODNS_READ_DATA;
data_->cumulative = 0; // No data yet received
data_->offset = 0; // First data into start of buffer
-// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <util/io_utilities.h>
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <algorithm>
#include <cstdlib>
+#include <functional>
#include <string>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <vector>
+using namespace boost::asio::ip;
using namespace boost::asio;
+using namespace isc::asiolink;
using namespace isc::dns;
using namespace isc::util;
-using namespace boost::asio::ip;
+using namespace std::placeholders;
using namespace std;
-using namespace isc::asiolink;
namespace isc {
namespace asiodns {
// Initiate a read on the socket.
cumulative_ = 0;
socket->async_receive(boost::asio::buffer(receive_buffer_, sizeof(receive_buffer_)),
- boost::bind(&IOFetchTest::tcpReceiveHandler, this, socket, _1, _2));
+ std::bind(&IOFetchTest::tcpReceiveHandler, this, socket, _1, _2));
}
/// \brief Completion handler for receiving TCP data
if (!complete) {
socket->async_receive(boost::asio::buffer((receive_buffer_ + cumulative_),
(sizeof(receive_buffer_) - cumulative_)),
- boost::bind(&IOFetchTest::tcpReceiveHandler, this, socket, _1, _2));
+ std::bind(&IOFetchTest::tcpReceiveHandler, this, socket, _1, _2));
return;
}
// Pointer to data to send
size_t amount = 16; // Amount of data to send
if (send_cumulative_ < (2 * amount)) {
-
+
// First or second time through, send at most 16 bytes
amount = min(amount, (send_buffer_.size() - send_cumulative_));
// ... and send it. The amount sent is also passed as the first
// argument of the send callback, as a check.
socket->async_send(boost::asio::buffer(send_ptr, amount),
- boost::bind(&IOFetchTest::tcpSendHandler, this,
- amount, socket, _1, _2));
+ std::bind(&IOFetchTest::tcpSendHandler, this,
+ amount, socket, _1, _2));
}
/// \brief Completion Handler for Sending TCP data
// socket over which data should be sent as an argument to that
// function.
timer_.expires_from_now(boost::posix_time::milliseconds(SEND_INTERVAL));
- timer_.async_wait(boost::bind(&IOFetchTest::tcpSendData, this,
- socket));
+ timer_.async_wait(std::bind(&IOFetchTest::tcpSendData, this,
+ socket));
}
}
// Post the query
service_.get_io_service().post(fetch);
- // Post query_.stop() (yes, the boost::bind thing is just
+ // Post query_.stop() (yes, the std::bind thing is just
// query_.stop()).
service_.get_io_service().post(
- boost::bind(&IOFetch::stop, fetch, IOFetch::STOPPED));
+ std::bind(&IOFetch::stop, fetch, IOFetch::STOPPED));
// Run both of them. run() returns when everything in the I/O service
// queue has completed.
tcp::acceptor acceptor(service_.get_io_service(),
tcp::endpoint(tcp::v4(), TEST_PORT));
acceptor.async_accept(socket,
- boost::bind(&IOFetchTest::tcpAcceptHandler, this, &socket, _1));
+ std::bind(&IOFetchTest::tcpAcceptHandler, this, &socket, _1));
// Post the TCP fetch object to send the query and receive the response.
service_.get_io_service().post(tcp_fetch_);
socket.async_receive_from(boost::asio::buffer(receive_buffer_,
sizeof(receive_buffer_)),
remote,
- boost::bind(&IOFetchTest::udpReceiveHandler,
- this, &remote, &socket,
- _1, _2, bad_qid, second_send));
+ std::bind(&IOFetchTest::udpReceiveHandler,
+ this, &remote, &socket,
+ _1, _2, bad_qid, second_send));
service_.get_io_service().post(udp_fetch_);
if (debug_) {
cout << "udpSendReceive: async_receive_from posted,"
#include <asiolink/interval_timer.h>
#include <asiolink/io_service.h>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <exceptions/exceptions.h>
#include <atomic>
+#include <functional>
#include <mutex>
using namespace std;
"equal to 0");
}
// Call back function should not be empty.
- if (cbfunc.empty()) {
+ if (!cbfunc) {
isc_throw(isc::InvalidParameter, "Callback function is empty");
}
timer_.expires_from_now(boost::posix_time::millisec(long(interval_)));
// Reset timer.
// Pass a function bound with a shared_ptr to this.
- timer_.async_wait(boost::bind(&IntervalTimerImpl::callback,
- shared_from_this(),
- boost::asio::placeholders::error));
+ timer_.async_wait(std::bind(&IntervalTimerImpl::callback,
+ shared_from_this(),
+ std::placeholders::_1)); //error
} catch (const boost::system::system_error& e) {
isc_throw(isc::Unexpected, "Failed to update timer: " << e.what());
} catch (const boost::bad_weak_ptr&) {
#ifndef ASIOLINK_INTERVAL_TIMER_H
#define ASIOLINK_INTERVAL_TIMER_H 1
-#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
+#include <functional>
#include <asiolink/io_service.h>
class IntervalTimer {
public:
/// \name The type of timer callback function
- typedef boost::function<void()> Callback;
+ typedef std::function<void()> Callback;
/// \brief Defines possible timer modes used to setup a timer.
/// - REPEATING - Timer will reschedule itself after each expiration
-// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
namespace asiolink {
namespace {
-// A trivial wrapper for boost::function. SunStudio doesn't seem to be capable
-// of handling a boost::function object if directly passed to
+// A trivial wrapper for std::function. SunStudio doesn't seem to be capable
+// of handling a std::function object if directly passed to
// io_service::post().
class CallbackWrapper {
public:
- CallbackWrapper(const boost::function<void()>& callback) :
+ CallbackWrapper(const std::function<void()>& callback) :
callback_(callback)
{}
void operator()() {
callback_();
}
private:
- boost::function<void()> callback_;
+ std::function<void()> callback_;
};
}
/// It will eventually be removed once the wrapper interface is
/// generalized.
boost::asio::io_service& get_io_service() { return io_service_; };
- void post(const boost::function<void ()>& callback) {
+ void post(const std::function<void ()>& callback) {
const CallbackWrapper wrapper(callback);
io_service_.post(wrapper);
}
}
void
-IOService::post(const boost::function<void ()>& callback) {
+IOService::post(const std::function<void ()>& callback) {
return (io_impl_->post(callback));
}
-// Copyright (C) 2011-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#ifndef ASIOLINK_IO_SERVICE_H
#define ASIOLINK_IO_SERVICE_H 1
-#include <boost/function.hpp>
+#include <boost/version.hpp>
+#include <boost/shared_ptr.hpp>
+#include <functional>
namespace boost {
namespace asio {
///
/// It may be used to implement "background" work, for example (doing stuff
/// by small bits that are called from time to time).
- void post(const boost::function<void ()>& callback);
+ void post(const std::function<void ()>& callback);
private:
IOServiceImpl* io_impl_;
-// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/io_service.h>
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
+#include <functional>
#include <vector>
using namespace isc::asiolink;
std::vector<int> called;
IOService service;
// Post two events
- service.post(boost::bind(&postedEvent, &called, 1));
- service.post(boost::bind(&postedEvent, &called, 2));
- service.post(boost::bind(&postedEvent, &called, 3));
+ service.post(std::bind(&postedEvent, &called, 1));
+ service.post(std::bind(&postedEvent, &called, 2));
+ service.post(std::bind(&postedEvent, &called, 3));
// They have not yet been called
EXPECT_TRUE(called.empty());
// Process two events
-// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/io_service.h>
#include <asiolink/tcp_acceptor.h>
#include <asiolink/tcp_endpoint.h>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
+#include <functional>
#include <list>
#include <netinet/in.h>
#include <string>
endpoint(boost::asio::ip::address::from_string(SERVER_ADDRESS),
SERVER_PORT);
socket_.async_connect(endpoint,
- boost::bind(&TCPClient::connectHandler, this,_1));
+ std::bind(&TCPClient::connectHandler, this,
+ std::placeholders::_1));
}
/// @brief Callback function for connect().
/// @brief A signature of the function implementing callback for the
/// TCPAcceptor.
-typedef boost::function<void(const boost::system::error_code&)> TCPAcceptorCallback;
+typedef std::function<void(const boost::system::error_code&)> TCPAcceptorCallback;
/// @brief TCPAcceptor using TCPAcceptorCallback.
typedef TCPAcceptor<TCPAcceptorCallback> TestTCPAcceptor;
endpoint_(asio_endpoint_), test_timer_(io_service_), connections_(),
clients_(), connections_num_(0), aborted_connections_num_(0),
max_connections_(1) {
- test_timer_.setup(boost::bind(&TCPAcceptorTest::timeoutHandler, this),
- TEST_TIMEOUT, IntervalTimer::ONE_SHOT);
+ test_timer_.setup(std::bind(&TCPAcceptorTest::timeoutHandler, this),
+ TEST_TIMEOUT, IntervalTimer::ONE_SHOT);
}
/// @brief Destructor.
/// accepting new connections. The instance of the Acceptor object is
/// retained in the connections_ list.
void accept() {
- TCPAcceptorCallback cb = boost::bind(&TCPAcceptorTest::acceptHandler,
- this, _1);
+ TCPAcceptorCallback cb = std::bind(&TCPAcceptorTest::acceptHandler,
+ this, std::placeholders::_1);
AcceptorPtr conn(new Acceptor(io_service_, acceptor_, cb));
connections_.push_back(conn);
connections_.back()->accept();
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/asio_wrapper.h>
#include <asiolink/testutils/test_server_unix_socket.h>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>
#include <functional>
/// @brief Starts asynchronous read from the socket.
void start() {
socket_->async_read_some(boost::asio::buffer(&raw_buf_[0], raw_buf_.size()),
- boost::bind(&Connection::readHandler, shared_from_this(),
- boost::asio::placeholders::error,
- boost::asio::placeholders::bytes_transferred));
+ std::bind(&Connection::readHandler, shared_from_this(),
+ std::placeholders::_1, // error
+ std::placeholders::_2)); // bytes_transferred
}
/// @brief Closes the socket.
void
TestServerUnixSocket::startTimer(const long test_timeout) {
- test_timer_.setup(boost::bind(&TestServerUnixSocket::timeoutHandler, this),
+ test_timer_.setup(std::bind(&TestServerUnixSocket::timeoutHandler, this),
test_timeout, IntervalTimer::ONE_SHOT);
}
// when the thread has already started and the IO service is running. The
// main thread can move forward when it receives this signal from the handler.
if (use_thread) {
- io_service_.post(boost::bind(&TestServerUnixSocket::signalRunning,
- this));
+ io_service_.post(std::bind(&TestServerUnixSocket::signalRunning,
+ this));
}
}
void
TestServerUnixSocket::accept() {
server_acceptor_.async_accept(*(connection_pool_->getSocket()),
- boost::bind(&TestServerUnixSocket::acceptHandler, this,
- boost::asio::placeholders::error));
+ std::bind(&TestServerUnixSocket::acceptHandler, this,
+ std::placeholders::_1)); // error
}
void
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// using @ref TestServerUnixSocket::getResponseNum.
///
/// This class uses @c shared_from_this() to pass its instance to the
-/// @c boost::bind function, thus the caller must store shared pointer
+/// @c std::bind function, thus the caller must store shared pointer
/// to this object.
class TestServerUnixSocket {
public:
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/asio_wrapper.h>
#include <asiolink/unix_domain_socket.h>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
+#include <functional>
#include <iostream>
using namespace boost::asio::local;
+using namespace std::placeholders;
namespace isc {
namespace asiolink {
void
UnixDomainSocketImpl::asyncConnect(const stream_protocol::endpoint& endpoint,
const UnixDomainSocket::ConnectHandler& handler) {
- auto local_handler = boost::bind(&UnixDomainSocketImpl::connectHandler, shared_from_this(),
- handler, _1);
+ auto local_handler = std::bind(&UnixDomainSocketImpl::connectHandler,
+ shared_from_this(),
+ handler, _1);
socket_.async_connect(endpoint, local_handler);
}
void
UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer,
const UnixDomainSocket::Handler& handler) {
- auto local_handler = boost::bind(&UnixDomainSocketImpl::sendHandler, shared_from_this(),
- handler, buffer, _1, _2);
+ auto local_handler = std::bind(&UnixDomainSocketImpl::sendHandler,
+ shared_from_this(),
+ handler, buffer, _1, _2);
socket_.async_send(buffer, local_handler);
}
void
UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer,
const UnixDomainSocket::Handler& handler) {
- auto local_handler = boost::bind(&UnixDomainSocketImpl::receiveHandler, shared_from_this(),
- handler, buffer, _1, _2);
+ auto local_handler = std::bind(&UnixDomainSocketImpl::receiveHandler,
+ shared_from_this(),
+ handler, buffer, _1, _2);
socket_.async_receive(buffer, 0, local_handler);
}
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <cc/data.h>
#include <cc/json_feed.h>
-#include <boost/bind.hpp>
+#include <functional>
using namespace isc::data;
using namespace isc::util;
StateModel::defineStates();
defineState(RECEIVE_START_ST, "RECEIVE_START_ST",
- boost::bind(&JSONFeed::receiveStartHandler, this));
+ std::bind(&JSONFeed::receiveStartHandler, this));
defineState(WHITESPACE_BEFORE_JSON_ST, "WHITESPACE_BEFORE_JSON_ST",
- boost::bind(&JSONFeed::whiteSpaceBeforeJSONHandler, this));
+ std::bind(&JSONFeed::whiteSpaceBeforeJSONHandler, this));
defineState(INNER_JSON_ST, "INNER_JSON_ST",
- boost::bind(&JSONFeed::innerJSONHandler, this));
+ std::bind(&JSONFeed::innerJSONHandler, this));
defineState(STRING_JSON_ST, "STRING_JSON_ST",
- boost::bind(&JSONFeed::stringJSONHandler, this));
+ std::bind(&JSONFeed::stringJSONHandler, this));
defineState(ESCAPE_JSON_ST, "ESCAPE_JSON_ST",
- boost::bind(&JSONFeed::escapeJSONHandler, this));
+ std::bind(&JSONFeed::escapeJSONHandler, this));
defineState(JSON_END_ST, "JSON_END_ST",
- boost::bind(&JSONFeed::endJSONHandler, this));
+ std::bind(&JSONFeed::endJSONHandler, this));
}
void
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config/config_log.h>
#include <hooks/callout_handle.h>
#include <hooks/hooks_manager.h>
-#include <boost/bind.hpp>
+#include <functional>
using namespace isc::data;
using namespace isc::hooks;
+using namespace std::placeholders;
namespace {
namespace config {
BaseCommandMgr::BaseCommandMgr() {
- registerCommand("list-commands", boost::bind(&BaseCommandMgr::listCommandsHandler,
- this, _1, _2));
+ registerCommand("list-commands", std::bind(&BaseCommandMgr::listCommandsHandler,
+ this, _1, _2));
}
void
// code, just in tests.
handlers_.clear();
registerCommand("list-commands",
- boost::bind(&BaseCommandMgr::listCommandsHandler, this, _1, _2));
+ std::bind(&BaseCommandMgr::listCommandsHandler, this, _1, _2));
}
isc::data::ConstElementPtr
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <cc/data.h>
#include <exceptions/exceptions.h>
-#include <boost/function.hpp>
+#include <functional>
#include <map>
#include <string>
/// @param name name of the commands
/// @param params parameters specific to the command
/// @return response (created with createAnswer())
- typedef boost::function<isc::data::ConstElementPtr (const std::string& name,
+ typedef std::function<isc::data::ConstElementPtr (const std::string& name,
const isc::data::ConstElementPtr& params)> CommandHandler;
/// @brief Defines extended command handler type.
/// @param params parameters specific to the command
/// @param original original control command.
/// @return response (created with createAnswer())
- typedef boost::function<isc::data::ConstElementPtr (const std::string& name,
+ typedef std::function<isc::data::ConstElementPtr (const std::string& name,
const isc::data::ConstElementPtr& params,
const isc::data::ConstElementPtr& original)> ExtendedCommandHandler;
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/unix_domain_socket.h>
#include <cc/json_feed.h>
#include <config/client_connection.h>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <array>
+#include <functional>
using namespace isc::asiolink;
void
ClientConnectionImpl::scheduleTimer(ClientConnection::Handler handler) {
if (timeout_ > 0) {
- timer_.setup(boost::bind(&ClientConnectionImpl::timeoutCallback,
- this, handler),
+ timer_.setup(std::bind(&ClientConnectionImpl::timeoutCallback,
+ this, handler),
timeout_, IntervalTimer::ONE_SHOT);
}
}
#include <config/config_log.h>
#include <config/timeouts.h>
#include <util/watch_socket.h>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <array>
+#include <functional>
#include <unistd.h>
#include <sys/file.h>
using namespace isc::asiolink;
using namespace isc::config;
using namespace isc::data;
+using namespace std::placeholders;
namespace {
/// @brief This method schedules timer or reschedules existing timer.
void scheduleTimer() {
- timeout_timer_.setup(boost::bind(&Connection::timeoutHandler, this),
+ timeout_timer_.setup(std::bind(&Connection::timeoutHandler, this),
timeout_, IntervalTimer::ONE_SHOT);
}
/// process received data.
void doReceive() {
socket_->asyncReceive(&buf_[0], sizeof(buf_),
- boost::bind(&Connection::receiveHandler,
- shared_from_this(), _1, _2));
+ std::bind(&Connection::receiveHandler,
+ shared_from_this(), _1, _2));
}
/// @brief Starts asynchronous send over the unix domain socket.
void doSend() {
size_t chunk_size = (response_.size() < BUF_SIZE) ? response_.size() : BUF_SIZE;
socket_->asyncSend(&response_[0], chunk_size,
- boost::bind(&Connection::sendHandler, shared_from_this(), _1, _2));
+ std::bind(&Connection::sendHandler, shared_from_this(), _1, _2));
// Asynchronous send has been scheduled and we need to indicate this
// to break the synchronous select(). The handler should clear this
#include <cc/data.h>
#include <boost/noncopyable.hpp>
-#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <exceptions/exceptions.h>
+#include <functional>
#include <map>
#include <string>
bool configuredReadOnly() const;
/// @brief Defines a callback prototype for propogating events upward
- typedef boost::function<bool (ReconnectCtlPtr db_retry)> DbLostCallback;
+ typedef std::function<bool (ReconnectCtlPtr db_retry)> DbLostCallback;
/// @brief Invokes the connection's lost connectivity callback
///
-// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <exceptions/exceptions.h>
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
+#include <functional>
using namespace isc::data;
using namespace isc::db;
TEST_F(DatabaseConnectionCallbackTest, dbLostCallback) {
/// Create a Database configuration that includes the reconnect
/// control parameters.
+ using namespace std::placeholders;
DatabaseConnection::ParameterMap pmap;
pmap[std::string("type")] = std::string("test");
pmap[std::string("max-reconnect-tries")] = std::string("3");
/// Install the callback.
DatabaseConnection::db_lost_callback =
- boost::bind(&DatabaseConnectionCallbackTest::dbLostCallback, this, _1);
+ std::bind(&DatabaseConnectionCallbackTest::dbLostCallback, this, _1);
/// Create the connection..
DatabaseConnection datasrc(pmap);
#include <util/multi_threading_mgr.h>
#include <boost/scoped_ptr.hpp>
-#include <boost/bind.hpp>
#include <cstring>
#include <errno.h>
#include <fstream>
+#include <functional>
#include <limits>
#include <sstream>
}
dhcp_receiver_.reset(new WatchedThread());
- dhcp_receiver_->start(boost::bind(&IfaceMgr::receiveDHCP4Packets, this));
+ dhcp_receiver_->start(std::bind(&IfaceMgr::receiveDHCP4Packets, this));
break;
case AF_INET6:
// If the queue doesn't exist, packet queing has been configured
}
dhcp_receiver_.reset(new WatchedThread());
- dhcp_receiver_->start(boost::bind(&IfaceMgr::receiveDHCP6Packets, this));
+ dhcp_receiver_->start(std::bind(&IfaceMgr::receiveDHCP6Packets, this));
break;
default:
isc_throw (BadValue, "startDHCPReceiver: invalid family: " << family);
#include <util/watch_socket.h>
#include <util/watched_thread.h>
-#include <boost/function.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
+#include <functional>
#include <list>
#include <vector>
#include <mutex>
///
/// @param errmsg An error message.
typedef
-boost::function<void(const std::string& errmsg)> IfaceMgrErrorMsgCallback;
+std::function<void(const std::string& errmsg)> IfaceMgrErrorMsgCallback;
/// @brief Handles network interfaces, transmission and reception.
///
public:
/// Defines callback used when data is received over external sockets.
/// @param fd socket descriptor of the ready socket
- typedef boost::function<void (int fd)> SocketCallback;
+ typedef std::function<void (int fd)> SocketCallback;
/// Keeps callback information for external sockets.
struct SocketCallbackInfo {
#include <dhcp/tests/packet_queue_testutils.h>
#include <testutils/gtest_utils.h>
-#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/scoped_ptr.hpp>
#include <gtest/gtest.h>
#include <fcntl.h>
#include <fstream>
+#include <functional>
#include <iostream>
#include <sstream>
#include <unistd.h>
using namespace std;
+using namespace std::placeholders;
using namespace isc;
using namespace isc::asiolink;
using namespace isc::dhcp;
// should be called when the IfaceMgr fails to open socket on an interface
// on which the server is configured to listen.
isc::dhcp::IfaceMgrErrorMsgCallback error_handler =
- boost::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1);
+ std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1);
ASSERT_NO_THROW(IfaceMgr::instance().openSockets4(DHCP4_SERVER_PORT, true,
error_handler));
// Install an error handler before trying to open sockets. This handler
// should be called when the IfaceMgr fails to open socket on eth0.
isc::dhcp::IfaceMgrErrorMsgCallback error_handler =
- boost::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1);
+ std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1);
// The openSockets4 should detect that there is another socket already
// open and bound to the same address and port. An attempt to open
// another socket and bind to this address and port should fail.
// Install an error handler before trying to open sockets. This handler
// should be called when the IfaceMgr fails to open socket on eth0.
isc::dhcp::IfaceMgrErrorMsgCallback error_handler =
- boost::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1);
+ std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1);
// Simulate opening sockets using the dummy packet filter.
bool success = false;
// Install an error handler before trying to open sockets. This handler
// should be called when the IfaceMgr fails to open socket on eth0.
isc::dhcp::IfaceMgrErrorMsgCallback error_handler =
- boost::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1);
+ std::bind(&IfaceMgrTest::ifaceMgrErrorHandler, this, _1);
// The openSockets6 should detect that a socket has been already
// opened on eth0 and an attempt to open another socket and bind to
// the same address and port should fail.
#include <dhcp_ddns/dhcp_ddns_log.h>
#include <dhcp_ddns/ncr_udp.h>
-#include <boost/bind.hpp>
+#include <functional>
namespace isc {
namespace dhcp_ddns {
UDPEndpointPtr& data_source,
const UDPCompletionHandler& handler)
: handler_(handler), data_(new Data(buffer, buf_size, data_source)) {
- if (handler.empty()) {
+ if (!handler) {
isc_throw(NcrUDPError, "UDPCallback - handler can't be null");
}
// Instantiate the receive callback. This gets passed into each receive.
// Note that the callback constructor is passed an instance method
// pointer to our completion handler method, receiveCompletionHandler.
+ using namespace std::placeholders;
RawBufferPtr buffer(new uint8_t[RECV_BUF_MAX]);
UDPEndpointPtr data_source(new asiolink::UDPEndpoint());
recv_callback_.reset(new
UDPCallback(buffer, RECV_BUF_MAX, data_source,
- boost::bind(&NameChangeUDPListener::
+ std::bind(&NameChangeUDPListener::
receiveCompletionHandler, this, _1, _2)));
}
// Instantiate the send callback. This gets passed into each send.
// Note that the callback constructor is passed the an instance method
// pointer to our completion handler, sendCompletionHandler.
+ using namespace std::placeholders;
RawBufferPtr buffer(new uint8_t[SEND_BUF_MAX]);
UDPEndpointPtr data_source(new asiolink::UDPEndpoint());
send_callback_.reset(new UDPCallback(buffer, SEND_BUF_MAX, data_source,
- boost::bind(&NameChangeUDPSender::
+ std::bind(&NameChangeUDPSender::
sendCompletionHandler, this,
_1, _2)));
}
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
class UDPCallback;
/// @brief Defines a function pointer for NameChangeRequest completion handlers.
-typedef boost::function<void(const bool, const UDPCallback*)>
+typedef std::function<void(const bool, const UDPCallback*)>
UDPCompletionHandler;
/// @brief Defines a dynamically allocated shared array.
#include <test_utils.h>
#include <boost/asio/ip/udp.hpp>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
+#include <functional>
#include <algorithm>
#include <sys/select.h>
FMT_JSON, *this, true));
// Set the test timeout to break any running tasks if they hang.
- test_timer_.setup(boost::bind(&NameChangeUDPListenerTest::
- testTimeoutHandler, this),
+ test_timer_.setup(std::bind(&NameChangeUDPListenerTest::
+ testTimeoutHandler, this),
TEST_TIMEOUT);
}
FMT_JSON, *this, 100, true));
// Set the test timeout to break any running tasks if they hang.
- test_timer_.setup(boost::bind(&NameChangeUDPTest::testTimeoutHandler,
- this),
+ test_timer_.setup(std::bind(&NameChangeUDPTest::testTimeoutHandler,
+ this),
TEST_TIMEOUT);
// Disble multi-threading
MultiThreadingMgr::instance().setMode(false);
#include <utility>
#include <vector>
-
using namespace isc::asiolink;
using namespace isc::dhcp;
using namespace isc::dhcp_ddns;
using namespace isc::stats;
using namespace isc::util;
using namespace isc::data;
+using namespace std::placeholders;
namespace {
// expired-reclaimed state or simply remove it.
LeaseMgr& lease_mgr = LeaseMgrFactory::instance();
reclaimLeaseInDatabase<Lease6Ptr>(lease, remove_lease,
- boost::bind(&LeaseMgr::updateLease6,
- &lease_mgr, _1));
+ std::bind(&LeaseMgr::updateLease6,
+ &lease_mgr, _1));
}
}
// expired-reclaimed state or simply remove it.
LeaseMgr& lease_mgr = LeaseMgrFactory::instance();
reclaimLeaseInDatabase<Lease4Ptr>(lease, remove_lease,
- boost::bind(&LeaseMgr::updateLease4,
- &lease_mgr, _1));
+ std::bind(&LeaseMgr::updateLease4,
+ &lease_mgr, _1));
}
}
template<typename LeasePtrType>
void AllocEngine::reclaimLeaseInDatabase(const LeasePtrType& lease,
const bool remove_lease,
- const boost::function<void (const LeasePtrType&)>&
+ const std::function<void (const LeasePtrType&)>&
lease_update_fun) const {
LeaseMgr& lease_mgr = LeaseMgrFactory::instance();
// expired-reclaimed state or simply remove it.
if (remove_lease) {
lease_mgr.deleteLease(lease);
- } else if (!lease_update_fun.empty()) {
+ } else if (lease_update_fun) {
// Clear FQDN information as we have already sent the
// name change request to remove the DNS record.
lease->hostname_.clear();
#include <util/multi_threading_mgr.h>
#include <util/readwrite_mutex.h>
-#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
+#include <functional>
#include <list>
#include <map>
#include <mutex>
template<typename LeasePtrType>
void reclaimLeaseInDatabase(const LeasePtrType& lease,
const bool remove_lease,
- const boost::function<void (const LeasePtrType&)>&
+ const std::function<void (const LeasePtrType&)>&
lease_update_fun) const;
/// @anchor reclaimDeclinedLease4
-// Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/interval_timer.h>
#include <cc/cfg_to_element.h>
#include <dhcpsrv/timer_mgr.h>
-#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
+#include <functional>
#include <stdint.h>
#include <string>
1000 * getReclaimTimerWaitTime();
// Register timer for leases' reclamation routine.
timer_mgr_->registerTimer(RECLAIM_EXPIRED_TIMER_NAME,
- boost::bind(reclaim_fun, instance_ptr,
- getMaxReclaimLeases(),
- getMaxReclaimTime(),
- flush_timer_disabled,
- getUnwarnedReclaimCycles()),
+ std::bind(reclaim_fun, instance_ptr,
+ getMaxReclaimLeases(),
+ getMaxReclaimTime(),
+ flush_timer_disabled,
+ getUnwarnedReclaimCycles()),
reclaim_interval,
asiolink::IntervalTimer::ONE_SHOT);
timer_mgr_->setup(RECLAIM_EXPIRED_TIMER_NAME);
1000 * getFlushReclaimedTimerWaitTime();
// Register and setup the timer.
timer_mgr_->registerTimer(FLUSH_RECLAIMED_TIMER_NAME,
- boost::bind(delete_fun, instance_ptr,
- getHoldReclaimedTime()),
+ std::bind(delete_fun, instance_ptr,
+ getHoldReclaimedTime()),
flush_interval,
asiolink::IntervalTimer::ONE_SHOT);
timer_mgr_->setup(FLUSH_RECLAIMED_TIMER_NAME);
#include <dhcpsrv/dhcpsrv_log.h>
#include <dhcpsrv/cfg_iface.h>
#include <util/strutil.h>
-#include <boost/bind.hpp>
#include <algorithm>
+#include <functional>
using namespace isc::asiolink;
using namespace isc::data;
+using namespace std::placeholders;
namespace isc {
namespace dhcp {
// for some specific interface. This callback will simply log a
// warning message.
IfaceMgrErrorMsgCallback error_callback =
- boost::bind(&CfgIface::socketOpenErrorHandler, _1);
+ std::bind(&CfgIface::socketOpenErrorHandler, _1);
bool sopen;
if (family == AF_INET) {
// Use broadcast only if we're using raw sockets. For the UDP sockets,
#include <dhcpsrv/d2_client_mgr.h>
#include <dhcpsrv/dhcpsrv_log.h>
-#include <boost/bind.hpp>
-
+#include <functional>
#include <string>
using namespace std;
// IO error handling in the sender may alter its select-fd.
registered_select_fd_ = name_change_sender_->getSelectFd();
IfaceMgr::instance().addExternalSocket(registered_select_fd_,
- boost::bind(&D2ClientMgr::runReadyIO,
- this));
+ std::bind(&D2ClientMgr::runReadyIO,
+ this));
}
bool
/// @note Handlers are expected not to throw. In the event a handler does
/// throw invoking code logs the exception and then swallows it.
typedef
-boost::function<void(const dhcp_ddns::NameChangeSender::Result result,
- dhcp_ddns::NameChangeRequestPtr& ncr)> D2ClientErrorHandler;
+std::function<void(const dhcp_ddns::NameChangeSender::Result result,
+ dhcp_ddns::NameChangeRequestPtr& ncr)> D2ClientErrorHandler;
/// @brief D2ClientMgr isolates Kea from the details of being a D2 client.
///
///
/// Serves as callback registered for the sender's select-fd with IfaceMgr.
/// It instructs the sender to execute the next ready IO handler.
- /// It provides an instance method that can be bound via boost::bind, as
+ /// It provides an instance method that can be bound via std::bind, as
/// NameChangeSender is abstract.
void runReadyIO();
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dhcpsrv/base_host_data_source.h>
#include <exceptions/exceptions.h>
#include <boost/scoped_ptr.hpp>
-#include <boost/function.hpp>
+#include <functional>
#include <string>
#include <vector>
#include <map>
///
/// A factory takes a parameter map and returns a pointer to a host
/// data source. In case of failure it must throw and not return NULL.
- typedef boost::function<HostDataSourcePtr (const db::DatabaseConnection::ParameterMap&)> Factory;
+ typedef std::function<HostDataSourcePtr (const db::DatabaseConnection::ParameterMap&)> Factory;
/// @brief Register a host data source factory
///
}
if (lfc_interval > 0 || conversion_needed) {
- lfc_setup_.reset(new LFCSetup(boost::bind(&Memfile_LeaseMgr::lfcCallback, this)));
+ lfc_setup_.reset(new LFCSetup(std::bind(&Memfile_LeaseMgr::lfcCallback, this)));
lfc_setup_->setup(lfc_interval, lease_file4_, lease_file6_, conversion_needed);
}
}
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <exceptions/exceptions.h>
#include <dhcpsrv/network_state.h>
#include <dhcpsrv/timer_mgr.h>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
+#include <functional>
#include <string>
namespace {
void createTimer(const unsigned int seconds) {
destroyTimer();
timer_mgr_->registerTimer(NETWORK_STATE_TIMER_NAME,
- boost::bind(&NetworkStateImpl::enableAll,
- shared_from_this()),
+ std::bind(&NetworkStateImpl::enableAll,
+ shared_from_this()),
seconds * 1000,
asiolink::IntervalTimer::ONE_SHOT);
timer_mgr_->setup(NETWORK_STATE_TIMER_NAME);
#include <hooks/hooks_manager.h>
#include <stats/stats_mgr.h>
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
#include <boost/static_assert.hpp>
+#include <functional>
#include <iomanip>
#include <sstream>
#include <time.h>
#include <vector>
using namespace std;
+using namespace std::placeholders;
using namespace isc;
using namespace isc::asiolink;
using namespace isc::dhcp;
public:
/// @brief Type definition for the lease algorithm.
- typedef boost::function<bool (const LeasePtrType)> LeaseAlgorithmFun;
+ typedef std::function<bool (const LeasePtrType)> LeaseAlgorithmFun;
/// @brief type definition for the lease index algorithm.
- typedef boost::function<bool (const size_t)> IndexAlgorithmFun;
+ typedef std::function<bool (const size_t)> IndexAlgorithmFun;
/// @brief Constructor.
///
D2ClientConfigPtr cfg(new D2ClientConfig());
cfg->enableUpdates(true);
mgr.setD2ClientConfig(cfg);
- mgr.startSender(boost::bind(&ExpirationAllocEngineTest::d2ErrorHandler, _1, _2));
+ mgr.startSender(std::bind(&ExpirationAllocEngineTest::d2ErrorHandler, _1, _2));
}
/// @brief No-op error handler for the D2 client.
-// Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dhcpsrv/timer_mgr.h>
#include <exceptions/exceptions.h>
#include <testutils/test_to_element.h>
-#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
+#include <functional>
#include <stdint.h>
using namespace isc;
namespace {
/// @brief Type definition of the @c CfgExpiration modified function.
-typedef boost::function<void(CfgExpiration*, const int64_t)> ModifierFun;
+typedef std::function<void(CfgExpiration*, const int64_t)> ModifierFun;
/// @brief Type definition of the @c CfgExpiration accessor function
/// returning uint16_t value.
-typedef boost::function<uint16_t(CfgExpiration*)> AccessorFunUint16;
+typedef std::function<uint16_t(CfgExpiration*)> AccessorFunUint16;
/// @brief Type definition of the @c CfgExpiration accessor function
/// returning uint32_t value.
-typedef boost::function<uint32_t(CfgExpiration*)> AccessorFunUint32;
+typedef std::function<uint32_t(CfgExpiration*)> AccessorFunUint32;
/// @brief Tests the accessor and modifier function for a particular
/// configuration parameter held in @c CfgExpiration.
template<typename ReturnType>
void
testAccessModify(const int64_t limit, const ModifierFun& modifier,
- const boost::function<ReturnType(CfgExpiration*)>& accessor) {
+ const std::function<ReturnType(CfgExpiration*)>& accessor) {
CfgExpiration cfg;
// Setting the value to maximum allowed + 1 should result in
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dhcpsrv/d2_client_mgr.h>
#include <exceptions/exceptions.h>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
#include <gtest/gtest.h>
+#include <functional>
#include <sys/select.h>
using namespace std;
+using namespace std::placeholders;
using namespace isc::dhcp;
using namespace isc;
/// @brief Returns D2ClientErroHandler bound to this::error_handler_.
D2ClientErrorHandler getErrorHandler() {
- return (boost::bind(&D2ClientMgrTest::error_handler, this, _1, _2));
+ return (std::bind(&D2ClientMgrTest::error_handler, this, _1, _2));
}
/// @brief Constructs a NameChangeRequest message from a fixed JSON string.
#include <dhcp/option_int.h>
#include <dhcpsrv/dhcp4o6_ipc.h>
#include <dhcpsrv/testutils/dhcp4o6_test_ipc.h>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
#include <gtest/gtest.h>
+#include <functional>
#include <sstream>
#include <string>
const uint16_t TEST_ITERATIONS = 10;
/// @brief Type definition for the function creating DHCP message.
-typedef boost::function<Pkt6Ptr(uint16_t, uint16_t)> CreateMsgFun;
+typedef std::function<Pkt6Ptr(uint16_t, uint16_t)> CreateMsgFun;
/// @brief Define short name for test IPC class.
typedef Dhcp4o6TestIpc TestIpc;
#include <sstream>
using namespace std;
+using namespace std::placeholders;
using namespace isc::asiolink;
using namespace isc::data;
using namespace isc::db;
void
LeaseMgrDbLostCallbackTest::testNoCallbackOnOpenFailure() {
DatabaseConnection::db_lost_callback =
- boost::bind(&LeaseMgrDbLostCallbackTest::db_lost_callback, this, _1);
+ std::bind(&LeaseMgrDbLostCallbackTest::db_lost_callback, this, _1);
callback_called_ = false;
ASSERT_THROW(LeaseMgrFactory::create(invalidConnectString()),
LeaseMgrDbLostCallbackTest::testDbLostCallback() {
// Set the connectivity lost callback.
DatabaseConnection::db_lost_callback =
- boost::bind(&LeaseMgrDbLostCallbackTest::db_lost_callback, this, _1);
+ std::bind(&LeaseMgrDbLostCallbackTest::db_lost_callback, this, _1);
// Connect to the lease backend.
ASSERT_NO_THROW(LeaseMgrFactory::create(validConnectString()));
using namespace isc::dhcp;
using namespace isc::dhcp::test;
using namespace isc::asiolink;
+using namespace std::placeholders;
namespace {
// Set the connectivity lost callback.
DatabaseConnection::db_lost_callback =
- boost::bind(&HostMgrDbLostCallbackTest::db_lost_callback, this, _1);
+ std::bind(&HostMgrDbLostCallbackTest::db_lost_callback, this, _1);
// Find the most recently opened socket. Our SQL client's socket should
// be the next one.
#include <dhcpsrv/d2_client_mgr.h>
#include <dhcpsrv/lease.h>
-#include <ctime>
-#include <boost/bind.hpp>
#include <gtest/gtest.h>
-
+#include <ctime>
+#include <functional>
#include <stdint.h>
#include <string>
using namespace isc::asiolink;
using namespace isc::dhcp;
using namespace isc::dhcp_ddns;
+using namespace std::placeholders;
namespace {
D2ClientConfigPtr cfg(new D2ClientConfig());
ASSERT_NO_THROW(cfg->enableUpdates(true));
ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(cfg));
- d2_mgr_.startSender(boost::bind(&NCRGeneratorTest::d2ErrorHandler, this,
- _1, _2));
+ d2_mgr_.startSender(std::bind(&NCRGeneratorTest::d2ErrorHandler, this,
+ _1, _2));
}
/// @brief Disables DHCP-DDNS updates.
-// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <asiolink/io_service.h>
#include <dhcpsrv/network_state.h>
#include <dhcpsrv/timer_mgr.h>
-#include <boost/bind.hpp>
#include <gtest/gtest.h>
+#include <functional>
using namespace isc;
using namespace isc::asiolink;
///
/// @param timeout_ms Timeout for running IO service in milliseconds.
void runIOService(const long timeout_ms) {
- test_timer_.setup(boost::bind(&NetworkStateTest::testTimerCallback, this), timeout_ms,
+ test_timer_.setup(std::bind(&NetworkStateTest::testTimerCallback,
+ this),
+ timeout_ms,
IntervalTimer::ONE_SHOT);
io_service_->run();
}
-// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dhcpsrv/timer_mgr.h>
#include <exceptions/exceptions.h>
-#include <boost/bind.hpp>
#include <gtest/gtest.h>
+#include <functional>
#include <sstream>
#include <unistd.h>
///
/// This is just a wrapped to make it a bit more convenient
/// in the test.
- boost::function<void ()> makeCallback(const std::string& timer_name);
+ std::function<void ()> makeCallback(const std::string& timer_name);
/// @brief Create a callback which generates exception.
- boost::function<void ()> makeCallbackWithException();
+ std::function<void ()> makeCallbackWithException();
/// @brief Callback for timeout.
///
isc_throw(Exception, "timerCallbackWithException");
}
-boost::function<void ()>
+std::function<void ()>
TimerMgrTest::makeCallback(const std::string& timer_name) {
- return (boost::bind(&TimerMgrTest::timerCallback, this, timer_name));
+ return (std::bind(&TimerMgrTest::timerCallback, this, timer_name));
}
-boost::function<void ()>
+std::function<void ()>
TimerMgrTest::makeCallbackWithException() {
- return (boost::bind(&TimerMgrTest::timerCallbackWithException, this));
+ return (std::bind(&TimerMgrTest::timerCallbackWithException, this));
}
// This test checks that certain errors are returned when invalid
-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/testutils/dhcp4o6_test_ipc.h>
-#include <boost/bind.hpp>
+#include <functional>
namespace isc {
namespace dhcp {
if (socket_fd_ != -1) {
IfaceMgr& iface_mgr = IfaceMgr::instance();
iface_mgr.addExternalSocket(socket_fd_,
- boost::bind(&Dhcp4o6TestIpc::receiveHandler, this));
+ std::bind(&Dhcp4o6TestIpc::receiveHandler, this));
}
}
#include <dhcpsrv/timer_mgr.h>
#include <exceptions/exceptions.h>
-#include <boost/bind.hpp>
-
+#include <functional>
#include <utility>
using namespace isc;
// Schedule the execution of the timer using the parameters supplied
// during the registration.
const TimerInfoPtr& timer_info = timer_info_it->second;
- IntervalTimer::Callback cb = boost::bind(&TimerMgrImpl::timerCallback, this,
- timer_name);
+ IntervalTimer::Callback cb = std::bind(&TimerMgrImpl::timerCallback, this,
+ timer_name);
timer_info->interval_timer_.setup(cb, timer_info->interval_,
timer_info->scheduling_mode_);
}
-// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
const AddRRCallback& add_callback,
Options options)
{
- if (add_callback.empty()) {
+ if (!add_callback) {
isc_throw(isc::InvalidParameter, "Empty add RR callback");
}
impl_ = new MasterLoaderImpl(master_file, zone_origin,
const AddRRCallback& add_callback,
Options options)
{
- if (add_callback.empty()) {
+ if (!add_callback) {
isc_throw(isc::InvalidParameter, "Empty add RR callback");
}
unique_ptr<MasterLoaderImpl>
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <exceptions/exceptions.h>
-#include <string>
-#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
+#include <functional>
+#include <string>
namespace isc {
namespace dns {
/// \param rrtype Type of the RR.
/// \param rrttl Time to live of the RR.
/// \param rdata The actual carried data of the RR.
-typedef boost::function<void(const Name& name, const RRClass& rrclass,
- const RRType& rrtype, const RRTTL& rrttl,
- const rdata::RdataPtr& rdata)>
+typedef std::function<void(const Name& name, const RRClass& rrclass,
+ const RRType& rrtype, const RRTTL& rrttl,
+ const rdata::RdataPtr& rdata)>
AddRRCallback;
/// \brief Set of issue callbacks for a loader.
/// \param source_line Position of the problem, counted in lines from the
/// beginning of the source.
/// \param reason Human readable description of what happened.
- typedef boost::function<void(const std::string& source_name,
- size_t source_line,
- const std::string& reason)> IssueCallback;
+ typedef std::function<void(const std::string& source_name,
+ size_t source_line,
+ const std::string& reason)> IssueCallback;
/// \brief Constructor
///
error_(error),
warning_(warning)
{
- if (error_.empty() || warning_.empty()) {
+ if (!error_ || !warning) {
isc_throw(isc::InvalidParameter,
"Empty function passed as callback");
}
-// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
-#include <istream>
-#include <fstream>
-#include <sstream>
-#include <string>
-#include <cctype>
-#include <cerrno>
-
-#include <boost/bind.hpp>
-#include <boost/scoped_ptr.hpp>
-
-#include <exceptions/exceptions.h>
-
#include <dns/masterload.h>
#include <dns/master_loader.h>
#include <dns/name.h>
#include <dns/rrttl.h>
#include <dns/rrtype.h>
#include <dns/rrcollator.h>
+#include <exceptions/exceptions.h>
+
+#include <boost/scoped_ptr.hpp>
+
+#include <functional>
+#include <istream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <cctype>
+#include <cerrno>
using namespace std;
-using namespace boost;
using namespace isc::dns::rdata;
namespace isc {
loadHelper(InputType input, const Name& origin,
const RRClass& zone_class, MasterLoadCallback callback)
{
- RRCollator rr_collator(boost::bind(callbackWrapper, _1,
- callback, &origin));
+ RRCollator rr_collator(std::bind(callbackWrapper, std::placeholders::_1,
+ callback, &origin));
MasterLoader loader(input, origin, zone_class,
MasterLoaderCallbacks::getNullCallbacks(),
rr_collator.getCallback());
-// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#ifndef MASTERLOAD_H
#define MASTERLOAD_H 1
-#include <iosfwd>
-
-#include <boost/function.hpp>
-
+#include <dns/rrset.h>
#include <exceptions/exceptions.h>
-#include <dns/rrset.h>
+#include <functional>
+#include <iosfwd>
namespace isc {
namespace dns {
///
/// This represents a functor object or a function that takes one parameter
/// of type \c RRsetPtr and returns nothing.
-typedef boost::function<void(RRsetPtr)> MasterLoadCallback;
+typedef std::function<void(RRsetPtr)> MasterLoadCallback;
///
/// \name Master zone file loader functions.
/// The \c callback parameter is a functor object or a function that
/// takes one parameter of type \c RRsetPtr and returns nothing,
/// i.e. \c void (see below for specific examples).
-/// More precisely, it can be anything that this form of boost::function
+/// More precisely, it can be anything that this form of std::function
/// can represent, but the caller normally doesn't have to care about
/// that level of details.
///
/// masterLoad(zone_file, Name("example.com"), RRClass::IN(), zoneDumper);
/// \endcode
/// Or, if you want to use it with a member function of some other class,
-/// wrapping things with \c boost::bind would be handy:
+/// wrapping things with \c std::bind would be handy:
/// \code class ZoneDumper {
/// public:
/// void dump(ConstRRsetPtr rrset) const {
/// ...
/// ZoneDumper dumper;
/// masterLoad(rr_stream, Name("example.com"), RRClass::IN(),
-/// boost::bind(&ZoneDumper::dump, &dumper, _1));
+/// std::bind(&ZoneDumper::dump, &dumper, _1));
/// \endcode
/// You can find a bit more complicated examples in the unit tests code for
/// this function.
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dns/rdata.h>
#include <dns/rrset.h>
-#include <boost/bind.hpp>
-
#include <algorithm>
+#include <functional>
namespace isc {
namespace dns {
AddRRCallback
RRCollator::getCallback() {
- return (boost::bind(&RRCollator::Impl::addRR, this->impl_,
- _1, _2, _3, _4, _5));
+ using namespace std::placeholders;
+ return (std::bind(&RRCollator::Impl::addRR, this->impl_,
+ _1, _2, _3, _4, _5));
}
void
-// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dns/rrset.h>
#include <boost/noncopyable.hpp>
-#include <boost/function.hpp>
+#include <functional>
namespace isc {
namespace dns {
/// the \c RRCollator.
///
/// \param rrset The collated RRset.
- typedef boost::function<void(const RRsetPtr& rrset)> AddRRsetCallback;
+ typedef std::function<void(const RRsetPtr& rrset)> AddRRsetCallback;
/// \brief Constructor.
///
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <exceptions/exceptions.h>
-#include <boost/bind.hpp>
+#include <functional>
using namespace isc;
RRsetCollection::constructHelper(T source, const isc::dns::Name& origin,
const isc::dns::RRClass& rrclass)
{
- RRCollator collator(boost::bind(&RRsetCollection::addRRset, this, _1));
+ using namespace std::placeholders;
+ RRCollator collator(std::bind(&RRsetCollection::addRRset, this, _1));
MasterLoaderCallbacks callbacks
- (boost::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3),
- boost::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3));
+ (std::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3),
+ std::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3));
MasterLoader loader(source, origin, rrclass, callbacks,
collator.getCallback(),
MasterLoader::DEFAULT);
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <exceptions/exceptions.h>
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
+#include <functional>
namespace {
using std::string;
using namespace isc::dns;
+ using namespace std::placeholders;
class MasterLoaderCallbacksTest : public ::testing::Test {
protected:
issue_called_(false),
rrset_(new RRset(Name("example.org"), RRClass::IN(), RRType::A(),
RRTTL(3600))),
- error_(boost::bind(&MasterLoaderCallbacksTest::checkCallback, this,
- true, _1, _2, _3)),
- warning_(boost::bind(&MasterLoaderCallbacksTest::checkCallback, this,
- false, _1, _2, _3)),
+ error_(std::bind(&MasterLoaderCallbacksTest::checkCallback, this,
+ true, _1, _2, _3)),
+ warning_(std::bind(&MasterLoaderCallbacksTest::checkCallback, this,
+ false, _1, _2, _3)),
callbacks_(error_, warning_)
{}
-// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/scoped_ptr.hpp>
+#include <functional>
#include <string>
#include <vector>
#include <list>
#include <sstream>
using namespace isc::dns;
+using namespace std::placeholders;
using std::vector;
using std::string;
using std::list;
class MasterLoaderTest : public ::testing::Test {
public:
MasterLoaderTest() :
- callbacks_(boost::bind(&MasterLoaderTest::callback, this,
- &errors_, _1, _2, _3),
- boost::bind(&MasterLoaderTest::callback, this,
- &warnings_, _1, _2, _3))
+ callbacks_(std::bind(&MasterLoaderTest::callback, this,
+ &errors_, _1, _2, _3),
+ std::bind(&MasterLoaderTest::callback, this,
+ &warnings_, _1, _2, _3))
{}
void TearDown() {
const RRClass& rrclass, const MasterLoader::Options options)
{
loader_.reset(new MasterLoader(file, origin, rrclass, callbacks_,
- boost::bind(&MasterLoaderTest::addRRset,
- this, _1, _2, _3, _4, _5),
+ std::bind(&MasterLoaderTest::addRRset,
+ this, _1, _2, _3, _4, _5),
options));
}
const RRClass& rrclass, const MasterLoader::Options options)
{
loader_.reset(new MasterLoader(stream, origin, rrclass, callbacks_,
- boost::bind(&MasterLoaderTest::addRRset,
- this, _1, _2, _3, _4, _5),
+ std::bind(&MasterLoaderTest::addRRset,
+ this, _1, _2, _3, _4, _5),
options));
}
-// Copyright (C) 2010-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <string>
#include <vector>
-#include <boost/bind.hpp>
-
#include <gtest/gtest.h>
#include <dns/masterload.h>
#include <dns/rrset.h>
using namespace std;
+using namespace std::placeholders;
using namespace isc::dns;
namespace {
// object)
rr_stream << txt_rr << a_rr1 << soa_rr;
masterLoad(rr_stream, origin, zclass,
- boost::bind(&testCallback, _1, &results));
+ std::bind(&testCallback, _1, &results));
ASSERT_EQ(3, results.size());
EXPECT_EQ(txt_rr, results[0]->toText());
EXPECT_EQ(a_rr1, results[1]->toText());
TEST_F(MasterLoadTest, loadWithMemFunctionCallback) {
// The same test as loadRRs but using a class member function (with a
- // help of Boost.bind)
+ // help of std.bind)
rr_stream << txt_rr << a_rr1 << soa_rr;
masterLoad(rr_stream, origin, zclass,
- boost::bind(&MasterLoadTest::rrsetCallback, this, _1));
+ std::bind(&MasterLoadTest::rrsetCallback, this, _1));
ASSERT_EQ(3, results.size());
EXPECT_EQ(txt_rr, results[0]->toText());
EXPECT_EQ(a_rr1, results[1]->toText());
-// Copyright (C) 2010-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
+#include <functional>
#include <vector>
#include <string>
#include <sstream>
#include <util/unittests/wiredata.h>
-#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
using namespace std;
+using namespace std::placeholders;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
CreateRdataCallback callback;
MasterLoaderCallbacks callbacks(
- boost::bind(&CreateRdataCallback::callback, &callback,
- CreateRdataCallback::ERROR, _1, _2, _3),
- boost::bind(&CreateRdataCallback::callback, &callback,
- CreateRdataCallback::WARN, _1, _2, _3));
+ std::bind(&CreateRdataCallback::callback, &callback,
+ CreateRdataCallback::ERROR, _1, _2, _3),
+ std::bind(&CreateRdataCallback::callback, &callback,
+ CreateRdataCallback::WARN, _1, _2, _3));
size_t line = 0;
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
-
+#include <functional>
#include <sstream>
#include <vector>
using std::vector;
using namespace isc::dns;
using namespace isc::dns::rdata;
+using namespace std::placeholders;
namespace {
RRCollatorTest() :
origin_("example.com"), rrclass_(RRClass::IN()), rrttl_(3600),
throw_from_callback_(false),
- collator_(boost::bind(addRRset, _1, &rrsets_, &throw_from_callback_)),
+ collator_(std::bind(addRRset, _1, &rrsets_, &throw_from_callback_)),
rr_callback_(collator_.getCallback()),
a_rdata1_(createRdata(RRType::A(), rrclass_, "192.0.2.1")),
a_rdata2_(createRdata(RRType::A(), rrclass_, "192.0.2.2")),
-// Copyright (C) 2012-2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <gtest/gtest.h>
-#include <boost/bind.hpp>
#include <boost/scoped_ptr.hpp>
#include <algorithm>
+#include <functional>
#include <string>
#include <sstream>
#include <vector>
using isc::Unexpected;
using namespace isc::dns;
using namespace isc::dns::rdata;
+using namespace std::placeholders;
namespace {
zname_("example.com"), zclass_(RRClass::IN()),
soa_(new RRset(zname_, zclass_, RRType::SOA(), RRTTL(60))),
ns_(new RRset(zname_, zclass_, RRType::NS(), RRTTL(60))),
- callbacks_(boost::bind(&ZoneCheckerTest::callback, this, _1, true),
- boost::bind(&ZoneCheckerTest::callback, this, _1, false))
+ callbacks_(std::bind(&ZoneCheckerTest::callback, this, _1, true),
+ std::bind(&ZoneCheckerTest::callback, this, _1, false))
{
std::stringstream ss;
ss << "example.com. 60 IN SOA " << soa_txt << "\n";
}
public:
- // This one is passed to boost::bind. Some compilers seem to require
+ // This one is passed to std::bind. Some compilers seem to require
// it be public.
void callback(const std::string& reason, bool is_error) {
if (is_error) {
// If null callback is specified, checkZone() only returns the final
// result.
ZoneCheckerCallbacks noerror_callbacks(
- 0, boost::bind(&ZoneCheckerTest::callback, this, _1, false));
+ 0, std::bind(&ZoneCheckerTest::callback, this, _1, false));
EXPECT_FALSE(checkZone(zname_, zclass_, *rrsets_, noerror_callbacks));
checkIssues();
// Same check, but disabling warning callback. Same result, but without
// the warning.
ZoneCheckerCallbacks nowarn_callbacks(
- boost::bind(&ZoneCheckerTest::callback, this, _1, true), 0);
+ std::bind(&ZoneCheckerTest::callback, this, _1, true), 0);
EXPECT_TRUE(checkZone(zname_, zclass_, *rrsets_, nowarn_callbacks));
checkIssues();
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dns/rrset.h>
#include <dns/rrset_collection_base.h>
-#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
+#include <functional>
#include <string>
using boost::lexical_cast;
checkZone(const Name& zone_name, const RRClass& zone_class,
const RRsetCollectionBase& zone_rrsets,
const ZoneCheckerCallbacks& callbacks) {
+ using namespace std::placeholders;
bool had_error = false;
ZoneCheckerCallbacks my_callbacks(
- boost::bind(errorWrapper, _1, &callbacks, &had_error),
- boost::bind(&ZoneCheckerCallbacks::warn, &callbacks, _1));
+ std::bind(errorWrapper, _1, &callbacks, &had_error),
+ std::bind(&ZoneCheckerCallbacks::warn, &callbacks, _1));
checkSOA(zone_name, zone_class, zone_rrsets, my_callbacks);
checkNS(zone_name, zone_class, zone_rrsets, my_callbacks);
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dns/dns_fwd.h>
-#include <boost/function.hpp>
-
+#include <functional>
#include <string>
namespace isc {
/// \brief Functor type of the callback on some issue (error or warning).
///
/// Its parameter indicates the reason for the corresponding issue.
- typedef boost::function<void(const std::string& reason)> IssueCallback;
+ typedef std::function<void(const std::string& reason)> IssueCallback;
/// \brief Constructor.
///
///
/// \param reason Textual representation of the reason for the error.
void error(const std::string& reason) const {
- if (!error_callback_.empty()) {
+ if (error_callback_) {
error_callback_(reason);
}
}
///
/// \param reason Textual representation of the reason for the issue.
void warn(const std::string& reason) const {
- if (!warn_callback_.empty())
+ if (warn_callback_)
warn_callback_(reason);
}
#include <util/multi_threading_mgr.h>
#include <util/unlock_guard.h>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/weak_ptr.hpp>
#include <atomic>
#include <array>
+#include <functional>
#include <iostream>
#include <map>
#include <mutex>
constexpr size_t MAX_LOGGED_MESSAGE_SIZE = 1024;
/// @brief TCP socket callback function type.
-typedef boost::function<void(boost::system::error_code ec, size_t length)>
+typedef std::function<void(boost::system::error_code ec, size_t length)>
SocketCallbackFunction;
/// @brief Socket callback class required by the TCPSocket API.
/// over for names.
TCPEndpoint endpoint(url_.getStrippedHostname(),
static_cast<unsigned short>(url_.getPort()));
- SocketCallback socket_cb(boost::bind(&Connection::connectCallback, shared_from_this(),
- connect_callback, current_transid_, _1));
+ SocketCallback socket_cb(std::bind(&Connection::connectCallback, shared_from_this(),
+ connect_callback, current_transid_,
+ std::placeholders::_1));
// Establish new connection or use existing connection.
socket_.open(&endpoint, socket_cb);
void
Connection::scheduleTimer(const long request_timeout) {
if (request_timeout > 0) {
- timer_.setup(boost::bind(&Connection::timerCallback, this), request_timeout,
+ timer_.setup(std::bind(&Connection::timerCallback, this), request_timeout,
IntervalTimer::ONE_SHOT);
}
}
void
Connection::doSend(const uint64_t transid) {
- SocketCallback socket_cb(boost::bind(&Connection::sendCallback, shared_from_this(),
- transid, _1, _2));
+ SocketCallback socket_cb(std::bind(&Connection::sendCallback,
+ shared_from_this(),
+ transid,
+ std::placeholders::_1,
+ std::placeholders::_2));
try {
socket_.asyncSend(&buf_[0], buf_.size(), socket_cb);
void
Connection::doReceive(const uint64_t transid) {
TCPEndpoint endpoint;
- SocketCallback socket_cb(boost::bind(&Connection::receiveCallback, shared_from_this(),
- transid, _1, _2));
+ SocketCallback socket_cb(std::bind(&Connection::receiveCallback,
+ shared_from_this(),
+ transid,
+ std::placeholders::_1,
+ std::placeholders::_2));
try {
socket_.asyncReceive(static_cast<void*>(input_buf_.data()), input_buf_.size(), 0,
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <http/connection_pool.h>
#include <http/http_log.h>
#include <http/http_messages.h>
-#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
+#include <functional>
using namespace isc::asiolink;
// Create instance of the callback. It is safe to pass the local instance
// of the callback, because the underlying boost functions make copies
// as needed.
- HttpAcceptorCallback cb = boost::bind(&HttpConnection::acceptorCallback,
- shared_from_this(),
- boost::asio::placeholders::error);
+ HttpAcceptorCallback cb = std::bind(&HttpConnection::acceptorCallback,
+ shared_from_this(),
+ std::placeholders::_1); // error
try {
acceptor_.asyncAccept(socket_, cb);
}
// Create instance of the callback. It is safe to pass the local instance
- // of the callback, because the underlying boost functions make copies
+ // of the callback, because the underlying std functions make copies
// as needed.
- SocketCallback cb(boost::bind(&HttpConnection::socketReadCallback,
- shared_from_this(),
- transaction,
- boost::asio::placeholders::error,
- boost::asio::placeholders::bytes_transferred));
+ SocketCallback cb(std::bind(&HttpConnection::socketReadCallback,
+ shared_from_this(),
+ transaction,
+ std::placeholders::_1, // error
+ std::placeholders::_2)); //bytes_transferred
socket_.asyncReceive(static_cast<void*>(transaction->getInputBufData()),
transaction->getInputBufSize(),
0, &endpoint, cb);
try {
if (transaction->outputDataAvail()) {
// Create instance of the callback. It is safe to pass the local instance
- // of the callback, because the underlying boost functions make copies
+ // of the callback, because the underlying std functions make copies
// as needed.
- SocketCallback cb(boost::bind(&HttpConnection::socketWriteCallback,
- shared_from_this(),
- transaction,
- boost::asio::placeholders::error,
- boost::asio::placeholders::bytes_transferred));
+ SocketCallback cb(std::bind(&HttpConnection::socketWriteCallback,
+ shared_from_this(),
+ transaction,
+ std::placeholders::_1, // error
+ std::placeholders::_2)); // bytes_transferred
socket_.asyncSend(transaction->getOutputBufData(),
transaction->getOutputBufSize(),
cb);
// because IntervalTimer already passes shared pointer to the
// IntervalTimerImpl to make sure that the callback remains
// valid.
- request_timer_.setup(boost::bind(&HttpConnection::requestTimeoutCallback,
- this, transaction),
+ request_timer_.setup(std::bind(&HttpConnection::requestTimeoutCallback,
+ this, transaction),
request_timeout_, IntervalTimer::ONE_SHOT);
}
void
HttpConnection::setupIdleTimer() {
- request_timer_.setup(boost::bind(&HttpConnection::idleTimeoutCallback,
- this),
+ request_timer_.setup(std::bind(&HttpConnection::idleTimeoutCallback,
+ this),
idle_timeout_, IntervalTimer::ONE_SHOT);
}
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <http/http_acceptor.h>
#include <http/request_parser.h>
#include <http/response_creator_factory.h>
-#include <boost/function.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/system/error_code.hpp>
#include <boost/shared_ptr.hpp>
#include <array>
+#include <functional>
#include <string>
namespace isc {
/// @brief Type of the function implementing a callback invoked by the
/// @c SocketCallback functor.
- typedef boost::function<void(boost::system::error_code ec, size_t length)>
+ typedef std::function<void(boost::system::error_code ec, size_t length)>
SocketCallbackFunction;
/// @brief Functor associated with the socket object.
-// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#define HTTP_ACCEPTOR_H
#include <asiolink/tcp_acceptor.h>
-#include <boost/function.hpp>
#include <boost/system/system_error.hpp>
+#include <functional>
namespace isc {
namespace http {
/// @brief Type of the callback for the TCP acceptor used in this library.
-typedef boost::function<void(const boost::system::error_code&)>
+typedef std::function<void(const boost::system::error_code&)>
HttpAcceptorCallback;
/// @brief Type of the TCP acceptor used in this library.
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
#include <http/http_message_parser_base.h>
-#include <boost/bind.hpp>
+#include <functional>
#include <sstream>
using namespace isc::util;
StateModel::defineStates();
defineState(HTTP_PARSE_OK_ST, "HTTP_PARSE_OK_ST",
- boost::bind(&HttpMessageParserBase::parseEndedHandler, this));
+ std::bind(&HttpMessageParserBase::parseEndedHandler, this));
defineState(HTTP_PARSE_FAILED_ST, "HTTP_PARSE_FAILED_ST",
- boost::bind(&HttpMessageParserBase::parseEndedHandler, this));
+ std::bind(&HttpMessageParserBase::parseEndedHandler, this));
}
void
HttpMessageParserBase::stateWithReadHandler(const std::string& handler_name,
- boost::function<void(const char c)>
+ std::function<void(const char c)>
after_read_logic) {
std::string bytes;
getNextFromBuffer(bytes);
void
HttpMessageParserBase::stateWithMultiReadHandler(const std::string& handler_name,
- boost::function<void(const std::string&)>
+ std::function<void(const std::string&)>
after_read_logic) {
std::string bytes;
getNextFromBuffer(bytes, 0);
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <exceptions/exceptions.h>
#include <http/http_message.h>
#include <util/state_model.h>
-#include <boost/function.hpp>
+#include <functional>
#include <string>
namespace isc {
///
/// @throw HttpRequestParserError when invalid event occurred.
void stateWithReadHandler(const std::string& handler_name,
- boost::function<void(const char c)>
+ std::function<void(const char c)>
after_read_logic);
/// @brief Generic parser handler which reads multiple bytes of data and
///
/// @throw HttpRequestParserError when invalid event occurred.
void stateWithMultiReadHandler(const std::string& handler_name,
- boost::function<void(const std::string&)>
+ std::function<void(const std::string&)>
after_read_logic);
/// @brief Transition parser to failure state.
-// Copyright (C) 2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2019-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// depends on the use case.
HttpResponseCreatorPtr response_creator = creator_factory_->create();
HttpAcceptorCallback acceptor_callback =
- boost::bind(&HttpListenerImpl::acceptHandler, this, _1);
+ std::bind(&HttpListenerImpl::acceptHandler, this,
+ std::placeholders::_1);
HttpConnectionPtr conn = createConnection(response_creator,
acceptor_callback);
// Add this new connection to the pool.
-// Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
#include <http/request_parser.h>
-#include <boost/bind.hpp>
+#include <functional>
#include <iostream>
using namespace isc::util;
// Define HTTP parser specific states.
defineState(RECEIVE_START_ST, "RECEIVE_START_ST",
- boost::bind(&HttpRequestParser::receiveStartHandler, this));
+ std::bind(&HttpRequestParser::receiveStartHandler, this));
defineState(HTTP_METHOD_ST, "HTTP_METHOD_ST",
- boost::bind(&HttpRequestParser::httpMethodHandler, this));
+ std::bind(&HttpRequestParser::httpMethodHandler, this));
defineState(HTTP_URI_ST, "HTTP_URI_ST",
- boost::bind(&HttpRequestParser::uriHandler, this));
+ std::bind(&HttpRequestParser::uriHandler, this));
defineState(HTTP_VERSION_H_ST, "HTTP_VERSION_H_ST",
- boost::bind(&HttpRequestParser::versionHTTPHandler, this, 'H',
- HTTP_VERSION_T1_ST));
+ std::bind(&HttpRequestParser::versionHTTPHandler, this, 'H',
+ HTTP_VERSION_T1_ST));
defineState(HTTP_VERSION_T1_ST, "HTTP_VERSION_T1_ST",
- boost::bind(&HttpRequestParser::versionHTTPHandler, this, 'T',
- HTTP_VERSION_T2_ST));
+ std::bind(&HttpRequestParser::versionHTTPHandler, this, 'T',
+ HTTP_VERSION_T2_ST));
defineState(HTTP_VERSION_T2_ST, "HTTP_VERSION_T2_ST",
- boost::bind(&HttpRequestParser::versionHTTPHandler, this, 'T',
- HTTP_VERSION_P_ST));
+ std::bind(&HttpRequestParser::versionHTTPHandler, this, 'T',
+ HTTP_VERSION_P_ST));
defineState(HTTP_VERSION_P_ST, "HTTP_VERSION_P_ST",
- boost::bind(&HttpRequestParser::versionHTTPHandler, this, 'P',
- HTTP_VERSION_SLASH_ST));
+ std::bind(&HttpRequestParser::versionHTTPHandler, this, 'P',
+ HTTP_VERSION_SLASH_ST));
defineState(HTTP_VERSION_SLASH_ST, "HTTP_VERSION_SLASH_ST",
- boost::bind(&HttpRequestParser::versionHTTPHandler, this, '/',
- HTTP_VERSION_MAJOR_ST));
+ std::bind(&HttpRequestParser::versionHTTPHandler, this, '/',
+ HTTP_VERSION_MAJOR_ST));
defineState(HTTP_VERSION_MAJOR_START_ST, "HTTP_VERSION_MAJOR_START_ST",
- boost::bind(&HttpRequestParser::versionNumberStartHandler, this,
- HTTP_VERSION_MAJOR_ST,
- &context_->http_version_major_));
+ std::bind(&HttpRequestParser::versionNumberStartHandler, this,
+ HTTP_VERSION_MAJOR_ST,
+ &context_->http_version_major_));
defineState(HTTP_VERSION_MAJOR_ST, "HTTP_VERSION_MAJOR_ST",
- boost::bind(&HttpRequestParser::versionNumberHandler, this,
- '.', HTTP_VERSION_MINOR_START_ST,
- &context_->http_version_major_));
+ std::bind(&HttpRequestParser::versionNumberHandler, this,
+ '.', HTTP_VERSION_MINOR_START_ST,
+ &context_->http_version_major_));
defineState(HTTP_VERSION_MINOR_START_ST, "HTTP_VERSION_MINOR_START_ST",
- boost::bind(&HttpRequestParser::versionNumberStartHandler, this,
- HTTP_VERSION_MINOR_ST,
- &context_->http_version_minor_));
+ std::bind(&HttpRequestParser::versionNumberStartHandler, this,
+ HTTP_VERSION_MINOR_ST,
+ &context_->http_version_minor_));
defineState(HTTP_VERSION_MINOR_ST, "HTTP_VERSION_MINOR_ST",
- boost::bind(&HttpRequestParser::versionNumberHandler, this,
- '\r', EXPECTING_NEW_LINE1_ST,
- &context_->http_version_minor_));
+ std::bind(&HttpRequestParser::versionNumberHandler, this,
+ '\r', EXPECTING_NEW_LINE1_ST,
+ &context_->http_version_minor_));
defineState(EXPECTING_NEW_LINE1_ST, "EXPECTING_NEW_LINE1_ST",
- boost::bind(&HttpRequestParser::expectingNewLineHandler, this,
- HEADER_LINE_START_ST));
+ std::bind(&HttpRequestParser::expectingNewLineHandler, this,
+ HEADER_LINE_START_ST));
defineState(HEADER_LINE_START_ST, "HEADER_LINE_START_ST",
- boost::bind(&HttpRequestParser::headerLineStartHandler, this));
+ std::bind(&HttpRequestParser::headerLineStartHandler, this));
defineState(HEADER_LWS_ST, "HEADER_LWS_ST",
- boost::bind(&HttpRequestParser::headerLwsHandler, this));
+ std::bind(&HttpRequestParser::headerLwsHandler, this));
defineState(HEADER_NAME_ST, "HEADER_NAME_ST",
- boost::bind(&HttpRequestParser::headerNameHandler, this));
+ std::bind(&HttpRequestParser::headerNameHandler, this));
defineState(SPACE_BEFORE_HEADER_VALUE_ST, "SPACE_BEFORE_HEADER_VALUE_ST",
- boost::bind(&HttpRequestParser::spaceBeforeHeaderValueHandler, this));
+ std::bind(&HttpRequestParser::spaceBeforeHeaderValueHandler, this));
defineState(HEADER_VALUE_ST, "HEADER_VALUE_ST",
- boost::bind(&HttpRequestParser::headerValueHandler, this));
+ std::bind(&HttpRequestParser::headerValueHandler, this));
defineState(EXPECTING_NEW_LINE2_ST, "EXPECTING_NEW_LINE2",
- boost::bind(&HttpRequestParser::expectingNewLineHandler, this,
- HEADER_LINE_START_ST));
+ std::bind(&HttpRequestParser::expectingNewLineHandler, this,
+ HEADER_LINE_START_ST));
defineState(EXPECTING_NEW_LINE3_ST, "EXPECTING_NEW_LINE3_ST",
- boost::bind(&HttpRequestParser::expectingNewLineHandler, this,
- HTTP_PARSE_OK_ST));
+ std::bind(&HttpRequestParser::expectingNewLineHandler, this,
+ HTTP_PARSE_OK_ST));
defineState(HTTP_BODY_ST, "HTTP_BODY_ST",
- boost::bind(&HttpRequestParser::bodyHandler, this));
+ std::bind(&HttpRequestParser::bodyHandler, this));
}
void
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
#include <http/response_parser.h>
-#include <boost/bind.hpp>
+#include <functional>
using namespace isc::util;
// Define HTTP parser specific states.
defineState(RECEIVE_START_ST, "RECEIVE_START_ST",
- boost::bind(&HttpResponseParser::receiveStartHandler, this));
+ std::bind(&HttpResponseParser::receiveStartHandler, this));
defineState(HTTP_VERSION_T1_ST, "HTTP_VERSION_T1_ST",
- boost::bind(&HttpResponseParser::versionHTTPHandler, this, 'T',
- HTTP_VERSION_T2_ST));
+ std::bind(&HttpResponseParser::versionHTTPHandler, this, 'T',
+ HTTP_VERSION_T2_ST));
defineState(HTTP_VERSION_T2_ST, "HTTP_VERSION_T2_ST",
- boost::bind(&HttpResponseParser::versionHTTPHandler, this, 'T',
- HTTP_VERSION_P_ST));
+ std::bind(&HttpResponseParser::versionHTTPHandler, this, 'T',
+ HTTP_VERSION_P_ST));
defineState(HTTP_VERSION_P_ST, "HTTP_VERSION_P_ST",
- boost::bind(&HttpResponseParser::versionHTTPHandler, this, 'P',
- HTTP_VERSION_SLASH_ST));
+ std::bind(&HttpResponseParser::versionHTTPHandler, this, 'P',
+ HTTP_VERSION_SLASH_ST));
defineState(HTTP_VERSION_SLASH_ST, "HTTP_VERSION_SLASH_ST",
- boost::bind(&HttpResponseParser::versionHTTPHandler, this, '/',
- HTTP_VERSION_MAJOR_ST));
+ std::bind(&HttpResponseParser::versionHTTPHandler, this, '/',
+ HTTP_VERSION_MAJOR_ST));
defineState(HTTP_VERSION_MAJOR_START_ST, "HTTP_VERSION_MAJOR_START_ST",
- boost::bind(&HttpResponseParser::numberStartHandler, this,
- HTTP_VERSION_MAJOR_ST,
- "HTTP version",
- &context_->http_version_major_));
+ std::bind(&HttpResponseParser::numberStartHandler, this,
+ HTTP_VERSION_MAJOR_ST,
+ "HTTP version",
+ &context_->http_version_major_));
defineState(HTTP_VERSION_MAJOR_ST, "HTTP_VERSION_MAJOR_ST",
- boost::bind(&HttpResponseParser::numberHandler, this,
- '.', HTTP_VERSION_MINOR_START_ST,
- "HTTP version",
- &context_->http_version_major_));
+ std::bind(&HttpResponseParser::numberHandler, this,
+ '.', HTTP_VERSION_MINOR_START_ST,
+ "HTTP version",
+ &context_->http_version_major_));
defineState(HTTP_VERSION_MINOR_START_ST, "HTTP_VERSION_MINOR_START_ST",
- boost::bind(&HttpResponseParser::numberStartHandler, this,
- HTTP_VERSION_MINOR_ST,
- "HTTP version",
- &context_->http_version_minor_));
+ std::bind(&HttpResponseParser::numberStartHandler, this,
+ HTTP_VERSION_MINOR_ST,
+ "HTTP version",
+ &context_->http_version_minor_));
defineState(HTTP_VERSION_MINOR_ST, "HTTP_VERSION_MINOR_ST",
- boost::bind(&HttpResponseParser::numberHandler, this,
- ' ', HTTP_STATUS_CODE_START_ST,
- "HTTP version",
- &context_->http_version_minor_));
+ std::bind(&HttpResponseParser::numberHandler, this,
+ ' ', HTTP_STATUS_CODE_START_ST,
+ "HTTP version",
+ &context_->http_version_minor_));
defineState(HTTP_STATUS_CODE_START_ST, "HTTP_STATUS_CODE_START_ST",
- boost::bind(&HttpResponseParser::numberStartHandler, this,
- HTTP_STATUS_CODE_ST,
- "HTTP status code",
- &context_->status_code_));
+ std::bind(&HttpResponseParser::numberStartHandler, this,
+ HTTP_STATUS_CODE_ST,
+ "HTTP status code",
+ &context_->status_code_));
defineState(HTTP_STATUS_CODE_ST, "HTTP_STATUS_CODE_ST",
- boost::bind(&HttpResponseParser::numberHandler, this,
- ' ', HTTP_PHRASE_START_ST,
- "HTTP status code",
- &context_->status_code_));
+ std::bind(&HttpResponseParser::numberHandler, this,
+ ' ', HTTP_PHRASE_START_ST,
+ "HTTP status code",
+ &context_->status_code_));
defineState(HTTP_PHRASE_START_ST, "HTTP_PHRASE_START_ST",
- boost::bind(&HttpResponseParser::phraseStartHandler, this));
+ std::bind(&HttpResponseParser::phraseStartHandler, this));
defineState(HTTP_PHRASE_ST, "HTTP_PHRASE_ST",
- boost::bind(&HttpResponseParser::phraseHandler, this));
+ std::bind(&HttpResponseParser::phraseHandler, this));
defineState(EXPECTING_NEW_LINE1_ST, "EXPECTING_NEW_LINE1_ST",
- boost::bind(&HttpResponseParser::expectingNewLineHandler, this,
- HEADER_LINE_START_ST));
+ std::bind(&HttpResponseParser::expectingNewLineHandler, this,
+ HEADER_LINE_START_ST));
defineState(HEADER_LINE_START_ST, "HEADER_LINE_START_ST",
- boost::bind(&HttpResponseParser::headerLineStartHandler, this));
+ std::bind(&HttpResponseParser::headerLineStartHandler, this));
defineState(HEADER_LWS_ST, "HEADER_LWS_ST",
- boost::bind(&HttpResponseParser::headerLwsHandler, this));
+ std::bind(&HttpResponseParser::headerLwsHandler, this));
defineState(HEADER_NAME_ST, "HEADER_NAME_ST",
- boost::bind(&HttpResponseParser::headerNameHandler, this));
+ std::bind(&HttpResponseParser::headerNameHandler, this));
defineState(SPACE_BEFORE_HEADER_VALUE_ST, "SPACE_BEFORE_HEADER_VALUE_ST",
- boost::bind(&HttpResponseParser::spaceBeforeHeaderValueHandler, this));
+ std::bind(&HttpResponseParser::spaceBeforeHeaderValueHandler, this));
defineState(HEADER_VALUE_ST, "HEADER_VALUE_ST",
- boost::bind(&HttpResponseParser::headerValueHandler, this));
+ std::bind(&HttpResponseParser::headerValueHandler, this));
defineState(EXPECTING_NEW_LINE2_ST, "EXPECTING_NEW_LINE2",
- boost::bind(&HttpResponseParser::expectingNewLineHandler, this,
- HEADER_LINE_START_ST));
+ std::bind(&HttpResponseParser::expectingNewLineHandler, this,
+ HEADER_LINE_START_ST));
defineState(EXPECTING_NEW_LINE3_ST, "EXPECTING_NEW_LINE3_ST",
- boost::bind(&HttpResponseParser::expectingNewLineHandler, this,
- HTTP_PARSE_OK_ST));
+ std::bind(&HttpResponseParser::expectingNewLineHandler, this,
+ HTTP_PARSE_OK_ST));
defineState(HTTP_BODY_ST, "HTTP_BODY_ST",
- boost::bind(&HttpResponseParser::bodyHandler, this));
+ std::bind(&HttpResponseParser::bodyHandler, this));
}
void
#include <boost/asio/buffer.hpp>
#include <boost/asio/ip/tcp.hpp>
-#include <boost/bind.hpp>
#include <boost/pointer_cast.hpp>
#include <gtest/gtest.h>
using namespace isc::http;
using namespace isc::http::test;
using namespace isc::util;
+namespace ph = std::placeholders;
namespace {
HttpListenerTest()
: io_service_(), factory_(new TestHttpResponseCreatorFactory()),
test_timer_(io_service_), run_io_service_timer_(io_service_), clients_() {
- test_timer_.setup(boost::bind(&HttpListenerTest::timeoutHandler, this, true),
+ test_timer_.setup(std::bind(&HttpListenerTest::timeoutHandler, this, true),
TEST_TIMEOUT, IntervalTimer::ONE_SHOT);
}
io_service_.get_io_service().reset();
if (timeout > 0) {
- run_io_service_timer_.setup(boost::bind(&HttpListenerTest::timeoutHandler,
- this, false),
+ run_io_service_timer_.setup(std::bind(&HttpListenerTest::timeoutHandler,
+ this, false),
timeout, IntervalTimer::ONE_SHOT);
}
io_service_.run();
EXPECT_FALSE(ec);
},
HttpClient::RequestTimeout(10000),
- boost::bind(&ExternalMonitor::connectHandler, &monitor, _1, _2),
- boost::bind(&ExternalMonitor::closeHandler, &monitor, _1)
+ std::bind(&ExternalMonitor::connectHandler, &monitor, ph::_1, ph::_2),
+ std::bind(&ExternalMonitor::closeHandler, &monitor, ph::_1)
));
// Initiate another request to the destination.
EXPECT_FALSE(ec);
},
HttpClient::RequestTimeout(10000),
- boost::bind(&ExternalMonitor::connectHandler, &monitor, _1, _2),
- boost::bind(&ExternalMonitor::closeHandler, &monitor, _1)
+ std::bind(&ExternalMonitor::connectHandler, &monitor, ph::_1, ph::_2),
+ std::bind(&ExternalMonitor::closeHandler, &monitor, ph::_1)
));
// Actually trigger the requests. The requests should be handlded by the
EXPECT_FALSE(ec);
},
HttpClient::RequestTimeout(10000),
- boost::bind(&ExternalMonitor::connectHandler, &monitor, _1, _2),
- boost::bind(&ExternalMonitor::closeHandler, &monitor, _1)
+ std::bind(&ExternalMonitor::connectHandler, &monitor, ph::_1, ph::_2),
+ std::bind(&ExternalMonitor::closeHandler, &monitor, ph::_1)
));
// Actually trigger the requests. The requests should be handlded by the
EXPECT_FALSE(ec);
},
HttpClient::RequestTimeout(10000),
- boost::bind(&ExternalMonitor::connectHandler, &monitor, _1, _2),
- boost::bind(&ExternalMonitor::closeHandler, &monitor, _1)
+ std::bind(&ExternalMonitor::connectHandler, &monitor, ph::_1, ph::_2),
+ std::bind(&ExternalMonitor::closeHandler, &monitor, ph::_1)
));
// Actually trigger the requests. The requests should be handlded by the
#include <process/d_controller.h>
#include <process/config_base.h>
#include <kea_version.h>
-#include <boost/bind.hpp>
+#include <functional>
#include <sstream>
#include <unistd.h>
// Create our signal set.
io_signal_set_.reset(new IOSignalSet(io_service_,
- boost::bind(&DControllerBase::
- processSignal,
- this, _1)));
+ std::bind(&DControllerBase::
+ processSignal,
+ this,
+ std::placeholders::_1)));
// Register for the signals we wish to handle.
io_signal_set_->add(SIGHUP);
io_signal_set_->add(SIGINT);
#include <process/config_base.h>
#include <util/filename.h>
-#include <boost/bind.hpp>
-
+#include <functional>
#include <sstream>
#include <fstream>
#include <errno.h>
}
void Daemon::handleSignal() {
+ using namespace std::placeholders;
if (signal_set_ && signal_handler_) {
- signal_set_->handleNext(boost::bind(signal_handler_, _1));
+ signal_set_->handleNext(std::bind(signal_handler_, _1));
}
}
#include <process/io_service_signal.h>
#include <exceptions/exceptions.h>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp>
#include <boost/asio/signal_set.hpp>
+#include <functional>
using namespace isc::asiolink;
void
IOSignalSetImpl::install() {
- signal_set_.async_wait(boost::bind(&IOSignalSetImpl::callback,
- shared_from_this(), _1, _2));
+ using namespace std::placeholders;
+ signal_set_.async_wait(std::bind(&IOSignalSetImpl::callback,
+ shared_from_this(), _1, _2));
}
void
namespace process {
/// @brief Defines a handler function for an IOSignal.
-typedef boost::function<void(int signum)> IOSignalHandler;
+typedef std::function<void(int signum)> IOSignalHandler;
class IOSignalSetImpl;
#include <process/io_service_signal.h>
#include <process/testutils/d_test_stubs.h>
-#include <boost/bind.hpp>
#include <gtest/gtest.h>
+#include <functional>
#include <queue>
namespace isc {
io_signal_set_.reset(new IOSignalSet(
io_service_,
- boost::bind(&IOSignalTest::processSignal,
- this, _1)));
+ std::bind(&IOSignalTest::processSignal,
+ this, std::placeholders::_1)));
}
/// @brief Destructor.
void setTestTime(int test_time_ms) {
// Fail safe shutdown
test_time_ms_ = test_time_ms;
- test_timer_.setup(boost::bind(&IOSignalTest::testTimerHandler,
- this),
+ test_timer_.setup(std::bind(&IOSignalTest::testTimerHandler, this),
test_time_ms_, asiolink::IntervalTimer::ONE_SHOT);
}
-// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <process/testutils/d_test_stubs.h>
#include <process/daemon.h>
#include <cc/command_interpreter.h>
-#include <boost/bind.hpp>
+#include <functional>
using namespace boost::asio;
int write_time_ms) {
new_cfg_content_ = config;
write_timer_.reset(new asiolink::IntervalTimer(*getIOService()));
- write_timer_->setup(boost::bind(&DControllerTest::timedWriteCallback, this),
+ write_timer_->setup(std::bind(&DControllerTest::timedWriteCallback, this),
write_time_ms, asiolink::IntervalTimer::ONE_SHOT);
}
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <exceptions/exceptions.h>
#include <util/process_spawn.h>
#include <util/signal_set.h>
-#include <boost/bind.hpp>
+#include <functional>
#include <map>
#include <signal.h>
#include <stdlib.h>
executable_(executable), args_(new char*[args.size() + 2]) {
// Set the handler which is invoked immediately when the signal
// is received.
- signals_->setOnReceiptHandler(boost::bind(&ProcessSpawnImpl::waitForProcess,
- this, _1));
+ signals_->setOnReceiptHandler(std::bind(&ProcessSpawnImpl::waitForProcess,
+ this, std::placeholders::_1));
// Conversion of the arguments to the C-style array we start by setting
// all pointers within an array to NULL to indicate that they haven't
// been allocated yet.
<< "' hasn't been spawned and it status cannot be"
" returned");
}
- return (proc->second.running_);
+ return (proc->second.running_);
}
bool
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#define SIGNAL_SET_H
#include <exceptions/exceptions.h>
-#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
+#include <functional>
#include <set>
#include <list>
#include <pthread.h>
/// @brief Pointer to the @c isc::util::SignalSet.
typedef boost::shared_ptr<SignalSet> SignalSetPtr;
/// @brief Pointer to the signal handling function.
-typedef boost::function<void(int signum)> SignalHandler;
+typedef std::function<void(int signum)> SignalHandler;
/// @brief Pointer to a signal handling function which returns bool result.
///
/// The handler is expected to return true if the signal it was given has
/// been processed (i.e. should not be recorded for deferred processing) or
/// false in which case it will be recorded.
-typedef boost::function<bool(int signum)> BoolSignalHandler;
+typedef std::function<bool(int signum)> BoolSignalHandler;
/// @brief Represents a collection of signals handled in a customized way.
///
#include <config.h>
#include <util/state_model.h>
-#include <boost/bind.hpp>
#include <string>
namespace isc {
void
StateModel::defineStates() {
defineState(NEW_ST, "NEW_ST",
- boost::bind(&StateModel::nopStateHandler, this));
+ std::bind(&StateModel::nopStateHandler, this));
defineState(END_ST, "END_ST",
- boost::bind(&StateModel::nopStateHandler, this));
+ std::bind(&StateModel::nopStateHandler, this));
}
void
#include <exceptions/exceptions.h>
#include <util/labeled_value.h>
-#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
+#include <functional>
#include <map>
#include <mutex>
#include <string>
typedef LabeledValuePtr EventPtr;
/// @brief Defines a pointer to an instance method for handling a state.
-typedef boost::function<void()> StateHandler;
+typedef std::function<void()> StateHandler;
/// @brief State machine pausing modes.
///
///
/// @code
/// State(SOME_INT_VAL, "SOME_INT_VAL",
- /// boost::bind(&StateModelDerivation::someHandler, this));
+ /// std::bind(&StateModelDerivation::someHandler, this));
/// @endcode
///
/// @throw StateModelError if label is null or blank.
///
/// // Add the states defined by the derivation.
/// defineState(SOME_ST, "SOME_ST",
- /// boost::bind(&StateModelDerivation::someHandler, this));
+ /// std::bind(&StateModelDerivation::someHandler, this));
/// :
/// }
/// @endcode
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
#include <util/signal_set.h>
-#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
#include <signal.h>
using namespace isc;
using namespace isc::util;
+using namespace std::placeholders;
/// @brief Test fixture class for @c isc::util::SignalSet class.
///
// second one should be dropped.
ASSERT_EQ(0, raise(SIGHUP));
// Execute the first handler (for SIGHUP).
- signal_set_->handleNext(boost::bind(&SignalSetTest::testHandler, _1));
+ signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1));
// The handler should have been called once and the signal
// handled should be SIGHUP.
EXPECT_EQ(1, handler_calls_);
EXPECT_EQ(SIGHUP, signum_);
// Next signal to be handled should be SIGINT.
EXPECT_EQ(SIGINT, signal_set_->getNext());
- signal_set_->handleNext(boost::bind(&SignalSetTest::testHandler, _1));
+ signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1));
EXPECT_EQ(2, handler_calls_);
EXPECT_EQ(SIGINT, signum_);
// There should be no more waiting handlers.
// The signal set owns SIGHUP so it should be the next to handle.
EXPECT_EQ(SIGHUP, signal_set_->getNext());
// Handle next signal owned by the secondary signal set.
- secondary_signal_set_->handleNext(boost::bind(&SignalSetTest::testHandler,
- _1));
+ secondary_signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1));
EXPECT_EQ(1, handler_calls_);
EXPECT_EQ(SIGINT, signum_);
// No more signals to be handled for this signal set.
EXPECT_EQ(-1, secondary_signal_set_->getNext());
// Handle next signal owned by the signal set.
- signal_set_->handleNext(boost::bind(&SignalSetTest::testHandler, _1));
+ signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1));
EXPECT_EQ(2, handler_calls_);
EXPECT_EQ(SIGHUP, signum_);
// No more signals to be handled by this signal set.
/// Check that on-receipt processing works.
TEST_F(SignalSetTest, onReceiptTests) {
// Install an on-receipt handler.
- SignalSet::setOnReceiptHandler(boost::bind(&SignalSetTest::onReceiptHandler,
- this, _1));
+ SignalSet::setOnReceiptHandler(std::bind(&SignalSetTest::onReceiptHandler,
+ this, _1));
// Create a SignalSet for SIGHUP and SIGUSR1.
ASSERT_NO_THROW(signal_set_.reset(new SignalSet(SIGHUP, SIGUSR1)));
EXPECT_EQ(SIGUSR1, signal_set_->getNext());
// Verify we can process SIGUSR1 with the deferred handler.
- signal_set_->handleNext(boost::bind(&SignalSetTest::testHandler, _1));
+ signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1));
EXPECT_EQ(1, handler_calls_);
EXPECT_EQ(SIGUSR1, signum_);
EXPECT_EQ(SIGHUP, signal_set_->getNext());
// Verify we can process it with deferred handler.
- signal_set_->handleNext(boost::bind(&SignalSetTest::testHandler, _1));
+ signal_set_->handleNext(std::bind(&SignalSetTest::testHandler, _1));
EXPECT_EQ(2, handler_calls_);
EXPECT_EQ(SIGHUP, signum_);
}
#include <util/state_model.h>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
#include <gtest/gtest.h>
using namespace std;
// Define our states.
defineState(DUMMY_ST, "DUMMY_ST",
- boost::bind(&StateModelTest::dummyHandler, this));
+ std::bind(&StateModelTest::dummyHandler, this));
defineState(READY_ST, "READY_ST",
- boost::bind(&StateModelTest::readyHandler, this));
+ std::bind(&StateModelTest::readyHandler, this));
defineState(DO_WORK_ST, "DO_WORK_ST",
- boost::bind(&StateModelTest::doWorkHandler, this));
+ std::bind(&StateModelTest::doWorkHandler, this));
defineState(DONE_ST, "DONE_ST",
- boost::bind(&StateModelTest::doneWorkHandler, this));
+ std::bind(&StateModelTest::doneWorkHandler, this));
defineState(PAUSE_ALWAYS_ST, "PAUSE_ALWAYS_ST",
- boost::bind(&StateModelTest::pauseHandler, this),
+ std::bind(&StateModelTest::pauseHandler, this),
STATE_PAUSE_ALWAYS);
defineState(PAUSE_ONCE_ST, "PAUSE_ONCE_ST",
- boost::bind(&StateModelTest::pauseHandler, this),
+ std::bind(&StateModelTest::pauseHandler, this),
STATE_PAUSE_ONCE);
}
// Verify that we can add a state to the dictionary.
ASSERT_NO_THROW(defineState(READY_ST, "READY_ST",
- boost::bind(&StateModelTest::dummyHandler,
- this)));
+ std::bind(&StateModelTest::dummyHandler,
+ this)));
// Verify that we can find the state by its value.
StatePtr state;
// Verify that we cannot add a duplicate.
EXPECT_THROW(defineState(READY_ST, "READY_ST",
- boost::bind(&StateModelTest::readyHandler, this)),
+ std::bind(&StateModelTest::readyHandler, this)),
StateModelError);
// Verify that we can still find the state.
// Verify that events and states can be added before the model is started.
EXPECT_NO_THROW(defineEvent(9998, "9998"));
EXPECT_NO_THROW(defineState(9998, "9998",
- boost::bind(&StateModelTest::readyHandler,
- this)));
+ std::bind(&StateModelTest::readyHandler,
+ this)));
// "START" the model.
// Fake out starting the model by calling transition to move from NEW_ST
// Verify that events and states cannot be added after the model is started.
EXPECT_THROW(defineEvent(9999, "9999"), StateModelError);
EXPECT_THROW(defineState(9999, "9999",
- boost::bind(&StateModelTest::readyHandler, this)),
+ std::bind(&StateModelTest::readyHandler, this)),
StateModelError);
// The state and event combos set above, should show the model as
#include <util/watched_thread.h>
-#include <boost/bind.hpp>
#include <gtest/gtest.h>
-#include <unistd.h>
#include <atomic>
+#include <functional>
+#include <unistd.h>
using namespace std;
using namespace isc;
/// our other tests as to why threads have finished are sound.
wthread_.reset(new WatchedThread());
ASSERT_FALSE(wthread_->isRunning());
- wthread_->start(boost::bind(&WatchedThreadTest::worker, this, WatchedThread::TERMINATE));
+ wthread_->start(std::bind(&WatchedThreadTest::worker, this, WatchedThread::TERMINATE));
ASSERT_TRUE(wthread_->isRunning());
// Wait more long enough (we hope) for the thread to expire.
/// Now we'll test stopping a thread.
/// Start the WatchedThread, let it run a little and then tell it to stop.
- wthread_->start(boost::bind(&WatchedThreadTest::worker, this, WatchedThread::TERMINATE));
+ wthread_->start(std::bind(&WatchedThreadTest::worker, this, WatchedThread::TERMINATE));
ASSERT_TRUE(wthread_->isRunning());
// No watches should be ready.
// Next we'll test error notification.
// Start the WatchedThread with a thread that sets an error on the second pass.
- wthread_->start(boost::bind(&WatchedThreadTest::worker, this, WatchedThread::ERROR));
+ wthread_->start(std::bind(&WatchedThreadTest::worker, this, WatchedThread::ERROR));
ASSERT_TRUE(wthread_->isRunning());
// No watches should be ready.
// Finally, we'll test data ready notification.
// We'll start the WatchedThread with a thread that indicates data ready on its second pass.
- wthread_->start(boost::bind(&WatchedThreadTest::worker, this, WatchedThread::READY));
+ wthread_->start(std::bind(&WatchedThreadTest::worker, this, WatchedThread::READY));
ASSERT_TRUE(wthread_->isRunning());
// No watches should be ready.
namespace util {
void
-WatchedThread::start(const boost::function<void()>& thread_main) {
+WatchedThread::start(const std::function<void()>& thread_main) {
clearReady(ERROR);
clearReady(READY);
clearReady(TERMINATE);
#include <util/watch_socket.h>
#include <boost/shared_ptr.hpp>
-#include <boost/function.hpp>
+#include <functional>
#include <mutex>
#include <thread>
/// Creates the thread, passing into it the given function to run.
///
/// @param thread_main function the thread should run
- void start(const boost::function<void()>& thread_main);
+ void start(const std::function<void()>& thread_main);
/// @brief Returns true if the thread is running
bool isRunning() {