33 Multicast,
"MulticastUdpTransport");
36 const protocol::endpoint& multicastGroup,
37 protocol::socket&& recvSocket,
38 protocol::socket&& sendSocket,
39 ndn::nfd::LinkType linkType)
41 , m_multicastGroup(multicastGroup)
42 , m_sendSocket(
std::move(sendSocket))
46 this->
setScope(ndn::nfd::FACE_SCOPE_NON_LOCAL);
59 m_sendSocket.async_send_to(boost::asio::buffer(packet.packet), m_multicastGroup,
61 boost::asio::placeholders::error,
62 boost::asio::placeholders::bytes_transferred,
67 MulticastUdpTransport::doClose()
69 if (m_sendSocket.is_open()) {
74 boost::system::error_code error;
75 m_sendSocket.cancel(error);
76 m_sendSocket.close(error);
87 BOOST_ASSERT(ep.address().is_v4());
89 return (static_cast<uint64_t>(ep.port()) << 32) |
90 static_cast<uint64_t
>(ep.address().to_v4().to_ulong());
void setLocalUri(const FaceUri &uri)
void doClose() override
performs Transport specific operations to close the transport
#define NFD_LOG_FACE_TRACE(msg)
Log a message at TRACE level.
void setScope(ndn::nfd::FaceScope scope)
ssize_t computeMtu(const Endpoint &localEndpoint)
computes maximum payload size in a UDP packet
stores a packet along with the remote endpoint
void handleSend(const boost::system::error_code &error, size_t nBytesSent, const Block &payload)
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
static EndpointId makeEndpointId(const typename protocol::endpoint &ep)
boost::asio::ip::udp protocol
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
uint64_t EndpointId
identifies an endpoint on the link
#define NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(cls, s1, s2, name)
void setLinkType(ndn::nfd::LinkType linkType)
void setPersistency(ndn::nfd::FacePersistency newPersistency)
changes face persistency setting
Implements Transport for datagram-based protocols.
void setRemoteUri(const FaceUri &uri)
MulticastUdpTransport(const protocol::endpoint &localEndpoint, const protocol::endpoint &multicastGroup, protocol::socket &&recvSocket, protocol::socket &&sendSocket, ndn::nfd::LinkType linkType)
Creates a UDP-based transport for multicast communication.