37 const ethernet::Address& remoteEndpoint,
38 ndn::nfd::FacePersistency persistency,
39 time::nanoseconds idleTimeout)
41 , m_idleTimeout(idleTimeout)
45 this->
setScope(ndn::nfd::FACE_SCOPE_NON_LOCAL);
47 this->
setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT);
48 this->
setMtu(localEndpoint.getMtu());
57 snprintf(filter,
sizeof(filter),
58 "(ether proto 0x%x) && (ether src %s) && (ether dst %s) && (not vlan)",
59 ethernet::ETHERTYPE_NDN,
65 m_idleTimeout > time::nanoseconds::zero()) {
66 scheduleClosureWhenIdle();
80 m_idleTimeout > time::nanoseconds::zero()) {
81 scheduleClosureWhenIdle();
84 m_closeIfIdleEvent.cancel();
90 UnicastEthernetTransport::scheduleClosureWhenIdle()
92 m_closeIfIdleEvent =
getScheduler().schedule(m_idleTimeout, [
this] {
99 scheduleClosureWhenIdle();
ethernet::Address m_srcAddress
void setLocalUri(const FaceUri &uri)
bool hasRecentlyReceived() const
ethernet::Address m_destAddress
UnicastEthernetTransport(const ndn::net::NetworkInterface &localEndpoint, const ethernet::Address &remoteEndpoint, ndn::nfd::FacePersistency persistency, time::nanoseconds idleTimeout)
Creates an Ethernet-based transport for unicast communication.
void setScope(ndn::nfd::FaceScope scope)
void resetRecentlyReceived()
#define NFD_LOG_FACE_DEBUG(msg)
Log a message at DEBUG level.
void setPacketFilter(const char *filter) const
Install a BPF filter on the receiving socket.
bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const final
invoked by canChangePersistencyTo to perform the check
std::string m_interfaceName
Scheduler & getScheduler()
Returns the global Scheduler instance for the calling thread.
Base class for Ethernet-based Transports.
void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) final
invoked after the persistency has been changed
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
#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.
#define NFD_LOG_INIT(name)
ndn::nfd::FacePersistency getPersistency() const
void setRemoteUri(const FaceUri &uri)
void setExpirationTime(const time::steady_clock::TimePoint &expirationTime)