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

ACE_RMCast_Retransmission Class Reference

Store messages for retransmission in reliable configurations. More...

#include <RMCast_Retransmission.h>

Inheritance diagram for ACE_RMCast_Retransmission:

Inheritance graph
[legend]
Collaboration diagram for ACE_RMCast_Retransmission:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_RB_Tree< ACE_UINT32,
ACE_RMCast::Data, ACE_Less_Than<
ACE_UINT32 >, ACE_Null_Mutex
Collection
 Use a Red-Black Tree to keep the queue of messages. More...

typedef ACE_RB_Tree_Iterator<
ACE_UINT32, ACE_RMCast::Data,
ACE_Less_Than< ACE_UINT32 >,
ACE_Null_Mutex
Collection_Iterator
typedef ACE_RMCast_Copy_On_Write<
ACE_UINT32, ACE_RMCast::Data,
Collection, Collection_Iterator
Messages
 The messages are stored in the Copy_On_Write wrapper to provide an efficient, but thread safe interface. More...


Public Methods

 ACE_RMCast_Retransmission (void)
 Constructor. More...

virtual ~ACE_RMCast_Retransmission (void)
 Destructor. More...

int resend (ACE_UINT32 max_sequence_number)
 Resend messages. More...

int resend_all (void)
 Resend all messages. More...

int has_data (void)
 Return 0 if there is no pending data to send. More...

virtual int close (void)
 Cleanup all the stored messages. More...

virtual int data (ACE_RMCast::Data &data)
 Pass the message downstream, but also save it in the retransmission queue. More...

virtual int ack (ACE_RMCast::Ack &)
 Process an Ack message from the remote receivers. More...

virtual int join (ACE_RMCast::Join &)
 Detect when new members join the group and Ack_Join them. More...

virtual int leave (ACE_RMCast::Leave &)
 A receiver is leaving. More...


Protected Attributes

Messages messages_
 The retransmission buffer. More...


Detailed Description

Store messages for retransmission in reliable configurations.

Reliable configurations of the RMCast framework need to store messages on the sender side to resend them if one or more clients do not receive them successfully.

Definition at line 36 of file RMCast_Retransmission.h.


Member Typedef Documentation

typedef ACE_RB_Tree<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex> ACE_RMCast_Retransmission::Collection
 

Use a Red-Black Tree to keep the queue of messages.

Definition at line 47 of file RMCast_Retransmission.h.

typedef ACE_RB_Tree_Iterator<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex> ACE_RMCast_Retransmission::Collection_Iterator
 

Definition at line 48 of file RMCast_Retransmission.h.

typedef ACE_RMCast_Copy_On_Write<ACE_UINT32,ACE_RMCast::Data,Collection,Collection_Iterator> ACE_RMCast_Retransmission::Messages
 

The messages are stored in the Copy_On_Write wrapper to provide an efficient, but thread safe interface.

Definition at line 52 of file RMCast_Retransmission.h.

Referenced by ACE_RMCast_Ack_Worker::ACE_RMCast_Ack_Worker.


Constructor & Destructor Documentation

ACE_INLINE ACE_RMCast_Retransmission::ACE_RMCast_Retransmission void   
 

Constructor.

Definition at line 4 of file RMCast_Retransmission.i.

00005 {
00006 }

ACE_RMCast_Retransmission::~ACE_RMCast_Retransmission void    [virtual]
 

Destructor.

Definition at line 17 of file RMCast_Retransmission.cpp.

00018 {
00019 }


Member Function Documentation

int ACE_RMCast_Retransmission::ack ACE_RMCast::Ack   [virtual]
 

Process an Ack message from the remote receivers.

Normally this Ack message will be a summary of all the Ack messages received by the ACE_RMCast_Membership class

Reimplemented from ACE_RMCast_Module.

Definition at line 110 of file RMCast_Retransmission.cpp.

References ACE_RMCast_Copy_On_Write< ACE_UINT32, ACE_RMCast::Data, Collection, Collection_Iterator >::for_each, and messages_.

00111 {
00112   Messages::Write_Guard ace_mon (this->messages_);
00113 
00114   ACE_RMCast_Ack_Worker worker (ack, ace_mon, &this->messages_);
00115 
00116   return this->messages_.for_each (&worker);
00117 }

int ACE_RMCast_Retransmission::close void    [virtual]
 

Cleanup all the stored messages.

Reimplemented from ACE_RMCast_Module.

Definition at line 56 of file RMCast_Retransmission.cpp.

00057 {
00058   // @@
00059   return 0;
00060 }

int ACE_RMCast_Retransmission::data ACE_RMCast::Data   data [virtual]
 

Pass the message downstream, but also save it in the retransmission queue.

Sequence number are assigned by the ACE_RMCast_Fragmentation class, consequently this class first passes the message downstream, to obtain the sequence number and then stores the message for later retransmission.

Reimplemented from ACE_RMCast_Module.

Definition at line 63 of file RMCast_Retransmission.cpp.

