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

ACE_RMCast_UDP_Proxy Class Reference

Define the proxy implementation for UDP based communication. More...

#include <RMCast_UDP_Proxy.h>

Inheritance diagram for ACE_RMCast_UDP_Proxy:

Inheritance graph
[legend]
Collaboration diagram for ACE_RMCast_UDP_Proxy:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_RMCast_UDP_Proxy (ACE_RMCast_IO_UDP *io_udp, const ACE_INET_Addr &peer_addr)
 Constructor. More...

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

int receive_message (char *buffer, size_t size)
 Receive a message, parse and send it upstream in the right format. More...

const ACE_INET_Addrpeer_addr (void) const
 Make the peer address available. More...

virtual int reply_data (ACE_RMCast::Data &)
 Send messages directly to the peer. More...

virtual int reply_poll (ACE_RMCast::Poll &)
 Send messages directly to the peer. More...

virtual int reply_ack_join (ACE_RMCast::Ack_Join &)
 Send messages directly to the peer. More...

virtual int reply_ack_leave (ACE_RMCast::Ack_Leave &)
 Send messages directly to the peer. More...

virtual int reply_ack (ACE_RMCast::Ack &)
 Send messages directly to the peer. More...

virtual int reply_join (ACE_RMCast::Join &)
 Send messages directly to the peer. More...

virtual int reply_leave (ACE_RMCast::Leave &)
 Send messages directly to the peer. More...


Private Attributes

ACE_RMCast_IO_UDPio_udp_
 The IO facade. More...

ACE_INET_Addr peer_addr_
 The remote peer's address. More...


Detailed Description

Define the proxy implementation for UDP based communication.

Proxy objects are transport specific, they are responsible for storing the remote peer addressing information. This class implements the UDP version of a proxy.

Definition at line 37 of file RMCast_UDP_Proxy.h.


Constructor & Destructor Documentation

ACE_RMCast_UDP_Proxy::ACE_RMCast_UDP_Proxy ACE_RMCast_IO_UDP   io_udp,
const ACE_INET_Addr   peer_addr
 

Constructor.

The

Parameters:
io_udp  argument is kept to send the replys through the right socket. The
peer_addr  is the address used byu the peer to receive responses.

Definition at line 14 of file RMCast_UDP_Proxy.cpp.

00016   : io_udp_ (io_udp)
00017   , peer_addr_ (addr)
00018 {
00019 }

ACE_RMCast_UDP_Proxy::~ACE_RMCast_UDP_Proxy void    [virtual]
 

Destructor.

Definition at line 21 of file RMCast_UDP_Proxy.cpp.

00022 {
00023 }


Member Function Documentation

ACE_INLINE const ACE_INET_Addr & ACE_RMCast_UDP_Proxy::peer_addr void    const
 

Make the peer address available.

Definition at line 4 of file RMCast_UDP_Proxy.i.

References peer_addr_.

00005 {
00006   return this->peer_addr_;
00007 }

int ACE_RMCast_UDP_Proxy::receive_message char *    buffer,
size_t    size
 

Receive a message, parse and send it upstream in the right format.

Definition at line 26 of file RMCast_UDP_Proxy.cpp.

References ACE_NEW_RETURN, ACE_NTOHL, ACE_RMCast_Proxy::ack, ACE_RMCast_Module::ack_join, ACE_RMCast_Module::ack_leave, ACE_Message_Block::copy, ACE_RMCast_Module::data, ACE_RMCast::Data::fragment_offset, ACE_RMCast::Ack::highest_received, ACE_RMCast_Module::join, ACE_RMCast_Module::leave, ACE_OS_String::memcpy, ACE_RMCast::MT_ACK, ACE_RMCast::MT_ACK_JOIN, ACE_RMCast::MT_ACK_LEAVE, ACE_RMCast::MT_DATA, ACE_RMCast::MT_JOIN, ACE_RMCast::MT_LAST, ACE_RMCast::MT_LEAVE, ACE_RMCast::MT_POLL, ACE_RMCast::Ack::next_expected, ACE_RMCast::Ack_Join::next_sequence_number, ACE_RMCast::Data::payload, ACE_RMCast_Module::poll, ACE_RMCast::Data::sequence_number, ACE_Message_Block::size, ACE_RMCast::Ack::source, ACE_RMCast::Leave::source, ACE_RMCast::Join::source, ACE_RMCast::Data::source, ACE_RMCast::Ack_Leave::source, ACE_RMCast::Ack_Join::source, ACE_RMCast::Poll::source, and ACE_RMCast::Data::total_size.

