#include <DTNTunnel.h>
Inheritance diagram for dtntunnel::DTNTunnel:
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_t * | dest_eid () |
Public Attributes | |
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_ |
UDPTunnel * | udptunnel_ |
TCPTunnel * | tcptunnel_ |
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... |
dtntunnel::DTNTunnel::DTNTunnel | ( | ) |
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
Definition at line 280 of file DTNTunnel.cc.
References oasys::ScratchBuffer< _memory_t, _static_size >::buf(), bundle_id, COS_NORMAL, custody_, dest_eid(), DOPTS_CUSTODY, DOPTS_NONE, dtn_copy_eid(), dtn_errno(), DTN_PAYLOAD_MEM, dtn_send(), dtn_set_payload(), dtn_strerror(), DTN_SUCCESS, expiration_, ExamineDump::l, oasys::ExpandableBuffer::len(), local_eid_, log_err, dtn::APIBundle::payload_, recv_handle_, send_handle_, and send_lock_.
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_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(), and send_bundle().
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, 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().
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] |
oasys::log_level_t dtntunnel::DTNTunnel::loglevel_ [protected] |
std::string dtntunnel::DTNTunnel::logfile_ [protected] |
UDPTunnel* dtntunnel::DTNTunnel::udptunnel_ [protected] |
TCPTunnel* dtntunnel::DTNTunnel::tcptunnel_ [protected] |
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] |
bool dtntunnel::DTNTunnel::listen_ [protected] |
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] |
u_int dtntunnel::DTNTunnel::expiration_ [protected] |
bool dtntunnel::DTNTunnel::tcp_ [protected] |
bool dtntunnel::DTNTunnel::udp_ [protected] |
in_addr_t dtntunnel::DTNTunnel::local_addr_ [protected] |
u_int16_t dtntunnel::DTNTunnel::local_port_ [protected] |
in_addr_t dtntunnel::DTNTunnel::remote_addr_ [protected] |
u_int16_t dtntunnel::DTNTunnel::remote_port_ [protected] |
u_int dtntunnel::DTNTunnel::delay_ [protected] |
u_int dtntunnel::DTNTunnel::max_size_ [protected] |