dtn::Link Class Reference

#include <Link.h>

Inheritance diagram for dtn::Link:

oasys::Formatter oasys::Logger oasys::SerializableObject dtn::AlwaysOnLink dtn::OndemandLink dtn::OpportunisticLink dtn::ScheduledLink

List of all members.


Detailed Description

Abstraction for a DTN link, i.e.

a one way communication channel to a next hop node in the DTN overlay.

The state of a link (regarding its availability) is described by the Link::state_t enumerated type.

All links in the OPEN or BUSY states have an associated contact that represents an actual connection.

Every link has a unique name associated with it which is used to identify it. The name is configured explicitly when the link is created.

Creating new links: Links are created explicitly in the configuration file. Syntax is:

 link add <name> <nexthop> <type> <conv_layer> <args>
See servlib/cmd/LinkCommand.cc for implementation of this TCL cmd.

----------------------------------------------------------

Links are of three types as discussed in the DTN architecture ONDEMAND, SCHEDULED, OPPORTUNISTIC.

The key differences from an implementation perspective are "who" and "when" manipulates the link state regarding availability.

ONDEMAND links are initializd in the AVAILABLE state, as one would expect. It remains in this state until a router explicitly opens it.

An ONDEMAND link can then be closed either due to connection failure or because the link has been idle for too long, both triggered by the convergence layer. If an ONDEMAND link is closed due to connection failure, then the contact manager is notified of this event and periodically tries to re-establish the link.

For OPPORTUNISTIC links the availability state is set by the code which detects that there is a new link available to be used.

SCHEDULED links have their availability dictated by the schedule implementation.

----------------------------------------------------------

Links are used for input and/or output. In other words, for connection-oriented convergence layers like TCP, a link object is created whenever a new connection is made to a peer or when a connection arrives from a peer.

Definition at line 93 of file Link.h.


Public Types

enum  link_type_t {
  LINK_INVALID = -1, ALWAYSON = 1, ONDEMAND = 2, SCHEDULED = 3,
  OPPORTUNISTIC = 4
}
 Valid types for a link. More...
enum  state_t {
  UNAVAILABLE = 1, AVAILABLE = 2, OPENING = 4, OPEN = 8,
  BUSY = 16, CLOSED = 32
}
 The possible states for a link. More...

Public Member Functions

 Link (const std::string &name, link_type_t type, ConvergenceLayer *cl, const char *nexthop)
 Constructor / Destructor.
 Link (const oasys::Builder &b)
 Constructor for unserialization.
void serialize (oasys::SerializeAction *action)
 Virtual from SerializableObject.
virtual int parse_args (int argc, const char *argv[], const char **invalidp=NULL)
 Hook for subclass to parse arguments.
virtual void set_initial_state ()
 Hook for subclass to post events to control the initial link state, after all initialization is complete.
link_type_t type ()
 Return the type of the link.
const char * type_str ()
 Return the string for of the link.
bool isopen ()
 Return whether or not the link is open.
bool isavailable ()
 Return the availability state of the link.
bool isbusy ()
 Return the busy state of the link.
bool isopening ()
 Return whether the link is in the process of opening.
state_t state ()
 Return the actual state.
void set_state (state_t state)
 Sets the state of the link.
const ContactRefcontact () const
 Return the current contact information (if any).
void set_contact (Contact *contact)
 Set the contact information.
void set_cl_info (CLInfo *cl_info)
 Store convergence layer state associated with the link.
CLInfocl_info () const
 Accessor to the convergence layer state.
ConvergenceLayerclayer () const
 Accessor to this contact's convergence layer.
const char * name () const
 Accessor to this links name.
const std::string & name_str () const
 Accessor to this links name as a c++ string.
const char * local () const
 Accessor to local string.
void set_local (const std::string &local)
 Mutator for local string.
const char * nexthop () const
 Accessor to next hop string.
void set_nexthop (const std::string &nexthop)
 Override for the next hop string.
bool is_reliable () const
 Accessor to the reliability bit.
void set_reliable (bool r)
 Accessor to set the reliability bit when the link is created.
void set_remote_eid (const EndpointID &remote)
 Accessor to set the remote endpoint id.
const EndpointIDremote_eid ()
 Accessor to the remote endpoint id.
BundleListqueue ()
 Accessor for the link's queue of bundles.
