Abstraction of neighbor discovery agent. More...
#include <Discovery.h>
Public Member Functions | |
const std::string & | name () const |
Name of this Discovery instance. | |
const std::string & | af () const |
Address family represented by this Discovery instance. | |
const std::string & | to_addr () const |
Outbound address of advertisements sent by this Discovery instance. | |
const std::string & | local_addr () const |
Local address on which to listen for advertisements. | |
void | dump (oasys::StringBuffer *buf) |
Append snapshot of object state to StringBuffer. | |
virtual void | shutdown ()=0 |
Close down listening socket and stop the thread. | |
bool | announce (const char *name, int argc, const char *argv[]) |
Register an Announce to advertise a local convergence layer and to respond to advertisements from neighbors. | |
bool | remove (const char *name) |
Remove registration for named announce object. | |
void | handle_neighbor_discovered (const std::string &cl_type, const std::string &cl_addr, const EndpointID &remote_eid) |
Handle neighbor discovery out to registered DiscoveryInfo objects. | |
virtual | ~Discovery () |
Static Public Member Functions | |
static Discovery * | create_discovery (const std::string &name, const std::string &afname, int argc, const char *argv[], const char **error) |
Factory method for instantiating objects from the appropriate derived class. | |
Protected Types | |
typedef std::list< Announce * > | List |
typedef std::list< Announce * > ::iterator | iterator |
Protected Member Functions | |
Discovery (const std::string &name, const std::string &af) | |
Constructor. | |
virtual bool | configure (int argc, const char *argv[])=0 |
Configure this Discovery instance. | |
virtual void | handle_announce () |
Optional handler for new Announce registration. | |
bool | find (const char *name, iterator *iter) |
Find a registration by name. | |
Protected Attributes | |
std::string | name_ |
name of discovery agent | |
std::string | af_ |
address family | |
std::string | to_addr_ |
outbound address of advertisements sent | |
std::string | local_ |
address of beacon listener | |
List | list_ |
registered Announce objects | |
Private Member Functions | |
Discovery (const Discovery &) |
Abstraction of neighbor discovery agent.
Much like Interface, Discovery is generally created by the configuration file / console. Derived classes (such as IPDiscovery) typically bind to a UDP socket to listen for neighbor beacons. Bluetooth has built-in discovery mechanisms, so BluetoothDiscovery polls via Inquiry instead of listen()ing on a socket.
To advertise a local convergence layer, register its local address (and port) by calling "discovery add_cl". For each registered CL, Discovery will advertise (outbound) the CL's presence to neighbors, and distribute (inbound) each event of neighbor discovery to each CL.
Definition at line 43 of file Discovery.h.
typedef std::list<Announce*>::iterator dtn::Discovery::iterator [protected] |
Definition at line 106 of file Discovery.h.
typedef std::list<Announce*> dtn::Discovery::List [protected] |
Definition at line 105 of file Discovery.h.
dtn::Discovery::~Discovery | ( | ) | [virtual] |
Definition at line 78 of file Discovery.cc.
dtn::Discovery::Discovery | ( | const std::string & | name, | |
const std::string & | af | |||
) | [protected] |
Constructor.
Definition at line 30 of file Discovery.cc.
dtn::Discovery::Discovery | ( | const Discovery & | ) | [inline, private] |
Definition at line 135 of file Discovery.h.
const std::string& dtn::Discovery::af | ( | ) | const [inline] |
Address family represented by this Discovery instance.
Definition at line 54 of file Discovery.h.
References af_.
bool dtn::Discovery::announce | ( | const char * | name, | |
int | argc, | |||
const char * | argv[] | |||
) |
Register an Announce to advertise a local convergence layer and to respond to advertisements from neighbors.
Definition at line 104 of file Discovery.cc.
Referenced by dtn::IPDiscovery::run().
virtual bool dtn::Discovery::configure | ( | int | argc, | |
const char * | argv[] | |||
) | [protected, pure virtual] |
Configure this Discovery instance.
Implemented in dtn::IPDiscovery.
Discovery * dtn::Discovery::create_discovery | ( | const std::string & | name, | |
const std::string & | afname, | |||
int | argc, | |||
const char * | argv[], | |||
const char ** | error | |||
) | [static] |
Factory method for instantiating objects from the appropriate derived class.
Definition at line 39 of file Discovery.cc.
Referenced by dtn::DiscoveryTable::add().
void dtn::Discovery::dump | ( | oasys::StringBuffer * | buf | ) |
Append snapshot of object state to StringBuffer.
Definition at line 88 of file Discovery.cc.
Referenced by dtn::DiscoveryTable::dump().
bool dtn::Discovery::find | ( | const char * | name, | |
Discovery::iterator * | iter | |||
) | [protected] |
Find a registration by name.
Definition at line 161 of file Discovery.cc.
virtual void dtn::Discovery::handle_announce | ( | ) | [inline, protected, virtual] |
Optional handler for new Announce registration.
Reimplemented in dtn::IPDiscovery.
Definition at line 122 of file Discovery.h.
void dtn::Discovery::handle_neighbor_discovered | ( | const std::string & | cl_type, | |
const std::string & | cl_addr, | |||
const EndpointID & | remote_eid | |||
) |
Handle neighbor discovery out to registered DiscoveryInfo objects.
Definition at line 177 of file Discovery.cc.
Referenced by dtn::IPDiscovery::run().
const std::string& dtn::Discovery::local_addr | ( | ) | const [inline] |
Local address on which to listen for advertisements.
Definition at line 64 of file Discovery.h.
References local_.
const std::string& dtn::Discovery::name | ( | ) | const [inline] |
Name of this Discovery instance.
Definition at line 49 of file Discovery.h.
References name_.
Referenced by dtn::DiscoveryTable::find().
bool dtn::Discovery::remove | ( | const char * | name | ) |
Remove registration for named announce object.
Definition at line 143 of file Discovery.cc.
virtual void dtn::Discovery::shutdown | ( | ) | [pure virtual] |
Close down listening socket and stop the thread.
Derived classes should NOT auto-delete.
Implemented in dtn::IPDiscovery.
Referenced by dtn::DiscoveryTable::del(), and dtn::DiscoveryTable::shutdown().
const std::string& dtn::Discovery::to_addr | ( | ) | const [inline] |
Outbound address of advertisements sent by this Discovery instance.
Definition at line 59 of file Discovery.h.
References to_addr_.
std::string dtn::Discovery::af_ [protected] |
List dtn::Discovery::list_ [protected] |
registered Announce objects
Definition at line 133 of file Discovery.h.
Referenced by dtn::IPDiscovery::run().
std::string dtn::Discovery::local_ [protected] |
address of beacon listener
Definition at line 132 of file Discovery.h.
Referenced by dtn::IPDiscovery::configure(), and local_addr().
std::string dtn::Discovery::name_ [protected] |
std::string dtn::Discovery::to_addr_ [protected] |
outbound address of advertisements sent
Definition at line 131 of file Discovery.h.
Referenced by dtn::IPDiscovery::configure(), and to_addr().