31 Face::Face(
const FaceUri& remoteUri,
const FaceUri& localUri,
bool isLocal)
34 , m_remoteUri(remoteUri)
35 , m_localUri(localUri)
66 m_description = description;
93 if (element.type() == tlv::Interest)
95 shared_ptr<Interest> i = make_shared<Interest>();
96 i->wireDecode(element);
99 else if (element.type() == tlv::Data)
101 shared_ptr<Data> d = make_shared<Data>();
102 d->wireDecode(element);
110 catch (tlv::Error&) {
128 template<
typename FaceTraits>
132 traits.setFaceId(
getId())
137 traits.setFaceScope(ndn::nfd::FACE_SCOPE_LOCAL);
140 traits.setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL);
144 traits.setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
147 traits.setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
152 Face::copyStatusTo<ndn::nfd::FaceStatus>(ndn::nfd::FaceStatus&)
const;
155 Face::copyStatusTo<ndn::nfd::FaceEventNotification>(ndn::nfd::FaceEventNotification&)
const;
160 ndn::nfd::FaceStatus status;
virtual const std::string & getDescription() const
Get the description.
const FaceCounters & getCounters() const
virtual ndn::nfd::FaceStatus getFaceStatus() const
void copyStatusTo(FaceTraits &traits) const
virtual bool isUp() const
Get whether underlying communication is up.
EventEmitter< Data > onReceiveData
fires when a Data is received
bool decodeAndDispatchInput(const Block &element)
EventEmitter< Interest > onSendInterest
fires when an Interest is sent out
const PacketCounter & getNOutDatas() const
outgoing Data
const FaceUri & getRemoteUri() const
bool isOnDemand() const
Get whether face is created on demand or explicitly via FaceManagement protocol.
const PacketCounter & getNOutInterests() const
outgoing Interest
EventEmitter< std::string > onFail
fires when face disconnects or fails to perform properly
void fail(const std::string &reason)
fail the face and raise onFail event if it's UP; otherwise do nothing
EventEmitter< Data > onSendData
fires when a Data is sent out
void copyTo(R &recipient) const
copy current obseverations to a struct
const PacketCounter & getNInDatas() const
incoming Data
const FaceId INVALID_FACEID
indicates an invalid FaceId
const PacketCounter & getNInInterests() const
incoming Interest
virtual bool isMultiAccess() const
Get whether packets sent this Face may reach multiple peers.
virtual void setDescription(const std::string &description)
Set the description.
const FaceUri & getLocalUri() const
bool isLocal() const
Get whether face is connected to a local app.
Face(const FaceUri &remoteUri, const FaceUri &localUri, bool isLocal=false)
EventEmitter< Interest > onReceiveInterest
fires when an Interest is received