22 #ifndef NDN_CXX_FACE_HPP
23 #define NDN_CXX_FACE_HPP
39 class PendingInterestHandle;
40 class RegisteredPrefixHandle;
41 class InterestFilterHandle;
93 class Error :
public std::runtime_error
96 using std::runtime_error::runtime_error;
132 Face(shared_ptr<Transport> transport =
nullptr);
163 Face(boost::asio::io_service& ioService);
172 Face(
const std::string& host,
const std::string& port =
"6363");
186 Face(shared_ptr<Transport> transport, KeyChain& keyChain);
201 Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService);
217 Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService, KeyChain& keyChain);
398 bool keepThread =
false)
422 boost::asio::io_service&
432 shared_ptr<Transport>
446 shared_ptr<Transport>
447 makeDefaultTransport();
453 construct(shared_ptr<Transport> transport, KeyChain& keyChain);
456 onReceiveElement(
const Block& blockFromDaemon);
460 unique_ptr<boost::asio::io_service> m_internalIoService;
462 boost::asio::io_service& m_ioService;
464 shared_ptr<Transport> m_transport;
473 unique_ptr<KeyChain> m_internalKeyChain;
476 shared_ptr<Impl> m_impl;
541 weak_ptr<Face::Impl> m_weakImpl;
Represents a TLV element of the NDN packet format.
Represents a Data packet.
Exception thrown when attempting to send a packet over size limit.
OversizedPacketError(char pktType, const Name &name, size_t wireSize)
Constructor.
Provide a communication channel with local or remote NDN forwarder.
void processEvents(time::milliseconds timeout=time::milliseconds::zero(), bool keepThread=false)
Process any data to receive or call timeout callbacks.
virtual void doProcessEvents(time::milliseconds timeout, bool keepThread)
RegisteredPrefixHandle registerPrefix(const Name &prefix, const RegisterPrefixSuccessCallback &onSuccess, const RegisterPrefixFailureCallback &onFailure, const security::SigningInfo &signingInfo=security::SigningInfo(), uint64_t flags=nfd::ROUTE_FLAG_CHILD_INHERIT)
Register prefix with the connected NDN forwarder.
RegisteredPrefixHandle setInterestFilter(const InterestFilter &filter, const InterestCallback &onInterest, const RegisterPrefixFailureCallback &onFailure, const security::SigningInfo &signingInfo=security::SigningInfo(), uint64_t flags=nfd::ROUTE_FLAG_CHILD_INHERIT)
Set InterestFilter to dispatch incoming matching interest to onInterest callback and register the fil...
boost::asio::io_service & getIoService()
Returns a reference to the io_service used by this face.
void removeAllPendingInterests()
Cancel all previously expressed Interests.
Face(shared_ptr< Transport > transport=nullptr)
Create Face using given transport (or default transport if omitted)
PendingInterestHandle expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express Interest.
shared_ptr< Transport > getTransport() const
Returns the underlying transport.
void shutdown()
Shutdown face operations.
void put(Data data)
Publish data packet.
size_t getNPendingInterests() const
Get number of pending Interests.
Handle for a registered Interest filter.
InterestFilterHandle() noexcept=default
declares the set of Interests a producer can serve, which starts with a name prefix,...
Represents an Interest packet.
Represents an absolute name.
Handle for a pending Interest.
PendingInterestHandle() noexcept=default
Handle for a registered prefix.
RegisteredPrefixHandle() noexcept
Handle to cancel an operation.
represents a Network Nack
Signing parameters passed to KeyChain.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
@ ROUTE_FLAG_CHILD_INHERIT
boost::chrono::milliseconds milliseconds
function< void(const std::string &)> UnregisterPrefixFailureCallback
Callback invoked when unregistering a prefix fails.
function< void(const InterestFilter &, const Interest &)> InterestCallback
Callback invoked when an incoming Interest matches the specified InterestFilter.
function< void(const Interest &, const lp::Nack &)> NackCallback
Callback invoked when a Nack is received in response to an expressed Interest.
function< void()> UnregisterPrefixSuccessCallback
Callback invoked when unregistering a prefix succeeds.
function< void(const Interest &)> TimeoutCallback
Callback invoked when an expressed Interest times out.
function< void(const Name &, const std::string &)> RegisterPrefixFailureCallback
Callback invoked when registerPrefix or setInterestFilter command fails.
function< void(const Name &)> RegisterPrefixSuccessCallback
Callback invoked when registerPrefix or setInterestFilter command succeeds.
function< void(const Interest &, const Data &)> DataCallback
Callback invoked when an expressed Interest is satisfied by a Data packet.