dtntunnel::DTNTunnel Class Reference

#include <DTNTunnel.h>

Inheritance diagram for dtntunnel::DTNTunnel:

oasys::Logger

List of all members.


Detailed Description

Main wrapper class for the DTN Tunnel.

Definition at line 38 of file DTNTunnel.h.


Public Member Functions

 DTNTunnel ()
 Constructor.
int send_bundle (dtn::APIBundle *bundle, dtn_endpoint_id_t *dest_eid)
 Hook for various tunnel classes to send a bundle.
int handle_bundle (dtn_bundle_spec_t *spec, dtn_bundle_payload_t *payload)
 Called for arriving bundles.
int main (int argc, char *argv[])
 Main application loop.
u_int max_size ()
 Accessors.
u_int delay ()
dtn_endpoint_id_tdest_eid ()

Public Attributes

struct
dtntunnel::DTNTunnel::BundleHeader 
packed
 Struct to encapsulate the header sent with each tunneled bundle.

Protected Member Functions

void init_log ()
void init_tunnel ()
void init_registration ()
void get_options (int argc, char *argv[])

Protected Attributes

std::string loglevelstr_
oasys::log_level_t loglevel_
std::string logfile_
UDPTunneludptunnel_
TCPTunneltcptunnel_
dtn_handle_t recv_handle_
dtn_handle_t send_handle_
oasys::Mutex send_lock_
bool listen_
dtn_endpoint_id_t local_eid_
dtn_endpoint_id_t dest_eid_
bool custody_
u_int expiration_
bool tcp_
bool udp_
in_addr_t local_addr_
u_int16_t local_port_
in_addr_t remote_addr_
u_int16_t remote_port_
u_int delay_
u_int max_size_

Classes

struct  BundleHeader
 Struct to encapsulate the header sent with each tunneled bundle. More...

Constructor & Destructor Documentation

dtntunnel::DTNTunnel::DTNTunnel (  ) 

Constructor.

Definition at line 42 of file DTNTunnel.cc.

References dest_eid_, and local_eid_.


Member Function Documentation

int dtntunnel::DTNTunnel::send_bundle ( dtn::APIBundle bundle,
dtn_endpoint_id_t dest_eid 
)

Hook for various tunnel classes to send a bundle.

Assumes ownership of the passed-in bundle

Returns:
DTN_SUCCESS on success, a DTN_ERRNO value on error

Definition at line 280 of file DTNTunnel.cc.

References oasys::ScratchBuffer< _memory_t, _static_size >::buf(), bundle_id, COS_NORMAL, custody_, dtn_bundle_spec_t::dest, dtn_bundle_spec_t::dopts, DOPTS_CUSTODY, DOPTS_NONE, dtn_copy_eid(), dtn_errno(), DTN_PAYLOAD_MEM, dtn_send(), dtn_set_payload(), dtn_strerror(), DTN_SUCCESS, dtn_bundle_spec_t::expiration, expiration_, ExamineDump::l, oasys::ExpandableBuffer::len(), local_eid_, log_err, dtn::APIBundle::payload_, dtn_bundle_spec_t::priority, recv_handle_, send_handle_, send_lock_, and dtn_bundle_spec_t::source.

Referenced by dtntunnel::UDPTunnel::Listener::run(), and dtntunnel::TCPTunnel::Connection::run().

int dtntunnel::DTNTunnel::handle_bundle ( dtn_bundle_spec_t spec,
dtn_bundle_payload_t payload 
)

Called for arriving bundles.

Definition at line 324 of file DTNTunnel.cc.

References ASSERT, oasys::ScratchBuffer< _memory_t, _static_size >::buf(), dtn_bundle_payload_t::buf, dtn_bundle_payload_t::buf_len, dtn_bundle_payload_t::buf_val, DTN_PAYLOAD_MEM, dtntunnel::TCPTunnel::handle_bundle(), dtntunnel::UDPTunnel::handle_bundle(), dtn_bundle_payload_t::location, log_err, dtn::APIBundle::payload_, dtntunnel::DTNTunnel::BundleHeader::protocol_, oasys::ExpandableBuffer::set_len(), dtn::APIBundle::spec_, tcptunnel_, and udptunnel_.

Referenced by main().

int dtntunnel::DTNTunnel::main ( int  argc,
char *  argv[] 
)

Main application loop.

Definition at line 360 of file DTNTunnel.cc.

References dtn_bundle_payload_t::buf, dtn_bundle_payload_t::buf_len, dtn_close(), dtn_errno(), dtn_free_payload(), DTN_PAYLOAD_MEM, dtn_recv(), dtn_strerror(), DTN_TIMEOUT_INF, get_options(), handle_bundle(), init_log(), init_registration(), init_tunnel(), log_debug, log_err, log_info, log_notice, recv_handle_, and send_handle_.

u_int dtntunnel::DTNTunnel::max_size (  )  [inline]

Accessors.

Definition at line 98 of file DTNTunnel.h.

References max_size_.

Referenced by dtntunnel::TCPTunnel::Connection::run().

u_int dtntunnel::DTNTunnel::delay (  )  [inline]

Definition at line 99 of file DTNTunnel.h.

References delay_.

Referenced by dtntunnel::TCPTunnel::Connection::run().

dtn_endpoint_id_t* dtntunnel::DTNTunnel::dest_eid (  )  [inline]

Definition at line 100 of file DTNTunnel.h.

References dest_eid_.

Referenced by dtntunnel::UDPTunnel::Listener::run().

void dtntunnel::DTNTunnel::init_log (  )  [protected]

Definition at line 178 of file DTNTunnel.cc.

References oasys::Log::init(), oasys::LOG_INVALID, oasys::LOG_NOTICE, logfile_, loglevel_, loglevelstr_, and oasys::str2level().