Referenced by ACE_RMCast_IO_UDP::handle_input.

00027 {
00028   int type = buffer[0];
00029 
00030   // @@ What should we do with invalid messages like this?
00031   //
00032   if (type < 0 || type >= ACE_RMCast::MT_LAST)
00033     return 0;
00034 
00035   if (type == ACE_RMCast::MT_POLL)
00036     {
00037       ACE_RMCast::Poll poll;
00038       poll.source = this;
00039       return this->poll (poll);
00040     }
00041 
00042   else if (type == ACE_RMCast::MT_ACK_JOIN)
00043     {
00044       ACE_RMCast::Ack_Join ack_join;
00045       ack_join.source = this;
00046 
00047       const size_t header_size = 1 + sizeof(ACE_UINT32);
00048       if (size < header_size)
00049         {
00050           // The message is too small
00051           return 0;
00052         }
00053 
00054       ACE_UINT32 tmp;
00055 
00056       ACE_OS::memcpy (&tmp, buffer + 1,
00057                       sizeof(tmp));
00058       ack_join.next_sequence_number = ACE_NTOHL (tmp);
00059       return this->ack_join (ack_join);
00060     }
00061 
00062   else if (type == ACE_RMCast::MT_ACK_LEAVE)
00063     {
00064       ACE_RMCast::Ack_Leave ack_leave;
00065       ack_leave.source = this;
00066       return this->ack_leave (ack_leave);
00067     }
00068 
00069   else if (type == ACE_RMCast::MT_DATA)
00070     {
00071       ACE_RMCast::Data data;
00072       data.source = this;
00073       const size_t header_size = 1 + 3 * sizeof(ACE_UINT32);
00074       if (size < header_size)
00075         {
00076           // The message is too small
00077           return 0;
00078         }
00079 
00080       ACE_UINT32 tmp;
00081 
00082       ACE_OS::memcpy (&tmp, buffer + 1,
00083                       sizeof(tmp));
00084       data.sequence_number = ACE_NTOHL (tmp);
00085 
00086       ACE_OS::memcpy (&tmp, buffer + 1 + sizeof(tmp),
00087                       sizeof(tmp));
00088       data.total_size = ACE_NTOHL (tmp);
00089 
00090       ACE_OS::memcpy (&tmp, buffer + 1 + 2 * sizeof(tmp),
00091                       sizeof(tmp));
00092       data.fragment_offset = ACE_NTOHL (tmp);
00093 
00094       // Pass it up the module...
00095       ACE_Message_Block *mb;
00096       ACE_NEW_RETURN (mb, ACE_Message_Block, -1);
00097       mb->size (size - header_size);
00098       mb->copy (buffer + header_size, size - header_size);
00099 
00100       data.payload = mb;
00101       return this->data (data);
00102     }
00103 
00104   else if (type == ACE_RMCast::MT_JOIN)
00105     {
00106       ACE_RMCast::Join join;
00107       join.source = this;
00108       return this->join (join);
00109     }
00110 
00111   else if (type == ACE_RMCast::MT_LEAVE)
00112     {
00113       ACE_RMCast::Leave leave;
00114       leave.source = this;
00115       return this->leave (leave);
00116     }
00117 
00118   else if (type == ACE_RMCast::MT_ACK)
00119     {
00120       ACE_RMCast::Ack ack;
00121       ack.source = this;
00122 
00123       const size_t header_size = 1 + sizeof(ACE_UINT32);
00124       if (size < header_size)
00125         {
00126           // The message is too small
00127           return 0;
00128         }
00129 
00130       ACE_UINT32 tmp;
00131 
00132       ACE_OS::memcpy (&tmp, buffer + 1,
00133                       sizeof(tmp));
00134       ack.next_expected = ACE_NTOHL (tmp);
00135       ACE_OS::memcpy (&tmp, buffer + 1 + sizeof(ACE_UINT32),
00136                       sizeof(tmp));
00137       ack.highest_received = ACE_NTOHL (tmp);
00138 
00139       return this->ack (ack);
00140     }
00141 
00142   return 0;
00143 }

int ACE_RMCast_UDP_Proxy::reply_ack ACE_RMCast::Ack   [virtual]
 

Send messages directly to the peer.

Send a message directly to the peer, i.e. the message is not sent through the multicast group and it may not be processed by all the layers in the stack.

