Helper class (and thread) that manages an established connection with a peer daemon. More...
#include <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. | |
| virtual void | serialize (oasys::SerializeAction *a) |
| Virtual from SerializableObject. | |
Protected Member Functions | |
| void | recv_data () |
| Hook for handle_poll_activity to receive data. | |
| TCPLinkParams * | tcp_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::TCPClient * | sock_ |
| The socket. | |
| struct pollfd * | sock_pollfd_ |
| Poll structure for the socket. | |
Friends | |
| class | TCPConvergenceLayer |
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 118 of file TCPConvergenceLayer.h.
| dtn::TCPConvergenceLayer::Connection::Connection | ( | TCPConvergenceLayer * | cl, | |
| TCPLinkParams * | params | |||
| ) |
Constructor for the active connect side of a connection.
Definition at line 269 of file TCPConvergenceLayer.cc.
References errno, dtn::TCPConvergenceLayer::TCPLinkParams::local_addr_, dtn::TCPConvergenceLayer::TCPLinkParams::remote_addr_, dtn::TCPConvergenceLayer::TCPLinkParams::remote_port_, dtn::CLConnection::set_nexthop(), 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 311 of file TCPConvergenceLayer.cc.
References dtn::CLConnection::set_nexthop(), and sock_.
| dtn::TCPConvergenceLayer::Connection::~Connection | ( | ) | [virtual] |
| void dtn::TCPConvergenceLayer::Connection::accept | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Reimplemented from dtn::CLConnection.
Definition at line 432 of file TCPConvergenceLayer.cc.
References ASSERT, dtn::StreamConvergenceLayer::Connection::initiate_contact(), and sock_.
| void dtn::TCPConvergenceLayer::Connection::connect | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 386 of file TCPConvergenceLayer.cc.
References ASSERT, dtn::StreamConvergenceLayer::Connection::break_contact(), dtn::ContactEvent::BROKEN, dtn::CLConnection::cl_, dtn::CLConnection::contact_, errno, dtn::StreamConvergenceLayer::Connection::initiate_contact(), dtn::CLConnection::params_, dtn::ConnectionConvergenceLayer::parse_nexthop(), dtn::TCPConvergenceLayer::TCPLinkParams::remote_addr_, dtn::TCPConvergenceLayer::TCPLinkParams::remote_port_, sock_, and sock_pollfd_.
| void dtn::TCPConvergenceLayer::Connection::disconnect | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 443 of file TCPConvergenceLayer.cc.
References sock_.
| void dtn::TCPConvergenceLayer::Connection::handle_poll_activity | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 452 of file TCPConvergenceLayer.cc.
References dtn::StreamConvergenceLayer::Connection::break_contact(), dtn::ContactEvent::BROKEN, dtn::StreamConvergenceLayer::Connection::check_keepalive(), dtn::CLConnection::contact_broken_, dtn::CLConnection::contact_up_, errno, dtn::StreamConvergenceLayer::Connection::initiate_contact(), dtn::StreamConvergenceLayer::Connection::process_data(), recv_data(), dtn::CLConnection::recvbuf_, send_data(), dtn::CLConnection::sendbuf_, sock_, and sock_pollfd_.
| void dtn::TCPConvergenceLayer::Connection::initialize_pollfds | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 364 of file TCPConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::num_pollfds_, dtn::CLConnection::params_, dtn::CLConnection::poll_timeout_, dtn::CLConnection::pollfds_, sock_, and sock_pollfd_.
| void dtn::TCPConvergenceLayer::Connection::recv_data | ( | ) | [protected] |
Hook for handle_poll_activity to receive data.
Definition at line 572 of file TCPConvergenceLayer.cc.
References ASSERT, dtn::StreamConvergenceLayer::Connection::break_contact(), dtn::ContactEvent::BROKEN, dtn::CLConnection::contact_broken_, hex, dtn::TCPConvergenceLayer::TCPLinkParams::hexdump_, dtn::CLConnection::params_, dtn::CLConnection::recvbuf_, sock_, tcp_lparams(), dtn::ConnectionConvergenceLayer::LinkParams::test_read_delay_, and dtn::ConnectionConvergenceLayer::LinkParams::test_read_limit_.
Referenced by handle_poll_activity().
| void dtn::TCPConvergenceLayer::Connection::send_data | ( | ) | [protected, virtual] |
virtual from StreamConvergenceLayer::Connection
Implements dtn::StreamConvergenceLayer::Connection.
Definition at line 521 of file TCPConvergenceLayer.cc.
References ASSERT, dtn::StreamConvergenceLayer::Connection::break_contact(), dtn::ContactEvent::BROKEN, dtn::CLConnection::contact_broken_, errno, hex, dtn::TCPConvergenceLayer::TCPLinkParams::hexdump_, dtn::CLConnection::params_, dtn::CLConnection::sendbuf_, sock_, sock_pollfd_, tcp_lparams(), and dtn::ConnectionConvergenceLayer::LinkParams::test_write_limit_.
Referenced by handle_poll_activity().
| void dtn::TCPConvergenceLayer::Connection::serialize | ( | oasys::SerializeAction * | a | ) | [virtual] |
Virtual from SerializableObject.
Reimplemented from dtn::CLInfo.
Definition at line 339 of file TCPConvergenceLayer.cc.
References dtn::TCPConvergenceLayer::TCPLinkParams::hexdump_, dtn::TCPConvergenceLayer::TCPLinkParams::local_addr_, dtn::TCPConvergenceLayer::TCPLinkParams::remote_addr_, dtn::TCPConvergenceLayer::TCPLinkParams::remote_port_, and tcp_lparams().
| 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 163 of file TCPConvergenceLayer.h.
References ASSERT, and dtn::CLConnection::params_.
Referenced by recv_data(), send_data(), and serialize().
friend class TCPConvergenceLayer [friend] |
Definition at line 142 of file TCPConvergenceLayer.h.
oasys::TCPClient* dtn::TCPConvergenceLayer::Connection::sock_ [protected] |
The socket.
Definition at line 170 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 171 of file TCPConvergenceLayer.h.
Referenced by connect(), handle_poll_activity(), initialize_pollfds(), and send_data().
1.6.3