References ACE_RMCast_Copy_On_Write< ACE_UINT32, ACE_RMCast::Data, Collection, Collection_Iterator >::bind, ACE_RMCast_Module::data, ACE_Message_Block::duplicate, messages_, ACE_RMCast_Module::next, ACE_RMCast::Data::payload, and ACE_RMCast::Data::sequence_number.

00064 {
00065   if (this->next () == 0)
00066     return 0;
00067 
00068   int r = this->next ()->data (data);
00069   if (r == 0)
00070     {
00071       ACE_RMCast::Data copy = data;
00072       copy.payload = ACE_Message_Block::duplicate (data.payload);
00073       r = this->messages_.bind (data.sequence_number, copy);
00074     }
00075   return r;
00076 }

int ACE_RMCast_Retransmission::has_data void   
 

Return 0 if there is no pending data to send.

Definition at line 50 of file RMCast_Retransmission.cpp.

References ACE_RMCast_Copy_On_Write< ACE_UINT32, ACE_RMCast::Data, Collection, Collection_Iterator >::empty, and messages_.

Referenced by ACE_RMCast_UDP_Reliable_Sender::has_data.

00051 {
00052   return !this->messages_.empty ();
00053 }

int ACE_RMCast_Retransmission::join ACE_RMCast::Join   [virtual]
 

Detect when new members join the group and Ack_Join them.

When a new receiver joins the group this module sends an Ack_Join message with the next sequence number that the receiver should expect. The sequence number is obtained from the current list of cached messages.

Reimplemented from ACE_RMCast_Module.

Definition at line 79 of file RMCast_Retransmission.cpp.

References ACE_RMCast_Module::ack_join, ACE_RMCast_Copy_On_Write< ACE_UINT32, ACE_RMCast::Data, Collection, Collection_Iterator >::first_key, messages_, ACE_RMCast::Ack_Join::next_sequence_number, ACE_RMCast_Proxy::reply_ack_join, ACE_RMCast::Ack_Join::source, and ACE_RMCast::Join::source.

00080 {
00081   if (join.source == 0)
00082     return 0;
00083 
00084   ACE_RMCast::Ack_Join ack_join;
00085   ack_join.source = 0;
00086   ack_join.next_sequence_number = this->messages_.first_key ();
00087 
00088   (void) join.source->reply_ack_join (ack_join);
00089 
00090   // @@ We should force a full retransmission of all the messages!
00091 
00092   return 0;
00093 }

int ACE_RMCast_Retransmission::leave ACE_RMCast::Leave   [virtual]
 

A receiver is leaving.

Normally the ACE_RMCast_Membership module could do this, but, because this module processes the Join messages, it seems more natural to process the Leave messages too.

Reimplemented from ACE_RMCast_Module.

Definition at line 96 of file RMCast_Retransmission.cpp.

References ACE_RMCast_Module::ack_leave, ACE_RMCast_Proxy::reply_ack_leave, ACE_RMCast::Ack_Leave::source, and ACE_RMCast::Leave::source.

00097 {
00098   if (leave.source == 0)
00099     return 0;
00100 
00101   ACE_RMCast::Ack_Leave ack_leave;
00102   ack_leave.source = 0;
00103 
00104   (void) leave.source->reply_ack_leave (ack_leave);
00105 
00106   return 0;
00107 }

int ACE_RMCast_Retransmission::resend ACE_UINT32    max_sequence_number
 

Resend messages.

Resends all the messages up to

Parameters:
max_sequence_number  Returns the number of messages sent, or -1 if there where any errors.

Definition at line 22 of file RMCast_Retransmission.cpp.

References ACE_RMCast_Copy_On_Write< ACE_UINT32, ACE_RMCast::Data, Collection, Collection_Iterator >::for_each, messages_, ACE_RMCast_Resend_Worker::n, and ACE_RMCast_Module::next.

00023 {
00024   if (this->next () == 0)
00025     return 0;
00026 
00027   ACE_RMCast_Resend_Worker worker (this->next (), max_sequence_number);
00028 
00029   if (this->messages_.for_each (&worker) == -1)
00030     return -1;
00031 
00032   return worker.n;
00033 }

int ACE_RMCast_Retransmission::resend_all void   
 

Resend all messages.

Resends all the messages currently in the queue.

Definition at line 36 of file RMCast_Retransmission.cpp.

References ACE_UINT32_MAX, ACE_RMCast_Copy_On_Write< ACE_UINT32, ACE_RMCast::Data, Collection, Collection_Iterator >::for_each, messages_, ACE_RMCast_Resend_Worker::n, and ACE_RMCast_Module::next.

Referenced by ACE_RMCast_Resend_Handler::handle_timeout.

00037 {
00038   if (this->next () == 0)
00039     return 0;
00040 
00041   ACE_RMCast_Resend_Worker worker (this->next (), ACE_UINT32_MAX);
00042 
00043   if (this->messages_.for_each (&worker) == -1)
00044     return -1;
00045 
00046   return worker.n;
00047 }


Member Data Documentation

Messages ACE_RMCast_Retransmission::messages_ [protected]
 

The retransmission buffer.

Definition at line 112 of file RMCast_Retransmission.h.

Referenced by ack, data, has_data, join, resend, and resend_all.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 13:14:18 2003 for ACE_RMCast by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002