#include <TCPConvergenceLayer.h>
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 116 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. | |
virtual void | serialize (oasys::SerializeAction *a) |
Virtual from SerializableObject. | |
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 () |
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 273 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 315 of file TCPConvergenceLayer.cc.
References intoa, oasys::Logger::logpath(), oasys::Logger::logpath_, oasys::Logger::logpathf(), and sock_.
dtn::TCPConvergenceLayer::Connection::~Connection | ( | ) | [virtual] |
void dtn::TCPConvergenceLayer::Connection::serialize | ( | oasys::SerializeAction * | a | ) | [virtual] |
Virtual from SerializableObject.
Definition at line 343 of file TCPConvergenceLayer.cc.
References oasys::Intoa::buf(), dtn::TCPConvergenceLayer::TCPLinkParams::local_addr_, oasys::SerializeAction::process(), dtn::TCPConvergenceLayer::TCPLinkParams::remote_addr_, dtn::TCPConvergenceLayer::TCPLinkParams::remote_port_, and tcp_lparams().
void dtn::TCPConvergenceLayer::Connection::connect | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Definition at line 397 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(), dtn::TCPConvergenceLayer::TCPLinkParams::remote_addr_, oasys::IPSocket::remote_port(), dtn::TCPConvergenceLayer::TCPLinkParams::remote_port_, oasys::IPSocket::set_remote_addr(), oasys::IPSocket::set_remote_port(), sock_, sock_pollfd_, and oasys::IPSocket::state().
void dtn::TCPConvergenceLayer::Connection::accept | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Definition at line 443 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 454 of file TCPConvergenceLayer.cc.
References oasys::IPSocket::close(), oasys::IPSocket::CLOSED, sock_, and oasys::IPSocket::state().
void dtn::TCPConvergenceLayer::Connection::initialize_pollfds | ( | ) | [protected, virtual] |
Virtual from CLConnection.
Definition at line 375 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 463 of file TCPConvergenceLayer.cc.
References oasys::IPSocket::async_connect_result(), dtn::ContactEvent::BROKEN, oasys::IPSocket::CONNECTING, errno, intoa, log_debug, log_err, 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 532 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 578 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::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 167 of file TCPConvergenceLayer.h.
References ASSERT.
Referenced by serialize().
friend class TCPConvergenceLayer [friend] |
Definition at line 140 of file TCPConvergenceLayer.h.
The socket.
Definition at line 174 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 175 of file TCPConvergenceLayer.h.
Referenced by connect(), handle_poll_activity(), initialize_pollfds(), and send_data().