#include <StreamConvergenceLayer.h>
Definition at line 187 of file StreamConvergenceLayer.h.
Public Member Functions | |
Connection (const char *classname, const char *logpath, StreamConvergenceLayer *cl, StreamLinkParams *params, bool active_connector) | |
Constructor. | |
bool | send_pending_data () |
virtual from CLConnection | |
void | handle_send_bundle (Bundle *bundle) |
virtual from CLConnection | |
void | handle_cancel_bundle (Bundle *bundle) |
virtual from CLConnection | |
void | handle_poll_timeout () |
virtual from CLConnection | |
void | break_contact (ContactEvent::reason_t reason) |
virtual from CLConnection | |
Protected Member Functions | |
virtual void | send_data ()=0 |
Hook used to tell the derived CL class to drain data out of the send buffer. | |
void | initiate_contact () |
utility functions used by derived classes | |
void | process_data () |
utility functions used by derived classes | |
void | check_keepalive () |
utility functions used by derived classes | |
Protected Attributes | |
InFlightBundle * | current_inflight_ |
Current bundle that's in flight. | |
size_t | send_segment_todo_ |
Bytes left to send of current segment. | |
size_t | recv_segment_todo_ |
Bytes left to recv of current segment. | |
struct timeval | data_rcvd_ |
Timestamp for idle/keepalive timer. | |
struct timeval | data_sent_ |
Timestamp for idle timer. | |
struct timeval | keepalive_sent_ |
Timestamp for keepalive timer. | |
bool | breaking_contact_ |
Bit to catch multiple calls to break_contact. | |
Private Member Functions | |
StreamLinkParams * | stream_lparams () |
Utility function to downcast the params_ pointer that's stored in the CLConnection parent class. | |
void | note_data_rcvd () |
utility functions used internally in this class | |
void | note_data_sent () |
utility functions used internally in this class | |
bool | send_pending_acks () |
utility functions used internally in this class | |
bool | start_next_bundle () |
utility functions used internally in this class | |
bool | send_next_segment (InFlightBundle *inflight) |
utility functions used internally in this class | |
bool | send_data_todo (InFlightBundle *inflight) |
utility functions used internally in this class | |
bool | finish_bundle (InFlightBundle *inflight) |
utility functions used internally in this class | |
void | check_completed (InFlightBundle *inflight) |
utility functions used internally in this class | |
void | send_keepalive () |
utility functions used internally in this class | |
void | handle_contact_initiation () |
utility functions used internally in this class | |
bool | handle_data_segment (u_int8_t flags) |
utility functions used internally in this class | |
bool | handle_data_todo () |
utility functions used internally in this class | |
bool | handle_ack_segment (u_int8_t flags) |
utility functions used internally in this class | |
bool | handle_refuse_bundle (u_int8_t flags) |
utility functions used internally in this class | |
bool | handle_keepalive (u_int8_t flags) |
utility functions used internally in this class | |
bool | handle_shutdown (u_int8_t flags) |
utility functions used internally in this class | |
void | check_completed (IncomingBundle *incoming) |
utility functions used internally in this class |
dtn::StreamConvergenceLayer::Connection::Connection | ( | const char * | classname, | |
const char * | logpath, | |||
StreamConvergenceLayer * | cl, | |||
StreamLinkParams * | params, | |||
bool | active_connector | |||
) |
bool dtn::StreamConvergenceLayer::Connection::send_pending_data | ( | ) | [virtual] |
virtual from CLConnection
Implements dtn::CLConnection.
Definition at line 343 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::contact_broken_, current_inflight_, send_data_todo(), send_next_segment(), send_pending_acks(), send_segment_todo_, dtn::CLConnection::sendbuf_, start_next_bundle(), and oasys::StreamBuffer::tailbytes().
void dtn::StreamConvergenceLayer::Connection::handle_send_bundle | ( | Bundle * | bundle | ) | [virtual] |
virtual from CLConnection
Implements dtn::CLConnection.
Definition at line 330 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::contact_, dtn::LinkBlockSet::find_blocks(), dtn::CLConnection::inflight_, dtn::BundleProtocol::total_length(), and dtn::Bundle::xmit_blocks_.
void dtn::StreamConvergenceLayer::Connection::handle_cancel_bundle | ( | Bundle * | bundle | ) | [virtual] |
virtual from CLConnection
Implements dtn::CLConnection.
Definition at line 714 of file StreamConvergenceLayer.cc.
void dtn::StreamConvergenceLayer::Connection::handle_poll_timeout | ( | ) | [virtual] |
virtual from CLConnection
Implements dtn::CLConnection.
Definition at line 721 of file StreamConvergenceLayer.cc.
References ASSERT, break_contact(), dtn::ContactEvent::BROKEN, check_keepalive(), dtn::CLConnection::contact_, data_rcvd_, data_sent_, dtn::ConnectionConvergenceLayer::LinkParams::data_timeout_, dtnsim::gettimeofday(), dtn::ContactEvent::IDLE, keepalive_sent_, ExamineDump::l, dtn::ContactManager::lock(), log_debug, log_info, dtn::Link::ONDEMAND, dtn::CLConnection::params_, dtn::CLConnection::poll_timeout_, dtn::BundleDaemon::shutting_down(), and TIMEVAL_DIFF_MSEC.
void dtn::StreamConvergenceLayer::Connection::break_contact | ( | ContactEvent::reason_t | reason | ) | [virtual] |
virtual from CLConnection
Reimplemented from dtn::CLConnection.
Definition at line 1242 of file StreamConvergenceLayer.cc.
References dtn::CLConnection::break_contact(), breaking_contact_, dtn::ContactEvent::BROKEN, dtn::ContactEvent::CL_ERROR, dtn::ContactEvent::CL_VERSION, oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), oasys::StreamBuffer::fullbytes(), dtn::ContactEvent::IDLE, dtn::ContactEvent::INVALID, log_debug, dtn::ContactEvent::NO_INFO, NOTREACHED, dtn::ContactEvent::RECONNECT, send_data(), send_segment_todo_, dtn::CLConnection::sendbuf_, dtn::StreamConvergenceLayer::SHUTDOWN, dtn::ContactEvent::SHUTDOWN, dtn::StreamConvergenceLayer::SHUTDOWN_BUSY, dtn::StreamConvergenceLayer::SHUTDOWN_HAS_REASON, dtn::StreamConvergenceLayer::SHUTDOWN_IDLE_TIMEOUT, dtn::StreamConvergenceLayer::SHUTDOWN_NO_REASON, dtn::StreamConvergenceLayer::SHUTDOWN_VERSION_MISMATCH, dtn::ContactEvent::TIMEOUT, dtn::ContactEvent::UNBLOCKED, and dtn::ContactEvent::USER.
Referenced by check_completed(), handle_ack_segment(), handle_contact_initiation(), handle_data_segment(), handle_data_todo(), handle_poll_timeout(), handle_refuse_bundle(), handle_shutdown(), process_data(), and send_data().
void dtn::TCPConvergenceLayer::Connection::send_data | ( | ) | [protected, pure virtual] |
Hook used to tell the derived CL class to drain data out of the send buffer.
Definition at line 532 of file TCPConvergenceLayer.cc.
References ASSERT, 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_, oasys::StreamBuffer::start(), and dtn::ConnectionConvergenceLayer::LinkParams::test_write_delay_.
Referenced by break_contact(), initiate_contact(), send_data_todo(), send_keepalive(), and send_pending_acks().
void dtn::StreamConvergenceLayer::Connection::initiate_contact | ( | ) | [protected] |
utility functions used by derived classes
Definition at line 132 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::cl_, dtn::EndpointID::data(), data_rcvd_, data_sent_, encode(), encoding_len(), oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), dtn::StreamConvergenceLayer::ContactHeader::flags, oasys::StreamBuffer::fullbytes(), dtnsim::gettimeofday(), dtn::StreamConvergenceLayer::ContactHeader::keepalive_interval, dtn::StreamConvergenceLayer::StreamLinkParams::keepalive_interval_, keepalive_sent_, dtn::EndpointID::length(), dtn::BundleDaemon::local_eid(), log_debug, log_warn, dtn::ConvergenceLayer::MAGIC, dtn::StreamConvergenceLayer::ContactHeader::magic, note_data_sent(), dtn::StreamConvergenceLayer::REACTIVE_FRAG_ENABLED, dtn::ConnectionConvergenceLayer::LinkParams::reactive_frag_enabled_, oasys::StreamBuffer::reserve(), dtn::StreamConvergenceLayer::SEGMENT_ACK_ENABLED, dtn::StreamConvergenceLayer::StreamLinkParams::segment_ack_enabled_, send_data(), dtn::CLConnection::sendbuf_, oasys::StreamBuffer::start(), stream_lparams(), oasys::StreamBuffer::tailbytes(), and dtn::StreamConvergenceLayer::ContactHeader::version.
void dtn::StreamConvergenceLayer::Connection::process_data | ( | ) | [protected] |
utility functions used by derived classes
Definition at line 850 of file StreamConvergenceLayer.cc.
References dtn::StreamConvergenceLayer::ACK_SEGMENT, ASSERT, break_contact(), dtn::ContactEvent::CL_ERROR, dtn::CLConnection::contact_broken_, dtn::CLConnection::contact_up_, dtn::StreamConvergenceLayer::DATA_SEGMENT, oasys::StreamBuffer::fullbytes(), handle_ack_segment(), handle_contact_initiation(), handle_data_segment(), handle_data_todo(), handle_keepalive(), handle_refuse_bundle(), handle_shutdown(), dtn::StreamConvergenceLayer::KEEPALIVE, log_debug, log_err, log_warn, note_data_rcvd(), recv_segment_todo_, dtn::CLConnection::recvbuf_, dtn::StreamConvergenceLayer::REFUSE_BUNDLE, oasys::StreamBuffer::reserve(), dtn::StreamConvergenceLayer::SHUTDOWN, oasys::StreamBuffer::size(), oasys::StreamBuffer::start(), and oasys::StreamBuffer::tailbytes().
void dtn::StreamConvergenceLayer::Connection::check_keepalive | ( | ) | [protected] |
utility functions used by derived classes
Definition at line 801 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::Link::AVAILABLE, dtn::Link::BUSY, dtn::CLConnection::contact_, data_sent_, dtnsim::gettimeofday(), dtn::StreamConvergenceLayer::StreamLinkParams::keepalive_interval_, keepalive_sent_, log_warn, dtn::CLConnection::num_pending_, dtn::CLConnection::params_, dtn::BundleDaemon::post_at_head(), send_keepalive(), TIMEVAL_DIFF_MSEC, dtn::ContactEvent::UNBLOCKED, and oasys::atomic_t::value.
Referenced by handle_poll_timeout().
void dtn::StreamConvergenceLayer::Connection::note_data_rcvd | ( | ) | [private] |
utility functions used internally in this class
Definition at line 945 of file StreamConvergenceLayer.cc.
References data_rcvd_, dtnsim::gettimeofday(), and log_debug.
Referenced by process_data().
void dtn::StreamConvergenceLayer::Connection::note_data_sent | ( | ) | [private] |
utility functions used internally in this class
Definition at line 953 of file StreamConvergenceLayer.cc.
References data_sent_, dtnsim::gettimeofday(), and log_debug.
Referenced by initiate_contact(), send_data_todo(), and send_pending_acks().
bool dtn::StreamConvergenceLayer::Connection::send_pending_acks | ( | ) | [private] |
utility functions used internally in this class
Definition at line 392 of file StreamConvergenceLayer.cc.
References dtn::StreamConvergenceLayer::ACK_SEGMENT, ASSERT, dtn::CLConnection::contact_broken_, encode(), encoding_len(), oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), dtn::CLConnection::incoming_, log_debug, note_data_sent(), send_data(), dtn::CLConnection::sendbuf_, and oasys::StreamBuffer::tailbytes().
Referenced by send_pending_data().
bool dtn::StreamConvergenceLayer::Connection::start_next_bundle | ( | ) | [private] |
utility functions used internally in this class
Definition at line 494 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::contact_broken_, current_inflight_, dtn::CLConnection::inflight_, log_debug, and send_next_segment().
Referenced by send_pending_data().
bool dtn::StreamConvergenceLayer::Connection::send_next_segment | ( | InFlightBundle * | inflight | ) | [private] |
utility functions used internally in this class
Definition at line 538 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::StreamConvergenceLayer::BUNDLE_END, dtn::StreamConvergenceLayer::BUNDLE_START, dtn::StreamConvergenceLayer::DATA_SEGMENT, encode(), encoding_len(), oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), finish_bundle(), log_debug, dtn::StreamConvergenceLayer::StreamLinkParams::segment_length_, send_data_todo(), send_segment_todo_, dtn::CLConnection::sendbuf_, stream_lparams(), and oasys::StreamBuffer::tailbytes().
Referenced by send_pending_data(), and start_next_bundle().
bool dtn::StreamConvergenceLayer::Connection::send_data_todo | ( | InFlightBundle * | inflight | ) | [private] |
utility functions used internally in this class
Definition at line 601 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::contact_broken_, oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), log_debug, note_data_sent(), dtn::BundleProtocol::produce(), send_data(), send_segment_todo_, dtn::CLConnection::sendbuf_, and oasys::StreamBuffer::tailbytes().
Referenced by send_next_segment(), and send_pending_data().
bool dtn::StreamConvergenceLayer::Connection::finish_bundle | ( | InFlightBundle * | inflight | ) | [private] |
utility functions used internally in this class
Definition at line 643 of file StreamConvergenceLayer.cc.
References ASSERT, check_completed(), dtn::CLConnection::check_unblock_link(), and current_inflight_.
Referenced by send_next_segment().
void dtn::StreamConvergenceLayer::Connection::check_completed | ( | InFlightBundle * | inflight | ) | [private] |
utility functions used internally in this class
Definition at line 658 of file StreamConvergenceLayer.cc.
References ASSERT, current_inflight_, dtn::CLConnection::inflight_, and log_debug.
Referenced by finish_bundle(), handle_ack_segment(), and handle_data_todo().
void dtn::StreamConvergenceLayer::Connection::send_keepalive | ( | ) | [private] |
utility functions used internally in this class
Definition at line 689 of file StreamConvergenceLayer.cc.
References ASSERT, oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), oasys::StreamBuffer::fullbytes(), dtnsim::gettimeofday(), dtn::StreamConvergenceLayer::KEEPALIVE, keepalive_sent_, log_debug, send_data(), dtn::CLConnection::sendbuf_, and oasys::StreamBuffer::tailbytes().
Referenced by check_keepalive().
void dtn::StreamConvergenceLayer::Connection::handle_contact_initiation | ( | ) | [private] |
utility functions used internally in this class
Definition at line 202 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::EndpointID::assign(), break_contact(), dtn::EndpointID::c_str(), dtn::CLConnection::cl_, dtn::ContactEvent::CL_ERROR, dtn::ContactEvent::CL_VERSION, oasys::StreamBuffer::consume(), dtn::CLConnection::contact_up(), dtn::CLConnection::contact_up_, dtn::ConnectionConvergenceLayer::LinkParams::data_timeout_, decode(), dtn::CLConnection::find_contact(), dtn::StreamConvergenceLayer::ContactHeader::flags, oasys::StreamBuffer::fullbytes(), dtn::StreamConvergenceLayer::ContactHeader::keepalive_interval, dtn::StreamConvergenceLayer::StreamLinkParams::keepalive_interval_, log_debug, log_err, log_warn, dtn::ConvergenceLayer::MAGIC, dtn::StreamConvergenceLayer::ContactHeader::magic, dtn::StreamConvergenceLayer::NEGATIVE_ACK_ENABLED, dtn::StreamConvergenceLayer::StreamLinkParams::negative_ack_enabled_, dtn::CLConnection::poll_timeout_, dtn::StreamConvergenceLayer::REACTIVE_FRAG_ENABLED, dtn::ConnectionConvergenceLayer::LinkParams::reactive_frag_enabled_, dtn::CLConnection::recvbuf_, dtn::StreamConvergenceLayer::SEGMENT_ACK_ENABLED, dtn::StreamConvergenceLayer::StreamLinkParams::segment_ack_enabled_, oasys::StreamBuffer::start(), stream_lparams(), and dtn::StreamConvergenceLayer::ContactHeader::version.
Referenced by process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_data_segment | ( | u_int8_t | flags | ) | [private] |
utility functions used internally in this class
Definition at line 961 of file StreamConvergenceLayer.cc.
References break_contact(), dtn::StreamConvergenceLayer::BUNDLE_END, dtn::StreamConvergenceLayer::BUNDLE_START, dtn::ContactEvent::CL_ERROR, oasys::StreamBuffer::consume(), decode(), oasys::StreamBuffer::fullbytes(), handle_data_todo(), dtn::CLConnection::incoming_, log_debug, log_err, recv_segment_todo_, dtn::CLConnection::recvbuf_, and oasys::StreamBuffer::start().
Referenced by process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_data_todo | ( | ) | [private] |
utility functions used internally in this class
Definition at line 1044 of file StreamConvergenceLayer.cc.
References ASSERT, break_contact(), check_completed(), dtn::ContactEvent::CL_ERROR, oasys::StreamBuffer::consume(), dtn::BundleProtocol::consume(), oasys::StreamBuffer::fullbytes(), dtn::CLConnection::incoming_, log_debug, log_err, recv_segment_todo_, dtn::CLConnection::recvbuf_, and oasys::StreamBuffer::start().
Referenced by handle_data_segment(), and process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_ack_segment | ( | u_int8_t | flags | ) | [private] |
utility functions used internally in this class
Definition at line 1151 of file StreamConvergenceLayer.cc.
References break_contact(), check_completed(), dtn::ContactEvent::CL_ERROR, oasys::StreamBuffer::consume(), dtn::CLConnection::contact_, decode(), oasys::StreamBuffer::fullbytes(), dtn::CLConnection::inflight_, log_debug, log_err, dtn::BundleDaemon::post(), dtn::CLConnection::recvbuf_, oasys::SparseBitmap< _inttype_t >::iterator::skip_contiguous(), and oasys::StreamBuffer::start().
Referenced by process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_refuse_bundle | ( | u_int8_t | flags | ) | [private] |
utility functions used internally in this class
Definition at line 1222 of file StreamConvergenceLayer.cc.
References break_contact(), dtn::ContactEvent::CL_ERROR, log_debug, and log_err.
Referenced by process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_keepalive | ( | u_int8_t | flags | ) | [private] |
utility functions used internally in this class
Definition at line 1232 of file StreamConvergenceLayer.cc.
References oasys::StreamBuffer::consume(), log_debug, and dtn::CLConnection::recvbuf_.
Referenced by process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_shutdown | ( | u_int8_t | flags | ) | [private] |
utility functions used internally in this class
Definition at line 1333 of file StreamConvergenceLayer.cc.
References break_contact(), oasys::StreamBuffer::consume(), log_debug, log_err, log_info, dtn::CLConnection::recvbuf_, dtn::ContactEvent::SHUTDOWN, dtn::StreamConvergenceLayer::SHUTDOWN_BUSY, dtn::StreamConvergenceLayer::SHUTDOWN_HAS_DELAY, dtn::StreamConvergenceLayer::SHUTDOWN_HAS_REASON, dtn::StreamConvergenceLayer::SHUTDOWN_IDLE_TIMEOUT, dtn::StreamConvergenceLayer::SHUTDOWN_NO_REASON, dtn::StreamConvergenceLayer::shutdown_reason_to_str(), dtn::StreamConvergenceLayer::SHUTDOWN_VERSION_MISMATCH, oasys::StreamBuffer::start(), and oasys::StreamBuffer::tailbytes().
Referenced by process_data().
void dtn::StreamConvergenceLayer::Connection::check_completed | ( | IncomingBundle * | incoming | ) | [private] |
utility functions used internally in this class
Definition at line 1098 of file StreamConvergenceLayer.cc.
References break_contact(), dtn::ContactEvent::CL_ERROR, dtn::CLConnection::contact_, dtn::EVENTSRC_PEER, log_debug, log_err, oasys::Ref< _Type >::object(), dtn::BundleDaemon::post(), and dtn::BundleProtocol::total_length().
StreamLinkParams* dtn::StreamConvergenceLayer::Connection::stream_lparams | ( | ) | [inline, private] |
Utility function to downcast the params_ pointer that's stored in the CLConnection parent class.
Definition at line 245 of file StreamConvergenceLayer.h.
References ASSERT, and dtn::CLConnection::params_.
Referenced by handle_contact_initiation(), initiate_contact(), and send_next_segment().
InFlightBundle* dtn::StreamConvergenceLayer::Connection::current_inflight_ [protected] |
Current bundle that's in flight.
Definition at line 253 of file StreamConvergenceLayer.h.
Referenced by check_completed(), finish_bundle(), send_pending_data(), and start_next_bundle().
size_t dtn::StreamConvergenceLayer::Connection::send_segment_todo_ [protected] |
Bytes left to send of current segment.
Definition at line 254 of file StreamConvergenceLayer.h.
Referenced by break_contact(), send_data_todo(), send_next_segment(), and send_pending_data().
size_t dtn::StreamConvergenceLayer::Connection::recv_segment_todo_ [protected] |
Bytes left to recv of current segment.
Definition at line 255 of file StreamConvergenceLayer.h.
Referenced by handle_data_segment(), handle_data_todo(), and process_data().
struct timeval dtn::StreamConvergenceLayer::Connection::data_rcvd_ [read, protected] |
Timestamp for idle/keepalive timer.
Definition at line 256 of file StreamConvergenceLayer.h.
Referenced by handle_poll_timeout(), initiate_contact(), and note_data_rcvd().
struct timeval dtn::StreamConvergenceLayer::Connection::data_sent_ [read, protected] |
Timestamp for idle timer.
Definition at line 257 of file StreamConvergenceLayer.h.
Referenced by check_keepalive(), handle_poll_timeout(), initiate_contact(), and note_data_sent().
struct timeval dtn::StreamConvergenceLayer::Connection::keepalive_sent_ [read, protected] |
Timestamp for keepalive timer.
Definition at line 258 of file StreamConvergenceLayer.h.
Referenced by check_keepalive(), handle_poll_timeout(), initiate_contact(), and send_keepalive().
Bit to catch multiple calls to break_contact.
Definition at line 259 of file StreamConvergenceLayer.h.
Referenced by break_contact().