face: minor code cleanups

Change-Id: I154d2ad4dfd9e12e1fa9756f74884286b31298e4
This commit is contained in:
Davide Pesavento committed 2023-10-08 19:26:55 -04:00
1 parent 9c36a65b11
commit c0df94ed10
21 files changed
+106 -103

No files matched your search

+4 -3
View File
@@ -40,7 +40,7 @@ struct Unicast {};
struct Multicast {};
/**
* \brief Implements Transport for datagram-based protocols.
* \brief Implements a Transport for datagram-based protocols.
*
* \tparam Protocol A datagram-based protocol in Boost.Asio
* \tparam Addressing The addressing mode, either Unicast or Multicast
@@ -52,9 +52,10 @@ public:
using protocol = Protocol;
using addressing = Addressing;
/** \brief Construct datagram transport.
/**
* \brief Construct datagram transport.
*
* \param socket Protocol-specific socket for the created transport
* \param socket Protocol-specific socket for the created transport
*/
explicit
DatagramTransport(typename protocol::socket&& socket);
+4 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,7 +36,7 @@
namespace nfd::face {
/**
* @brief Base class for Ethernet-based Transports
* @brief Base class for Ethernet-based Transports.
*/
class EthernetTransport : public Transport
{
@@ -48,7 +48,7 @@ public:
};
/**
* @brief Processes the payload of an incoming frame
* @brief Processes the payload of an incoming frame.
* @param payload Payload bytes, starting from the first byte after the Ethernet header
* @param sender Sender address
*/
@@ -82,7 +82,7 @@ private:
doSend(const Block& packet) final;
/**
* @brief Sends the specified TLV block on the network wrapped in an Ethernet frame
* @brief Sends the specified TLV block on the network wrapped in an Ethernet frame.
*/
void
sendPacket(const ndn::Block& block);
+2 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -103,8 +103,7 @@ MulticastEthernetTransport::joinMulticastGroup()
#if defined(__APPLE__) || defined(__FreeBSD__)
// see bug #2327
using boost::asio::ip::udp;
udp::socket sock(getGlobalIoService(), udp::v4());
boost::asio::ip::udp::socket sock(getGlobalIoService(), boost::asio::ip::udp::v4());
int fd = sock.native_handle();
// Differences between Linux and the BSDs (including macOS):
+4 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -31,13 +31,13 @@
namespace nfd::face {
/**
* @brief A multicast Transport that uses raw Ethernet II frames
* @brief A multicast Transport that uses raw Ethernet II frames.
*/
class MulticastEthernetTransport final : public EthernetTransport
{
public:
/**
* @brief Creates an Ethernet-based transport for multicast communication
* @brief Creates an Ethernet-based transport for multicast communication.
*/
MulticastEthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& mcastAddress,
@@ -45,7 +45,7 @@ public:
private:
/**
* @brief Enables receiving frames addressed to our MAC multicast group
* @brief Enables receiving frames addressed to our MAC multicast group.
*/
void
joinMulticastGroup();
+22 -21
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -40,11 +40,13 @@
namespace nfd::face {
NFD_LOG_MEMBER_INIT_SPECIALIZED((DatagramTransport<boost::asio::ip::udp, Multicast>), MulticastUdpTransport);
namespace ip = boost::asio::ip;
MulticastUdpTransport::MulticastUdpTransport(const protocol::endpoint& multicastGroup,
protocol::socket&& recvSocket,
protocol::socket&& sendSocket,
NFD_LOG_MEMBER_INIT_SPECIALIZED((DatagramTransport<ip::udp, Multicast>), MulticastUdpTransport);
MulticastUdpTransport::MulticastUdpTransport(const ip::udp::endpoint& multicastGroup,
ip::udp::socket&& recvSocket,
ip::udp::socket&& sendSocket,
ndn::nfd::LinkType linkType)
: DatagramTransport(std::move(recvSocket))
, m_multicastGroup(multicastGroup)
@@ -57,7 +59,7 @@ MulticastUdpTransport::MulticastUdpTransport(const protocol::endpoint& multicast
this->setLinkType(linkType);
this->setMtu(udp::computeMtu(m_sendSocket.local_endpoint()));
protocol::socket::send_buffer_size sendBufferSizeOption;
boost::asio::socket_base::send_buffer_size sendBufferSizeOption;
boost::system::error_code error;
m_sendSocket.get_option(sendBufferSizeOption);
if (error) {
@@ -131,27 +133,26 @@ bindToDevice(int fd, const std::string& ifname)
}
void
MulticastUdpTransport::openRxSocket(protocol::socket& sock,
const protocol::endpoint& multicastGroup,
const boost::asio::ip::address& localAddress,
MulticastUdpTransport::openRxSocket(ip::udp::socket& sock,
const ip::udp::endpoint& multicastGroup,
const ip::address& localAddress,
const ndn::net::NetworkInterface* netif)
{
BOOST_ASSERT(!sock.is_open());
sock.open(multicastGroup.protocol());
sock.set_option(protocol::socket::reuse_address(true));
sock.set_option(boost::asio::socket_base::reuse_address(true));
if (multicastGroup.address().is_v4()) {
BOOST_ASSERT(localAddress.is_v4());
sock.bind(multicastGroup);
sock.set_option(boost::asio::ip::multicast::join_group(multicastGroup.address().to_v4(),
localAddress.to_v4()));
sock.set_option(ip::multicast::join_group(multicastGroup.address().to_v4(), localAddress.to_v4()));
}
else {
BOOST_ASSERT(multicastGroup.address().to_v6().scope_id() != 0);
sock.set_option(boost::asio::ip::v6_only(true));
sock.set_option(ip::v6_only(true));
sock.bind(multicastGroup);
sock.set_option(boost::asio::ip::multicast::join_group(multicastGroup.address().to_v6()));
sock.set_option(ip::multicast::join_group(multicastGroup.address().to_v6()));
}
if (netif)
@@ -159,27 +160,27 @@ MulticastUdpTransport::openRxSocket(protocol::socket& sock,
}
void
MulticastUdpTransport::openTxSocket(protocol::socket& sock,
const protocol::endpoint& localEndpoint,
MulticastUdpTransport::openTxSocket(ip::udp::socket& sock,
const ip::udp::endpoint& localEndpoint,
const ndn::net::NetworkInterface* netif,
bool enableLoopback)
{
BOOST_ASSERT(!sock.is_open());
sock.open(localEndpoint.protocol());
sock.set_option(protocol::socket::reuse_address(true));
sock.set_option(boost::asio::ip::multicast::enable_loopback(enableLoopback));
sock.set_option(boost::asio::socket_base::reuse_address(true));
sock.set_option(ip::multicast::enable_loopback(enableLoopback));
if (localEndpoint.address().is_v4()) {
sock.bind(localEndpoint);
if (!localEndpoint.address().is_unspecified())
sock.set_option(boost::asio::ip::multicast::outbound_interface(localEndpoint.address().to_v4()));
sock.set_option(ip::multicast::outbound_interface(localEndpoint.address().to_v4()));
}
else {
sock.set_option(boost::asio::ip::v6_only(true));
sock.set_option(ip::v6_only(true));
sock.bind(localEndpoint);
if (netif)
sock.set_option(boost::asio::ip::multicast::outbound_interface(netif->getIndex()));
sock.set_option(ip::multicast::outbound_interface(netif->getIndex()));
}
}
+14 -14
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,7 +36,7 @@ namespace nfd::face {
NFD_LOG_MEMBER_DECL_SPECIALIZED((DatagramTransport<boost::asio::ip::udp, Multicast>));
/**
* \brief A Transport that communicates on a UDP multicast group
* \brief A Transport that communicates on a UDP multicast group.
*/
class MulticastUdpTransport final : public DatagramTransport<boost::asio::ip::udp, Multicast>
{
@@ -48,35 +48,35 @@ public:
};
/**
* \brief Creates a UDP-based transport for multicast communication
* \brief Creates a UDP-based transport for multicast communication.
* \param multicastGroup multicast group
* \param recvSocket socket used to receive multicast packets
* \param sendSocket socket used to send to the multicast group
* \param linkType either `ndn::nfd::LINK_TYPE_MULTI_ACCESS` or `ndn::nfd::LINK_TYPE_AD_HOC`
*/
MulticastUdpTransport(const protocol::endpoint& multicastGroup,
protocol::socket&& recvSocket,
protocol::socket&& sendSocket,
MulticastUdpTransport(const boost::asio::ip::udp::endpoint& multicastGroup,
boost::asio::ip::udp::socket&& recvSocket,
boost::asio::ip::udp::socket&& sendSocket,
ndn::nfd::LinkType linkType);
ssize_t
getSendQueueLength() final;
/**
* \brief Opens and configures the receive-side socket
* \brief Opens and configures the receive-side socket.
*/
static void
openRxSocket(protocol::socket& sock,
const protocol::endpoint& multicastGroup,
openRxSocket(boost::asio::ip::udp::socket& sock,
const boost::asio::ip::udp::endpoint& multicastGroup,
const boost::asio::ip::address& localAddress = {},
const ndn::net::NetworkInterface* netif = nullptr);
/**
* \brief Opens and configures the transmit-side socket
* \brief Opens and configures the transmit-side socket.
*/
static void
openTxSocket(protocol::socket& sock,
const protocol::endpoint& localEndpoint,
openTxSocket(boost::asio::ip::udp::socket& sock,
const boost::asio::ip::udp::endpoint& localEndpoint,
const ndn::net::NetworkInterface* netif = nullptr,
bool enableLoopback = false);
@@ -88,8 +88,8 @@ private:
doClose() final;
private:
protocol::endpoint m_multicastGroup;
protocol::socket m_sendSocket;
boost::asio::ip::udp::endpoint m_multicastGroup;
boost::asio::ip::udp::socket m_sendSocket;
};
} // namespace nfd::face
+1 -1
View File
@@ -44,7 +44,7 @@ public:
~NetworkPredicateBase();
/**
* \brief Set the whitelist to "*" and clear the blacklist
* \brief Set the whitelist to "*" and clear the blacklist.
*/
void
clear();
+6 -4
View File
@@ -37,9 +37,10 @@
namespace nfd::face {
/** \brief Implements Transport for stream-based protocols.
/**
* \brief Implements a Transport for stream-based protocols.
*
* \tparam Protocol a stream-based protocol in Boost.Asio
* \tparam Protocol a stream-based protocol in Boost.Asio
*/
template<class Protocol>
class StreamTransport : public Transport
@@ -47,9 +48,10 @@ class StreamTransport : public Transport
public:
using protocol = Protocol;
/** \brief Construct stream transport.
/**
* \brief Construct stream transport.
*
* \param socket Protocol-specific socket for the created transport
* \param socket Protocol-specific socket for the created transport
*/
explicit
StreamTransport(typename protocol::socket&& socket);
+3 -3
View File
@@ -33,10 +33,10 @@
namespace nfd::face {
NFD_LOG_INIT(TcpChannel);
namespace ip = boost::asio::ip;
NFD_LOG_INIT(TcpChannel);
TcpChannel::TcpChannel(const tcp::Endpoint& localEndpoint, bool wantCongestionMarking,
DetermineFaceScopeFromAddress determineFaceScope)
: m_localEndpoint(localEndpoint)
@@ -59,7 +59,7 @@ TcpChannel::listen(const FaceCreatedCallback& onFaceCreated,
}
m_acceptor.open(m_localEndpoint.protocol());
m_acceptor.set_option(ip::tcp::acceptor::reuse_address(true));
m_acceptor.set_option(boost::asio::socket_base::reuse_address(true));
if (m_localEndpoint.address().is_v6()) {
m_acceptor.set_option(ip::v6_only(true));
}
+2 -2
View File
@@ -215,8 +215,8 @@ TcpFactory::doGetChannels() const
}
ndn::nfd::FaceScope
TcpFactory::determineFaceScopeFromAddresses(const boost::asio::ip::address& localAddress,
const boost::asio::ip::address& remoteAddress) const
TcpFactory::determineFaceScopeFromAddresses(const ip::address& localAddress,
const ip::address& remoteAddress) const
{
if (m_local(localAddress) && m_local(remoteAddress)) {
return ndn::nfd::FACE_SCOPE_LOCAL;
+5 -3
View File
@@ -35,9 +35,11 @@
namespace nfd::face {
NFD_LOG_MEMBER_INIT_SPECIALIZED(StreamTransport<boost::asio::ip::tcp>, TcpTransport);
namespace ip = boost::asio::ip;
TcpTransport::TcpTransport(protocol::socket&& socket,
NFD_LOG_MEMBER_INIT_SPECIALIZED(StreamTransport<ip::tcp>, TcpTransport);
TcpTransport::TcpTransport(ip::tcp::socket&& socket,
ndn::nfd::FacePersistency persistency,
ndn::nfd::FaceScope faceScope)
: StreamTransport(std::move(socket))
@@ -130,7 +132,7 @@ TcpTransport::reconnect()
BOOST_ASSERT(getState() == TransportState::DOWN);
// recreate the socket
m_socket = protocol::socket(m_socket.get_executor());
m_socket = ip::tcp::socket(m_socket.get_executor());
this->resetReceiveBuffer();
this->resetSendQueue();
+10 -12
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -35,7 +35,7 @@ namespace nfd::face {
NFD_LOG_MEMBER_DECL_SPECIALIZED(StreamTransport<boost::asio::ip::tcp>);
/**
* \brief A Transport that communicates on a connected TCP socket
* \brief A Transport that communicates on a connected TCP socket.
*
* When persistency is set to permanent, whenever the TCP connection is severed, the transport
* state is set to DOWN, and the connection is retried periodically with exponential backoff
@@ -44,7 +44,9 @@ NFD_LOG_MEMBER_DECL_SPECIALIZED(StreamTransport<boost::asio::ip::tcp>);
class TcpTransport NFD_FINAL_UNLESS_WITH_TESTS : public StreamTransport<boost::asio::ip::tcp>
{
public:
TcpTransport(protocol::socket&& socket, ndn::nfd::FacePersistency persistency, ndn::nfd::FaceScope faceScope);
TcpTransport(boost::asio::ip::tcp::socket&& socket,
ndn::nfd::FacePersistency persistency,
ndn::nfd::FaceScope faceScope);
ssize_t
getSendQueueLength() final;
@@ -74,29 +76,25 @@ NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE:
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/**
* \brief Delay before the first reconnection attempt after the TCP connection has been severed
* \brief Delay before the first reconnection attempt after the TCP connection has been severed.
*/
static constexpr time::milliseconds INITIAL_RECONNECT_DELAY = 1_s;
/**
* \brief Maximum amount of time to wait before a reconnection attempt
* \brief Maximum amount of time to wait before a reconnection attempt.
*/
static constexpr time::milliseconds MAX_RECONNECT_DELAY = 5_min;
/**
* \brief Multiplier for the exponential backoff of the reconnection timer
* \brief Multiplier for the exponential backoff of the reconnection timer.
*/
static constexpr float RECONNECT_DELAY_MULTIPLIER = 2.0f;
private:
typename protocol::endpoint m_remoteEndpoint;
boost::asio::ip::tcp::endpoint m_remoteEndpoint;
/** \note valid only when persistency is set to permanent
*/
// The following members are valid only when the persistency is set to permanent
scheduler::ScopedEventId m_reconnectEvent;
/** \note valid only when persistency is set to permanent
*/
time::milliseconds m_nextReconnectWait;
};
+5 -5
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,10 +33,10 @@
namespace nfd::face {
NFD_LOG_INIT(UdpChannel);
namespace ip = boost::asio::ip;
NFD_LOG_INIT(UdpChannel);
UdpChannel::UdpChannel(const udp::Endpoint& localEndpoint,
time::nanoseconds idleTimeout,
bool wantCongestionMarking,
@@ -83,7 +83,7 @@ UdpChannel::listen(const FaceCreatedCallback& onFaceCreated,
}
m_socket.open(m_localEndpoint.protocol());
m_socket.set_option(ip::udp::socket::reuse_address(true));
m_socket.set_option(boost::asio::socket_base::reuse_address(true));
if (m_localEndpoint.address().is_v6()) {
m_socket.set_option(ip::v6_only(true));
}
@@ -160,7 +160,7 @@ UdpChannel::createFace(const udp::Endpoint& remoteEndpoint,
// else, create a new face
ip::udp::socket socket(getGlobalIoService(), m_localEndpoint.protocol());
socket.set_option(ip::udp::socket::reuse_address(true));
socket.set_option(boost::asio::socket_base::reuse_address(true));
socket.bind(m_localEndpoint);
socket.connect(remoteEndpoint);
-4
View File
@@ -91,10 +91,6 @@ private:
waitForNewPeer(const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onReceiveFailed);
/**
* \brief The channel has received a packet from a remote
* endpoint not associated with any UDP face yet.
*/
void
handleNewPeer(const boost::system::error_code& error,
size_t nBytesReceived,
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -31,13 +31,13 @@
namespace nfd::face {
/**
* @brief A unicast Transport that uses raw Ethernet II frames
* @brief A unicast Transport that uses raw Ethernet II frames.
*/
class UnicastEthernetTransport final : public EthernetTransport
{
public:
/**
* @brief Creates an Ethernet-based transport for unicast communication
* @brief Creates an Ethernet-based transport for unicast communication.
*/
UnicastEthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& remoteEndpoint,
+5 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,9 +36,11 @@
namespace nfd::face {
NFD_LOG_MEMBER_INIT_SPECIALIZED((DatagramTransport<boost::asio::ip::udp, Unicast>), UnicastUdpTransport);
namespace ip = boost::asio::ip;
UnicastUdpTransport::UnicastUdpTransport(protocol::socket&& socket,
NFD_LOG_MEMBER_INIT_SPECIALIZED((DatagramTransport<ip::udp, Unicast>), UnicastUdpTransport);
UnicastUdpTransport::UnicastUdpTransport(ip::udp::socket&& socket,
ndn::nfd::FacePersistency persistency,
time::nanoseconds idleTimeout)
: DatagramTransport(std::move(socket))
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -35,12 +35,12 @@ namespace nfd::face {
NFD_LOG_MEMBER_DECL_SPECIALIZED((DatagramTransport<boost::asio::ip::udp, Unicast>));
/**
* \brief A Transport that communicates on a unicast UDP socket
* \brief A Transport that communicates on a unicast UDP socket.
*/
class UnicastUdpTransport final : public DatagramTransport<boost::asio::ip::udp, Unicast>
{
public:
UnicastUdpTransport(protocol::socket&& socket,
UnicastUdpTransport(boost::asio::ip::udp::socket&& socket,
ndn::nfd::FacePersistency persistency,
time::nanoseconds idleTimeout);
+6 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,13 +27,15 @@
namespace nfd::face {
NFD_LOG_MEMBER_INIT_SPECIALIZED(StreamTransport<boost::asio::local::stream_protocol>, UnixStreamTransport);
namespace local = boost::asio::local;
UnixStreamTransport::UnixStreamTransport(protocol::socket&& socket)
NFD_LOG_MEMBER_INIT_SPECIALIZED(StreamTransport<local::stream_protocol>, UnixStreamTransport);
UnixStreamTransport::UnixStreamTransport(local::stream_protocol::socket&& socket)
: StreamTransport(std::move(socket))
{
static_assert(
std::is_same_v<std::remove_cv_t<protocol::socket::native_handle_type>, int>,
std::is_same_v<std::remove_cv_t<local::stream_protocol::socket::native_handle_type>, int>,
"The native handle type for UnixStreamTransport sockets must be 'int'"
);
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -39,13 +39,13 @@ namespace nfd::face {
NFD_LOG_MEMBER_DECL_SPECIALIZED(StreamTransport<boost::asio::local::stream_protocol>);
/**
* \brief A Transport that communicates on a stream-oriented Unix domain socket
* \brief A Transport that communicates on a stream-oriented Unix domain socket.
*/
class UnixStreamTransport final : public StreamTransport<boost::asio::local::stream_protocol>
{
public:
explicit
UnixStreamTransport(protocol::socket&& socket);
UnixStreamTransport(boost::asio::local::stream_protocol::socket&& socket);
};
} // namespace nfd::face
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -48,7 +48,7 @@ protected:
{
BOOST_REQUIRE(!acceptor.is_open());
acceptor.open(remoteEp.protocol());
acceptor.set_option(tcp::acceptor::reuse_address(true));
acceptor.set_option(boost::asio::socket_base::reuse_address(true));
acceptor.bind(remoteEp);
acceptor.listen(1);
acceptor.async_accept(remoteSocket, [this] (const boost::system::error_code& error) {
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -66,7 +66,7 @@ protected:
{
udp::endpoint remoteEp(address, 7070);
remoteSocket.open(remoteEp.protocol());
remoteSocket.set_option(udp::socket::reuse_address(true));
remoteSocket.set_option(boost::asio::socket_base::reuse_address(true));
remoteSocket.bind(remoteEp);
remoteSocket.connect(localEp);
}