ReliableSession.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef DCPS_RELIABLESESSION_H
00009 #define DCPS_RELIABLESESSION_H
00010 
00011 #include "Multicast_Export.h"
00012 
00013 #include "MulticastSession.h"
00014 #include "MulticastTypes.h"
00015 
00016 #include "ace/Synch_Traits.h"
00017 
00018 #include "dds/DCPS/DisjointSequence.h"
00019 #include "dds/DCPS/PoolAllocator.h"
00020 #include "dds/DCPS/RcEventHandler.h"
00021 
00022 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00023 
00024 namespace OpenDDS {
00025 namespace DCPS {
00026 
00027 class ReliableSession;
00028 
00029 class OpenDDS_Multicast_Export NakWatchdog
00030   : public DataLinkWatchdog {
00031 public:
00032   explicit NakWatchdog(ACE_Reactor* reactor,
00033                        ACE_thread_t owner,
00034                        ReliableSession* session);
00035 
00036   virtual bool reactor_is_shut_down() const;
00037 
00038 protected:
00039   virtual ACE_Time_Value next_interval();
00040   virtual void on_interval(const void* arg);
00041 
00042 private:
00043   ~NakWatchdog() { }
00044   ReliableSession* session_;
00045 };
00046 
00047 class OpenDDS_Multicast_Export ReliableSession
00048   : public MulticastSession {
00049 public:
00050   ReliableSession(ACE_Reactor* reactor,
00051                   ACE_thread_t owner,
00052                   MulticastDataLink* link,
00053                   MulticastPeer remote_peer);
00054 
00055   ~ReliableSession();
00056 
00057   virtual bool check_header(const TransportHeader& header);
00058   virtual void record_header_received(const TransportHeader& header);
00059 
00060   virtual bool ready_to_deliver(const TransportHeader& header,
00061                                 const ReceivedDataSample& data);
00062   void deliver_held_data();
00063   virtual void release_remote(const RepoId& remote);
00064 
00065   virtual bool control_received(char submessage_id,
00066                                 const Message_Block_Ptr& control);
00067 
00068   void expire_naks();
00069   void send_naks();
00070 
00071   void nak_received(const Message_Block_Ptr& control);
00072   void send_naks(DisjointSequence& found);
00073 
00074   void nakack_received(const Message_Block_Ptr& control);
00075   virtual void send_nakack(SequenceNumber low);
00076 
00077   virtual bool start(bool active, bool acked);
00078   virtual void stop();
00079   virtual bool is_reliable() { return true;}
00080 
00081   virtual void syn_hook(const SequenceNumber& seq);
00082 
00083 private:
00084   RcHandle<NakWatchdog> nak_watchdog_;
00085 
00086   DisjointSequence nak_sequence_;
00087 
00088   typedef OPENDDS_MAP(ACE_Time_Value, SequenceNumber) NakRequestMap;
00089   NakRequestMap nak_requests_;
00090 
00091   ACE_Thread_Mutex held_lock_;
00092   typedef SequenceNumber TransportHeaderSN;
00093   OPENDDS_MULTIMAP(TransportHeaderSN, ReceivedDataSample) held_;
00094 
00095   typedef OPENDDS_SET(SequenceRange) NakPeerSet;
00096   NakPeerSet nak_peers_;
00097 };
00098 
00099 } // namespace DCPS
00100 } // namespace OpenDDS
00101 
00102 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00103 
00104 #endif  /* DCPS_RELIABLESESSION_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1