dtn::TCPConvergenceLayer::Connection Class Reference

#include <TCPConvergenceLayer.h>

List of all members.


Detailed Description

Helper class (and thread) that manages an established connection with a peer daemon.

Although the same class is used in both cases, a particular Connection is either a receiver or a sender, as indicated by the direction variable. Note that to deal with NAT, the side which does the active connect is not necessarily the sender.

Definition at line 132 of file TCPConvergenceLayer.h.

Public Member Functions

 Connection (TCPConvergenceLayer *cl, TCPLinkParams *params)
 Constructor for the active connect side of a connection.
 Connection (TCPConvergenceLayer *cl, TCPLinkParams *params, int fd, in_addr_t addr, u_int16_t port)
 Constructor for the passive accept side of a connection.
virtual ~Connection ()
 Destructor.

Protected Member Functions

void recv_data ()
bool recv_contact_header (int timeout)
bool send_bundle (Bundle *bundle)
bool recv_bundle ()
bool handle_reply ()
int handle_ack ()
bool send_ack (u_int32_t bundle_id, size_t acked_len)
bool send_keepalive ()
TCPLinkParamstcp_lparams ()
 Utility function to downcast the params_ pointer that's stored in the CLConnection parent class.
virtual void connect ()
 Virtual from CLConnection.
virtual void accept ()
 Virtual from CLConnection.
virtual void disconnect ()
 Virtual from CLConnection.
virtual void initialize_pollfds ()
 Virtual from CLConnection.
virtual void handle_poll_activity ()
 Virtual from CLConnection.
void send_data ()
 virtual from StreamConvergenceLayer::Connection

Protected Attributes

oasys::TCPClientsock_
 The socket.
pollfd * sock_pollfd_
 Poll structure for the socket.

Friends

class TCPConvergenceLayer


Constructor & Destructor Documentation

dtn::TCPConvergenceLayer::Connection::Connection ( TCPConvergenceLayer cl,
TCPLinkParams params 
)

Constructor for the active connect side of a connection.

Definition at line 289 of file TCPConvergenceLayer.cc.

References errno, intoa, dtn::TCPConvergenceLayer::TCPLinkParams::local_addr_, log_err, oasys::Logger::logpath(), oasys::Logger::logpath_, oasys::Logger::logpathf(), dtn::TCPConvergenceLayer::TCPLinkParams::remote_addr_, dtn::TCPConvergenceLayer::TCPLinkParams::remote_port_, and sock_.

dtn::TCPConvergenceLayer::Connection::Connection ( TCPConvergenceLayer cl,
TCPLinkParams params,
int  fd,
in_addr_t  addr,
u_int16_t  port 
)

Constructor for the passive accept side of a connection.

Definition at line 337 of file TCPConvergenceLayer.cc.

References intoa, oasys::Logger::logpath(), oasys::Logger::logpath_, oasys::Logger::logpathf(), and sock_.

dtn::TCPConvergenceLayer::Connection::~Connection (  )  [virtual]

Destructor.

Definition at line 358 of file TCPConvergenceLayer.cc.

References sock_.


Member Function Documentation

void dtn::TCPConvergenceLayer::Connection::connect (  )  [protected, virtual]

Virtual from CLConnection.

Definition at line 387 of file TCPConvergenceLayer.cc.

References ASSERT, dtn::ContactEvent::BROKEN, oasys::IPSocket::connect(), errno, oasys::IPSocket::ESTABLISHED, intoa, log_debug, log_info, oasys::IPSocket::remote_addr(), oasys::IPSocket::remote_port(), sock_, sock_pollfd_, and oasys::IPSocket::state().

void dtn::TCPConvergenceLayer::Connection::accept (  )  [protected, virtual]

Virtual from CLConnection.

Definition at line 419 of file TCPConvergenceLayer.cc.

References ASSERT, oasys::IPSocket::ESTABLISHED, intoa, log_debug, oasys::IPSocket::remote_addr(), oasys::IPSocket::remote_port(), sock_, and oasys::IPSocket::state().

