36 const protocol::endpoint& multicastGroup,
37 protocol::socket&& recvSocket,
38 protocol::socket&& sendSocket)
40 , m_multicastGroup(multicastGroup)
41 , m_sendSocket(
std::move(sendSocket))
57 BOOST_THROW_EXCEPTION(
58 std::invalid_argument(
"MulticastUdpTransport supports only FACE_PERSISTENCY_PERMANENT"));
67 m_sendSocket.async_send_to(boost::asio::buffer(packet.packet), m_multicastGroup,
69 boost::asio::placeholders::error,
70 boost::asio::placeholders::bytes_transferred,
75 MulticastUdpTransport::doClose()
77 if (m_sendSocket.is_open()) {
82 boost::system::error_code error;
83 m_sendSocket.cancel(error);
84 m_sendSocket.close(error);
95 BOOST_ASSERT(ep.address().is_v4());
97 return (static_cast<uint64_t>(ep.port()) << 32) |
98 static_cast<uint64_t
>(ep.address().to_v4().to_ulong());
void handleSend(const boost::system::error_code &error, size_t nBytesSent, const Block &payload)
MulticastUdpTransport(const protocol::endpoint &localEndpoint, const protocol::endpoint &multicastGroup, protocol::socket &&recvSocket, protocol::socket &&sendSocket)
Creates a UDP-based transport for multicast communication.
#define NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(cls, s1, s2, name)
#define NFD_LOG_FACE_TRACE(msg)
Log a message at TRACE level.
void setPersistency(ndn::nfd::FacePersistency persistency)
changes face persistency setting
void setRemoteUri(const FaceUri &uri)
represents the underlying protocol and address used by a Face
virtual void doClose() override
performs Transport specific operations to close the transport
stores a packet along with the remote endpoint
virtual void beforeChangePersistency(ndn::nfd::FacePersistency newPersistency) final
invoked before persistency is changed
void setLinkType(ndn::nfd::LinkType linkType)
Implements Transport for datagram-based protocols.
void setScope(ndn::nfd::FaceScope scope)
static EndpointId makeEndpointId(const typename protocol::endpoint &ep)
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
Copyright (c) 2011-2015 Regents of the University of California.
void setLocalUri(const FaceUri &uri)
ssize_t computeMtu(const boost::asio::ip::udp::endpoint &localEndpoint)
computes maximum payload size in a UDP packet
boost::asio::ip::udp protocol
uint64_t EndpointId
identifies an endpoint on the link