dtn::ContactManager Class Reference

A contact manager class. More...

#include <ContactManager.h>

Inheritance diagram for dtn::ContactManager:
dtn::BundleEventHandler

List of all members.

Classes

class  LinkAvailabilityTimer
 Timer class used to re-enable broken ondemand links. More...

Public Member Functions

 ContactManager ()
 Constructor / Destructor.
virtual ~ContactManager ()
void dump (oasys::StringBuffer *buf) const
 Dump a string representation of the info inside contact manager.
bool add_new_link (const LinkRef &link)
 Add a link if the contact manager does not already have a link by the same name.
void del_link (const LinkRef &link, bool wait=false, ContactEvent::reason_t reason=ContactEvent::NO_INFO)
 Delete a link.
bool has_link (const LinkRef &link)
 Check if contact manager already has this link.
bool has_link (const char *name)
 Check if contact manager already has a link by the same name.
LinkRef find_link (const char *name)
 Finds link corresponding to this name.
LinkRef find_link_to (ConvergenceLayer *cl, const std::string &nexthop, const EndpointID &remote_eid=EndpointID::NULL_EID(), Link::link_type_t type=Link::LINK_INVALID, u_int states=0xffffffff)
 Helper routine to find a link based on criteria:
const LinkSetlinks ()
 Return the list of links.
oasys::Lock * lock ()
 Accessor for the ContactManager internal lock.
void handle_event (BundleEvent *event)
 Generic event handler.
void handle_link_created (LinkCreatedEvent *event)
 Event handler when a link has been created.
void handle_link_available (LinkAvailableEvent *event)
 Event handler when a link becomes unavailable.
void handle_link_unavailable (LinkUnavailableEvent *event)
 Event handler when a link becomes unavailable.
void handle_contact_up (ContactUpEvent *event)
 Event handler when a link is opened successfully.
LinkRef new_opportunistic_link (ConvergenceLayer *cl, const std::string &nexthop, const EndpointID &remote_eid, const std::string *link_name=NULL)
 Notification from a convergence layer that a new opportunistic link has come knocking.

Protected Types

typedef std::map< LinkRef,
LinkAvailabilityTimer * > 
AvailabilityTimerMap
 Table storing link -> availability timer class.

Protected Member Functions

void reopen_link (const LinkRef &link)
 Reopen a broken link.

Protected Attributes

LinkSetlinks_
 Set of all links.
int opportunistic_cnt_
 Counter for opportunistic links.
AvailabilityTimerMap availability_timers_
oasys::SpinLock lock_
 Lock to protect internal data structures.

Friends

class LinkAvailabilityTimer

Detailed Description

A contact manager class.

Maintains topological information and connectivity state regarding available links and contacts.

Definition at line 39 of file ContactManager.h.


Member Typedef Documentation

Table storing link -> availability timer class.

Definition at line 190 of file ContactManager.h.


Constructor & Destructor Documentation

dtn::ContactManager::ContactManager (  ) 

Constructor / Destructor.

Definition at line 27 of file ContactManager.cc.

dtn::ContactManager::~ContactManager (  )  [virtual]

Definition at line 35 of file ContactManager.cc.


Member Function Documentation

bool dtn::ContactManager::add_new_link ( const LinkRef link  ) 

Add a link if the contact manager does not already have a link by the same name.

Definition at line 42 of file ContactManager.cc.

References links_.

Referenced by dtn::TcaRouter::create_link().

void dtn::ContactManager::del_link ( const LinkRef link,
bool  wait = false,
ContactEvent::reason_t  reason = ContactEvent::NO_INFO 
)

Delete a link.

Definition at line 65 of file ContactManager.cc.

void dtn::ContactManager::dump ( oasys::StringBuffer *  buf  )  const

Dump a string representation of the info inside contact manager.

Definition at line 491 of file ContactManager.cc.

LinkRef dtn::ContactManager::find_link ( const char *  name  ) 

Finds link corresponding to this name.

Definition at line 151 of file ContactManager.cc.

