/ltmain.sh
/missing
/py-compile
-/stamp-h1
+/stamp-h*
/test-driver
/ylwrap
/kea_version.h
- Kevin P. Fleming
2023-02: Fixed several examples in DHCPv6 section of the ARM.
+
+ - Dimitry Andric
+ 2024-09: Added support for libc++ 19 and later.
+
+ - q66
+ 2025-01: Added support for building with Boost 1.87.
+2263. [build] fdupont, q66
+ Kea can now build with Boost 1.87. The minimum supported Boost
+ version has been bumped up from 1.57 to 1.66. Thanks to q66
+ for the patch.
+ (Gitlab #3823, #3696)
+
+2262. [build] dim
+ Replace ``std::basic_string<uint8_t>`` with equivalent
+ ``std::vector<uint8_t>`` constructs, since the former has been
+ deprecated for a while in libc++, and has been completely
+ removed as of libc++ 19.
+ (Gitlab #3823, #3532)
+
Kea 2.6.2 (stable) released on March 26, 2025
2261. [build] mgodzina
# For released versions, this is in x.y.z format.
# For GIT versions, this is x.y.z-git, where x.y.z denotes the next development
# version that is worked on and that is to be released.
-AC_INIT(kea, 2.6.2-git, kea-dev@lists.isc.org)
+AC_INIT(kea, 2.6.3-git, kea-dev@lists.isc.org)
AC_CONFIG_SRCDIR(README)
# serial-tests is not available in automake version before 1.13, so
])
AM_INIT_AUTOMAKE(foreign serial_tests)
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])dnl be backward compatible
+AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4macros])
[AC_MSG_ERROR([$CXX does not support $extra"])])
done
-fi dnl GXX = yes
+fi # if test "X$GXX" = "Xyes"
# allow building programs with static link. we need to make it selective
# because loadable modules cannot be statically linked.
AC_DEFINE([CONFIG_H_WAS_INCLUDED], [1], [config.h inclusion marker])
# Autoconf 2.70 has runstatedir.
-m4_version_prereq([2.70], [], [dnl
- AC_ARG_VAR(runstatedir, [$localstatedir/run for autoconf < 2.70])dnl
- AC_SUBST(runstatedir)dnl
+m4_version_prereq([2.70], [], [
+ AC_ARG_VAR(runstatedir, [$localstatedir/run for autoconf < 2.70])
+ AC_SUBST(runstatedir)
])
if test "x$runstatedir" = "x"; then
runstatedir="$localstatedir/run"
the system:
- Boost C++ libraries (https://www.boost.org/). The oldest Boost version
- used for testing is 1.57 (although Kea may also work with older
- versions). The Boost system library must also be installed.
+ used for testing is 1.67 (although Kea may also work with older
+ versions e.g. 1.66). The Boost system library must also be installed.
Installing a header-only version of Boost is not recommended.
- OpenSSL (at least version 1.0.2) or Botan (at least version 2).
AC_CHECK_HEADERS(boost/integer/common_factor.hpp)
+AC_CHECK_HEADERS(boost/asio/io_context.hpp,,AC_MSG_ERROR([Missing boost asio io_context header: boost version must be at least 1.66]))
+
# Verify that the path does not include standard headers by mistake.
# There are two regex.h headers: one is a standard system header (usually
# in /usr/include) and the second one is provided by boost. If you specify the
CPPFLAGS="$CPPFLAGS_SAVED"
AC_LANG_RESTORE
-])dnl AX_BOOST_FOR_KEA
+])
break
done
-])dnl AX_ISC_CPP14
+])
AC_SUBST(DISTCHECK_GSSAPI_CONFIGURE_FLAG)
AM_CONDITIONAL([HAVE_GSSAPI], [test $ENABLE_GSSAPI = "yes"])
-])dnl AX_GSS_API
+])
AC_SUBST(GTEST_LDADD)
AC_SUBST(GTEST_SOURCE)
-])dnl AX_ISC_GTEST
+])
CCFLAGS=$CCFLAGS_SAVED
fi
-])dnl AX_ISC_RPATH
+])
D2Process::runIO() {
// Handle events registered by hooks using external IOService objects.
IOServiceMgr::instance().pollIOServices();
- // We want to block until at least one handler is called. We'll use
- // boost::asio::io_service directly for two reasons. First off
- // asiolink::IOService::runOne is a void and boost::asio::io_service::stopped
- // is not present in older versions of boost. We need to know if any
- // handlers ran or if the io_service was stopped. That latter represents
- // some form of error and the application cannot proceed with a stopped
- // service. Secondly, asiolink::IOService does not provide the poll
- // method. This is a handy method which runs all ready handlers without
- // blocking.
-
+ // We want to block until at least one handler is called.
// Poll runs all that are ready. If none are ready it returns immediately
// with a count of zero.
size_t cnt = getIOService()->poll();
namespace isc {
namespace asiodns {
-const boost::asio::ip::address TEST_HOST(boost::asio::ip::address::from_string("127.0.0.1"));
+const boost::asio::ip::address TEST_HOST(boost::asio::ip::make_address("127.0.0.1"));
const uint16_t TEST_PORT(5301);
const int SEND_INTERVAL = 250; // Interval in ms between TCP sends
const size_t MAX_SIZE = 64 * 1024; // Should be able to take 64kB
/// @brief Returns file descriptor of the underlying socket.
virtual int getNative() const {
-#if BOOST_VERSION < 106600
- return (acceptor_->native());
-#else
return (acceptor_->native_handle());
-#endif
}
/// @brief Opens acceptor socket given the endpoint.
#include <sys/socket.h>
#include <netinet/in.h>
+#if BOOST_VERSION < 106600
+#error "Boost ASIO older than 1.66 are not supported"
+#endif
+
using namespace boost::asio;
using boost::asio::ip::udp;
using boost::asio::ip::tcp;
// because we'd like to throw our own exception on failure.
IOAddress::IOAddress(const std::string& address_str) {
boost::system::error_code err;
- asio_address_ = ip::address::from_string(address_str, err);
+ asio_address_ = ip::make_address(address_str, err);
if (err) {
isc_throw(IOError, "Failed to convert string to address '"
<< address_str << "': " << err.message());
uint32_t
IOAddress::toUint32() const {
if (asio_address_.is_v4()) {
- return (asio_address_.to_v4().to_ulong());
+ return (asio_address_.to_v4().to_uint());
} else {
isc_throw(BadValue, "Can't convert " << toText()
<< " address to IPv4.");
/// @brief The constructor.
IOServiceImpl() :
io_service_(),
- work_(new boost::asio::io_service::work(io_service_)) {
+ work_(boost::asio::make_work_guard(io_service_)) {
};
/// @brief The destructor.
/// @brief Restarts the IOService in preparation for a subsequent @ref run() invocation.
void restart() {
- io_service_.reset();
+ io_service_.restart();
}
/// @brief Removes IO service work object to let it finish running
work_.reset();
}
- /// @brief Return the native @c io_service object used in this wrapper.
+ /// @brief Return the native @c io_context object used in this wrapper.
///
/// This is a short term work around to support other Kea modules
- /// that share the same @c io_service with the authoritative server.
+ /// that share the same @c io_context with the authoritative server.
/// It will eventually be removed once the wrapper interface is
/// generalized.
- boost::asio::io_service& getInternalIOService() {
+ boost::asio::io_context& getInternalIOService() {
return (io_service_);
}
///
/// @param callback The callback to be run on the IO service.
void post(const std::function<void ()>& callback) {
- io_service_.post(callback);
+ boost::asio::post(io_service_, callback);
}
private:
- boost::asio::io_service io_service_;
- boost::shared_ptr<boost::asio::io_service::work> work_;
+ boost::asio::io_context io_service_;
+ boost::asio::executor_work_guard<boost::asio::io_context::executor_type> work_;
};
IOService::IOService() : io_impl_(new IOServiceImpl()) {
io_impl_->stopWork();
}
-boost::asio::io_service&
+boost::asio::io_context&
IOService::getInternalIOService() {
return (io_impl_->getInternalIOService());
}
#include <functional>
#include <list>
-namespace boost {
-namespace asio {
#if BOOST_VERSION < 106600
- class io_service;
-#else
- class io_context;
- typedef io_context io_service;
+#error "Boost ASIO older than 1.66 are not supported"
#endif
-}
-}
+
+#include <boost/asio/io_context.hpp>
namespace isc {
namespace asiolink {
/// @brief Defines a smart pointer to an IOService instance.
typedef boost::shared_ptr<IOService> IOServicePtr;
-/// @brief The @ref IOService class is a wrapper for the ASIO @c io_service
+/// @brief The @ref IOService class is a wrapper for the ASIO @c io_context
/// class.
class IOService {
/// @brief Constructors and Destructor.
/// when all handlers have been invoked.
void stopWork();
- /// @brief Return the native @c io_service object used in this wrapper.
+ /// @brief Return the native @c io_context object used in this wrapper.
///
/// This is a short term work around to support other Kea modules
- /// that share the same @c io_service with the authoritative server.
+ /// that share the same @c io_context with the authoritative server.
/// It will eventually be removed once the wrapper interface is
/// generalized.
///
- /// @return The internal io_service object.
- boost::asio::io_service& getInternalIOService();
+ /// @return The internal io_context object.
+ boost::asio::io_context& getInternalIOService();
/// @brief Post a callback to the end of the queue.
///
/// \param port The TCP port number of the endpoint.
TCPEndpoint(const IOAddress& address, const unsigned short port) :
asio_endpoint_placeholder_(
- new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(address.toText()),
+ new boost::asio::ip::tcp::endpoint(boost::asio::ip::make_address(address.toText()),
port)),
asio_endpoint_(*asio_endpoint_placeholder_)
{}
/// \brief Return file descriptor of underlying socket
virtual int getNative() const {
-#if BOOST_VERSION < 106600
- return (socket_.native());
-#else
return (socket_.native_handle());
-#endif
}
/// \brief Return protocol of socket
/// connectHandler as a callback function.
void connect() {
boost::asio::ip::tcp::endpoint
- endpoint(boost::asio::ip::address::from_string(SERVER_ADDRESS),
+ endpoint(boost::asio::ip::make_address(SERVER_ADDRESS),
SERVER_PORT);
socket_.async_connect(endpoint,
std::bind(&TCPClient::connectHandler, this,
/// unsuccessful.
TCPAcceptorTest()
: io_service_(new IOService()), acceptor_(io_service_),
- asio_endpoint_(boost::asio::ip::address::from_string(SERVER_ADDRESS),
+ asio_endpoint_(boost::asio::ip::make_address(SERVER_ADDRESS),
SERVER_PORT),
endpoint_(asio_endpoint_), test_timer_(io_service_), connections_(),
clients_(), connections_num_(0), aborted_connections_num_(0),
/// connectHandler as a callback function.
void connect() {
ip::tcp::endpoint
- endpoint(ip::address::from_string(SERVER_ADDRESS),
- SERVER_PORT);
+ endpoint(ip::make_address(SERVER_ADDRESS), SERVER_PORT);
socket_.async_connect(endpoint,
std::bind(&TLSClient::connectHandler, this,
ph::_1));
/// unsuccessful.
TLSAcceptorTest()
: io_service_(new IOService()), acceptor_(io_service_),
- asio_endpoint_(ip::address::from_string(SERVER_ADDRESS),
- SERVER_PORT),
+ asio_endpoint_(ip::make_address(SERVER_ADDRESS), SERVER_PORT),
endpoint_(asio_endpoint_), test_timer_(io_service_), connections_(),
clients_(), connections_num_(0), aborted_connections_num_(0),
max_connections_(1), running_(true) {
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
server_.reset(new TlsStream<TestCallback>(io_service_, server_ctx));
// Accept a client.
- tcp::endpoint server_ep(tcp::endpoint(address::from_string(SERVER_ADDRESS),
+ tcp::endpoint server_ep(tcp::endpoint(make_address(SERVER_ADDRESS),
SERVER_PORT));
tcp::acceptor acceptor(io_service_->getInternalIOService(), server_ep);
acceptor.set_option(tcp::acceptor::reuse_address(true));
class client
{
public:
- client(boost::asio::io_service& io_context,
+ client(boost::asio::io_context& io_context,
Botan::TLS::Context& context,
const tcp::endpoint& endpoint)
: socket_(io_context, context)
return 1;
}
- boost::asio::io_service io_context;
+ boost::asio::io_context io_context;
using namespace std; // For atoi.
tcp::endpoint endpoint(
- boost::asio::ip::address::from_string(argv[1]), atoi(argv[2]));
+ boost::asio::ip::make_address(argv[1]), atoi(argv[2]));
Botan::AutoSeeded_RNG rng;
Client_Credentials_Manager creds_mgr(rng);
Client_Session_Manager sess_mgr;
class server
{
public:
- server(boost::asio::io_service& io_context,
+ server(boost::asio::io_context& io_context,
unsigned short port,
Botan::Credentials_Manager& creds_mgr,
Botan::RandomNumberGenerator& rng,
return 1;
}
- boost::asio::io_service io_context;
+ boost::asio::io_context io_context;
Botan::AutoSeeded_RNG rng;
Server_Credentials_Manager creds_mgr(rng);
class client
{
public:
- client(boost::asio::io_service& io_context,
+ client(boost::asio::io_context& io_context,
boost::asio::ssl::context& context,
const tcp::endpoint& endpoint)
: socket_(io_context, context)
return 1;
}
- boost::asio::io_service io_context;
+ boost::asio::io_context io_context;
using namespace std; // For atoi.
tcp::endpoint endpoint(
- boost::asio::ip::address::from_string(argv[1]), atoi(argv[2]));
+ boost::asio::ip::make_address(argv[1]), atoi(argv[2]));
boost::asio::ssl::context ctx(boost::asio::ssl::context::method::tls);
ctx.load_verify_file(CA_("kea-ca.crt"));
class session
{
public:
- session(boost::asio::io_service& io_context,
+ session(boost::asio::io_context& io_context,
boost::asio::ssl::context& context)
: socket_(io_context, context)
{
class server
{
public:
- server(boost::asio::io_service& io_context, unsigned short port)
+ server(boost::asio::io_context& io_context, unsigned short port)
: io_context_(io_context),
acceptor_(io_context,
boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)),
}
private:
- boost::asio::io_service& io_context_;
+ boost::asio::io_context& io_context_;
boost::asio::ip::tcp::acceptor acceptor_;
boost::asio::ssl::context context_;
};
return 1;
}
- boost::asio::io_service io_context;
+ boost::asio::io_context io_context;
using namespace std; // For atoi.
server s(io_context, atoi(argv[1]));
/// @brief Return file descriptor of underlying socket.
virtual int getNative() const {
-#if BOOST_VERSION < 106600
- return (socket_.native());
-#else
return (socket_.native_handle());
-#endif
}
/// @brief Return protocol of socket.
/// \param port The UDP port number of the endpoint.
UDPEndpoint(const IOAddress& address, const unsigned short port) :
asio_endpoint_placeholder_(
- new boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(address.toText()),
+ new boost::asio::ip::udp::endpoint(boost::asio::ip::make_address(address.toText()),
port)),
asio_endpoint_(*asio_endpoint_placeholder_)
{}
/// \brief Return file descriptor of underlying socket
virtual int getNative() const {
-#if BOOST_VERSION < 106600
- return (socket_.native());
-#else
return (socket_.native_handle());
-#endif
}
/// \brief Return protocol of socket
/// @param buffer Buffers holding the data to be sent.
/// @param handler User supplied callback to be invoked when data have
/// been sent or sending error is signalled.
- void doSend(const boost::asio::const_buffers_1& buffer,
+ void doSend(const boost::asio::const_buffer& buffer,
const UnixDomainSocket::Handler& handler);
/// @param ec Error code returned as a result of sending the data.
/// @param length Length of the data sent.
void sendHandler(const UnixDomainSocket::Handler& remote_handler,
- const boost::asio::const_buffers_1& buffer,
+ const boost::asio::const_buffer& buffer,
const boost::system::error_code& ec,
size_t length);
/// @param buffer A buffer into which the data should be received.
/// @param handler User supplied callback invoked when data have been
/// received on an error is signalled.
- void doReceive(const boost::asio::mutable_buffers_1& buffer,
+ void doReceive(const boost::asio::mutable_buffer& buffer,
const UnixDomainSocket::Handler& handler);
/// @brief Local handler invoked as a result of asynchronous receive.
/// @param ec Error code returned as a result of asynchronous receive.
/// @param length Size of the received data.
void receiveHandler(const UnixDomainSocket::Handler& remote_handler,
- const boost::asio::mutable_buffers_1& buffer,
+ const boost::asio::mutable_buffer& buffer,
const boost::system::error_code& ec,
size_t length);
}
void
-UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer,
+UnixDomainSocketImpl::doSend(const boost::asio::const_buffer& buffer,
const UnixDomainSocket::Handler& handler) {
auto local_handler = std::bind(&UnixDomainSocketImpl::sendHandler,
shared_from_this(),
void
UnixDomainSocketImpl::sendHandler(const UnixDomainSocket::Handler& remote_handler,
- const boost::asio::const_buffers_1& buffer,
+ const boost::asio::const_buffer& buffer,
const boost::system::error_code& ec,
size_t length) {
// The asynchronous send may return EWOULDBLOCK or EAGAIN on some
}
void
-UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer,
+UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffer& buffer,
const UnixDomainSocket::Handler& handler) {
auto local_handler = std::bind(&UnixDomainSocketImpl::receiveHandler,
shared_from_this(),
void
UnixDomainSocketImpl::receiveHandler(const UnixDomainSocket::Handler& remote_handler,
- const boost::asio::mutable_buffers_1& buffer,
+ const boost::asio::mutable_buffer& buffer,
const boost::system::error_code& ec,
size_t length) {
// The asynchronous receive may return EWOULDBLOCK or EAGAIN on some
int
UnixDomainSocket::getNative() const {
-#if BOOST_VERSION < 106600
- return (impl_->socket_.native());
-#else
return (impl_->socket_.native_handle());
-#endif
}
int
/// @brief Runs IO service with optional timeout.
///
- /// We iterate over calls to asio::io_service.run(), until
+ /// We iterate over calls to asio::io_context.run(), until
/// all the clients have completed their requests. We do it this way
/// because the test clients stop the io_service when they're
/// through with a request.
socket_.reset(new udp::socket(service_->getInternalIOService(),
boost::asio::ip::udp::v4()));
socket_->set_option(socket_base::reuse_address(true));
- socket_->bind(udp::endpoint(address::from_string(TEST_ADDRESS),
- TEST_PORT));
+ socket_->bind(udp::endpoint(make_address(TEST_ADDRESS), TEST_PORT));
// Once socket is created, we can post an IO request to receive some
// packet from this socket. This is asynchronous operation and
// nothing is received until another IO request to send a query is
// Setup our "loopback" server.
udp::socket udp_socket(service_->getInternalIOService(), boost::asio::ip::udp::v4());
udp_socket.set_option(socket_base::reuse_address(true));
- udp_socket.bind(udp::endpoint(address::from_string(TEST_ADDRESS),
- TEST_PORT));
+ udp_socket.bind(udp::endpoint(make_address(TEST_ADDRESS), TEST_PORT));
udp::endpoint remote;
udp_socket.async_receive_from(boost::asio::buffer(receive_buffer_,
sizeof(receive_buffer_)),
}
// Create socket that will be used to connect to remote endpoint.
- boost::asio::io_service io_service;
+ boost::asio::io_context io_service;
boost::asio::ip::udp::socket sock(io_service);
boost::system::error_code err_code;
// Create an endpoint pointed at the listener.
boost::asio::ip::udp::endpoint
- listener_endpoint(boost::asio::ip::address::from_string(TEST_ADDRESS),
+ listener_endpoint(boost::asio::ip::make_address(TEST_ADDRESS),
LISTENER_PORT);
// A response message is now ready to send. Send it!
// And get the output
labelcount_ = offsets.size();
isc_throw_assert(labelcount_ > 0 && labelcount_ <= Name::MAX_LABELS);
- ndata_.assign(ndata.data(), ndata.size());
+ ndata_.assign(ndata.data(), ndata.data() + ndata.size());
length_ = ndata_.size();
offsets_.assign(offsets.begin(), offsets.end());
}
// Get the output
labelcount_ = offsets.size();
isc_throw_assert(labelcount_ > 0 && labelcount_ <= Name::MAX_LABELS);
- ndata_.assign(ndata.data(), ndata.size());
+ ndata_.assign(ndata.data(), ndata.data() + ndata.size());
length_ = ndata_.size();
offsets_.assign(offsets.begin(), offsets.end());
// Drop the last character of the data (the \0) and append a copy of
// the origin's data
ndata_.erase(ndata_.end() - 1);
- ndata_.append(origin->ndata_);
+ ndata_.insert(ndata_.end(), origin->ndata_.begin(), origin->ndata_.end());
// Do a similar thing with offsets. However, we need to move them
// so they point after the prefix we parsed before.
Name retname;
retname.ndata_.reserve(length);
- retname.ndata_.assign(ndata_, 0, length_ - 1);
+ retname.ndata_.assign(ndata_.data(), ndata_.data() + length_ - 1);
retname.ndata_.insert(retname.ndata_.end(),
suffix.ndata_.begin(), suffix.ndata_.end());
isc_throw_assert(retname.ndata_.size() == length);
NameString::const_iterator n0 = ndata_.begin();
retname.offsets_.push_back(0);
while (rit1 != offsets_.rend()) {
- retname.ndata_.append(n0 + *rit1, n0 + *rit0);
+ retname.ndata_.insert(retname.ndata_.end(), n0 + *rit1, n0 + *rit0);
retname.offsets_.push_back(retname.ndata_.size());
++rit0;
++rit1;
// original name, and append the trailing dot explicitly.
//
retname.ndata_.reserve(retname.offsets_.back() + 1);
- retname.ndata_.assign(ndata_, offsets_[first], retname.offsets_.back());
+ auto it = ndata_.data() + offsets_[first];
+ retname.ndata_.assign(it, it + retname.offsets_.back());
retname.ndata_.push_back(0);
retname.length_ = retname.ndata_.size();
//@{
private:
/// \brief Name data string
- typedef std::basic_string<uint8_t> NameString;
+ typedef std::vector<uint8_t> NameString;
/// \brief Name offsets type
typedef std::vector<uint8_t> NameOffsets;
tcp::acceptor acceptor(io_service_->getInternalIOService());
// Use other port than SERVER_PORT to make sure that this TCP connection
// doesn't affect subsequent tests.
- tcp::endpoint endpoint(address::from_string(SERVER_ADDRESS),
- SERVER_PORT + 1);
+ tcp::endpoint endpoint(make_address(SERVER_ADDRESS), SERVER_PORT + 1);
acceptor.open(endpoint.protocol());
acceptor.bind(endpoint);
///
/// @param request HTTP request in the textual format.
void startRequest(const std::string& request) {
- tcp::endpoint endpoint(address::from_string(server_address_), server_port_);
+ tcp::endpoint endpoint(make_address(server_address_), server_port_);
socket_.async_connect(endpoint,
[this, request](const boost::system::error_code& ec) {
receive_done_ = false;
///
/// @param request HTTP request in the textual format.
void startRequest(const std::string& request) {
- tcp::endpoint endpoint(address::from_string(SERVER_ADDRESS),
- SERVER_PORT);
+ tcp::endpoint endpoint(make_address(SERVER_ADDRESS), SERVER_PORT);
stream_.lowest_layer().async_connect(endpoint,
[this, request](const boost::system::error_code& ec) {
if (ec) {
tcp::acceptor acceptor(io_service_->getInternalIOService());
// Use other port than SERVER_PORT to make sure that this TCP connection
// doesn't affect subsequent tests.
- tcp::endpoint endpoint(address::from_string(SERVER_ADDRESS),
- SERVER_PORT + 1);
+ tcp::endpoint endpoint(make_address(SERVER_ADDRESS), SERVER_PORT + 1);
acceptor.open(endpoint.protocol());
acceptor.bind(endpoint);
if (result) {
mysql_free_result(result);
}
- throw;
}
+ return (string());
}
bool isMySQLTlsConfigured() {
/// @param cfg_mgr the configuration manager instance that handles
/// configuration parsing.
///
- /// @throw DProcessBaseError is io_service is NULL.
+ /// @throw DProcessBaseError if io_service is null.
DProcessBase(const char* app_name, asiolink::IOServicePtr io_service,
DCfgMgrBasePtr cfg_mgr)
: app_name_(app_name), io_service_(io_service), shut_down_flag_(false),
/// @param io_service is the io_service used by the caller for
/// asynchronous event handling.
///
- /// @throw DProcessBaseError is io_service is NULL.
+ /// @throw DProcessBaseError if io_service is null.
DStubProcess(const char* name, asiolink::IOServicePtr io_service);
/// @brief Invoked after process instantiation to perform initialization.
/// ftCreateProcessException OR ftCreateProcessNull.
///
/// @return returns a pointer to the new process instance (DProcessBase*)
- /// or NULL if SimFailure is set to ftCreateProcessNull.
+ /// or null if SimFailure is set to ftCreateProcessNull.
/// @throw throws std::runtime_error if SimFailure is set to
/// ftCreateProcessException.
virtual DProcessBase* createProcess();
/// @brief Runs IO service with optional timeout.
///
- /// We iterate over calls to asio::io_service.run(), until
+ /// We iterate over calls to asio::io_context.run(), until
/// all the clients have completed their requests. We do it this way
/// because the test clients stop the io_service when they're
/// through with a request.
/// Upon successful connection, carry out the TLS handshake. If the handshake
/// completes successful start sending requests.
void start() {
- isc::asiolink::TCPEndpoint endpoint(boost::asio::ip::address::from_string(server_address_), server_port_);
+ isc::asiolink::TCPEndpoint endpoint(boost::asio::ip::make_address(server_address_), server_port_);
SocketCallback socket_cb(
[this](boost::system::error_code ec, size_t /*length */) {
receive_done_ = false;
/// is the equivalent of running "make shm_clean" in sysrepo:
/// https://github.com/sysrepo/sysrepo/blob/v1.4.140/CMakeLists.txt#L329-L334
static void cleanSharedMemory() {
- call_system("rm -rf /dev/shm/sr_*");
- call_system("rm -rf /dev/shm/srsub_*");
+ call_system("rm -rf /Users/razvan/isc/git/sysrepo/shm/sr_*");
+ call_system("rm -rf /Users/razvan/isc/git/sysrepo/shm/srsub_*");
}
private: