26 #ifndef NFD_DAEMON_FACE_FACE_HPP
27 #define NFD_DAEMON_FACE_FACE_HPP
32 #include <ndn-cxx/util/face-uri.hpp>
33 #include <ndn-cxx/management/nfd-face-status.hpp>
34 #include <ndn-cxx/management/nfd-face-event-notification.hpp>
55 using ndn::util::FaceUri;
59 class Face : noncopyable,
public enable_shared_from_this<Face>
65 class Error :
public std::runtime_error
70 : std::runtime_error(what)
75 Face(
const FaceUri& remoteUri,
const FaceUri& localUri,
bool isLocal =
false);
123 virtual const std::string&
171 template<
typename FaceTraits>
177 virtual ndn::nfd::FaceStatus
194 fail(
const std::string& reason);
202 std::string m_description;
233 inline const FaceUri&
239 inline const FaceUri&
271 #endif // NFD_DAEMON_FACE_FACE_HPP
void setOnDemand(bool isOnDemand)
virtual const std::string & getDescription() const
Get the description.
const FaceId FACEID_INTERNAL_FACE
identifies the InternalFace used in management
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.
const FaceId FACEID_RESERVED_MAX
upper bound of reserved FaceIds
EventEmitter< Data > onReceiveData
fires when a Data is received
Error(const std::string &what)
contains counters on face
bool decodeAndDispatchInput(const Block &element)
EventEmitter< Interest > onSendInterest
fires when an Interest is sent out
uint64_t getMetric() const
virtual void sendData(const Data &data)=0
send a Data
const FaceUri & getRemoteUri() const
bool isOnDemand() const
Get whether face is created on demand or explicitly via FaceManagement protocol.
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
FaceCounters & getMutableCounters()
void setMetric(uint64_t metric)
const FaceId FACEID_NULL
identifies the NullFace that drops every packet
const FaceId FACEID_CONTENT_STORE
identifies a packet comes from the ContentStore, in LocalControlHeader incomingFaceId ...
const FaceId INVALID_FACEID
indicates an invalid FaceId
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
virtual void close()=0
Close the face.
bool isLocal() const
Get whether face is connected to a local app.
Face(const FaceUri &remoteUri, const FaceUri &localUri, bool isLocal=false)
virtual void sendInterest(const Interest &interest)=0
send an Interest
EventEmitter< Interest > onReceiveInterest
fires when an Interest is received