Referenced by dtn::TcaRouter::create_link(), and dtn::DTLSRRouter::recompute_routes().

LinkRef dtn::ContactManager::find_link_to ( ConvergenceLayer cl,
const std::string &  nexthop,
const EndpointID remote_eid = EndpointID::NULL_EID(),
Link::link_type_t  type = Link::LINK_INVALID,
u_int  states = 0xffffffff 
)

Helper routine to find a link based on criteria:

Parameters:
cl The convergence layer
nexthop The next hop string
remote_eid Remote endpoint id (NULL_EID for any)
type Link type (LINK_INVALID for any)
states Bit vector of legal link states, e.g. ~(OPEN | OPENING)
Returns:
The link if it matches or NULL if there's no match

Definition at line 388 of file ContactManager.cc.

void dtn::ContactManager::handle_contact_up ( ContactUpEvent event  )  [virtual]

Event handler when a link is opened successfully.

Reimplemented from dtn::BundleEventHandler.

Definition at line 356 of file ContactManager.cc.

void dtn::ContactManager::handle_event ( BundleEvent event  )  [inline, virtual]

Generic event handler.

Implements dtn::BundleEventHandler.

Definition at line 121 of file ContactManager.h.

References dtn::BundleEventHandler::dispatch_event().

Referenced by dtn::BundleDaemon::load_registrations().

void dtn::ContactManager::handle_link_available ( LinkAvailableEvent event  )  [virtual]

Event handler when a link becomes unavailable.

Reimplemented from dtn::BundleEventHandler.

Definition at line 243 of file ContactManager.cc.

void dtn::ContactManager::handle_link_created ( LinkCreatedEvent event  )  [virtual]

Event handler when a link has been created.

Reimplemented from dtn::BundleEventHandler.

Definition at line 217 of file ContactManager.cc.

void dtn::ContactManager::handle_link_unavailable ( LinkUnavailableEvent event  )  [virtual]

Event handler when a link becomes unavailable.

Reimplemented from dtn::BundleEventHandler.

Definition at line 284 of file ContactManager.cc.

bool dtn::ContactManager::has_link ( const char *  name  ) 

Check if contact manager already has a link by the same name.

Definition at line 136 of file ContactManager.cc.

bool dtn::ContactManager::has_link ( const LinkRef link  ) 

Check if contact manager already has this link.

Definition at line 123 of file ContactManager.cc.

const LinkSet * dtn::ContactManager::links (  ) 

Return the list of links.

Asserts that the CM spin lock is held by the caller.

Definition at line 170 of file ContactManager.cc.

Referenced by dtn::TableBasedRouter::remove_from_deferred(), and dtnsim::SimConvergenceLayer::update_connectivity().

oasys::Lock* dtn::ContactManager::lock (  )  [inline]
LinkRef dtn::ContactManager::new_opportunistic_link ( ConvergenceLayer cl,
const std::string &  nexthop,
const EndpointID remote_eid,
const std::string *  link_name = NULL 
)

Notification from a convergence layer that a new opportunistic link has come knocking.

Returns:
An idle link to represent the new contact

Definition at line 434 of file ContactManager.cc.

void dtn::ContactManager::reopen_link ( const LinkRef link  )  [protected]

Reopen a broken link.

Definition at line 188 of file ContactManager.cc.


Friends And Related Function Documentation

friend class LinkAvailabilityTimer [friend]

Definition at line 185 of file ContactManager.h.


Member Data Documentation

Definition at line 191 of file ContactManager.h.

Set of all links.

Definition at line 164 of file ContactManager.h.

Referenced by add_new_link().

oasys::SpinLock dtn::ContactManager::lock_ [mutable, protected]

Lock to protect internal data structures.

Definition at line 196 of file ContactManager.h.

Referenced by lock().

Counter for opportunistic links.

Definition at line 165 of file ContactManager.h.


The documentation for this class was generated from the following files:
Generated on Sun Nov 21 11:41:03 2010 for DTN Reference Implementation by  doxygen 1.6.3