int format (char *buf, size_t sz) const
 Virtual from formatter.
void dump (oasys::StringBuffer *buf)
 Debugging printout.
const Paramsparams ()
 Accessor for the parameter structure.
Statsstats ()
 Accessor for the stats structure.
void reset_stats () const
 Reset the stats.
void dump_stats (oasys::StringBuffer *buf)
 Dump a printable version of the stats.

Static Public Member Functions

static const char * link_type_to_str (link_type_t type)
 Link type string conversion.
static link_type_t str_to_link_type (const char *str)
static const char * state_to_str (state_t state)
 Convert a link state into a string.
static Linkcreate_link (const std::string &name, link_type_t type, ConvergenceLayer *cl, const char *nexthop, int argc, const char *argv[], const char **invalid_argp=NULL)
 Static function to create appropriate link object from link type.

Public Attributes

u_int retry_interval_
 Seconds to wait between attempts to re-open an unavailable link.

Protected Member Functions

virtual void open ()
 Open the link.
virtual void close ()
 Close the link.
virtual ~Link ()
 Destructor -- protected since links shouldn't be deleted.

Protected Attributes

int type_
 Type of the link.
int state_
 State of the link.
std::string local_
 Local address (optional).
std::string nexthop_
 Next hop address.
std::string name_
 Internal name of the link.
bool reliable_
 Whether or not this link is reliable.
Params params_
 Parameters of the link.
BundleList queue_
 Queue of bundles currently active or pending transmission on the Link.
Stats stats_
 Stats for the link.
ContactRef contact_
 Current contact. contact_ != null iff link is open.
ConvergenceLayerclayer_
 Pointer to convergence layer.
CLInfocl_info_
 Convergence layer specific info, if needed.
EndpointID remote_eid_
 Remote's endpoint ID (eg, dtn://hostname.dtn).

Static Protected Attributes

static Params default_params_
 Default parameters of the link.

Friends

class BundleActions
class BundleDaemon
class ContactManager
class ParamCommand

Classes

struct  Params
struct  Stats

Member Enumeration Documentation

enum dtn::Link::link_type_t

Valid types for a link.

Enumerator:
LINK_INVALID 
ALWAYSON  The link is expected to be ALWAYS available, and any convergence layer connection state is always maintained for it.
ONDEMAND  The link is expected to be either always available, or can be made available easily.

Examples include DSL (always), and dialup (easily available). Convergence layers are free to tear down idle connection state, but are expected to be able to easily re-establish it.

SCHEDULED  The link is only available at pre-determined times.
OPPORTUNISTIC  The link may or may not be available, based on uncontrollable factors.

Examples include a wireless link whose connectivity depends on the relative locations of the two nodes.

Definition at line 100 of file Link.h.

enum dtn::Link::state_t

The possible states for a link.

Enumerator:
UNAVAILABLE  The link is closed and not able to be opened currently.

AVAILABLE  The link is closed but is able to be opened, either because it is an on demand link, or because an opportunistic peer node is in close proximity but no convergence layer session has yet been opened.

OPENING  A convergence layer session is in the process of being established.

OPEN  A convergence layer session has been established, and the link has capacity for a bundle to be sent on it.

This may be because no bundle is currently being sent, or because the convergence layer can handle multiple simultaneous bundle transmissions.

BUSY  The link is busy, i.e.

a bundle is currently being sent on it by the convergence layer and no more bundles may be delivered to the link.

CLOSED  Bogus state that's never actually used in the Link state_ variable, but is used for signalling the daemon thread with a LinkStateChangeRequest.

Definition at line 171 of file Link.h.


Constructor & Destructor Documentation

dtn::Link::Link ( const std::string &  name,
link_type_t  type,
ConvergenceLayer cl,
const char *  nexthop 
)

Constructor / Destructor.

Definition at line 91 of file Link.cc.

References ASSERT, clayer_, default_params_, params_, retry_interval_, and stats_.

dtn::Link::Link ( const oasys::Builder b  ) 

Constructor for unserialization.

Definition at line 114 of file Link.cc.

dtn::Link::~Link (  )  [protected, virtual]

Destructor -- protected since links shouldn't be deleted.

Definition at line 216 of file Link.cc.

References ASSERT, cl_info_, and isopen().


Member Function Documentation

