43 return os <<
"CLOSING";
45 return os <<
"FAILED";
47 return os <<
"CLOSED";
54 : packet(
std::move(packet1))
62 , m_scope(
ndn::
nfd::FACE_SCOPE_NONE)
63 , m_persistency(
ndn::
nfd::FACE_PERSISTENCY_NONE)
64 , m_linkType(
ndn::
nfd::LINK_TYPE_NONE)
67 , m_expirationTime(time::steady_clock::TimePoint::max())
76 BOOST_ASSERT(m_face ==
nullptr);
77 BOOST_ASSERT(m_service ==
nullptr);
100 packet.packet.size() <=
static_cast<size_t>(this->
getMtu()));
113 this->doSend(std::move(packet));
120 packet.packet.size() <=
static_cast<size_t>(this->
getMtu()));
123 this->
nInBytes += packet.packet.size();
132 if (m_persistency == newPersistency || m_persistency == ndn::nfd::FACE_PERSISTENCY_NONE) {
136 if (newPersistency == ndn::nfd::FACE_PERSISTENCY_NONE) {
155 if (m_persistency == newPersistency) {
159 auto oldPersistency = m_persistency;
160 m_persistency = newPersistency;
162 if (oldPersistency != ndn::nfd::FACE_PERSISTENCY_NONE) {
163 NFD_LOG_FACE_INFO(
"setPersistency " << oldPersistency <<
" -> " << newPersistency);
176 if (m_state == newState) {
180 bool isValid =
false;
201 BOOST_THROW_EXCEPTION(std::runtime_error(
"invalid state transition"));
214 operator<<(std::ostream& os, const FaceLogHelper<Transport>& flh)
220 os <<
"[id=" << faceId <<
",local=" << transport.
getLocalUri()
virtual void doClose()=0
performs Transport specific operations to close the transport
Copyright (c) 2014-2017, Regents of the University of California, Arizona Board of Regents...
#define NFD_LOG_FACE_TRACE(msg)
Log a message at TRACE level.
const ssize_t MTU_UNLIMITED
indicates the transport has no limit on payload size
TransportState
indicates the state of a transport
const ssize_t MTU_INVALID
(for internal use) indicates MTU field is unset
std::ostream & operator<<(std::ostream &os, const FaceLogHelper< Face > &flh)
signal::Signal< Transport, TransportState, TransportState > afterStateChange
signals when transport state changes
FaceUri getRemoteUri() const
void receive(Packet &&packet)
receive a link-layer packet
stores a packet along with the remote endpoint
ByteCounter nInBytes
total incoming bytes
the transport is being closed due to a failure
virtual bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const
invoked by canChangePersistencyTo to perform the check
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
the transport is closed, and can be safely deallocated
virtual void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency)
invoked after the persistency has been changed
PacketCounter nInPackets
count of incoming packets
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
const Face * getFace() const
generalization of a network interface
the transport is being closed gracefully, either by the peer or by a call to close() ...
PacketCounter nOutPackets
count of outgoing packets
void send(Packet &&packet)
send a link-layer packet
void setPersistency(ndn::nfd::FacePersistency newPersistency)
changes face persistency setting
void close()
request the transport to be closed
#define NFD_LOG_INIT(name)
TransportState getState() const
void receivePacket(Transport::Packet &&packet)
performs LinkService specific operations to receive a lower-layer packet
FaceUri getLocalUri() const
void setState(TransportState newState)
set transport state
the transport is up and can transmit packets
uint64_t FaceId
identifies a face
ByteCounter nOutBytes
total outgoing bytes
bool canChangePersistencyTo(ndn::nfd::FacePersistency newPersistency) const
check whether the face persistency can be changed to newPersistency
const FaceId INVALID_FACEID
indicates an invalid FaceId
void setFaceAndLinkService(Face &face, LinkService &service)
set Face and LinkService for Transport
the transport is temporarily down, and is being recovered