Announce represents a ConvergenceLayer (Interface). More...
#include <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 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 Announce * | create_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 | |
ConvergenceLayer * | cl_ |
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 &) |
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.
virtual dtn::Announce::~Announce | ( | ) | [inline, virtual] |
Definition at line 67 of file Announce.h.
dtn::Announce::Announce | ( | const char * | logpath = "/dtn/discovery/announce" |
) | [inline, protected] |
Definition at line 97 of file Announce.h.
References data_sent_, and dtnsim::gettimeofday().
dtn::Announce::Announce | ( | const Announce & | ) | [inline, private] |
Definition at line 116 of file Announce.h.
virtual bool dtn::Announce::configure | ( | const std::string & | name, | |
ConvergenceLayer * | cl, | |||
int | argc, | |||
const char * | argv[] | |||
) | [protected, pure virtual] |
Implemented in dtn::IPAnnounce.
Referenced by create_announce().
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().
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::IPAnnounce.
u_int dtn::Announce::interval | ( | ) | [inline] |
Number of milliseconds between announcements.
Definition at line 94 of file Announce.h.
References interval_.
Referenced by dtn::IPDiscovery::run().
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 73 of file Announce.h.
References data_sent_, dtnsim::gettimeofday(), interval_, and TIMEVAL_DIFF_MSEC.
Referenced by dtn::IPDiscovery::run().
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_.
const std::string& dtn::Announce::name | ( | ) | [inline] |
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().
ConvergenceLayer* dtn::Announce::cl_ [protected] |
CL represented by this Announce.
Definition at line 108 of file Announce.h.
Referenced by dtn::IPAnnounce::configure().
struct timeval dtn::Announce::data_sent_ [protected] |
mark each time data is sent
Definition at line 114 of file Announce.h.
Referenced by Announce(), dtn::IPAnnounce::format_advertisement(), and interval_remaining().
u_int dtn::Announce::interval_ [protected] |
interval (in milliseconds) for beacon header
Definition at line 112 of file Announce.h.
Referenced by dtn::IPAnnounce::configure(), dtn::IPAnnounce::format_advertisement(), interval(), and interval_remaining().
std::string dtn::Announce::local_ [protected] |
Beacon info to advertise.
Definition at line 109 of file Announce.h.
Referenced by dtn::IPAnnounce::configure(), and local_addr().
std::string dtn::Announce::name_ [protected] |
name for this beacon instance
Definition at line 110 of file Announce.h.
Referenced by dtn::IPAnnounce::configure(), and name().
std::string dtn::Announce::type_ [protected] |
pulled from cl_
Definition at line 111 of file Announce.h.
Referenced by dtn::IPAnnounce::configure(), and type().