32 #include <netinet/in.h> 33 #include <sys/socket.h> 40 "UnicastUdpTransport");
43 ndn::nfd::FacePersistency persistency,
44 time::nanoseconds idleTimeout)
46 , m_idleTimeout(idleTimeout)
50 this->
setScope(ndn::nfd::FACE_SCOPE_NON_LOCAL);
52 this->
setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT);
70 const int value = IP_PMTUDISC_DONT;
71 if (::setsockopt(
m_socket.native_handle(), IPPROTO_IP,
72 IP_MTU_DISCOVER, &value,
sizeof(value)) < 0) {
73 NFD_LOG_FACE_WARN(
"Failed to disable path MTU discovery: " << std::strerror(errno));
78 m_idleTimeout > time::nanoseconds::zero()) {
79 scheduleClosureWhenIdle();
93 m_idleTimeout > time::nanoseconds::zero()) {
94 scheduleClosureWhenIdle();
97 m_closeIfIdleEvent.
cancel();
103 UnicastUdpTransport::scheduleClosureWhenIdle()
112 scheduleClosureWhenIdle();
void setLocalUri(const FaceUri &uri)
void setScope(ndn::nfd::FaceScope scope)
void resetRecentlyReceived()
protocol::socket m_socket
bool hasRecentlyReceived() const
ssize_t computeMtu(const Endpoint &localEndpoint)
computes maximum payload size in a UDP packet
#define NFD_LOG_FACE_WARN(msg)
Log a message at WARN level.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) final
invoked after the persistency has been changed
boost::asio::ip::udp protocol
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
#define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(cls, specialization, name)
void setLinkType(ndn::nfd::LinkType linkType)
void setPersistency(ndn::nfd::FacePersistency newPersistency)
changes face persistency setting
void close()
request the transport to be closed
ndn::nfd::FacePersistency getPersistency() const
Implements Transport for datagram-based protocols.
EventId schedule(time::nanoseconds after, const EventCallback &event)
schedule an event
bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const final
invoked by canChangePersistencyTo to perform the check
void setRemoteUri(const FaceUri &uri)
void cancel()
cancels the event manually
UnicastUdpTransport(protocol::socket &&socket, ndn::nfd::FacePersistency persistency, time::nanoseconds idleTimeout)
void setExpirationTime(const time::steady_clock::TimePoint &expirationTime)