Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

RMCast_Retransmission.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: RMCast_Retransmission.h,v 1.1.1.1 2001/12/04 14:33:17 chad Exp $
00003 
00004 // ============================================================================
00005 //
00006 // = LIBRARY
00007 //    ace
00008 //
00009 // = FILENAME
00010 //    RMCast_Retransmission.h
00011 //
00012 // = AUTHOR
00013 //    Carlos O'Ryan <coryan@uci.edu>
00014 //
00015 // ============================================================================
00016 
00017 #ifndef ACE_RMCAST_RETRANSMISSION_H
00018 #define ACE_RMCAST_RETRANSMISSION_H
00019 #include "ace/pre.h"
00020 
00021 #include "RMCast_Module.h"
00022 #include "RMCast_Copy_On_Write.h"
00023 #include "ace/RB_Tree.h"
00024 #include "ace/Synch.h"
00025 
00026 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00027 # pragma once
00028 #endif /* ACE_LACKS_PRAGMA_ONCE */
00029 
00030 /// Store messages for retransmission in reliable configurations
00031 /**
00032  * Reliable configurations of the RMCast framework need to store
00033  * messages on the sender side to resend them if one or more clients
00034  * do not receive them successfully.
00035  */
00036 class ACE_RMCast_Export ACE_RMCast_Retransmission : public ACE_RMCast_Module
00037 {
00038 public:
00039   // = Initialization and termination methods.
00040   /// Constructor
00041   ACE_RMCast_Retransmission (void);
00042 
00043   /// Destructor
00044   virtual ~ACE_RMCast_Retransmission (void);
00045 
00046   /// Use a Red-Black Tree to keep the queue of messages
00047   typedef ACE_RB_Tree<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex> Collection;
00048   typedef ACE_RB_Tree_Iterator<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex> Collection_Iterator;
00049 
00050   /// The messages are stored in the Copy_On_Write wrapper to provide
00051   /// an efficient, but thread safe interface.
00052   typedef ACE_RMCast_Copy_On_Write<ACE_UINT32,ACE_RMCast::Data,Collection,Collection_Iterator> Messages;
00053 
00054   /// Resend messages
00055   /**
00056    * Resends all the messages up to \param max_sequence_number
00057    * Returns the number of messages sent, or -1 if there where any
00058    * errors.
00059    */
00060   int resend (ACE_UINT32 max_sequence_number);
00061 
00062   /// Resend all messages
00063   /**
00064    * Resends all the messages currently in the queue.
00065    */
00066   int resend_all (void);
00067 
00068   /// Return 0 if there is no pending data to send
00069   int has_data (void);
00070 
00071   /// Cleanup all the stored messages
00072   virtual int close (void);
00073 
00074   /// Pass the message downstream, but also save it in the
00075   /// retransmission queue
00076   /**
00077    * Sequence number are assigned by the ACE_RMCast_Fragmentation
00078    * class, consequently this class first passes the message
00079    * downstream, to obtain the sequence number and then stores the
00080    * message for later retransmission.
00081    */
00082   virtual int data (ACE_RMCast::Data &data);
00083 
00084   /// Process an Ack message from the remote receivers.
00085   /**
00086    * Normally this Ack message will be a summary of all the Ack
00087    * messages received by the ACE_RMCast_Membership class
00088    */
00089   virtual int ack (ACE_RMCast::Ack &);
00090 
00091   /// Detect when new members join the group and Ack_Join them
00092   /**
00093    * When a new receiver joins the group this module sends an Ack_Join
00094    * message with the next sequence number that the receiver should
00095    * expect.
00096    * The sequence number is obtained from the current list of cached
00097    * messages.
00098    */
00099   virtual int join (ACE_RMCast::Join &);
00100 
00101   /// A receiver is leaving
00102   /**
00103    * Normally the ACE_RMCast_Membership module could do this, but,
00104    * because this module processes the Join messages, it seems more
00105    * natural to process the Leave messages too.
00106    */
00107   virtual int leave (ACE_RMCast::Leave &);
00108 
00109 protected:
00110 
00111   /// The retransmission buffer
00112   Messages messages_;
00113 };
00114 
00115 #if defined (__ACE_INLINE__)
00116 #include "RMCast_Retransmission.i"
00117 #endif /* __ACE_INLINE__ */
00118 
00119 #include "ace/post.h"
00120 #endif /* ACE_RMCAST_RETRANSMISSION_H */

Generated on Mon Jun 16 13:12:38 2003 for ACE_RMCast by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002