|
| Face (shared_ptr< Transport > transport=nullptr) |
| Create Face using given transport (or default transport if omitted) More...
|
|
| Face (boost::asio::io_service &ioService) |
| Create Face using default transport and given io_service. More...
|
|
| Face (const std::string &host, const std::string &port="6363") |
| Create Face using TcpTransport. More...
|
|
| Face (shared_ptr< Transport > transport, KeyChain &keyChain) |
| Create Face using given transport and KeyChain. More...
|
|
| Face (shared_ptr< Transport > transport, boost::asio::io_service &ioService) |
| Create Face using given transport and io_service. More...
|
|
| Face (shared_ptr< Transport > transport, boost::asio::io_service &ioService, KeyChain &keyChain) |
| Create a new Face using given Transport and io_service. More...
|
|
virtual | ~Face () |
|
const PendingInterestId * | expressInterest (const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout) |
| Express Interest. More...
|
|
boost::asio::io_service & | getIoService () |
|
size_t | getNPendingInterests () const |
| Get number of pending Interests. More...
|
|
void | processEvents (time::milliseconds timeout=time::milliseconds::zero(), bool keepThread=false) |
| Process any data to receive or call timeout callbacks. More...
|
|
void | put (Data data) |
| Publish data packet. More...
|
|
void | put (lp::Nack nack) |
| Send a network NACK. More...
|
|
const RegisteredPrefixId * | 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. More...
|
|
void | removeAllPendingInterests () |
| Cancel all previously expressed Interests. More...
|
|
void | removePendingInterest (const PendingInterestId *pendingInterestId) |
| Cancel previously expressed Interest. More...
|
|
const RegisteredPrefixId * | setInterestFilter (const InterestFilter &interestFilter, 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 filtered prefix with the connected NDN forwarder. More...
|
|
const RegisteredPrefixId * | setInterestFilter (const InterestFilter &interestFilter, const InterestCallback &onInterest, const RegisterPrefixSuccessCallback &onSuccess, 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 filtered prefix with the connected NDN forwarder. More...
|
|
const InterestFilterId * | setInterestFilter (const InterestFilter &interestFilter, const InterestCallback &onInterest) |
| Set InterestFilter to dispatch incoming matching interest to onInterest callback. More...
|
|
void | shutdown () |
| Shutdown face operations. More...
|
|
void | unregisterPrefix (const RegisteredPrefixId *registeredPrefixId, const UnregisterPrefixSuccessCallback &onSuccess, const UnregisterPrefixFailureCallback &onFailure) |
| Unregister prefix from RIB. More...
|
|
void | unsetInterestFilter (const RegisteredPrefixId *registeredPrefixId) |
| Remove the registered prefix entry with the registeredPrefixId. More...
|
|
void | unsetInterestFilter (const InterestFilterId *interestFilterId) |
| Remove previously set InterestFilter from library's FIB. More...
|
|
Provide a communication channel with local or remote NDN forwarder.
Definition at line 90 of file face.hpp.
void ndn::Face::processEvents |
( |
time::milliseconds |
timeout = time::milliseconds::zero() , |
|
|
bool |
keepThread = false |
|
) |
| |
|
inline |
Process any data to receive or call timeout callbacks.
This call will block forever (default timeout == 0) to process IO on the face. To exit cleanly on a producer, unset any Interest filters with unsetInterestFilter() and wait for processEvents() to return. To exit after an error, one can call shutdown(). In consumer applications, processEvents() will return when all expressed Interests have been satisfied, Nacked, or timed out. To terminate earlier, a consumer application should call removePendingInterests() for all previously expressed and still-pending Interests.
If a positive timeout is specified, then processEvents() will exit after this timeout, provided it is not stopped earlier with shutdown() or when all active events finish. processEvents() can be called repeatedly, if desired.
If a negative timeout is specified, then processEvents will not block and will process only pending events.
- Parameters
-
timeout | maximum time to block the thread |
keepThread | Keep thread in a blocked state (in event processing), even when there are no outstanding events (e.g., no Interest/Data is expected). If timeout is zero and this parameter is true, the only way to stop processEvents() is to call shutdown(). |
- Note
- This may throw an exception for reading data or in the callback for processing the data. If you call this from an main event loop, you may want to catch and log/disregard all exceptions.
- Exceptions
-
Definition at line 453 of file face.hpp.
Set InterestFilter to dispatch incoming matching interest to onInterest callback and register the filtered prefix with the connected NDN forwarder.
This version of setInterestFilter combines setInterestFilter and registerPrefix operations and is intended to be used when only one filter for the same prefix needed to be set. When multiple names sharing the same prefix should be dispatched to different callbacks, use one registerPrefix call, followed (in onSuccess callback) by a series of setInterestFilter calls.
- Parameters
-
interestFilter | Interest filter (prefix part will be registered with the forwarder) |
onInterest | A callback to be called when a matching interest is received |
onFailure | A callback to be called when prefixRegister command fails |
flags | (optional) RIB flags |
signingInfo | (optional) Signing parameters. When omitted, a default parameters used in the signature will be used. |
- Returns
- Opaque registered prefix ID which can be used with unsetInterestFilter or removeRegisteredPrefix
Definition at line 232 of file face.cpp.
Set InterestFilter to dispatch incoming matching interest to onInterest callback.
- Parameters
-
interestFilter | Interest |
onInterest | A callback to be called when a matching interest is received |
This method modifies library's FIB only, and does not register the prefix with the forwarder. It will always succeed. To register prefix with the forwarder, use registerPrefix, or use the setInterestFilter overload taking two callbacks.
- Returns
- Opaque interest filter ID which can be used with unsetInterestFilter
Definition at line 259 of file face.cpp.
void ndn::Face::shutdown |
( |
| ) |
|
Shutdown face operations.
This method cancels all pending operations and closes connection to NDN Forwarder.
Note that this method does not stop the io_service if it is shared between multiple Faces or with other IO objects (e.g., Scheduler).
- Warning
- Calling this method could cause outgoing packets to be lost. Producers that shut down immediately after sending a Data packet should instead use unsetInterestFilter() to shut down cleanly.
Definition at line 348 of file face.cpp.
void ndn::Face::unsetInterestFilter |
( |
const RegisteredPrefixId * |
registeredPrefixId | ) |
|
Remove the registered prefix entry with the registeredPrefixId.
This does not affect another registered prefix with a different registeredPrefixId, even it if has the same prefix name. If there is no entry with the registeredPrefixId, do nothing.
unsetInterestFilter will use the same credentials as original setInterestFilter/registerPrefix command
- Parameters
-
registeredPrefixId | The ID returned from registerPrefix |
Definition at line 285 of file face.cpp.