dtn::Announce Class Reference

#include <Announce.h>

Inheritance diagram for dtn::Announce:

oasys::Logger dtn::BluetoothAnnounce dtn::IPAnnounce

List of all members.


Detailed Description

Announce represents a ConvergenceLayer (Interface).

Each announce instance records its CL's address and the interval at which to advertise to or poll for neighbors. Discovery maintains a list of Announce which serve as the basis for its advertisement.

Additionally, Announce serves as a responder. For each discovery it creates a new Contact to the remote node by placing the appropriate call into its CL.

Definition at line 42 of file Announce.h.


Public Member Functions

const std::string & name ()
 The name of this Announce instance.
const std::string & type ()
 Which type of CL is represented by this Announce.
const std::string & local_addr ()
 Return a string representation of the ConvergenceLayer address info to be advertised by parent Discovery.
virtual void handle_neighbor_discovered (const std::string &cl_addr, const EndpointID &remote_eid)=0
 Hook for derived classes to parse information received by Discovery.
virtual size_t format_advertisement (u_char *buf, size_t len)=0
 Hook for derived classes to format information to be advertised.
virtual ~Announce ()
u_int interval_remaining ()
 Return the number of milliseconds remaining until the interval expires, or 0 if it's already expired.
u_int interval ()
 Number of milliseconds between announcements.

Static Public Member Functions

static Announcecreate_announce (const std::string &name, ConvergenceLayer *cl, int argc, const char *argv[])
 Factory method for creating instances of derived classes.

Protected Member Functions

 Announce (const char *logpath="/dtn/discovery/announce")
virtual bool configure (const std::string &name, ConvergenceLayer *cl, int argc, const char *argv[])=0

Protected Attributes

ConvergenceLayercl_
 CL represented by this Announce.
std::string local_
 Beacon info to advertise.
std::string name_
 name for this beacon instance
std::string type_
 pulled from cl_
u_int interval_
 interval (in milliseconds) for beacon header
struct timeval data_sent_
 mark each time data is sent

Private Member Functions

 Announce (const Announce &)

Constructor & Destructor Documentation

virtual dtn::Announce::~Announce (  )  [inline, virtual]

Definition at line 74 of file Announce.h.

dtn::Announce::Announce ( const char *  logpath = "/dtn/discovery/announce"  )  [inline, protected]

Definition at line 104 of file Announce.h.

References data_sent_, and dtnsim::gettimeofday().

dtn::Announce::Announce ( const Announce  )  [inline, private]

Definition at line 123 of file Announce.h.


Member Function Documentation

const std::string& dtn::Announce::name (  )  [inline]

The name of this Announce instance.

Definition at line 49 of file Announce.h.

References name_.

Referenced by dtn::Discovery::find().

const std::string& dtn::Announce::type (  )  [inline]

Which type of CL is represented by this Announce.

Definition at line 54 of file Announce.h.

References type_.

Referenced by dtn::IPAnnounce::format_advertisement(), dtn::IPAnnounce::handle_neighbor_discovered(), and dtn::BluetoothAnnounce::handle_neighbor_discovered().

const std::string& dtn::Announce::local_addr (  )  [inline]

Return a string representation of the ConvergenceLayer address info to be advertised by parent Discovery.

Definition at line 60 of file Announce.h.

References local_.

virtual void dtn::Announce::handle_neighbor_discovered ( const std::string &  cl_addr,
const EndpointID remote_eid 
) [pure virtual]

Hook for derived classes to parse information received by Discovery.

Implemented in dtn::BluetoothAnnounce, and dtn::IPAnnounce.

virtual size_t dtn::Announce::format_advertisement ( u_char *  buf,
size_t  len 
) [pure virtual]

Hook for derived classes to format information to be advertised.

Implemented in dtn::BluetoothAnnounce, and dtn::IPAnnounce.

u_int dtn::Announce::interval_remaining (  )  [inline]

Return the number of milliseconds remaining until the interval expires, or 0 if it's already expired.

Definition at line 80 of file Announce.h.

References data_sent_, dtnsim::gettimeofday(), interval_, and TIMEVAL_DIFF_MSEC.

Referenced by dtn::IPDiscovery::run(), and dtn::BluetoothDiscovery::run().

Announce * dtn::Announce::create_announce ( const std::string &  name,
ConvergenceLayer cl,
int  argc,
const char *  argv[] 
) [static]

Factory method for creating instances of derived classes.

Definition at line 26 of file Announce.cc.

References ASSERT, configure(), and dtn::ConvergenceLayer::name().

Referenced by dtn::Discovery::announce().

u_int dtn::Announce::interval (  )  [inline]

Number of milliseconds between announcements.

Definition at line 101 of file Announce.h.

References interval_.

Referenced by dtn::IPDiscovery::run().

virtual bool dtn::Announce::configure ( const std::string &  name,
ConvergenceLayer cl,
int  argc,
const char *  argv[] 
) [protected, pure virtual]

Implemented in dtn::BluetoothAnnounce, and dtn::IPAnnounce.

Referenced by create_announce().


Member Data Documentation

ConvergenceLayer* dtn::Announce::cl_ [protected]

CL represented by this Announce.

Definition at line 115 of file Announce.h.

Referenced by dtn::IPAnnounce::configure(), dtn::BluetoothAnnounce::configure(), dtn::IPAnnounce::handle_neighbor_discovered(), and dtn::BluetoothAnnounce::handle_neighbor_discovered().

std::string dtn::Announce::local_ [protected]

Beacon info to advertise.

Definition at line 116 of file Announce.h.

Referenced by dtn::IPAnnounce::configure(), dtn::BluetoothAnnounce::configure(), and local_addr().

std::string dtn::Announce::name_ [protected]

name for this beacon instance

Definition at line 117 of file Announce.h.

Referenced by dtn::IPAnnounce::configure(), dtn::BluetoothAnnounce::configure(), and name().

std::string dtn::Announce::type_ [protected]

pulled from cl_

Definition at line 118 of file Announce.h.

Referenced by dtn::IPAnnounce::configure(), dtn::BluetoothAnnounce::configure(), and type().

u_int dtn::Announce::interval_ [protected]

interval (in milliseconds) for beacon header

Definition at line 119 of file Announce.h.

Referenced by dtn::IPAnnounce::configure(), dtn::BluetoothAnnounce::configure(), dtn::IPAnnounce::format_advertisement(), interval(), and interval_remaining().

struct timeval dtn::Announce::data_sent_ [read, protected]

mark each time data is sent

Definition at line 121 of file Announce.h.

Referenced by Announce(), dtn::IPAnnounce::format_advertisement(), interval_remaining(), and dtn::BluetoothAnnounce::reset_interval().


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 08:43:46 2007 for DTN Reference Implementation by  doxygen 1.5.3