Implements ACE_RMCast_Proxy.

Definition at line 171 of file RMCast_UDP_Proxy.cpp.

References io_udp_, and ACE_RMCast_IO_UDP::send_ack.

00172 {
00173   return this->io_udp_->send_ack (ack, this->peer_addr_);
00174 }

int ACE_RMCast_UDP_Proxy::reply_ack_join ACE_RMCast::Ack_Join   [virtual]
 

Send messages directly to the peer.

Send a message directly to the peer, i.e. the message is not sent through the multicast group and it may not be processed by all the layers in the stack.

Reimplemented from ACE_RMCast_Proxy.

Definition at line 158 of file RMCast_UDP_Proxy.cpp.

References io_udp_, ACE_RMCast_Proxy::reply_ack_join, and ACE_RMCast_IO_UDP::send_ack_join.

00159 {
00160   (void) this->ACE_RMCast_Proxy::reply_ack_join (ack_join);
00161   return this->io_udp_->send_ack_join (ack_join, this->peer_addr_);
00162 }

int ACE_RMCast_UDP_Proxy::reply_ack_leave ACE_RMCast::Ack_Leave   [virtual]
 

Send messages directly to the peer.

Send a message directly to the peer, i.e. the message is not sent through the multicast group and it may not be processed by all the layers in the stack.

Implements ACE_RMCast_Proxy.

Definition at line 165 of file RMCast_UDP_Proxy.cpp.

References io_udp_, and ACE_RMCast_IO_UDP::send_ack_leave.

00166 {
00167   return this->io_udp_->send_ack_leave (ack_leave, this->peer_addr_);
00168 }

int ACE_RMCast_UDP_Proxy::reply_data ACE_RMCast::Data   [virtual]
 

Send messages directly to the peer.

Send a message directly to the peer, i.e. the message is not sent through the multicast group and it may not be processed by all the layers in the stack.

Implements ACE_RMCast_Proxy.

Definition at line 146 of file RMCast_UDP_Proxy.cpp.

References io_udp_, and ACE_RMCast_IO_UDP::send_data.

00147 {
00148   return this->io_udp_->send_data (data, this->peer_addr_);
00149 }

int ACE_RMCast_UDP_Proxy::reply_join ACE_RMCast::Join   [virtual]
 

Send messages directly to the peer.

Send a message directly to the peer, i.e. the message is not sent through the multicast group and it may not be processed by all the layers in the stack.

Implements ACE_RMCast_Proxy.

Definition at line 177 of file RMCast_UDP_Proxy.cpp.

References io_udp_, and ACE_RMCast_IO_UDP::send_join.

00178 {
00179   return this->io_udp_->send_join (join, this->peer_addr_);
00180 }

int ACE_RMCast_UDP_Proxy::reply_leave ACE_RMCast::Leave   [virtual]
 

Send messages directly to the peer.

Send a message directly to the peer, i.e. the message is not sent through the multicast group and it may not be processed by all the layers in the stack.

Implements ACE_RMCast_Proxy.

Definition at line 183 of file RMCast_UDP_Proxy.cpp.

References io_udp_, and ACE_RMCast_IO_UDP::send_leave.

00184 {
00185   return this->io_udp_->send_leave (leave, this->peer_addr_);
00186 }

int ACE_RMCast_UDP_Proxy::reply_poll ACE_RMCast::Poll   [virtual]
 

Send messages directly to the peer.

Send a message directly to the peer, i.e. the message is not sent through the multicast group and it may not be processed by all the layers in the stack.

Implements ACE_RMCast_Proxy.

Definition at line 152 of file RMCast_UDP_Proxy.cpp.

References io_udp_, and ACE_RMCast_IO_UDP::send_poll.

00153 {
00154   return this->io_udp_->send_poll (poll, this->peer_addr_);
00155 }


Member Data Documentation

ACE_RMCast_IO_UDP* ACE_RMCast_UDP_Proxy::io_udp_ [private]
 

The IO facade.

Definition at line 77 of file RMCast_UDP_Proxy.h.

Referenced by reply_ack, reply_ack_join, reply_ack_leave, reply_data, reply_join, reply_leave, and reply_poll.

ACE_INET_Addr ACE_RMCast_UDP_Proxy::peer_addr_ [private]
 

The remote peer's address.

Definition at line 80 of file RMCast_UDP_Proxy.h.

Referenced by peer_addr.


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