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

RMCast_Partial_Message.h

Go to the documentation of this file.
00001 // $Id: RMCast_Partial_Message.h,v 1.1.1.1 2001/12/04 14:33:17 chad Exp $
00002 
00003 // ============================================================================
00004 //
00005 // = DESCRIPTION
00006 //   Helper class used in the reassembly layer of the realiable
00007 //   multicast library.
00008 //
00009 // = AUTHOR
00010 //    Carlos O'Ryan <coryan@uci.edu>
00011 //
00012 // ============================================================================
00013 
00014 #ifndef ACE_RMCAST_PARTIAL_MESSAGE_H
00015 #define ACE_RMCAST_PARTIAL_MESSAGE_H
00016 #include "ace/pre.h"
00017 
00018 #include "RMCast_Export.h"
00019 #include "ace/Task.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #ifndef ACE_RMCAST_DEFAULT_HOLE_COUNT
00026 #define ACE_RMCAST_DEFAULT_HOLE_COUNT 16
00027 #endif /* ACE_RMCAST_DEFAULT_HOLE_COUNT */
00028 
00029 //! Represent a partially received message in the
00030 //! ACE_RMCast_Reassembly module
00031 /*!
00032  * This class provides temporary storage for the fragments as they are
00033  * received in the ACE_RMCast_Reassembly module.  It also keeps track
00034  * of what portions of the message are still missing.
00035  */
00036 class ACE_RMCast_Export ACE_RMCast_Partial_Message
00037 {
00038 public:
00039   //! Constructor, reserve enough memory for the complete message
00040   ACE_RMCast_Partial_Message (ACE_UINT32 message_size);
00041 
00042   //! Destructor
00043   ~ACE_RMCast_Partial_Message (void);
00044 
00045   //! Process a fragment
00046   /*!
00047    * A fragment starting at <offset> has been received, copy the
00048    * fragment contents and update the list of holes.
00049    */
00050   int fragment_received (ACE_UINT32 message_size,
00051                          ACE_UINT32 offset,
00052                          ACE_Message_Block *mb);
00053 
00054   //! Return 1 if the message is complete
00055   int is_complete (void) const;
00056 
00057   //! Return the body of the message, the memory is *not* owned by the
00058   //! caller
00059   ACE_Message_Block *message_body (void);
00060 
00061 private:
00062   //! Insert a new hole into the list
00063   /*!
00064    * The class keeps an array to represent the missing portions of the
00065    * message.  This method inserts a new hole, i.e. a new element in
00066    * the array at index <i>. The <start> and <end> arguments represent
00067    * the offsets of the missing portion of the message.
00068    */
00069   int insert_hole (size_t i,
00070                    ACE_UINT32 start,
00071                    ACE_UINT32 end);
00072 
00073   //! Remove a hole from the list
00074   int remove_hole (size_t i);
00075 
00076 private:
00077   //! Maintain the message storage
00078   ACE_Message_Block message_body_;
00079 
00080   //! Represent a missing portion of a message
00081   struct Hole
00082   {
00083     //! Offset where the missing portion of the message starts
00084     ACE_UINT32 start;
00085     //! Offset where the missing portion of the message ends
00086     ACE_UINT32 end;
00087   };
00088 
00089   //! Implement a growing array of Hole structures
00090   //@{
00091   Hole *hole_list_;
00092   size_t max_hole_count_;
00093   size_t hole_count_;
00094   //@}
00095 };
00096 
00097 #if defined (__ACE_INLINE__)
00098 #include "RMCast_Partial_Message.i"
00099 #endif /* __ACE_INLINE__ */
00100 
00101 #include "ace/post.h"
00102 #endif /* ACE_RMCAST_PARTIAL_MESSAGE_H */

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