39 class PendingInterestId;
40 class PendingInterestHandle;
41 class RegisteredPrefixId;
42 class RegisteredPrefixHandle;
43 class InterestFilterId;
44 class InterestFilterHandle;
58 typedef function<void(const Interest&, const lp::Nack&)>
NackCallback;
96 class Error :
public std::runtime_error
99 using std::runtime_error::runtime_error;
135 Face(shared_ptr<Transport> transport =
nullptr);
166 Face(boost::asio::io_service& ioService);
175 Face(
const std::string& host,
const std::string& port =
"6363");
189 Face(shared_ptr<Transport> transport, KeyChain& keyChain);
204 Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService);
220 Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService, KeyChain& keyChain);
238 expressInterest(
const Interest& interest,
239 const DataCallback& afterSatisfied,
240 const NackCallback& afterNacked,
241 const TimeoutCallback& afterTimeout);
250 cancelPendingInterest(pendingInterestId);
257 removeAllPendingInterests();
263 getNPendingInterests()
const;
286 setInterestFilter(
const InterestFilter& filter,
const InterestCallback& onInterest,
287 const RegisterPrefixFailureCallback& onFailure,
312 setInterestFilter(
const InterestFilter& filter,
const InterestCallback& onInterest,
313 const RegisterPrefixSuccessCallback& onSuccess,
314 const RegisterPrefixFailureCallback& onFailure,
331 setInterestFilter(
const InterestFilter& filter,
const InterestCallback& onInterest);
351 registerPrefix(
const Name& prefix,
352 const RegisterPrefixSuccessCallback& onSuccess,
353 const RegisterPrefixFailureCallback& onFailure,
364 unregisterPrefixImpl(registeredPrefixId,
nullptr,
nullptr);
374 clearInterestFilter(interestFilterId);
383 const UnregisterPrefixSuccessCallback& onSuccess,
384 const UnregisterPrefixFailureCallback& onFailure)
386 unregisterPrefixImpl(registeredPrefixId, onSuccess, onFailure);
443 bool keepThread =
false)
445 this->doProcessEvents(timeout, keepThread);
466 boost::asio::io_service&
476 shared_ptr<Transport>
481 doProcessEvents(time::milliseconds timeout,
bool keepThread);
487 shared_ptr<Transport>
488 makeDefaultTransport();
495 construct(shared_ptr<Transport> transport, KeyChain& keyChain);
498 onReceiveElement(
const Block& blockFromDaemon);
501 cancelPendingInterest(
const PendingInterestId* pendingInterestId);
504 clearInterestFilter(
const InterestFilterId* interestFilterId);
507 unregisterPrefixImpl(
const RegisteredPrefixId* registeredPrefixId,
508 const UnregisterPrefixSuccessCallback& onSuccess,
509 const UnregisterPrefixFailureCallback& onFailure);
513 unique_ptr<boost::asio::io_service> m_internalIoService;
515 boost::asio::io_service& m_ioService;
517 shared_ptr<Transport> m_transport;
526 unique_ptr<KeyChain> m_internalKeyChain;
528 unique_ptr<nfd::Controller> m_nfdController;
531 shared_ptr<Impl> m_impl;
556 operator const PendingInterestId*()
const noexcept
562 const PendingInterestId* m_id =
nullptr;
596 operator const RegisteredPrefixId*()
const noexcept
606 unregister(
const UnregisterPrefixSuccessCallback& onSuccess =
nullptr,
607 const UnregisterPrefixFailureCallback& onFailure =
nullptr);
610 Face* m_face =
nullptr;
611 const RegisteredPrefixId* m_id =
nullptr;
650 operator const InterestFilterId*()
const noexcept
656 const InterestFilterId* m_id =
nullptr;
678 #endif // NDN_FACE_HPP
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
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
A handle of pending Interest.
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()
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.
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.
util::scheduler::EventId deprecated
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)
Cancels an operation automatically upon destruction.
Exception thrown when attempting to send a packet over size limit.