#include <TCPTunnel.h>
Inheritance diagram for dtntunnel::TCPTunnel:
Definition at line 58 of file TCPTunnel.h.
Public Member Functions | |
TCPTunnel () | |
Constructor. | |
void | add_listener (in_addr_t listen_addr, u_int16_t listen_port, in_addr_t remote_addr, u_int16_t remote_port) |
Add a new listening to from the given listening address/port to the given remote address/port. | |
void | handle_bundle (dtn::APIBundle *bundle) |
Handle a newly arriving bundle. | |
Protected Types | |
typedef std::map< ConnKey, Connection * > | ConnTable |
Table of connection classes indexed by the remote address/port. | |
Protected Member Functions | |
void | new_connection (Connection *c) |
Hook called by the listener when a new connection comes in. | |
void | kill_connection (Connection *c) |
Hook called when a new connection dies. | |
Protected Attributes | |
ConnTable | connections_ |
oasys::SpinLock | lock_ |
Lock to protect the connections table. | |
Classes | |
class | Connection |
Helper class to handle an actively proxied connection. More... | |
struct | ConnKey |
Helper struct used as the index key into the connection table. More... | |
class | Listener |
Helper class to accept incoming TCP connections. More... |
typedef std::map<ConnKey, Connection*> dtntunnel::TCPTunnel::ConnTable [protected] |
Table of connection classes indexed by the remote address/port.
Definition at line 176 of file TCPTunnel.h.
dtntunnel::TCPTunnel::TCPTunnel | ( | ) |
void dtntunnel::TCPTunnel::add_listener | ( | in_addr_t | listen_addr, | |
u_int16_t | listen_port, | |||
in_addr_t | remote_addr, | |||
u_int16_t | remote_port | |||
) | [virtual] |
Add a new listening to from the given listening address/port to the given remote address/port.
Implements dtntunnel::IPTunnel.
Definition at line 53 of file TCPTunnel.cc.
Referenced by dtntunnel::DTNTunnel::init_tunnel().
void dtntunnel::TCPTunnel::handle_bundle | ( | dtn::APIBundle * | bundle | ) | [virtual] |
Handle a newly arriving bundle.
Implements dtntunnel::IPTunnel.
Definition at line 114 of file TCPTunnel.cc.
References ASSERT, oasys::ScratchBuffer< _memory_t, _static_size >::buf(), connections_, dtntunnel::TCPTunnel::Connection::handle_bundle(), intoa, ExamineDump::l, oasys::ExpandableBuffer::len(), lock_, log_debug, log_info, dtn::APIBundle::payload_, dtn_bundle_spec_t::source, dtn::APIBundle::spec_, and oasys::Thread::start().
Referenced by dtntunnel::DTNTunnel::handle_bundle().
void dtntunnel::TCPTunnel::new_connection | ( | Connection * | c | ) | [protected] |
Hook called by the listener when a new connection comes in.
Definition at line 62 of file TCPTunnel.cc.
References dtntunnel::TCPTunnel::Connection::client_addr_, dtntunnel::TCPTunnel::Connection::client_port_, connections_, intoa, ExamineDump::l, lock_, log_err, dtntunnel::TCPTunnel::Connection::remote_addr_, and dtntunnel::TCPTunnel::Connection::remote_port_.
Referenced by dtntunnel::TCPTunnel::Listener::accepted().
void dtntunnel::TCPTunnel::kill_connection | ( | Connection * | c | ) | [protected] |
Hook called when a new connection dies.
Definition at line 88 of file TCPTunnel.cc.
References dtntunnel::TCPTunnel::Connection::client_addr_, dtntunnel::TCPTunnel::Connection::client_port_, connections_, intoa, ExamineDump::l, lock_, log_err, dtntunnel::TCPTunnel::Connection::remote_addr_, and dtntunnel::TCPTunnel::Connection::remote_port_.
Referenced by dtntunnel::TCPTunnel::Connection::run().
ConnTable dtntunnel::TCPTunnel::connections_ [protected] |
Definition at line 177 of file TCPTunnel.h.
Referenced by handle_bundle(), kill_connection(), and new_connection().
oasys::SpinLock dtntunnel::TCPTunnel::lock_ [protected] |
Lock to protect the connections table.
Definition at line 180 of file TCPTunnel.h.
Referenced by handle_bundle(), kill_connection(), and new_connection().