All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Types | Public Member Functions | List of all members
ndntools::PrefixDiscovery Class Reference

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...
 

Detailed Description

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

Constructor & Destructor Documentation

ndntools::PrefixDiscovery::PrefixDiscovery ( OnPrefixes  onPrefixes,
ndn::Face face,
ndn::Milliseconds  periodMilliseconds = 60000.0 
)
inline

Create a PrefixDiscovery to use the given OnPrefixes callback and face.

After creating an instance of PrefixDiscovery, you must call start().

Parameters
onPrefixesWhen 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.)
faceThe 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).

Member Function Documentation

void ndntools::PrefixDiscovery::start ( )
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.

void ndntools::PrefixDiscovery::stop ( )
inline

Stop the process.

You can restart by calling start() again.


The documentation for this class was generated from the following file: