#include <DTNTunnel.h>
Definition at line 39 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. | |
void | fill_options () |
Virtual from oasys::App. | |
void | validate_options (int argc, char *const argv[], int remainder) |
u_int | max_size () |
Accessors. | |
u_int | delay () |
dtn_endpoint_id_t * | dest_eid () |
Public Attributes | |
struct dtntunnel::DTNTunnel::BundleHeader | packed |
Struct to encapsulate the header sent with each tunneled bundle. | |
Protected Member Functions | |
void | init_tunnel () |
void | init_registration () |
Protected Attributes | |
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_ |
std::string | tunnel_spec_ |
bool | tunnel_spec_set_ |
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 298 of file DTNTunnel.cc.
References 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_REG_DEFER, dtn_send(), dtn_set_payload(), dtn_strerror(), DTN_SUCCESS, dtn_bundle_spec_t::expiration, expiration_, local_eid_, 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 342 of file DTNTunnel.cc.
References ASSERT, 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(), len, dtn_bundle_payload_t::location, dtn::APIBundle::payload_, dtntunnel::DTNTunnel::BundleHeader::protocol_, dtn::APIBundle::spec_, tcptunnel_, and udptunnel_.
Referenced by main().
int dtntunnel::DTNTunnel::main | ( | int | argc, | |
char * | argv[] | |||
) |
Main application loop.
Definition at line 378 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, handle_bundle(), init_registration(), init_tunnel(), recv_handle_, and send_handle_.
void dtntunnel::DTNTunnel::fill_options | ( | ) |
Virtual from oasys::App.
Definition at line 74 of file DTNTunnel.cc.
References custody_, delay_, expiration_, listen_, local_eid_, max_size_, tcp_, tunnel_spec_, tunnel_spec_set_, and udp_.
void dtntunnel::DTNTunnel::validate_options | ( | int | argc, | |
char *const | argv[], | |||
int | remainder | |||
) |
Definition at line 118 of file DTNTunnel.cc.
References CHECK_OPT, dest_eid_, dtn_parse_eid_string(), listen_, local_addr_, local_port_, remote_addr_, remote_port_, tcp_, tunnel_spec_, tunnel_spec_set_, and udp_.
u_int dtntunnel::DTNTunnel::max_size | ( | ) | [inline] |
Accessors.
Definition at line 106 of file DTNTunnel.h.
References max_size_.
Referenced by dtntunnel::TCPTunnel::Connection::run().
u_int dtntunnel::DTNTunnel::delay | ( | ) | [inline] |
Definition at line 107 of file DTNTunnel.h.
References delay_.
Referenced by dtntunnel::TCPTunnel::Connection::run().
dtn_endpoint_id_t* dtntunnel::DTNTunnel::dest_eid | ( | ) | [inline] |
Definition at line 108 of file DTNTunnel.h.
References dest_eid_.
Referenced by dtntunnel::UDPTunnel::Listener::run().
void dtntunnel::DTNTunnel::init_tunnel | ( | ) | [protected] |
Definition at line 206 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 224 of file DTNTunnel.cc.
References dest_eid_, 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::flags, listen_, local_addr_, local_eid_, local_port_, recv_handle_, regid, remote_addr_, remote_port_, send_handle_, tcp_, and dtn_endpoint_id_t::uri.
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
UDPTunnel* dtntunnel::DTNTunnel::udptunnel_ [protected] |
TCPTunnel* dtntunnel::DTNTunnel::tcptunnel_ [protected] |
dtn_handle_t dtntunnel::DTNTunnel::recv_handle_ [protected] |
Definition at line 114 of file DTNTunnel.h.
Referenced by init_registration(), main(), and send_bundle().
dtn_handle_t dtntunnel::DTNTunnel::send_handle_ [protected] |
Definition at line 115 of file DTNTunnel.h.
Referenced by init_registration(), main(), and send_bundle().
oasys::Mutex dtntunnel::DTNTunnel::send_lock_ [protected] |
bool dtntunnel::DTNTunnel::listen_ [protected] |
Definition at line 117 of file DTNTunnel.h.
Referenced by fill_options(), init_registration(), init_tunnel(), and validate_options().
dtn_endpoint_id_t dtntunnel::DTNTunnel::local_eid_ [protected] |
Definition at line 118 of file DTNTunnel.h.
Referenced by DTNTunnel(), fill_options(), init_registration(), and send_bundle().
dtn_endpoint_id_t dtntunnel::DTNTunnel::dest_eid_ [protected] |
Definition at line 119 of file DTNTunnel.h.
Referenced by dest_eid(), DTNTunnel(), init_registration(), and validate_options().
bool dtntunnel::DTNTunnel::custody_ [protected] |
u_int dtntunnel::DTNTunnel::expiration_ [protected] |
bool dtntunnel::DTNTunnel::tcp_ [protected] |
Definition at line 122 of file DTNTunnel.h.
Referenced by fill_options(), init_registration(), init_tunnel(), and validate_options().
bool dtntunnel::DTNTunnel::udp_ [protected] |
Definition at line 123 of file DTNTunnel.h.
Referenced by fill_options(), init_tunnel(), and validate_options().
in_addr_t dtntunnel::DTNTunnel::local_addr_ [protected] |
Definition at line 124 of file DTNTunnel.h.
Referenced by init_registration(), init_tunnel(), and validate_options().
u_int16_t dtntunnel::DTNTunnel::local_port_ [protected] |
Definition at line 125 of file DTNTunnel.h.
Referenced by init_registration(), init_tunnel(), and validate_options().
in_addr_t dtntunnel::DTNTunnel::remote_addr_ [protected] |
Definition at line 126 of file DTNTunnel.h.
Referenced by init_registration(), init_tunnel(), and validate_options().
u_int16_t dtntunnel::DTNTunnel::remote_port_ [protected] |
Definition at line 127 of file DTNTunnel.h.
Referenced by init_registration(), init_tunnel(), and validate_options().
u_int dtntunnel::DTNTunnel::delay_ [protected] |
u_int dtntunnel::DTNTunnel::max_size_ [protected] |
std::string dtntunnel::DTNTunnel::tunnel_spec_ [protected] |
bool dtntunnel::DTNTunnel::tunnel_spec_set_ [protected] |