38 time::nanoseconds idleTimeout,
39 optional<ssize_t> overrideMtu)
41 , m_idleTimeout(idleTimeout)
50 this->
setMtu(std::min<ssize_t>(localEndpoint.
getMtu(), *overrideMtu));
63 snprintf(filter,
sizeof(filter),
64 "(ether proto 0x%x) && (ether src %s) && (ether dst %s) && (not vlan)",
71 m_idleTimeout > time::nanoseconds::zero()) {
72 scheduleClosureWhenIdle();
86 m_idleTimeout > time::nanoseconds::zero()) {
87 scheduleClosureWhenIdle();
90 m_closeIfIdleEvent.
cancel();
96 UnicastEthernetTransport::scheduleClosureWhenIdle()
105 scheduleClosureWhenIdle();
void setPersistency(ndn::nfd::FacePersistency newPersistency)
changes face persistency setting
void setExpirationTime(const time::steady_clock::TimePoint &expirationTime)
void setRemoteUri(const FaceUri &uri)
static time_point now() noexcept
void resetRecentlyReceived()
void close()
request the transport to be closed
void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) final
invoked after the persistency has been changed
void setLinkType(ndn::nfd::LinkType linkType)
std::string toString(char sep=':') const
Converts the address to a human-readable string.
void setPacketFilter(const char *filter) const
Install a BPF filter on the receiving socket.
void setScope(ndn::nfd::FaceScope scope)
Represents one network interface attached to the host.
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
Copyright (c) 2011-2015 Regents of the University of California.
bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const final
invoked by canChangePersistencyTo to perform the check
void cancel()
Cancel the operation.
ethernet::Address m_destAddress
void setLocalUri(const FaceUri &uri)
const uint16_t ETHERTYPE_NDN
represents the underlying protocol and address used by a Face
uint32_t getMtu() const
Returns the MTU (maximum transmission unit) of the interface.
UnicastEthernetTransport(const ndn::net::NetworkInterface &localEndpoint, const ethernet::Address &remoteEndpoint, ndn::nfd::FacePersistency persistency, time::nanoseconds idleTimeout, optional< ssize_t > overrideMtu={})
Creates an Ethernet-based transport for unicast communication.
represents an Ethernet hardware address
ndn::nfd::FacePersistency getPersistency() const
EventId schedule(time::nanoseconds after, const EventCallback &event)
Schedule an event.
Base class for Ethernet-based Transports.
bool hasRecentlyReceived() const
#define NFD_LOG_INIT(name)
A unicast Transport that uses raw Ethernet II frames.
std::string m_interfaceName
static FaceUri fromDev(const std::string &ifname)
create dev FaceUri from network device name
ethernet::Address m_srcAddress