39 class PendingInterestId;
40 class PendingInterestHandle;
41 class RegisteredPrefixId;
42 class RegisteredPrefixHandle;
43 class InterestFilterId;
49 typedef function<void(const Interest&, const Data&)>
DataCallback;
54 typedef function<void(const Interest&, const lp::Nack&)>
NackCallback;
92 class Error :
public std::runtime_error
95 using std::runtime_error::runtime_error;
131 Face(shared_ptr<Transport> transport =
nullptr);
162 Face(boost::asio::io_service& ioService);
171 Face(
const std::string& host,
const std::string& port =
"6363");
185 Face(shared_ptr<Transport> transport,
KeyChain& keyChain);
200 Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService);
216 Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService,
KeyChain& keyChain);
235 const DataCallback& afterSatisfied,
236 const NackCallback& afterNacked,
237 const TimeoutCallback& afterTimeout);
246 cancelPendingInterest(pendingInterestId);
283 const RegisterPrefixFailureCallback& onFailure,
309 const RegisterPrefixSuccessCallback& onSuccess,
310 const RegisterPrefixFailureCallback& onFailure,
348 const RegisterPrefixSuccessCallback& onSuccess,
349 const RegisterPrefixFailureCallback& onFailure,
360 unregisterPrefixImpl(registeredPrefixId,
nullptr,
nullptr);
370 clearInterestFilter(interestFilterId);
379 const UnregisterPrefixSuccessCallback& onSuccess,
380 const UnregisterPrefixFailureCallback& onFailure)
382 unregisterPrefixImpl(registeredPrefixId, onSuccess, onFailure);
439 bool keepThread =
false)
462 boost::asio::io_service&
472 shared_ptr<Transport>
486 shared_ptr<Transport>
487 makeDefaultTransport();
494 construct(shared_ptr<Transport> transport,
KeyChain& keyChain);
497 onReceiveElement(
const Block& blockFromDaemon);
500 cancelPendingInterest(
const PendingInterestId* pendingInterestId);
503 clearInterestFilter(
const InterestFilterId* interestFilterId);
506 unregisterPrefixImpl(
const RegisteredPrefixId* registeredPrefixId,
507 const UnregisterPrefixSuccessCallback& onSuccess,
508 const UnregisterPrefixFailureCallback& onFailure);
512 unique_ptr<boost::asio::io_service> m_internalIoService;
514 boost::asio::io_service& m_ioService;
516 shared_ptr<Transport> m_transport;
525 unique_ptr<KeyChain> m_internalKeyChain;
528 shared_ptr<Impl> m_impl;
588 unregister(
const UnregisterPrefixSuccessCallback& onSuccess =
nullptr,
589 const UnregisterPrefixFailureCallback& onFailure =
nullptr);
592 Face* m_face =
nullptr;
593 const RegisteredPrefixId* m_id =
nullptr;
651 #endif // NDN_FACE_HPP
virtual void doProcessEvents(time::milliseconds timeout, bool keepThread)
The interface of signing key management.
function< void(const std::string &)> UnregisterPrefixFailureCallback
Callback invoked when unregisterPrefix or unsetInterestFilter command fails.
declares the set of Interests a producer can serve, which starts with a name prefix, plus an optional regular expression
shared_ptr< Transport > getTransport() const
Returns the underlying transport.
Represents a TLV element of NDN packet format.
Represents an Interest packet.
void unsetInterestFilter(const InterestFilterId *interestFilterId)
Signing parameters passed to KeyChain.
void unregisterPrefix(const RegisteredPrefixId *registeredPrefixId, const UnregisterPrefixSuccessCallback &onSuccess, const UnregisterPrefixFailureCallback &onFailure)
represents a Network Nack
void removeAllPendingInterests()
Cancel all previously expressed Interests.
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.
A handle of pending Interest.
size_t getNPendingInterests() const
Get number of pending Interests.
void shutdown()
Shutdown face operations.
Provide a communication channel with local or remote NDN forwarder.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
function< void(const Name &, const std::string &)> RegisterPrefixFailureCallback
Callback invoked when registerPrefix or setInterestFilter command fails.
void processEvents(time::milliseconds timeout=time::milliseconds::zero(), bool keepThread=false)
Process any data to receive or call timeout callbacks.
function< void(const Name &)> RegisterPrefixSuccessCallback
Callback invoked when registerPrefix or setInterestFilter command succeeds.
Represents an absolute name.
void unsetInterestFilter(const RegisteredPrefixId *registeredPrefixId)
boost::asio::io_service & getIoService()
Returns a reference to the io_service used by this face.
PendingInterestHandle expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express Interest.
function< void(const InterestFilter &, const Interest &)> InterestCallback
Callback invoked when incoming Interest matches the specified InterestFilter.
RegisteredPrefixHandle() noexcept
Handle to cancel an operation.
function< void()> UnregisterPrefixSuccessCallback
Callback invoked when unregisterPrefix or unsetInterestFilter command succeeds.
void put(Data data)
Publish data packet.
A handle of registered Interest filter.
function< void(const Interest &)> TimeoutCallback
Callback invoked when expressed Interest times out.
function< void(const Interest &, const lp::Nack &)> NackCallback
Callback invoked when Nack is sent in response to expressed Interest.
Represents a Data packet.
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...
Face(shared_ptr< Transport > transport=nullptr)
Create Face using given transport (or default transport if omitted)
A handle of registered prefix.
function< void(const Interest &, const Data &)> DataCallback
Callback invoked when expressed Interest gets satisfied with a Data packet.
void removePendingInterest(const PendingInterestId *pendingInterestId)
Exception thrown when attempting to send a packet over size limit.