static const char* dtn::Link::link_type_to_str ( link_type_t  type  )  [inline, static]

Link type string conversion.

Definition at line 139 of file Link.h.

References ALWAYSON, ONDEMAND, OPPORTUNISTIC, and SCHEDULED.

Referenced by dump(), dtn::ContactManager::find_link_to(), format(), serialize(), and type_str().

static link_type_t dtn::Link::str_to_link_type ( const char *  str  )  [inline, static]

Definition at line 151 of file Link.h.

References ALWAYSON, LINK_INVALID, ONDEMAND, OPPORTUNISTIC, and SCHEDULED.

Referenced by dtn::LinkCommand::exec(), and serialize().

static const char* dtn::Link::state_to_str ( state_t  state  )  [inline, static]

Convert a link state into a string.

Definition at line 209 of file Link.h.

References AVAILABLE, BUSY, CLOSED, NOTREACHED, OPEN, OPENING, and UNAVAILABLE.

Referenced by dump(), dtn::LinkCommand::exec(), format(), dtn::BundleDaemon::handle_link_state_change_request(), open(), dtn::ContactManager::reopen_link(), and set_state().

Link * dtn::Link::create_link ( const std::string &  name,
link_type_t  type,
ConvergenceLayer cl,
const char *  nexthop,
int  argc,
const char *  argv[],
const char **  invalid_argp = NULL 
) [static]

Static function to create appropriate link object from link type.

Definition at line 45 of file Link.cc.

References ALWAYSON, ASSERT, clayer_, count, dtn::ConvergenceLayer::init_link(), oasys::LOG_INFO, oasys::Logger::logf(), ONDEMAND, OPPORTUNISTIC, parse_args(), SCHEDULED, and set_initial_state().

Referenced by dtn::TcaRouter::create_link(), dtn::LinkCommand::exec(), and dtn::ContactManager::new_opportunistic_link().

void dtn::Link::serialize ( oasys::SerializeAction action  )  [virtual]

Virtual from SerializableObject.

Implements oasys::SerializableObject.

Definition at line 131 of file Link.cc.

References oasys::SerializeAction::action_code(), ASSERT, BUSY, clayer_, contact_, dtn::ConvergenceLayer::find_clayer(), dtn::Link::Params::idle_close_time_, LINK_INVALID, link_type_to_str(), oasys::Logger::logpathf(), dtn::Link::Params::max_retry_interval_, dtn::Link::Params::min_retry_interval_, dtn::ConvergenceLayer::name(), name_, nexthop_, OPEN, params_, oasys::SerializeAction::process(), reliable_, remote_eid_, state_, str_to_link_type(), type_, type_str(), and oasys::Serialize::UNMARSHAL.

int dtn::Link::parse_args ( int  argc,
const char *  argv[],
const char **  invalidp = NULL 
) [virtual]

Hook for subclass to parse arguments.

Definition at line 173 of file Link.cc.

References oasys::OptParser::addopt(), ALWAYSON, dtn::Link::Params::idle_close_time_, dtn::Link::Params::max_retry_interval_, dtn::Link::Params::min_retry_interval_, dtn::Link::Params::mtu_, params_, oasys::OptParser::parse_and_shift(), dtn::Link::Params::prevhop_hdr_, reliable_, remote_eid_, and type_.

Referenced by create_link(), and dtn::LinkCommand::exec().

void dtn::Link::set_initial_state (  )  [virtual]

Hook for subclass to post events to control the initial link state, after all initialization is complete.

Reimplemented in dtn::AlwaysOnLink, and dtn::OndemandLink.

Definition at line 211 of file Link.cc.

Referenced by create_link().

link_type_t dtn::Link::type (  )  [inline]

Return the type of the link.

Definition at line 261 of file Link.h.

References type_.

Referenced by dtn::ContactManager::find_link_to(), dtn::ContactManager::handle_contact_up(), and dtn::ContactManager::handle_link_unavailable().

const char* dtn::Link::type_str (  )  [inline]

Return the string for of the link.

Definition at line 266 of file Link.h.

References link_type_to_str(), and type_.

Referenced by dtn::BundleActions::cancel_bundle(), dtn::ContactManager::handle_link_unavailable(), dtn::UDPConvergenceLayer::init_link(), dtn::ConnectionConvergenceLayer::init_link(), dtn::BundleActions::send_bundle(), and serialize().

