#include <StreamConvergenceLayer.h>
Inheritance diagram for dtn::StreamConvergenceLayer::Connection:
Definition at line 162 of file StreamConvergenceLayer.h.
Public Member Functions | |
Connection (const char *classname, const char *logpath, ConvergenceLayer *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 | |
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 | |
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. | |
timeval | data_rcvd_ |
Timestamp for idle/keepalive timer. | |
timeval | data_sent_ |
Timestamp for idle timer. | |
timeval | keepalive_sent_ |
Timestamp for keepalive timer. | |
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_start_bundle () |
utility functions used internally in this class | |
bool | handle_end_bundle () |
utility functions used internally in this class | |
bool | handle_data_segment () |
utility functions used internally in this class | |
bool | handle_data_todo () |
utility functions used internally in this class | |
bool | handle_ack_segment () |
utility functions used internally in this class | |
bool | handle_keepalive () |
utility functions used internally in this class | |
bool | handle_shutdown () |
utility functions used internally in this class |
dtn::StreamConvergenceLayer::Connection::Connection | ( | const char * | classname, | |
const char * | logpath, | |||
ConvergenceLayer * | cl, | |||
StreamLinkParams * | params, | |||
bool | active_connector | |||
) |
bool dtn::StreamConvergenceLayer::Connection::send_pending_data | ( | ) | [virtual] |
virtual from CLConnection
Implements dtn::CLConnection.
Definition at line 359 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 337 of file StreamConvergenceLayer.cc.
References dtn::BundleProtocol::header_block_length(), dtn::CLConnection::inflight_, and dtn::BundleProtocol::tail_block_length().
void dtn::StreamConvergenceLayer::Connection::handle_cancel_bundle | ( | Bundle * | bundle | ) | [virtual] |
virtual from CLConnection
Implements dtn::CLConnection.
Definition at line 829 of file StreamConvergenceLayer.cc.
void dtn::StreamConvergenceLayer::Connection::handle_poll_timeout | ( | ) | [virtual] |
virtual from CLConnection
Implements dtn::CLConnection.
Definition at line 836 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, dtn::CLConnection::contact_, data_rcvd_, data_sent_, dtn::ConnectionConvergenceLayer::LinkParams::data_timeout_, dtnsim::gettimeofday(), dtn::ContactEvent::IDLE, dtn::StreamConvergenceLayer::StreamLinkParams::keepalive_interval_, keepalive_sent_, log_debug, log_info, dtn::Link::ONDEMAND, dtn::CLConnection::params_, send_keepalive(), and TIMEVAL_DIFF_MSEC.
virtual void dtn::StreamConvergenceLayer::Connection::send_data | ( | ) | [protected, pure virtual] |
Hook used to tell the derived CL class to drain data out of the send buffer.
Referenced by finish_bundle(), initiate_contact(), send_data_todo(), send_keepalive(), send_pending_acks(), and start_next_bundle().
void dtn::StreamConvergenceLayer::Connection::initiate_contact | ( | ) | [protected] |
utility functions used by derived classes
Definition at line 144 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::cl_, dtn::AnnounceBundle::create_announce_bundle(), dtn::SDNV::encode(), dtn::SDNV::encoding_len(), oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), dtn::StreamConvergenceLayer::ContactHeader::flags, dtn::BundleProtocol::format_bundle(), dtn::BundleProtocol::formatted_length(), oasys::StreamBuffer::fullbytes(), dtn::BundleDaemon::instance(), dtn::StreamConvergenceLayer::ContactHeader::keepalive_interval, dtn::StreamConvergenceLayer::StreamLinkParams::keepalive_interval_, 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 903 of file StreamConvergenceLayer.cc.
References dtn::StreamConvergenceLayer::ACK_SEGMENT, ASSERT, dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, dtn::CLConnection::contact_broken_, dtn::CLConnection::contact_up_, dtn::StreamConvergenceLayer::DATA_SEGMENT, dtn::StreamConvergenceLayer::END_BUNDLE, oasys::StreamBuffer::fullbytes(), handle_ack_segment(), handle_contact_initiation(), handle_data_segment(), handle_data_todo(), handle_end_bundle(), handle_keepalive(), handle_shutdown(), handle_start_bundle(), dtn::StreamConvergenceLayer::KEEPALIVE, log_debug, log_err, log_warn, note_data_rcvd(), recv_segment_todo_, dtn::CLConnection::recvbuf_, oasys::StreamBuffer::reserve(), dtn::StreamConvergenceLayer::SHUTDOWN, oasys::StreamBuffer::size(), oasys::StreamBuffer::start(), dtn::StreamConvergenceLayer::START_BUNDLE, and oasys::StreamBuffer::tailbytes().
void dtn::StreamConvergenceLayer::Connection::note_data_rcvd | ( | ) | [private] |
utility functions used internally in this class
Definition at line 998 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 1006 of file StreamConvergenceLayer.cc.
References data_sent_, dtnsim::gettimeofday(), and log_debug.
Referenced by finish_bundle(), initiate_contact(), send_data_todo(), send_pending_acks(), and start_next_bundle().
bool dtn::StreamConvergenceLayer::Connection::send_pending_acks | ( | ) | [private] |
utility functions used internally in this class
Definition at line 402 of file StreamConvergenceLayer.cc.
References dtn::StreamConvergenceLayer::ACK_SEGMENT, ASSERT, dtn::CLConnection::contact_broken_, dtn::SDNV::encode(), dtn::SDNV::encoding_len(), oasys::StreamBuffer::end(), end, oasys::StreamBuffer::fill(), dtn::CLConnection::incoming_, log_debug, note_data_sent(), send_data(), dtn::CLConnection::sendbuf_, oasys::Thread::start(), 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 526 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::contact_broken_, current_inflight_, dtn::StreamConvergenceLayer::DATA_SEGMENT, dtn::SDNV::encode(), dtn::SDNV::encoding_len(), oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), dtn::BundleProtocol::format_header_blocks(), dtn::BundleProtocol::header_block_length(), dtn::CLConnection::inflight_, log_debug, log_warn, note_data_sent(), oasys::StreamBuffer::reserve(), dtn::StreamConvergenceLayer::StreamLinkParams::segment_length_, send_data(), send_data_todo(), send_segment_todo_, dtn::CLConnection::sendbuf_, oasys::StreamBuffer::size(), dtn::StreamConvergenceLayer::START_BUNDLE, stream_lparams(), and oasys::StreamBuffer::tailbytes().
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 648 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::StreamConvergenceLayer::DATA_SEGMENT, dtn::SDNV::encode(), dtn::SDNV::encoding_len(), oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), finish_bundle(), dtn::BundlePayload::length(), log_debug, dtn::Bundle::payload_, 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().
bool dtn::StreamConvergenceLayer::Connection::send_data_todo | ( | InFlightBundle * | inflight | ) | [private] |
utility functions used internally in this class
Definition at line 706 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::contact_broken_, oasys::StreamBuffer::end(), oasys::StreamBuffer::fill(), dtn::BundlePayload::FORCE_COPY, log_debug, note_data_sent(), send_data(), send_segment_todo_, dtn::CLConnection::sendbuf_, and oasys::StreamBuffer::tailbytes().
Referenced by send_next_segment(), send_pending_data(), and start_next_bundle().
bool dtn::StreamConvergenceLayer::Connection::finish_bundle | ( | InFlightBundle * | inflight | ) | [private] |
utility functions used internally in this class
Definition at line 744 of file StreamConvergenceLayer.cc.
References ASSERT, check_completed(), current_inflight_, oasys::StreamBuffer::end(), dtn::StreamConvergenceLayer::END_BUNDLE, oasys::StreamBuffer::fill(), log_debug, log_warn, note_data_sent(), oasys::StreamBuffer::reserve(), send_data(), dtn::CLConnection::sendbuf_, and oasys::StreamBuffer::tailbytes().
Referenced by send_next_segment().
void dtn::StreamConvergenceLayer::Connection::check_completed | ( | InFlightBundle * | inflight | ) | [private] |
utility functions used internally in this class
Definition at line 773 of file StreamConvergenceLayer.cc.
References ASSERT, current_inflight_, dtn::CLConnection::inflight_, and log_debug.
Referenced by finish_bundle(), and handle_ack_segment().
void dtn::StreamConvergenceLayer::Connection::send_keepalive | ( | ) | [private] |
utility functions used internally in this class
Definition at line 804 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 handle_poll_timeout().
void dtn::StreamConvergenceLayer::Connection::handle_contact_initiation | ( | ) | [private] |
utility functions used internally in this class
Definition at line 210 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, dtn::CLConnection::cl_, oasys::StreamBuffer::consume(), dtn::CLConnection::contact_up(), dtn::CLConnection::contact_up_, data_rcvd_, data_sent_, dtn::SDNV::decode(), dtn::StreamConvergenceLayer::ContactHeader::flags, oasys::StreamBuffer::fullbytes(), dtnsim::gettimeofday(), dtn::CLConnection::handle_announce_bundle(), dtn::StreamConvergenceLayer::ContactHeader::keepalive_interval, dtn::StreamConvergenceLayer::StreamLinkParams::keepalive_interval_, keepalive_sent_, log_debug, log_err, log_warn, dtn::ConvergenceLayer::MAGIC, dtn::StreamConvergenceLayer::ContactHeader::magic, dtn::BundleProtocol::parse_bundle(), 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_start_bundle | ( | ) | [private] |
utility functions used internally in this class
Definition at line 1014 of file StreamConvergenceLayer.cc.
References dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, oasys::StreamBuffer::consume(), dtn::CLConnection::incoming_, log_debug, log_err, and dtn::CLConnection::recvbuf_.
Referenced by process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_end_bundle | ( | ) | [private] |
utility functions used internally in this class
Definition at line 1036 of file StreamConvergenceLayer.cc.
References dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, oasys::StreamBuffer::consume(), dtn::EVENTSRC_PEER, dtn::BundleProtocol::formatted_length(), dtn::CLConnection::incoming_, log_debug, log_err, dtn::BundleDaemon::post(), and dtn::CLConnection::recvbuf_.
Referenced by process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_data_segment | ( | ) | [private] |
utility functions used internally in this class
Definition at line 1103 of file StreamConvergenceLayer.cc.
References dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, oasys::StreamBuffer::consume(), dtn::SDNV::decode(), oasys::StreamBuffer::fullbytes(), handle_data_todo(), dtn::CLConnection::incoming_, log_debug, log_err, dtn::BundleProtocol::parse_header_blocks(), 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 1198 of file StreamConvergenceLayer.cc.
References ASSERT, dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, oasys::StreamBuffer::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 | ( | ) | [private] |
utility functions used internally in this class
Definition at line 1251 of file StreamConvergenceLayer.cc.
References dtn::CLConnection::break_contact(), dtn::ContactEvent::BROKEN, check_completed(), oasys::StreamBuffer::consume(), dtn::CLConnection::contact_, dtn::SDNV::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_keepalive | ( | ) | [private] |
utility functions used internally in this class
Definition at line 1323 of file StreamConvergenceLayer.cc.
References oasys::StreamBuffer::consume(), log_debug, and dtn::CLConnection::recvbuf_.
Referenced by process_data().
bool dtn::StreamConvergenceLayer::Connection::handle_shutdown | ( | ) | [private] |
utility functions used internally in this class
Definition at line 1332 of file StreamConvergenceLayer.cc.
References dtn::CLConnection::break_contact(), oasys::StreamBuffer::consume(), log_debug, dtn::CLConnection::recvbuf_, and dtn::ContactEvent::SHUTDOWN.
Referenced by process_data().
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 218 of file StreamConvergenceLayer.h.
References ASSERT, and dtn::CLConnection::params_.
Referenced by handle_contact_initiation(), initiate_contact(), send_next_segment(), and start_next_bundle().
InFlightBundle* dtn::StreamConvergenceLayer::Connection::current_inflight_ [protected] |
Current bundle that's in flight.
Definition at line 226 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 227 of file StreamConvergenceLayer.h.
Referenced by send_data_todo(), send_next_segment(), send_pending_data(), and start_next_bundle().
size_t dtn::StreamConvergenceLayer::Connection::recv_segment_todo_ [protected] |
Bytes left to recv of current segment.
Definition at line 228 of file StreamConvergenceLayer.h.
Referenced by handle_data_segment(), handle_data_todo(), and process_data().
struct timeval dtn::StreamConvergenceLayer::Connection::data_rcvd_ [protected] |
Timestamp for idle/keepalive timer.
Definition at line 229 of file StreamConvergenceLayer.h.
Referenced by handle_contact_initiation(), handle_poll_timeout(), and note_data_rcvd().
struct timeval dtn::StreamConvergenceLayer::Connection::data_sent_ [protected] |
Timestamp for idle timer.
Definition at line 230 of file StreamConvergenceLayer.h.
Referenced by handle_contact_initiation(), handle_poll_timeout(), and note_data_sent().
struct timeval dtn::StreamConvergenceLayer::Connection::keepalive_sent_ [protected] |
Timestamp for keepalive timer.
Definition at line 231 of file StreamConvergenceLayer.h.
Referenced by handle_contact_initiation(), handle_poll_timeout(), and send_keepalive().