32 #include <netinet/in.h> 33 #include <sys/socket.h> 40 "UnicastUdpTransport");
44 time::nanoseconds idleTimeout)
46 , m_idleTimeout(idleTimeout)
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();
87 m_idleTimeout > time::nanoseconds::zero()) {
88 scheduleClosureWhenIdle();
91 m_closeIfIdleEvent.
cancel();
97 UnicastUdpTransport::scheduleClosureWhenIdle()
106 scheduleClosureWhenIdle();
void cancel()
cancels the event manually
void setExpirationTime(const time::steady_clock::TimePoint &expirationTime)
#define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(cls, specialization, name)
void setPersistency(ndn::nfd::FacePersistency persistency)
changes face persistency setting
void setRemoteUri(const FaceUri &uri)
static time_point now() noexcept
protocol::socket m_socket
represents the underlying protocol and address used by a Face
void close()
request the transport to be closed
void setLinkType(ndn::nfd::LinkType linkType)
Implements Transport for datagram-based protocols.
UnicastUdpTransport(protocol::socket &&socket, ndn::nfd::FacePersistency persistency, time::nanoseconds idleTimeout)
void setScope(ndn::nfd::FaceScope scope)
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
Copyright (c) 2011-2015 Regents of the University of California.
virtual void beforeChangePersistency(ndn::nfd::FacePersistency newPersistency) final
invoked before persistency is changed
void setLocalUri(const FaceUri &uri)
ndn::nfd::FacePersistency getPersistency() const
EventId schedule(const time::nanoseconds &after, const Scheduler::Event &event)
schedule an event
ssize_t computeMtu(const boost::asio::ip::udp::endpoint &localEndpoint)
computes maximum payload size in a UDP packet
boost::asio::ip::udp protocol
bool hasBeenUsedRecently() const
#define NFD_LOG_FACE_WARN(msg)
Log a message at WARN level.