Class to manage TCP <-> DTN tunnels. More...
#include <TCPTunnel.h>
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... | |
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. | |
| typedef std::map< ConnKey, dtn::APIBundleVector * > | NoConnBundleTable |
| Table of bundles that arrive out of order before the connection is set up. | |
Protected Member Functions | |
| u_int32_t | next_connection_id () |
| Return the next connection id. | |
| 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_ |
| NoConnBundleTable | no_conn_bundles_ |
| oasys::SpinLock | lock_ |
| Lock to protect the connections table. | |
| u_int32_t | next_connection_id_ |
| Increasing counter for connection identifiers. | |
Class to manage TCP <-> DTN tunnels.
Definition at line 37 of file TCPTunnel.h.
typedef std::map<ConnKey, Connection*> dtntunnel::TCPTunnel::ConnTable [protected] |
Table of connection classes indexed by the remote address/port.
Definition at line 181 of file TCPTunnel.h.
typedef std::map<ConnKey, dtn::APIBundleVector*> dtntunnel::TCPTunnel::NoConnBundleTable [protected] |
Table of bundles that arrive out of order before the connection is set up.
Definition at line 186 of file TCPTunnel.h.
| dtntunnel::TCPTunnel::TCPTunnel | ( | ) |
Constructor.
Definition at line 29 of file TCPTunnel.cc.
| 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 37 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, dtntunnel::DTNTunnel::BundleHeader::client_addr_, dtntunnel::DTNTunnel::BundleHeader::client_port_, dtntunnel::DTNTunnel::BundleHeader::connection_id_, connections_, lock_, no_conn_bundles_, dtn::APIBundle::payload_, dtntunnel::DTNTunnel::BundleHeader::remote_addr_, dtntunnel::DTNTunnel::BundleHeader::remote_port_, dtntunnel::DTNTunnel::BundleHeader::seqno_, dtn_bundle_spec_t::source, dtn::APIBundle::spec_, and dtn_endpoint_id_t::uri.
Referenced by dtntunnel::DTNTunnel::handle_bundle().
| void dtntunnel::TCPTunnel::kill_connection | ( | Connection * | c | ) | [protected] |
Hook called when a new connection dies.
Definition at line 82 of file TCPTunnel.cc.
References dtntunnel::TCPTunnel::Connection::client_addr_, dtntunnel::TCPTunnel::Connection::client_port_, dtntunnel::TCPTunnel::Connection::connection_id_, connections_, dtntunnel::TCPTunnel::Connection::dest_eid_, lock_, dtntunnel::TCPTunnel::Connection::remote_addr_, and dtntunnel::TCPTunnel::Connection::remote_port_.
Referenced by dtntunnel::TCPTunnel::Connection::run().
| void dtntunnel::TCPTunnel::new_connection | ( | Connection * | c | ) | [protected] |
Hook called by the listener when a new connection comes in.
Definition at line 54 of file TCPTunnel.cc.
References ASSERT, dtntunnel::TCPTunnel::Connection::client_addr_, dtntunnel::TCPTunnel::Connection::client_port_, dtntunnel::TCPTunnel::Connection::connection_id_, connections_, dtntunnel::TCPTunnel::Connection::dest_eid_, lock_, dtntunnel::TCPTunnel::Connection::remote_addr_, and dtntunnel::TCPTunnel::Connection::remote_port_.
Referenced by dtntunnel::TCPTunnel::Listener::accepted().
| u_int32_t dtntunnel::TCPTunnel::next_connection_id | ( | ) | [protected] |
Return the next connection id.
Definition at line 46 of file TCPTunnel.cc.
References lock_, and next_connection_id_.
Referenced by dtntunnel::TCPTunnel::Listener::accepted().
ConnTable dtntunnel::TCPTunnel::connections_ [protected] |
Definition at line 182 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 190 of file TCPTunnel.h.
Referenced by handle_bundle(), kill_connection(), new_connection(), and next_connection_id().
u_int32_t dtntunnel::TCPTunnel::next_connection_id_ [protected] |
Increasing counter for connection identifiers.
Definition at line 193 of file TCPTunnel.h.
Referenced by next_connection_id().
Definition at line 187 of file TCPTunnel.h.
Referenced by handle_bundle().
1.6.3