bool dtn::Link::isopen (  )  [inline]

Return whether or not the link is open.

Definition at line 272 of file Link.h.

References BUSY, OPEN, and state_.

Referenced by dtn::BundleActions::close_link(), dtn::LinkCommand::exec(), dtn::TableBasedRouter::fwd_to_nexthop(), dtn::ProphetEncounter::fwd_to_nexthop(), dtn::BundleDaemon::handle_link_state_change_request(), dtn::BundleDaemon::handle_shutdown_request(), dtn::BundleActions::open_link(), dtn::ConnectionConvergenceLayer::reconfigure_link(), and ~Link().

bool dtn::Link::isavailable (  )  [inline]

Return the availability state of the link.

Definition at line 278 of file Link.h.

References state_, and UNAVAILABLE.

Referenced by dtn::TableBasedRouter::fwd_to_nexthop(), dtn::BundleDaemon::handle_link_available(), dtn::BundleDaemon::handle_link_unavailable(), and dtn::BundleActions::open_link().

bool dtn::Link::isbusy (  )  [inline]

Return the busy state of the link.

Definition at line 283 of file Link.h.

References BUSY, and state_.

Referenced by dtn::TableBasedRouter::fwd_to_nexthop(), and dtn::ProphetEncounter::fwd_to_nexthop().

bool dtn::Link::isopening (  )  [inline]

Return whether the link is in the process of opening.

Definition at line 288 of file Link.h.

References OPENING, and state_.

Referenced by dtn::BundleActions::close_link(), dtn::LinkCommand::exec(), dtn::TableBasedRouter::fwd_to_nexthop(), and dtn::BundleDaemon::handle_link_state_change_request().

state_t dtn::Link::state (  )  [inline]

Return the actual state.

Definition at line 293 of file Link.h.

References state_.

Referenced by dtn::BundleActions::cancel_bundle(), dtn::LinkCommand::exec(), dtn::ContactManager::find_link_to(), dtn::BundleDaemon::handle_link_state_change_request(), dtn::LinkStateChangeRequest::LinkStateChangeRequest(), dtn::ContactManager::reopen_link(), dtn::BundleActions::send_bundle(), and dtn::LinkStateChangeRequest::serialize().

void dtn::Link::set_state ( state_t  state  ) 

Sets the state of the link.

Performs various assertions to ensure the state transitions are legal.

This function should only ever be called by the main BundleDaemon thread and helper classes. All other threads must use a LinkStateChangeRequest event to cause changes in the link state.

The function isn't protected since some callers (i.e. convergence layers) are not friend classes but some functions are run by the BundleDaemon thread.

Definition at line 232 of file Link.cc.

References ASSERT_STATE, AVAILABLE, BUSY, log_debug, NOTREACHED, OPEN, OPENING, state_, state_to_str(), and UNAVAILABLE.

Referenced by dtn::AlwaysOnLink::AlwaysOnLink(), dtn::BundleDaemon::handle_contact_up(), dtn::BundleDaemon::handle_link_state_change_request(), dtn::OndemandLink::OndemandLink(), and open().

const ContactRef& dtn::Link::contact (  )  const [inline]

Return the current contact information (if any).

Definition at line 313 of file Link.h.

References contact_.

Referenced by dtn::BundleActions::cancel_bundle(), dtn::BundleActions::close_link(), dtn::BundleDaemon::handle_contact_up(), dtn::BundleDaemon::handle_link_state_change_request(), dtn::LinkStateChangeRequest::LinkStateChangeRequest(), dtn::UDPConvergenceLayer::open_contact(), dtn::BundleActions::open_link(), dtn::ConnectionConvergenceLayer::reconfigure_link(), dtn::BundleActions::send_bundle(), and dtn::LinkStateChangeRequest::serialize().

void dtn::Link::set_contact ( Contact contact  )  [inline]

Set the contact information.

Definition at line 318 of file Link.h.

References ASSERT, and contact_.

void dtn::Link::set_cl_info ( CLInfo cl_info  )  [inline]

Store convergence layer state associated with the link.

Definition at line 328 of file Link.h.

References ASSERT, and cl_info_.