void dtn::TCPConvergenceLayer::Connection::disconnect (  )  [protected, virtual]

Virtual from CLConnection.

Definition at line 430 of file TCPConvergenceLayer.cc.

References oasys::IPSocket::close(), oasys::IPSocket::CLOSED, log_debug, dtn::StreamConvergenceLayer::SHUTDOWN, sock_, oasys::IPSocket::state(), and oasys::IPClient::write().

void dtn::TCPConvergenceLayer::Connection::initialize_pollfds (  )  [protected, virtual]

Virtual from CLConnection.

Definition at line 365 of file TCPConvergenceLayer.cc.

References ASSERT, oasys::IPSocket::fd(), sock_, and sock_pollfd_.

void dtn::TCPConvergenceLayer::Connection::handle_poll_activity (  )  [protected, virtual]

Virtual from CLConnection.

Definition at line 448 of file TCPConvergenceLayer.cc.

References oasys::IPSocket::async_connect_result(), dtn::ContactEvent::BROKEN, oasys::IPSocket::CONNECTING, errno, intoa, log_debug, log_info, recv_data(), oasys::IPSocket::remote_addr(), oasys::IPSocket::remote_port(), send_data(), sock_, sock_pollfd_, and oasys::IPSocket::state().

void dtn::TCPConvergenceLayer::Connection::send_data (  )  [protected]

virtual from StreamConvergenceLayer::Connection

Definition at line 499 of file TCPConvergenceLayer.cc.

References ASSERT, dtn::ContactEvent::BROKEN, errno, log_debug, log_info, sock_, sock_pollfd_, and oasys::IPClient::write().

Referenced by handle_poll_activity().

void dtn::TCPConvergenceLayer::Connection::recv_data (  )  [protected]

Definition at line 545 of file TCPConvergenceLayer.cc.

References ASSERT, dtn::ContactEvent::BROKEN, log_debug, log_err, log_info, oasys::IPClient::read(), and sock_.

Referenced by handle_poll_activity().

bool dtn::TCPConvergenceLayer::Connection::recv_contact_header ( int  timeout  )  [protected]

bool dtn::TCPConvergenceLayer::Connection::send_bundle ( Bundle bundle  )  [protected]

bool dtn::TCPConvergenceLayer::Connection::recv_bundle (  )  [protected]

bool dtn::TCPConvergenceLayer::Connection::handle_reply (  )  [protected]

int dtn::TCPConvergenceLayer::Connection::handle_ack (  )  [protected]

bool dtn::TCPConvergenceLayer::Connection::send_ack ( u_int32_t  bundle_id,
size_t  acked_len 
) [protected]

bool dtn::TCPConvergenceLayer::Connection::send_keepalive (  )  [protected]

TCPLinkParams* dtn::TCPConvergenceLayer::Connection::tcp_lparams (  )  [inline, protected]

Utility function to downcast the params_ pointer that's stored in the CLConnection parent class.

Definition at line 178 of file TCPConvergenceLayer.h.

References ASSERT.


Friends And Related Function Documentation

friend class TCPConvergenceLayer [friend]

Definition at line 151 of file TCPConvergenceLayer.h.


Member Data Documentation

oasys::TCPClient* dtn::TCPConvergenceLayer::Connection::sock_ [protected]

The socket.

Definition at line 185 of file TCPConvergenceLayer.h.

Referenced by accept(), connect(), Connection(), disconnect(), handle_poll_activity(), initialize_pollfds(), recv_data(), send_data(), and ~Connection().

struct pollfd* dtn::TCPConvergenceLayer::Connection::sock_pollfd_ [protected]

Poll structure for the socket.

Definition at line 186 of file TCPConvergenceLayer.h.

Referenced by connect(), handle_poll_activity(), initialize_pollfds(), and send_data().


The documentation for this class was generated from the following files:
Generated on Fri Dec 22 14:48:04 2006 for DTN Reference Implementation by  doxygen 1.5.1