Referenced by main().

void dtntunnel::DTNTunnel::init_tunnel (  )  [protected]

Definition at line 201 of file DTNTunnel.cc.

References dtntunnel::UDPTunnel::add_listener(), dtntunnel::TCPTunnel::add_listener(), listen_, local_addr_, local_port_, remote_addr_, remote_port_, tcp_, tcptunnel_, udp_, and udptunnel_.

Referenced by main().

void dtntunnel::DTNTunnel::init_registration (  )  [protected]

Definition at line 219 of file DTNTunnel.cc.

References dtn_bind(), dtn_build_local_eid(), dtn_copy_eid(), DTN_ENOTFOUND, dtn_errno(), dtn_find_registration(), dtn_open(), DTN_REG_DEFER, dtn_register(), dtn_strerror(), DTN_SUCCESS, dtn_reg_info_t::endpoint, dtn_reg_info_t::expiration, dtn_reg_info_t::failure_action, local_eid_, log_crit, log_debug, log_notice, recv_handle_, regid, send_handle_, and dtn_endpoint_id_t::uri.

Referenced by main().

void dtntunnel::DTNTunnel::get_options ( int  argc,
char *  argv[] 
) [protected]

Definition at line 66 of file DTNTunnel.cc.

References oasys::Getopt::addopt(), CHECK_OPT, custody_, delay_, dest_eid_, expiration_, oasys::Getopt::getopt(), INADDR_NONE, listen_, local_addr_, local_eid_, local_port_, logfile_, loglevelstr_, max_size_, remote_addr_, remote_port_, tcp_, udp_, oasys::Getopt::usage(), and usage().

Referenced by main().


Member Data Documentation

struct dtntunnel::DTNTunnel::BundleHeader dtntunnel::DTNTunnel::packed

Struct to encapsulate the header sent with each tunneled bundle.

Note that since it is declared as a packed struct, it can be sent over the wire as-is.

XXX/demmer if this is used for non-IP tunnels, the address fields will need to be union'd or something like that

std::string dtntunnel::DTNTunnel::loglevelstr_ [protected]

Definition at line 103 of file DTNTunnel.h.

Referenced by get_options(), and init_log().

oasys::log_level_t dtntunnel::DTNTunnel::loglevel_ [protected]

Definition at line 104 of file DTNTunnel.h.

Referenced by init_log().

std::string dtntunnel::DTNTunnel::logfile_ [protected]

Definition at line 105 of file DTNTunnel.h.

Referenced by get_options(), and init_log().

UDPTunnel* dtntunnel::DTNTunnel::udptunnel_ [protected]

Definition at line 107 of file DTNTunnel.h.

Referenced by handle_bundle(), and init_tunnel().

TCPTunnel* dtntunnel::DTNTunnel::tcptunnel_ [protected]

Definition at line 108 of file DTNTunnel.h.

Referenced by handle_bundle(), and init_tunnel().

dtn_handle_t dtntunnel::DTNTunnel::recv_handle_ [protected]

Definition at line 110 of file DTNTunnel.h.

Referenced by init_registration(), main(), and send_bundle().

dtn_handle_t dtntunnel::DTNTunnel::send_handle_ [protected]

Definition at line 111 of file DTNTunnel.h.

Referenced by init_registration(), main(), and send_bundle().

oasys::Mutex dtntunnel::DTNTunnel::send_lock_ [protected]

Definition at line 112 of file DTNTunnel.h.

Referenced by send_bundle().

bool dtntunnel::DTNTunnel::listen_ [protected]

Definition at line 113 of file DTNTunnel.h.

Referenced by get_options(), and init_tunnel().

dtn_endpoint_id_t dtntunnel::DTNTunnel::local_eid_ [protected]

Definition at line 114 of file DTNTunnel.h.

Referenced by DTNTunnel(), get_options(), init_registration(), and send_bundle().

dtn_endpoint_id_t dtntunnel::DTNTunnel::dest_eid_ [protected]

Definition at line 115 of file DTNTunnel.h.

Referenced by dest_eid(), DTNTunnel(), and get_options().

bool dtntunnel::DTNTunnel::custody_ [protected]

Definition at line 116 of file DTNTunnel.h.

Referenced by get_options(), and send_bundle().

u_int dtntunnel::DTNTunnel::expiration_ [protected]

Definition at line 117 of file DTNTunnel.h.

Referenced by get_options(), and send_bundle().

bool dtntunnel::DTNTunnel::tcp_ [protected]

Definition at line 118 of file DTNTunnel.h.

Referenced by get_options(), and init_tunnel().

bool dtntunnel::DTNTunnel::udp_ [protected]

Definition at line 119 of file DTNTunnel.h.

Referenced by get_options(), and init_tunnel().

in_addr_t dtntunnel::DTNTunnel::local_addr_ [protected]

Definition at line 120 of file DTNTunnel.h.

Referenced by get_options(), and init_tunnel().

u_int16_t dtntunnel::DTNTunnel::local_port_ [protected]

Definition at line 121 of file DTNTunnel.h.

Referenced by get_options(), and init_tunnel().

in_addr_t dtntunnel::DTNTunnel::remote_addr_ [protected]

Definition at line 122 of file DTNTunnel.h.

Referenced by get_options(), and init_tunnel().

u_int16_t dtntunnel::DTNTunnel::remote_port_ [protected]

Definition at line 123 of file DTNTunnel.h.

Referenced by get_options(), and init_tunnel().

u_int dtntunnel::DTNTunnel::delay_ [protected]

Definition at line 124 of file DTNTunnel.h.

Referenced by delay(), and get_options().

u_int dtntunnel::DTNTunnel::max_size_ [protected]

Definition at line 125 of file DTNTunnel.h.

Referenced by get_options(), and max_size().


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