Referenced by dtn::UDPConvergenceLayer::init_link(), dtnsim::SimConvergenceLayer::init_link(), and dtn::ConnectionConvergenceLayer::init_link().

CLInfo* dtn::Link::cl_info (  )  const [inline]

Accessor to the convergence layer state.

Definition at line 339 of file Link.h.

References cl_info_.

Referenced by dtn::UDPConvergenceLayer::dump_link(), dtn::TCPConvergenceLayer::dump_link(), dtn::StreamConvergenceLayer::dump_link(), dtn::ConnectionConvergenceLayer::dump_link(), dtn::BluetoothConvergenceLayer::dump_link(), dtn::UDPConvergenceLayer::open_contact(), dtn::ConnectionConvergenceLayer::open_contact(), and dtn::ConnectionConvergenceLayer::reconfigure_link().

ConvergenceLayer* dtn::Link::clayer (  )  const [inline]

Accessor to this contact's convergence layer.

Definition at line 344 of file Link.h.

References clayer_.

Referenced by dtn::ForwardingLog::add_entry(), dtn::BundleActions::cancel_bundle(), close(), dtn::LinkCommand::exec(), dtn::ContactManager::find_link_to(), dtn::ForwardingLog::get_latest_entry(), open(), dtn::BundleActions::send_bundle(), and dtn::ForwardingLog::update().

const char* dtn::Link::name (  )  const [inline]

Accessor to this links name.

Definition at line 349 of file Link.h.

References name_.

Referenced by dtn::ContactManager::add_link(), dtn::BundleActions::cancel_bundle(), dtn::BundleActions::close_link(), dtn::RouteTable::del_entries_for_nexthop(), dtn::ContactManager::del_link(), dtn::RouteEntry::dump(), dump(), dtn::ContactManager::find_link(), format(), dtn::TcaRouter::fwd_to_matching_r(), dtn::BundleDaemon::handle_bundle_transmitted(), dtn::ContactManager::handle_contact_up(), dtn::ContactManager::handle_link_unavailable(), dtn::BundleActions::open_link(), dtn::ContactManager::reopen_link(), dtn::BundleActions::send_bundle(), dtn::TableBasedRouter::should_fwd(), dtn::ProphetDecider::should_fwd(), and dtn::ProphetEncounter::should_fwd().

const std::string& dtn::Link::name_str (  )  const [inline]

Accessor to this links name as a c++ string.

Definition at line 354 of file Link.h.

References name_.

Referenced by dtn::RouteEntry::serialize().

const char* dtn::Link::local (  )  const [inline]

Accessor to local string.

Definition at line 359 of file Link.h.

References local_.

Referenced by dtn::ProphetEncounter::ProphetEncounter().

void dtn::Link::set_local ( const std::string &  local  )  [inline]

Mutator for local string.

Definition at line 364 of file Link.h.

References local_.

const char* dtn::Link::nexthop (  )  const [inline]

Accessor to next hop string.

Definition at line 369 of file Link.h.

References nexthop_.

Referenced by dtn::ForwardingLog::add_entry(), dtn::BundleActions::cancel_bundle(), dtn::TableBasedRouter::check_next_hop(), dtn::RouteTable::del_entry(), dump(), dtn::ContactManager::find_link_to(), dtn::RouteEntry::format(), format(), dtn::Contact::format(), dtn::ForwardingLog::get_latest_entry(), dtn::BundleDaemon::handle_bundle_transmitted(), dtn::BundleDaemon::handle_custody_timeout(), dtn::ProphetEncounter::handle_hello_tlv(), dtn::UDPConvergenceLayer::init_link(), dtnsim::SimConvergenceLayer::init_link(), dtn::ConvergenceLayer::init_link(), dtn::ConnectionConvergenceLayer::init_link(), dtn::UDPConvergenceLayer::open_contact(), dtn::TCPConvergenceLayer::parse_nexthop(), dtn::BluetoothConvergenceLayer::parse_nexthop(), dtn::BundleActions::send_bundle(), dtn::ForwardingLog::update(), and dtn::ProphetEncounter::update_peer_verifier().

void dtn::Link::set_nexthop ( const std::string &  nexthop  )  [inline]

Override for the next hop string.

Definition at line 374 of file Link.h.

References nexthop_.

Referenced by dtn::CLConnection::find_contact().

bool dtn::Link::is_reliable (  )  const [inline]

