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);
161 Face(boost::asio::io_context& ioCtx);
170 Face(
const std::string& host,
const std::string& port =
"6363");
184 Face(shared_ptr<Transport> transport,
KeyChain& keyChain);
199 Face(shared_ptr<Transport> transport, boost::asio::io_context& ioCtx);
215 Face(shared_ptr<Transport> transport, boost::asio::io_context& ioCtx,
KeyChain& keyChain);
421 boost::asio::io_context&
430 [[deprecated(
"use getIoContext")]]
431 boost::asio::io_context&
456 construct(shared_ptr<Transport> transport,
KeyChain& keyChain);
459 onReceiveElement(
const Block& blockFromDaemon);
463 unique_ptr<boost::asio::io_context> m_internalIoCtx;
465 boost::asio::io_context& m_ioCtx;
467 shared_ptr<Transport> m_transport;
476 unique_ptr<KeyChain> m_internalKeyChain;
479 shared_ptr<Impl> m_impl;
535 unregister(const weak_ptr<
Face::Impl>& impl, detail::
RecordId id,
540 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.
boost::asio::io_context & getIoContext() const noexcept
Returns a reference to the io_context used by this face.
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...
Transport & getTransport() const
Returns the underlying transport.
virtual void doProcessEvents(time::milliseconds timeout, bool keepRunning)
void removeAllPendingInterests()
Cancel all previously expressed Interests.
Face(shared_ptr< Transport > transport=nullptr)
Create Face using the given Transport (or default transport if omitted).
void put(const Data &data)
Publish a Data packet.
boost::asio::io_context & getIoService() const noexcept
PendingInterestHandle expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express an Interest.
void shutdown()
Shutdown face operations.
size_t getNPendingInterests() const
Get number of pending Interests.
void processEvents(time::milliseconds timeout=0_ms, bool keepRunning=false)
Run the event loop to process any pending work and execute completion handlers.
Handle for a registered Interest filter.
InterestFilterHandle() noexcept=default
Declares the set of Interests a producer can serve.
Represents an Interest packet.
Represents an absolute name.
Handle for a pending Interest.
PendingInterestHandle() noexcept=default
Handle for a registered prefix.
RegisteredPrefixHandle() noexcept=default
Provides a "TLV-oriented" delivery service.
Handle to cancel an operation.
Represents a Network Nack.
The main interface for signing key management.
Signing parameters passed to KeyChain.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
@ ROUTE_FLAG_CHILD_INHERIT
::boost::chrono::milliseconds milliseconds
std::function< void(const Name &)> RegisterPrefixSuccessCallback
Callback invoked when registerPrefix or setInterestFilter command succeeds.
std::function< void(const Interest &)> TimeoutCallback
Callback invoked when an expressed Interest times out.
std::function< void(const std::string &)> UnregisterPrefixFailureCallback
Callback invoked when unregistering a prefix fails.
std::function< void(const Interest &, const lp::Nack &)> NackCallback
Callback invoked when a Nack is received in response to an expressed Interest.
std::function< void(const Interest &, const Data &)> DataCallback
Callback invoked when an expressed Interest is satisfied by a Data packet.
std::function< void()> UnregisterPrefixSuccessCallback
Callback invoked when unregistering a prefix succeeds.
std::function< void(const Name &, const std::string &)> RegisterPrefixFailureCallback
Callback invoked when registerPrefix or setInterestFilter command fails.
std::function< void(const InterestFilter &, const Interest &)> InterestCallback
Callback invoked when an incoming Interest matches the specified InterestFilter.