36 const ethernet::Address& remoteEndpoint,
37 ndn::nfd::FacePersistency persistency,
38 time::nanoseconds idleTimeout)
40 , m_idleTimeout(idleTimeout)
44 this->
setScope(ndn::nfd::FACE_SCOPE_NON_LOCAL);
46 this->
setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT);
47 this->
setMtu(localEndpoint.getMtu());
54 std::snprintf(filter,
sizeof(filter),
55 "(ether proto 0x%x) && (ether src %s) && (ether dst %s) && (not vlan)",
56 ethernet::ETHERTYPE_NDN,
62 m_idleTimeout > time::nanoseconds::zero()) {
63 scheduleClosureWhenIdle();
77 m_idleTimeout > time::nanoseconds::zero()) {
78 scheduleClosureWhenIdle();
81 m_closeIfIdleEvent.cancel();
87 UnicastEthernetTransport::scheduleClosureWhenIdle()
89 m_closeIfIdleEvent =
getScheduler().schedule(m_idleTimeout, [
this] {
96 scheduleClosureWhenIdle();
Base class for Ethernet-based Transports.
bool hasRecentlyReceived() const
std::string m_interfaceName
ethernet::Address m_srcAddress
ethernet::Address m_destAddress
void resetRecentlyReceived()
void setPacketFilter(const char *filter) const
Install a BPF filter on the receiving socket.
void setScope(ndn::nfd::FaceScope scope) noexcept
void setPersistency(ndn::nfd::FacePersistency newPersistency)
Changes the persistency setting of the transport.
ndn::nfd::FacePersistency getPersistency() const noexcept
Returns the current persistency setting of the transport.
void setMtu(ssize_t mtu) noexcept
void setExpirationTime(const time::steady_clock::time_point &expirationTime) noexcept
void setLocalUri(const FaceUri &uri) noexcept
void setLinkType(ndn::nfd::LinkType linkType) noexcept
void setRemoteUri(const FaceUri &uri) noexcept
void close()
Request the transport to be closed.
void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) final
Invoked after the persistency has been changed.
bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const final
Invoked by canChangePersistencyTo to perform the check.
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.
#define NFD_LOG_FACE_DEBUG(msg)
Log a message at DEBUG level.
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
#define NFD_LOG_INIT(name)
ndn::Scheduler & getScheduler()
Returns the global Scheduler instance for the calling thread.