Accessor to the reliability bit.

Definition at line 379 of file Link.h.

References reliable_.

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

void dtn::Link::set_reliable ( bool  r  )  [inline]

Accessor to set the reliability bit when the link is created.

Definition at line 384 of file Link.h.

References reliable_.

Referenced by dtn::StreamConvergenceLayer::finish_init_link().

void dtn::Link::set_remote_eid ( const EndpointID remote  )  [inline]

Accessor to set the remote endpoint id.

Definition at line 389 of file Link.h.

References dtn::EndpointID::assign(), and remote_eid_.

Referenced by dtn::ContactManager::new_opportunistic_link().

const EndpointID& dtn::Link::remote_eid (  )  [inline]

Accessor to the remote endpoint id.

Definition at line 396 of file Link.h.

References remote_eid_.

Referenced by dtn::ProphetEncounter::dump_state(), dtn::ProphetController::find_instance(), dtn::ContactManager::find_link_to(), dtn::ProphetEncounter::handle_bundle_received(), dtn::TableBasedRouter::handle_link_created(), dtn::ProphetRouter::handle_link_created(), dtn::ProphetEncounter::handle_rib_tlv(), dtn::ProphetEncounter::ProphetEncounter(), dtn::ProphetEncounter::remote_eid(), dtn::ProphetEncounter::reset_ribd(), dtn::ProphetEncounter::run(), dtn::ProphetEncounter::send_dictionary(), and dtn::ProphetEncounter::send_prophet_tlv().

BundleList* dtn::Link::queue (  )  [inline]

Accessor for the link's queue of bundles.

Definition at line 401 of file Link.h.

References queue_.

int dtn::Link::format ( char *  buf,
size_t  sz 
) const [virtual]

Virtual from formatter.

Implements oasys::Formatter.

Definition at line 327 of file Link.cc.

References dtn::EndpointID::c_str(), link_type_to_str(), name(), nexthop(), remote_eid_, snprintf(), state_, state_to_str(), and type_.

void dtn::Link::dump ( oasys::StringBuffer buf  ) 

Debugging printout.

Definition at line 337 of file Link.cc.

References oasys::StringBuffer::appendf(), dtn::EndpointID::c_str(), clayer_, dtn::ConvergenceLayer::dump_link(), link_type_to_str(), dtn::Link::Params::max_retry_interval_, dtn::Link::Params::min_retry_interval_, dtn::Link::Params::mtu_, dtn::ConvergenceLayer::name(), name(), nexthop(), params_, dtn::Link::Params::prevhop_hdr_, remote_eid_, state_, state_to_str(), and type_.

Referenced by dtn::LinkCommand::exec().

const Params& dtn::Link::params (  )  [inline]

Accessor for the parameter structure.

Definition at line 471 of file Link.h.

References params_.

Referenced by dtn::PreviousHopBlockProcessor::generate(), dtn::ContactManager::handle_contact_up(), dtn::ContactManager::handle_link_unavailable(), dtn::UDPConvergenceLayer::init_link(), dtn::PreviousHopBlockProcessor::prepare(), and dtn::BundleActions::send_bundle().

Stats* dtn::Link::stats (  )  [inline]

Accessor for the stats structure.

Definition at line 525 of file Link.h.

References stats_.

Referenced by dtn::BundleDaemon::handle_bundle_transmitted(), dtn::RoutePriorityGT::operator()(), and dtn::BundleActions::send_bundle().

void dtn::Link::reset_stats (  )  const [inline]

Reset the stats.

Definition at line 530 of file Link.h.

References stats_.

void dtn::Link::dump_stats ( oasys::StringBuffer buf  ) 

Dump a printable version of the stats.

Definition at line 365 of file Link.cc.

References oasys::StringBuffer::appendf(), dtn::Link::Stats::bundles_queued_, dtn::Link::Stats::bundles_transmitted_, dtn::Link::Stats::bytes_queued_, dtn::Link::Stats::bytes_transmitted_, dtn::Link::Stats::contact_attempts_, dtn::Link::Stats::contacts_, and stats_.

Referenced by dtn::LinkCommand::exec().

void dtn::Link::open (  )  [protected, virtual]

Open the link.

Protected to make sure only the friend components can call it and virtual to allow subclasses to override it.

