#include <TCPConvergenceLayer.h>
Inheritance diagram for dtn::TCPConvergenceLayer::Connection:

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 () |
| utility functions used internally in this class | |
| 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. | |
| pollfd * | sock_pollfd_ |
| Poll structure for the socket. | |
Friends | |
| class | TCPConvergenceLayer |
| 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_, 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 337 of file TCPConvergenceLayer.cc.
References intoa, oasys::Logger::logpath(), oasys::Logger::logpath_, oasys::Logger::logpathf(), dtn::CLConnection::set_nexthop(), and sock_.
| dtn::TCPConvergenceLayer::Connection::~Connection | ( | ) | [virtual] |
| void dtn::TCPConvergenceLayer::Connection::accept | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 419 of file TCPConvergenceLayer.cc.
References ASSERT, oasys::IPSocket::ESTABLISHED, dtn::StreamConvergenceLayer::Connection::initiate_contact(), intoa, log_debug, oasys::IPSocket::remote_addr(), oasys::IPSocket::remote_port(), sock_, and oasys::IPSocket::state().
| void dtn::TCPConvergenceLayer::Connection::connect | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 387 of file TCPConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, oasys::IPSocket::connect(), dtn::CLConnection::contact_, errno, oasys::IPSocket::ESTABLISHED, dtn::StreamConvergenceLayer::Connection::initiate_contact(), intoa, log_debug, log_info, oasys::IPSocket::remote_addr(), oasys::IPSocket::remote_port(), sock_, sock_pollfd_, and oasys::IPSocket::state().
| void dtn::TCPConvergenceLayer::Connection::disconnect | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 430 of file TCPConvergenceLayer.cc.
References oasys::IPSocket::close(), oasys::IPSocket::CLOSED, log_debug, dtn::StreamConvergenceLayer::Connection::send_segment_todo_, dtn::StreamConvergenceLayer::SHUTDOWN, sock_, oasys::IPSocket::state(), and oasys::IPClient::write().
| int dtn::TCPConvergenceLayer::Connection::handle_ack | ( | ) | [protected] |
| void dtn::TCPConvergenceLayer::Connection::handle_poll_activity | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 448 of file TCPConvergenceLayer.cc.
References oasys::IPSocket::async_connect_result(), dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, oasys::IPSocket::CONNECTING, errno, dtn::StreamConvergenceLayer::Connection::initiate_contact(), intoa, log_debug, log_info, dtn::StreamConvergenceLayer::Connection::process_data(), recv_data(), oasys::IPSocket::remote_addr(), oasys::IPSocket::remote_port(), send_data(), sock_, sock_pollfd_, and oasys::IPSocket::state().
| bool dtn::TCPConvergenceLayer::Connection::handle_reply | ( | ) | [protected] |
| void dtn::TCPConvergenceLayer::Connection::initialize_pollfds | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Implements dtn::CLConnection.
Definition at line 365 of file TCPConvergenceLayer.cc.
References ASSERT, oasys::IPSocket::fd(), dtn::CLConnection::num_pollfds_, dtn::CLConnection::params_, dtn::CLConnection::poll_timeout_, dtn::CLConnection::pollfds_, sock_, and sock_pollfd_.
| bool dtn::TCPConvergenceLayer::Connection::recv_bundle | ( | ) | [protected] |
| bool dtn::TCPConvergenceLayer::Connection::recv_contact_header | ( | int | timeout | ) | [protected] |
| void dtn::TCPConvergenceLayer::Connection::recv_data | ( | ) | [protected] |
Definition at line 545 of file TCPConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, dtn::CLConnection::contact_broken_, oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), oasys::StreamBuffer::fullbytes(), log_debug, log_err, log_info, dtn::CLConnection::params_, oasys::IPClient::read(), dtn::CLConnection::recvbuf_, sock_, and oasys::StreamBuffer::tailbytes().
Referenced by handle_poll_activity().
| bool dtn::TCPConvergenceLayer::Connection::send_ack | ( | u_int32_t | bundle_id, | |
| size_t | acked_len | |||
| ) | [protected] |
| void dtn::TCPConvergenceLayer::Connection::send_data | ( | ) | [protected, virtual] |
virtual from StreamConvergenceLayer::Connection
Implements dtn::StreamConvergenceLayer::Connection.
Definition at line 499 of file TCPConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, oasys::StreamBuffer::consume(), dtn::CLConnection::contact_broken_, errno, oasys::StreamBuffer::fullbytes(), log_debug, log_info, dtn::CLConnection::params_, dtn::CLConnection::sendbuf_, sock_, sock_pollfd_, oasys::StreamBuffer::start(), and oasys::IPClient::write().
Referenced by handle_poll_activity().
| bool dtn::TCPConvergenceLayer::Connection::send_keepalive | ( | ) | [protected] |
utility functions used internally in this class
Reimplemented from dtn::StreamConvergenceLayer::Connection.
| 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, and dtn::CLConnection::params_.
friend class TCPConvergenceLayer [friend] |
Definition at line 151 of file TCPConvergenceLayer.h.
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().
1.4.7