26 #ifndef NFD_DAEMON_FACE_TRANSPORT_HPP
27 #define NFD_DAEMON_FACE_TRANSPORT_HPP
202 send(
const Block& packet);
235 ndn::nfd::FacePersistency
238 return m_persistency;
292 return m_sendQueueCapacity;
314 time::steady_clock::time_point
317 return m_expirationTime;
363 m_linkType = linkType;
367 setMtu(ssize_t mtu) noexcept;
372 m_sendQueueCapacity = sendQueueCapacity;
388 m_expirationTime = expirationTime;
427 doSend(
const Block& packet) = 0;
430 Face* m_face =
nullptr;
434 ndn::nfd::FaceScope m_scope = ndn::nfd::FACE_SCOPE_NONE;
435 ndn::nfd::FacePersistency m_persistency = ndn::nfd::FACE_PERSISTENCY_NONE;
436 ndn::nfd::LinkType m_linkType = ndn::nfd::LINK_TYPE_NONE;
440 time::steady_clock::time_point m_expirationTime = time::steady_clock::time_point::max();
447 std::enable_if_t<std::is_base_of_v<Transport, T> && !std::is_same_v<Transport, T>,
451 return os << FaceLogHelper<Transport>(flh.
obj);
Represents a counter of number of bytes.
Represents a counter of number of packets.
Generalization of a network interface.
For internal use by FaceLogging macros.
The upper half of a Face.
Counters provided by a transport.
ByteCounter nInBytes
Total bytes received.
PacketCounter nInPackets
Count of incoming packets.
PacketCounter nOutPackets
Count of outgoing packets.
ByteCounter nOutBytes
Total bytes sent.
The lower half of a Face.
const LinkService * getLinkService() const noexcept
Returns the LinkService to which this transport is attached.
void setScope(ndn::nfd::FaceScope scope) noexcept
void receive(const Block &packet, const EndpointId &endpoint={})
Pass a received link-layer packet to the upper layer for further processing.
void setPersistency(ndn::nfd::FacePersistency newPersistency)
Changes the persistency setting of the transport.
ssize_t getMtu() const noexcept
Returns the maximum payload size.
FaceUri getLocalUri() const noexcept
Returns a FaceUri representing the local endpoint.
ndn::nfd::FacePersistency getPersistency() const noexcept
Returns the current persistency setting of the transport.
virtual void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency)
Invoked after the persistency has been changed.
ndn::nfd::FaceScope getScope() const noexcept
Returns whether the transport is local or non-local for scope control purposes.
LinkService * getLinkService() noexcept
Returns the LinkService to which this transport is attached.
void setMtu(ssize_t mtu) noexcept
void send(const Block &packet)
Send a link-layer packet.
void setFaceAndLinkService(Face &face, LinkService &service) noexcept
Set Face and LinkService for this transport.
signal::Signal< Transport, TransportState, TransportState > afterStateChange
Called when the transport state changes.
const Face * getFace() const noexcept
Returns the Face to which this transport is attached.
TransportState getState() const noexcept
Returns the current transport state.
virtual void doClose()=0
Performs Transport specific operations to close the transport.
bool canChangePersistencyTo(ndn::nfd::FacePersistency newPersistency) const
Check whether the persistency can be changed to newPersistency.
virtual const Counters & getCounters() const
void setExpirationTime(const time::steady_clock::time_point &expirationTime) noexcept
TransportCounters Counters
Counters provided by a transport.
FaceUri getRemoteUri() const noexcept
Returns a FaceUri representing the remote endpoint.
Transport()
Default constructor.
virtual bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const
Invoked by canChangePersistencyTo to perform the check.
void setSendQueueCapacity(ssize_t sendQueueCapacity) noexcept
void setState(TransportState newState)
Set transport state.
void setLocalUri(const FaceUri &uri) noexcept
time::steady_clock::time_point getExpirationTime() const noexcept
Returns the expiration time of the transport.
ssize_t getSendQueueCapacity() const noexcept
Returns the capacity of the send queue (in bytes).
void setLinkType(ndn::nfd::LinkType linkType) noexcept
void setRemoteUri(const FaceUri &uri) noexcept
ndn::nfd::LinkType getLinkType() const noexcept
Returns the link type of the transport.
virtual ssize_t getSendQueueLength()
Returns the current send queue length of the transport (in octets).
void close()
Request the transport to be closed.
std::ostream & operator<<(std::ostream &os, const FaceLogHelper< Face > &flh)
constexpr ssize_t QUEUE_UNSUPPORTED
Indicates that the transport does not support reading the queue capacity/length.
TransportState
Indicates the state of a transport.
@ CLOSED
the transport is closed, and can be safely deallocated
@ CLOSING
the transport is being closed gracefully, either by the peer or by a call to close()
@ FAILED
the transport is being closed due to a failure
@ DOWN
the transport is temporarily down, and is being recovered
@ UP
the transport is up and can transmit packets
constexpr ssize_t MTU_INVALID
(for internal use) Indicates that the MTU field is unset.
std::variant< std::monostate, ethernet::Address, udp::Endpoint > EndpointId
Identifies a remote endpoint on the link.
constexpr ssize_t QUEUE_ERROR
Indicates that the transport was unable to retrieve the queue capacity/length.
constexpr ssize_t MTU_UNLIMITED
Indicates that the transport has no limit on payload size.