Definition at line 277 of file Link.cc.

References ASSERT, AVAILABLE, clayer(), contact_, dtn::Link::Stats::contact_attempts_, log_crit, log_debug, oasys::Ref< _Type >::object(), dtn::ConvergenceLayer::open_contact(), OPENING, set_state(), state_, state_to_str(), and stats_.

Referenced by dtn::BundleActions::open_link().

void dtn::Link::close (  )  [protected, virtual]

Close the link.

Protected to make sure only the friend components can call it and virtual to allow subclasses to override it.

Definition at line 303 of file Link.cc.

References ASSERT, clayer(), dtn::ConvergenceLayer::close_contact(), contact_, log_debug, and log_err.

Referenced by dtn::BundleActions::close_link(), and dtn::BundleDaemon::handle_shutdown_request().


Friends And Related Function Documentation

friend class BundleActions [friend]

Definition at line 541 of file Link.h.

friend class BundleDaemon [friend]

Definition at line 542 of file Link.h.

friend class ContactManager [friend]

Definition at line 543 of file Link.h.

friend class ParamCommand [friend]

Definition at line 544 of file Link.h.


Member Data Documentation

u_int dtn::Link::retry_interval_

Seconds to wait between attempts to re-open an unavailable link.

Initially set to min_retry_interval_, then doubles up to max_retry_interval_.

Definition at line 466 of file Link.h.

Referenced by dtn::ContactManager::handle_contact_up(), dtn::ContactManager::handle_link_unavailable(), and Link().

int dtn::Link::type_ [protected]

Type of the link.

Definition at line 561 of file Link.h.

Referenced by dump(), format(), parse_args(), serialize(), type(), and type_str().

int dtn::Link::state_ [protected]

State of the link.

Definition at line 564 of file Link.h.

Referenced by dump(), format(), isavailable(), isbusy(), isopen(), isopening(), open(), serialize(), set_state(), and state().

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

Local address (optional).

Definition at line 567 of file Link.h.

Referenced by local(), and set_local().

std::string dtn::Link::nexthop_ [protected]

Next hop address.

Definition at line 570 of file Link.h.

Referenced by nexthop(), serialize(), and set_nexthop().

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

Internal name of the link.

Definition at line 573 of file Link.h.

Referenced by name(), name_str(), and serialize().

bool dtn::Link::reliable_ [protected]

Whether or not this link is reliable.

Definition at line 576 of file Link.h.

Referenced by dtn::BundleDaemon::handle_bundle_transmitted(), is_reliable(), parse_args(), serialize(), and set_reliable().

Params dtn::Link::params_ [protected]

Parameters of the link.

Definition at line 579 of file Link.h.

Referenced by dump(), Link(), dtn::OndemandLink::OndemandLink(), params(), parse_args(), and serialize().

Link::Params dtn::Link::default_params_ [static, protected]

Default parameters of the link.

Definition at line 582 of file Link.h.

Referenced by Link(), and dtn::ParamCommand::ParamCommand().

BundleList dtn::Link::queue_ [protected]

Queue of bundles currently active or pending transmission on the Link.

Definition at line 585 of file Link.h.

Referenced by queue().

Stats dtn::Link::stats_ [mutable, protected]

Stats for the link.

Definition at line 588 of file Link.h.

Referenced by dump_stats(), dtn::BundleDaemon::handle_contact_up(), Link(), open(), reset_stats(), and stats().

ContactRef dtn::Link::contact_ [protected]

Current contact. contact_ != null iff link is open.

Definition at line 591 of file Link.h.

Referenced by close(), contact(), open(), serialize(), and set_contact().

ConvergenceLayer* dtn::Link::clayer_ [protected]

Pointer to convergence layer.

Definition at line 594 of file Link.h.

Referenced by clayer(), create_link(), dump(), Link(), and serialize().

CLInfo* dtn::Link::cl_info_ [protected]

Convergence layer specific info, if needed.

Definition at line 597 of file Link.h.

Referenced by cl_info(), set_cl_info(), and ~Link().

EndpointID dtn::Link::remote_eid_ [protected]

Remote's endpoint ID (eg, dtn://hostname.dtn).

Definition at line 600 of file Link.h.

Referenced by dump(), format(), parse_args(), remote_eid(), serialize(), and set_remote_eid().


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