33 #include <netinet/in.h> 34 #include <sys/socket.h> 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()
105 m_closeIfIdleEvent =
getScheduler().schedule(m_idleTimeout, [
this] {
112 scheduleClosureWhenIdle();
void setLocalUri(const FaceUri &uri)
bool hasRecentlyReceived() const
void setScope(ndn::nfd::FaceScope scope)
void resetRecentlyReceived()
protocol::socket m_socket
#define NFD_LOG_MEMBER_INIT_SPECIALIZED(cls, name)
#define NFD_LOG_FACE_DEBUG(msg)
Log a message at DEBUG level.
ssize_t computeMtu(const Endpoint &localEndpoint)
computes maximum payload size in a UDP packet
Scheduler & getScheduler()
Returns the global Scheduler instance for the calling thread.
#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
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
void setLinkType(ndn::nfd::LinkType linkType)
void setPersistency(ndn::nfd::FacePersistency newPersistency)
changes face persistency setting
void close()
Request the transport to be closed.
Implements Transport for datagram-based protocols.
bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const final
invoked by canChangePersistencyTo to perform the check
ndn::nfd::FacePersistency getPersistency() const
void setRemoteUri(const FaceUri &uri)
UnicastUdpTransport(protocol::socket &&socket, ndn::nfd::FacePersistency persistency, time::nanoseconds idleTimeout)
void setExpirationTime(const time::steady_clock::TimePoint &expirationTime)