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

RMCast.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: RMCast.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.h
00011 //
00012 // = AUTHOR
00013 //    Carlos O'Ryan <coryan@uci.edu>
00014 //
00015 // ============================================================================
00016 
00017 #ifndef ACE_RMCAST_H
00018 #define ACE_RMCAST_H
00019 #include "ace/pre.h"
00020 
00021 #include "ace/OS.h"
00022 #include "RMCast_Export.h"
00023 
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 class ACE_Message_Block;
00029 class ACE_RMCast_Proxy;
00030 
00031 // LynxOS 3.X defines the following macro
00032 #if defined(MT_DATA)
00033 #undef MT_DATA
00034 #endif /* MT_DATA */
00035 
00036 //! The RMCast namespace
00037 /*!
00038   Several simple data structures and enums are shared by all the
00039   RMCast components, this is the place where we put them by default.
00040 */
00041 class ACE_RMCast_Export ACE_RMCast
00042 {
00043 public:
00044 
00045   //! The message types
00046   /*!
00047     Each message includes a type field in the header used by the
00048     receiver to correctly parse it.
00049     Classes with the same name as the message type describe the actual
00050     format of the message.
00051   */
00052   enum Message_Type
00053   {
00054     // Sender initiated
00055     MT_POLL,
00056     MT_ACK_JOIN,
00057     MT_ACK_LEAVE,
00058     MT_DATA,
00059     // Receiver initiated
00060     MT_JOIN,
00061     MT_LEAVE,
00062     MT_ACK,
00063     MT_LAST
00064   };
00065 
00066   //! Simle enum used to describe the state transitions for senders
00067   /*!
00068    State transition (and actions) for the senders.
00069    This configuration is pesimistic, any invalid message is cause
00070    enough to reclaim all the resources.  This partially addresses
00071    situations where either accidentally or intentionally a sender is
00072    multicasting packets to the wrong group.
00073 
00074   <CODE>
00075               NON_EXISTENT   JOINED<BR>
00076    ------------------------------------------<BR>
00077    POLL       NON_EXISTENT   NON_EXISTENT<BR>
00078               Destroy        Destroy<BR>
00079   <BR>
00080    ACK        NON_EXISTENT   JOINED<BR>
00081               Noop           Process/Ack<BR>
00082   <BR>
00083    JOIN       JOINED         NON_EXISTENT<BR>
00084               Send/Join_Ack  Send/Join_Ack<BR>
00085   <BR>
00086    LEAVE      NON_EXISTENT   NON_EXISTENT<BR>
00087               Send/Leave_Ack Send/Leave_Ack<BR>
00088                              Destroy<BR>
00089   <BR>
00090    ACK_JOIN   NON_EXISTENT   NON_EXISTENT<BR>
00091               Noop           Destroy<BR>
00092   <BR>
00093    ACK_LEAVE  NON_EXISTENT   NON_EXISTENT<BR>
00094               Noop           Destroy<BR>
00095   <BR>
00096    SEND_DATA  NON_EXISTENT   NON_EXISTENT<BR>
00097               Noop           Destroy<BR>
00098   </CODE>
00099   */
00100   enum Sender_State
00101   {
00102     SS_NON_EXISTENT,
00103     SS_JOINED
00104   };
00105 
00106 
00107   // These structures define the basic layout of the messages.
00108 
00109   //! This is the main message sent by senders
00110   /*!
00111   <CODE>
00112    +---------+----------------------+<BR>
00113    | 8 bits  | DATA                 |<BR>
00114    +---------+----------------------+<BR>
00115    | 32 bits | sequence_number      |<BR>
00116    +---------+----------------------+<BR>
00117    | 32 bits | message_size         |<BR>
00118    +---------+----------------------+<BR>
00119    | 32 bits | fragment_offset      |<BR>
00120    +---------+----------------------+<BR>
00121    ? ? ? ? ? | 32 bits | payload_size         |<BR>
00122    ? ? ? ? ? +---------+----------------------+<BR>
00123    |         | payload              |<BR>
00124    +---------+----------------------+<BR>
00125   </CODE>
00126   */
00127   struct Data
00128   {
00129     // Source ID is implicit in recvfrom()...
00130     ACE_UINT32 sequence_number;
00131     ACE_UINT32 total_size;
00132     ACE_UINT32 fragment_offset;
00133 
00134     // @@ TODO: we may want to add optional fields, such as:
00135     //    - Polling clients for their status
00136     //    - Sending the range of messages in the queue
00137     //    - If we are using authentic group communication we may
00138     //    piggyback the ACK / NAK messages
00139 
00140     ACE_Message_Block *payload;
00141 
00142     //! Pass the proxy source between layers
00143     ACE_RMCast_Proxy *source;
00144   };
00145 
00146   /*!
00147     <CODE>
00148     +---------+----------------------+<BR>
00149     | 8 bits  | MT_POLL              |<BR>
00150     +---------+----------------------+<BR>
00151     </CODE>
00152   */
00153   struct Poll
00154   {
00155     //! Pass the proxy source between layers
00156     ACE_RMCast_Proxy *source;
00157   };
00158 
00159   //! Receivers accept new members using this message
00160   /*!
00161     <CODE>
00162     +---------+----------------------+<BR>
00163     | 8 bits  | MT_ACK_JOIN          |<BR>
00164     +---------+----------------------+<BR>
00165     | 32 bits | next_sequence_number |<BR>
00166     +---------+----------------------+<BR>
00167     </CODE>
00168   */
00169   struct Ack_Join
00170   {
00171     ACE_UINT32 next_sequence_number;
00172 
00173     //! Pass the proxy source between layers
00174     ACE_RMCast_Proxy *source;
00175   };
00176 
00177   //! Senders acknowledge when receivers try to leave
00178   /*!
00179   <CODE>
00180     +---------+----------------------+<BR>
00181     | 8 bits  | ACK_LEAVE            |<BR>
00182     +---------+----------------------+<BR>
00183     </CODE>
00184   */
00185   struct Ack_Leave
00186   {
00187     //! Pass the proxy source between layers
00188     ACE_RMCast_Proxy *source;
00189   };
00190 
00191   //! Provide feedback to the sender about messages received and sent
00192   //! so far.
00193   /*!
00194    *
00195    * This message is used to provide feedback information to senders.
00196    * It contains two sequence numbers:
00197    * - \param next_expected: is the sequence number of the next message
00198    *   expected, i.e. (next_expected-1) is the last message received
00199    *   without any losses before it.
00200    * - \param highest_received: is the highest sequence number among
00201    *   all the messages successfully received.
00202    * In other words, all messages lost (if any) are in the range:
00203    * [next_expected,highest_received)
00204    *
00205    * <CODE>
00206    * +---------+----------------------+<BR>
00207    * | 8 bits  | MT_ACK               |<BR>
00208    * +---------+----------------------+<BR>
00209    * | 32 bits | next_expected        |<BR>
00210    * +---------+----------------------+<BR>
00211    * | 32 bits | highest_received     |<BR>
00212    * +---------+----------------------+<BR>
00213    * </CODE>
00214    */
00215   struct Ack
00216   {
00217     //! The last message received without any losses before it.
00218     ACE_UINT32 next_expected;
00219 
00220     //! The last message successfully received
00221     ACE_UINT32 highest_received;
00222 
00223     //! Pass the proxy source between layers
00224     ACE_RMCast_Proxy *source;
00225   };
00226 
00227   //! Receivers send this message to indicate they want to join
00228   /*
00229   <CODE>
00230     +---------+----------------------+<BR>
00231     | 8 bits  | MT_JOIN              |<BR>
00232     +---------+----------------------+<BR>
00233   </CODE>
00234   */
00235   struct Join
00236   {
00237     //! Pass the proxy source between layers
00238     ACE_RMCast_Proxy *source;
00239   };
00240 
00241   //! Receivers send this message to disconnect gracefully
00242   /*!
00243   <CODE>
00244     +---------+----------------------+<BR>
00245     | 8 bits  | MT_LEAVE             |<BR>
00246     +---------+----------------------+<BR>
00247   </CODE>
00248   */
00249   struct Leave
00250   {
00251     //! Pass the proxy source between layers
00252     ACE_RMCast_Proxy *source;
00253   };
00254 };
00255 
00256 #if defined (__ACE_INLINE__)
00257 #include "RMCast.i"
00258 #endif /* __ACE_INLINE__ */
00259 
00260 #include "ace/post.h"
00261 #endif /* ACE_RMCAST_H */

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