PrefixDiscovery repeatedly sends an interest for the routable prefix to the connected NFD. More...
#include <prefix-discovery.hpp>
Public Types | |
|
typedef ndn::func_lib::function< void(const ndn::ptr_lib::shared_ptr < std::vector< ndn::Name > > &prefixes)> | OnPrefixes |
Public Member Functions | |
| PrefixDiscovery (OnPrefixes onPrefixes, ndn::Face *face, ndn::Milliseconds periodMilliseconds=60000.0) | |
| Create a PrefixDiscovery to use the given OnPrefixes callback and face. More... | |
| void | start () |
| Start the process by sending the first interest to the Face given to the constructor, then automatically repeat indefinitely with the period specified in the constructor. More... | |
| void | stop () |
| Stop the process. More... | |
PrefixDiscovery repeatedly sends an interest for the routable prefix to the connected NFD.
When a new prefix Name (or Names) is received, this calls an application callback. Note that NFD must be configured to respond to an interest for the routable prefix, for example by running ndn-autoconfig-server. See: https://named-data.net/doc/NFD/current/misc/local-prefix-discovery.html
|
inline |
Create a PrefixDiscovery to use the given OnPrefixes callback and face.
After creating an instance of PrefixDiscovery, you must call start().
| onPrefixes | When a new list of prefixes is received (or the first list), this calls onPrefixes(prefixes) with the list of prefix Names. (It is normal if this list only has one prefix.) |
| face | The Face for calling expressInterest to request the list of prefixes. Usually the Face should be connected to the local NFD. |
| periodMilliseconds | (optional) The period in milliseconds between each interest to request the current list of prefixes. If omitted, use the default 60000 (one minute). |
|
inline |
Start the process by sending the first interest to the Face given to the constructor, then automatically repeat indefinitely with the period specified in the constructor.
If any Interest times out, log an event and send another Interest to try again. If the process is already started, do nothing.
|
inline |
Stop the process.
You can restart by calling start() again.
1.8.6