OpenDDS::DCPS::BestEffortSession Class Reference

#include <BestEffortSession.h>

Inheritance diagram for OpenDDS::DCPS::BestEffortSession:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::BestEffortSession:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BestEffortSession (ACE_Reactor *reactor, ACE_thread_t owner, MulticastDataLink *link, MulticastPeer remote_peer)
virtual bool check_header (const TransportHeader &header)
virtual void record_header_received (const TransportHeader &header)
virtual bool ready_to_deliver (const TransportHeader &header, const ReceivedDataSample &data)
virtual bool start (bool active, bool acked)
virtual bool is_reliable ()

Private Attributes

SequenceNumber expected_

Detailed Description

Definition at line 18 of file BestEffortSession.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::BestEffortSession::BestEffortSession ( ACE_Reactor *  reactor,
ACE_thread_t  owner,
MulticastDataLink link,
MulticastPeer  remote_peer 
)

Definition at line 13 of file BestEffortSession.cpp.

00017   : MulticastSession(reactor, owner, link, remote_peer)
00018   , expected_(SequenceNumber::SEQUENCENUMBER_UNKNOWN())
00019 {
00020 }


Member Function Documentation

bool OpenDDS::DCPS::BestEffortSession::check_header ( const TransportHeader header  )  [virtual]

Implements OpenDDS::DCPS::MulticastSession.

Definition at line 23 of file BestEffortSession.cpp.

References OpenDDS::DCPS::TransportReassembly::data_unavailable(), expected_, header, OpenDDS::DCPS::MulticastSession::reassembly_, OpenDDS::DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN(), and VDBG_LVL.

Referenced by record_header_received().

00024 {
00025   if (header.sequence_ != this->expected_ &&
00026       expected_ != SequenceNumber::SEQUENCENUMBER_UNKNOWN()) {
00027     VDBG_LVL((LM_WARNING,
00028                ACE_TEXT("(%P|%t) WARNING: BestEffortSession::check_header ")
00029                ACE_TEXT("expected %q received %q\n"),
00030                this->expected_.getValue(), header.sequence_.getValue()), 2);
00031     if (header.sequence_ > this->expected_) {
00032       SequenceRange range(this->expected_, header.sequence_.previous());
00033       this->reassembly_.data_unavailable(range);
00034     }
00035   }
00036 
00037   this->expected_ = header.sequence_;
00038   ++this->expected_;
00039 
00040   // Assume header is valid; this does not prevent duplicate
00041   // delivery of datagrams:
00042   return true;
00043 }

virtual bool OpenDDS::DCPS::BestEffortSession::is_reliable (  )  [inline, virtual]

Reimplemented from OpenDDS::DCPS::MulticastSession.

Definition at line 33 of file BestEffortSession.h.

00033 { return false;}

bool OpenDDS::DCPS::BestEffortSession::ready_to_deliver ( const TransportHeader header,
const ReceivedDataSample data 
) [virtual]

Implements OpenDDS::DCPS::MulticastSession.

Definition at line 54 of file BestEffortSession.cpp.

References expected_, header, OpenDDS::DCPS::SequenceNumber::previous(), and OpenDDS::DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN().

00056 {
00057   if (expected_ != SequenceNumber::SEQUENCENUMBER_UNKNOWN()
00058       && header.sequence_ == expected_.previous()) {
00059     return true;
00060   }
00061   return false;
00062 }

void OpenDDS::DCPS::BestEffortSession::record_header_received ( const TransportHeader header  )  [virtual]

Implements OpenDDS::DCPS::MulticastSession.

Definition at line 46 of file BestEffortSession.cpp.

References check_header(), and header.

00047 {
00048   if (this->remote_peer_ != header.source_) return;
00049 
00050   check_header(header);
00051 }

bool OpenDDS::DCPS::BestEffortSession::start ( bool  active,
bool  acked 
) [virtual]

Implements OpenDDS::DCPS::MulticastSession.

Definition at line 65 of file BestEffortSession.cpp.

References OpenDDS::DCPS::MulticastSession::active_, and OpenDDS::DCPS::MulticastSession::started_.

00066 {
00067   ACE_GUARD_RETURN(ACE_SYNCH_MUTEX,
00068                    guard,
00069                    this->start_lock_,
00070                    false);
00071 
00072   if (this->started_) return true;  // already started
00073 
00074   this->active_ = active;
00075 
00076   if (active && !this->start_syn()) {
00077     ACE_ERROR_RETURN((LM_ERROR,
00078                       ACE_TEXT("(%P|%t) ERROR: ")
00079                       ACE_TEXT("BestEffortSession::start: ")
00080                       ACE_TEXT("failed to schedule SYN watchdog!\n")),
00081                      false);
00082   }
00083 
00084   return this->started_ = true;
00085 }


Member Data Documentation

SequenceNumber OpenDDS::DCPS::BestEffortSession::expected_ [private]

Definition at line 36 of file BestEffortSession.h.

Referenced by check_header(), and ready_to_deliver().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:34 2016 for OpenDDS by  doxygen 1.4.7