43 return os <<
"CLOSING";
45 return os <<
"FAILED";
47 return os <<
"CLOSED";
54 : packet(
std::move(packet1))
68 , m_expirationTime(
time::steady_clock::TimePoint::max())
77 BOOST_ASSERT(m_face ==
nullptr);
78 BOOST_ASSERT(m_service ==
nullptr);
101 packet.packet.size() <=
static_cast<size_t>(this->
getMtu()));
114 this->doSend(std::move(packet));
121 packet.packet.size() <=
static_cast<size_t>(this->
getMtu()));
124 this->
nInBytes += packet.packet.size();
162 if (m_persistency == newPersistency) {
166 auto oldPersistency = m_persistency;
167 m_persistency = newPersistency;
170 NFD_LOG_FACE_INFO(
"setPersistency " << oldPersistency <<
" -> " << newPersistency);
183 if (m_state == newState) {
187 bool isValid =
false;
208 BOOST_THROW_EXCEPTION(std::runtime_error(
"invalid state transition"));
221 operator<<(std::ostream& os, const FaceLogHelper<Transport>& flh)
227 os <<
"[id=" << faceId <<
",local=" << transport.
getLocalUri()
virtual void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency)
invoked after the persistency has been changed
const ssize_t QUEUE_UNSUPPORTED
indicates that the transport does not support reading the queue capacity/length
void setPersistency(ndn::nfd::FacePersistency newPersistency)
changes face persistency setting
void setFaceAndLinkService(Face &face, LinkService &service)
set Face and LinkService for Transport
Copyright (c) 2011-2015 Regents of the University of California.
#define NFD_LOG_FACE_TRACE(msg)
Log a message at TRACE level.
generalization of a network interface
std::ostream & operator<<(std::ostream &os, const Face &face)
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
virtual bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const
invoked by canChangePersistencyTo to perform the check
stores a packet along with the remote endpoint
PacketCounter nOutPackets
count of outgoing packets
void close()
request the transport to be closed
Represents a TLV element of NDN packet format.
const Face * getFace() const
ByteCounter nOutBytes
total outgoing bytes
FaceUri getRemoteUri() const
void send(Packet &&packet)
send a link-layer packet
the transport is being closed due to a failure
bool canChangePersistencyTo(ndn::nfd::FacePersistency newPersistency) const
check whether the face persistency can be changed to newPersistency
ByteCounter nInBytes
total incoming bytes
FaceUri getLocalUri() const
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
TransportState getState() const
Copyright (c) 2011-2015 Regents of the University of California.
signal::Signal< Transport, TransportState, TransportState > afterStateChange
signals when transport state changes
the transport is closed, and can be safely deallocated
void receivePacket(Transport::Packet &&packet)
performs LinkService specific operations to receive a lower-layer packet
the transport is being closed gracefully, either by the peer or by a call to close() ...
void setState(TransportState newState)
set transport state
the transport is up and can transmit packets
uint64_t FaceId
identifies a face
void receive(Packet &&packet)
receive a link-layer packet
#define NFD_LOG_INIT(name)
PacketCounter nInPackets
count of incoming packets
virtual void doClose()=0
performs Transport specific operations to close the transport
virtual ssize_t getSendQueueLength()
const FaceId INVALID_FACEID
indicates an invalid FaceId
the transport is temporarily down, and is being recovered