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

RMCast_Retransmission.cpp

Go to the documentation of this file.
00001 //
00002 // $Id: RMCast_Retransmission.cpp,v 1.1.1.1 2001/12/04 14:33:17 chad Exp $
00003 //
00004 
00005 #include "RMCast_Retransmission.h"
00006 #include "RMCast_Proxy.h"
00007 #include "RMCast_Ack_Worker.h"
00008 #include "RMCast_Resend_Worker.h"
00009 #include "ace/Message_Block.h"
00010 
00011 #if !defined (__ACE_INLINE__)
00012 # include "RMCast_Retransmission.i"
00013 #endif /* ! __ACE_INLINE__ */
00014 
00015 ACE_RCSID(ace, RMCast_Retransmission, "$Id: RMCast_Retransmission.cpp,v 1.1.1.1 2001/12/04 14:33:17 chad Exp $")
00016 
00017 ACE_RMCast_Retransmission::~ACE_RMCast_Retransmission (void)
00018 {
00019 }
00020 
00021 int
00022 ACE_RMCast_Retransmission::resend (ACE_UINT32 max_sequence_number)
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 }
00034 
00035 int
00036 ACE_RMCast_Retransmission::resend_all (void)
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 }
00048 
00049 int
00050 ACE_RMCast_Retransmission::has_data (void)
00051 {
00052   return !this->messages_.empty ();
00053 }
00054 
00055 int
00056 ACE_RMCast_Retransmission::close (void)
00057 {
00058   // @@
00059   return 0;
00060 }
00061 
00062 int
00063 ACE_RMCast_Retransmission::data (ACE_RMCast::Data &data)
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 }
00077 
00078 int
00079 ACE_RMCast_Retransmission::join (ACE_RMCast::Join &join)
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 }
00094 
00095 int
00096 ACE_RMCast_Retransmission::leave (ACE_RMCast::Leave &leave)
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 }
00108 
00109 int
00110 ACE_RMCast_Retransmission::ack (ACE_RMCast::Ack &ack)
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 }
00118 
00119 #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
00120 
00121 template class ACE_RB_Tree<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>;
00122 template class ACE_RB_Tree_Iterator_Base<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>;
00123 template class ACE_RB_Tree_Iterator<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>;
00124 template class ACE_RB_Tree_Reverse_Iterator<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>;
00125 template class ACE_RB_Tree_Node<ACE_UINT32,ACE_RMCast::Data>;
00126 
00127 template class ACE_RMCast_Copy_On_Write<ACE_UINT32,ACE_RMCast::Data,ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
00128 template class ACE_RMCast_Copy_On_Write_Container<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
00129 template class ACE_RMCast_Copy_On_Write_Write_Guard<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
00130 template class ACE_RMCast_Copy_On_Write_Read_Guard<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
00131 template class ACE_RMCast_Copy_On_Write_Collection<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
00132 template class ACE_RMCast_Worker<ACE_UINT32,ACE_RMCast::Data>;
00133 
00134 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */

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