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

ACE_RMCast_IO_UDP Class Reference

#include <RMCast_IO_UDP.h>

Inheritance diagram for ACE_RMCast_IO_UDP:

Inheritance graph
[legend]
Collaboration diagram for ACE_RMCast_IO_UDP:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_RMCast_IO_UDP (ACE_RMCast_Module_Factory *factory)
 Constructor. More...

 ~ACE_RMCast_IO_UDP (void)
 Destructor. More...

int init (const ACE_INET_Addr &mcast_group, const ACE_Addr &local, int protocol_family=PF_INET, int protocol=0, int reuse_addr=0)
 Open the internal socket, but only to send multicast data. More...

int subscribe (const ACE_INET_Addr &mcast_addr, int reuse_addr=1, const ACE_TCHAR *net_if=0, int protocol_family=PF_INET, int protocol=0)
 Join a new multicast group. More...

int handle_events (ACE_Time_Value *tv=0)
 Wait for events for the period <tv>. If <tv> is zero it blocks forever. More...

int handle_input (ACE_HANDLE h)
 There is data to read, read it and process it. More...

ACE_HANDLE get_handle (void) const
 Obtain the handle for the underlying socket. More...

virtual int data (ACE_RMCast::Data &)
 Push data through the stack. More...

virtual int poll (ACE_RMCast::Poll &)
 Push a polling request through the stack. More...

virtual int ack_join (ACE_RMCast::Ack_Join &)
 Push a message to ack a join request through the stack. More...

virtual int ack_leave (ACE_RMCast::Ack_Leave &)
 Push a message to ack a leave request through the stack. More...

virtual int ack (ACE_RMCast::Ack &)
 Push an ack mesage through the stack. More...

virtual int join (ACE_RMCast::Join &)
 Push a join message through the stack. More...

virtual int leave (ACE_RMCast::Leave &)
 Push a leave message through the stack. More...

int send_data (ACE_RMCast::Data &, const ACE_INET_Addr &)
 Send the message to the ACE_INET_Addr argument. More...

int send_poll (ACE_RMCast::Poll &, const ACE_INET_Addr &)
 Send the message to the ACE_INET_Addr argument. More...

int send_ack_join (ACE_RMCast::Ack_Join &, const ACE_INET_Addr &)
 Send the message to the ACE_INET_Addr argument. More...

int send_ack_leave (ACE_RMCast::Ack_Leave &, const ACE_INET_Addr &)
 Send the message to the ACE_INET_Addr argument. More...

int send_ack (ACE_RMCast::Ack &, const ACE_INET_Addr &)
 Send the message to the ACE_INET_Addr argument. More...

int send_join (ACE_RMCast::Join &, const ACE_INET_Addr &)
 Send the message to the ACE_INET_Addr argument. More...

int send_leave (ACE_RMCast::Leave &, const ACE_INET_Addr &)
 Send the message to the ACE_INET_Addr argument. More...


Private Types

typedef ACE_Hash_Map_Manager<
ACE_INET_Addr, ACE_RMCast_UDP_Proxy *,
ACE_Null_Mutex
Map
 Use a Hash_Map to maintain the collection of proxies. More...


Private Methods

ACE_RMCast_UDP_Proxyallocate_and_bind_proxy (ACE_RMCast_Module *module, const ACE_INET_Addr &)

Private Attributes

ACE_RMCast_Module_Factoryfactory_
 The factory used to create the modules attached to each proxy. More...

ACE_INET_Addr mcast_group_
 The multicast group we subscribe and send to. More...

ACE_SOCK_Dgram_Mcast dgram_
 The socket used to receive and send data. More...

Map map_
 The collection of proxies. More...


Member Typedef Documentation

typedef ACE_Hash_Map_Manager<ACE_INET_Addr,ACE_RMCast_UDP_Proxy*,ACE_Null_Mutex> ACE_RMCast_IO_UDP::Map [private]
 

Use a Hash_Map to maintain the collection of proxies.

Definition at line 128 of file RMCast_IO_UDP.h.


Constructor & Destructor Documentation

ACE_INLINE ACE_RMCast_IO_UDP::ACE_RMCast_IO_UDP ACE_RMCast_Module_Factory   factory
 

Constructor.

The <factory> argument is used to create the modules for each proxy that process incoming messages. The class does *not* assume ownership of <factory>, the caller owns it. But it does assume ownership of the modules returned by the factory, and it may ask the factory to release them eventually.

Definition at line 8 of file RMCast_IO_UDP.i.

00009   :  factory_ (factory)
00010 {
00011 }

ACE_RMCast_IO_UDP::~ACE_RMCast_IO_UDP void   
 

Destructor.

Definition at line 17 of file RMCast_IO_UDP.cpp.

00018 {
00019 }


Member Function Documentation

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

Push an ack mesage through the stack.

Reimplemented from ACE_RMCast_Module.

Definition at line 213 of file RMCast_IO_UDP.cpp.

References send_ack.

00214 {
00215   return this->send_ack (ack, this->mcast_group_);
00216 }

int ACE_RMCast_IO_UDP::ack_join ACE_RMCast::Ack_Join   [virtual]
 

Push a message to ack a join request through the stack.

Reimplemented from ACE_RMCast_Module.

Definition at line 201 of file RMCast_IO_UDP.cpp.

References send_ack_join.

00202 {
00203   return this->send_ack_join (ack_join, this->mcast_group_);
00204 }

int ACE_RMCast_IO_UDP::ack_leave ACE_RMCast::Ack_Leave   [virtual]
 

Push a message to ack a leave request through the stack.

Reimplemented from ACE_RMCast_Module.

Definition at line 207 of file RMCast_IO_UDP.cpp.

References send_ack_leave.

00208 {
00209   return this->send_ack_leave (ack_leave, this->mcast_group_);
00210 }

ACE_INLINE ACE_RMCast_UDP_Proxy * ACE_RMCast_IO_UDP::allocate_and_bind_proxy ACE_RMCast_Module   module,
const ACE_INET_Addr  
[private]
 

Definition at line 17 of file RMCast_IO_UDP.i.

References ACE_NEW_RETURN, map_, and ACE_RMCast_Module::next.

Referenced by handle_input.

00019 {
00020   ACE_RMCast_UDP_Proxy *proxy;
00021   ACE_NEW_RETURN (proxy,
00022                   ACE_RMCast_UDP_Proxy(this,
00023                                        from_address),
00024                   0);
00025   proxy->next (module);
00026 
00027   if (this->map_.bind (from_address, proxy) != 0)
00028     {
00029       // @@ LOG??
00030       return 0;
00031     }
00032 
00033   return proxy;
00034 }

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

Push data through the stack.

Reimplemented from ACE_RMCast_Module.

Definition at line 189 of file RMCast_IO_UDP.cpp.

References send_data.

00190 {
00191   return this->send_data (data, this->mcast_group_);
00192 }

ACE_HANDLE ACE_RMCast_IO_UDP::get_handle void    const
 

Obtain the handle for the underlying socket.

Definition at line 183 of file RMCast_IO_UDP.cpp.

References dgram_.

Referenced by ACE_RMCast_UDP_Event_Handler::get_handle.

00184 {
00185   return this->dgram_.get_handle ();
00186 }

int ACE_RMCast_IO_UDP::handle_events ACE_Time_Value   tv = 0
 

Wait for events for the period <tv>. If <tv> is zero it blocks forever.

Definition at line 50 of file RMCast_IO_UDP.cpp.

References dgram_, handle_input, ACE_OS::select, and ACE_Handle_Set::set_bit.

00051 {
00052   ACE_HANDLE h = this->dgram_.get_handle ();
00053   if (h == ACE_INVALID_HANDLE)
00054     return -1;
00055 
00056   ACE_Handle_Set handle_set;
00057   handle_set.set_bit (h);
00058 
00059   ACE_Countdown_Time countdown (tv);
00060 
00061   int r = ACE_OS::select (int(size_t(h)) + 1,
00062                           handle_set, 0, 0,
00063                           tv);
00064   if (r == -1)
00065     {
00066       if (errno == EINTR)
00067         return 0;
00068       else
00069         return -1;
00070     }
00071   else if (r == 0)
00072     {
00073       return 0;
00074     }
00075 
00076   return this->handle_input (h);
00077 }

int ACE_RMCast_IO_UDP::handle_input ACE_HANDLE    h
 

There is data to read, read it and process it.

Definition at line 80 of file RMCast_IO_UDP.cpp.

References ACE_ERROR, ACE_TEXT, allocate_and_bind_proxy, ACE_RMCast_Module_Factory::create, ACE_RMCast_Module_Factory::destroy, dgram_, factory_, LM_ERROR, map_, ACE_RMCast::MT_ACK, ACE_RMCast::MT_ACK_LEAVE, ACE_RMCast::MT_JOIN, ACE_RMCast::MT_LAST, ACE_RMCast::MT_LEAVE, ACE_RMCast_Module::next, ACE_RMCast_UDP_Proxy::receive_message, and ssize_t.

Referenced by handle_events, and ACE_RMCast_UDP_Event_Handler::handle_input.

00081 {
00082   // @@ We should use a system constant instead of this literal
00083   const int max_udp_packet_size = 65536;
00084   char buffer[max_udp_packet_size];
00085 
00086   ACE_INET_Addr from_address;
00087   ssize_t r =
00088     this->dgram_.recv (buffer, sizeof(buffer), from_address);
00089 
00090   if (r == -1)
00091     {
00092       // @@ LOG??
00093       ACE_ERROR ((LM_ERROR,
00094                   "RMCast_IO_UDP::handle_input () - error in recv %p\n",
00095                   ACE_TEXT ("")));
00096       return -1;
00097     }
00098 
00099   // ACE_HEX_DUMP ((LM_DEBUG, buffer, 16, "Receiver::handle_input"));
00100 
00101   // @@ Locking!
00102 
00103   int type = buffer[0];
00104 
00105   if (type < 0 || type >= ACE_RMCast::MT_LAST)
00106     {
00107       // @@ Log: invalid message type!!
00108       // @@ TODO: should we return -1?  The socket is still valid, it
00109       // makes little sense to destroy it just because one remote
00110       // sender is sending invalid messages. Maybe we should
00111       // strategize this too, and report the problem to the
00112       // application, this could indicate a misconfiguration or
00113       // something worse...
00114 
00115       // In any case the proxy should be destroyed, its peer is making
00116       // something really wrong.
00117       ACE_RMCast_UDP_Proxy *proxy;
00118       if (this->map_.unbind (from_address, proxy) == 0)
00119         {
00120           this->factory_->destroy (proxy->next ());
00121           delete proxy;
00122         }
00123       return 0;
00124     }
00125 
00126   ACE_RMCast_UDP_Proxy *proxy;
00127   if (this->map_.find (from_address, proxy) != 0)
00128     {
00129       //ACE_DEBUG ((LM_DEBUG,
00130       //            "IO_UDP::handle_input - new proxy from <%s:%d>\n",
00131       //            from_address.get_host_addr (),
00132       //            from_address.get_port_number ()));
00133 
00134       // @@ We should validate the message *before* creating the
00135       // object, all we need is some sort of validation strategy, a
00136       // different one for the receiver and another one for the
00137       // sender.
00138 
00139 #if 0
00140       if (type == ACE_RMCast::MT_ACK
00141           || type == ACE_RMCast::MT_JOIN
00142           || type == ACE_RMCast::MT_LEAVE
00143           || type == ACE_RMCast::MT_ACK_LEAVE)
00144         {
00145           // All these message types indicate a problem, the should be
00146           // generated by receivers, not received by them.
00147           return 0;
00148         }
00149 #endif /* 0 */
00150       ACE_RMCast_Module *module = this->factory_->create ();
00151       if (module == 0)
00152         {
00153           // @@ LOG??
00154           // Try to continue working, maybe the module can be created
00155           // later.
00156           return 0;
00157         }
00158       // This is necessary to satisfy the xgcc for Lynx on Solaris
00159       // by including the code directly causes :
00160       // RMCast_IO_UDP.cpp:202: error: internal error--unrecognizable insn:
00161       // (insn 1510 1507 524 (set (mem:SI (plus:SI (reg:SI 28 r28)
00162       //                 (const_int 65536)))
00163       //         (reg:SI 0 r0)) -1 (insn_list 528 (insn_list 1507 (nil)))
00164       //     (nil))
00165       // /usr/lynx/home2/jose/98r2/src/gcc/toplev.c:1489: Internal compiler error in function fatal_insn
00166       // to be thrown at the end of the function.
00167       if ((proxy = allocate_and_bind_proxy(module,from_address)) == 0)
00168         return 0;
00169     }
00170 
00171   // Have the proxy process the message and do the right thing.
00172   if (proxy->receive_message (buffer, r) != 0)
00173     {
00174       (void) this->map_.unbind (from_address);
00175       this->factory_->destroy (proxy->next ());
00176       delete proxy;
00177     }
00178 
00179   return 0;
00180 }

int ACE_RMCast_IO_UDP::init const ACE_INET_Addr   mcast_group,
const ACE_Addr   local,
int    protocol_family = PF_INET,
int    protocol = 0,
int    reuse_addr = 0
 

Open the internal socket, but only to send multicast data.

It is not clear to me if this is a valid configuration. Maybe it would be a problem to expose two separate, incompatible interfaces (check the subscribe() method). However, the alternative would be to implement almost identical class for outgoing and incoming UDP I/O

Definition at line 22 of file RMCast_IO_UDP.cpp.

References dgram_, mcast_group_, and ACE_SOCK_Dgram::open.

Referenced by ACE_RMCast_UDP_Reliable_Sender::init.

00027 {
00028   this->mcast_group_ = mcast_group;
00029 
00030   ACE_SOCK_Dgram &dgram = this->dgram_;
00031   return dgram.open (local, protocol_family, protocol, reuse_addr);
00032 }

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

Push a join message through the stack.

Reimplemented from ACE_RMCast_Module.

Definition at line 219 of file RMCast_IO_UDP.cpp.

References send_join.

00220 {
00221   return this->send_join (join, this->mcast_group_);
00222 }

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

Push a leave message through the stack.

Reimplemented from ACE_RMCast_Module.

Definition at line 225 of file RMCast_IO_UDP.cpp.

References send_leave.

00226 {
00227   return this->send_leave (leave, this->mcast_group_);
00228 }

int ACE_RMCast_IO_UDP::poll ACE_RMCast::Poll   [virtual]
 

Push a polling request through the stack.

Reimplemented from ACE_RMCast_Module.

Definition at line 195 of file RMCast_IO_UDP.cpp.

References send_poll.

00196 {
00197   return this->send_poll (poll, this->mcast_group_);
00198 }

int ACE_RMCast_IO_UDP::send_ack ACE_RMCast::Ack  ,
const ACE_INET_Addr  
 

Send the message to the ACE_INET_Addr argument.

These methods are used in the implementation of the ACE_RMCast_UDP_Proxy objects and the implementation of the inherited ACE_RMCast_Module methods in this class.

Definition at line 368 of file RMCast_IO_UDP.cpp.

References ACE_HTONL, dgram_, ACE_RMCast::Ack::highest_received, ACE_OS_String::memcpy, ACE_RMCast::MT_ACK, ACE_RMCast::Ack::next_expected, and ACE_SOCK_Dgram::send.

Referenced by ack, and ACE_RMCast_UDP_Proxy::reply_ack.

00370 {
00371   //ACE_DEBUG ((LM_DEBUG,
00372   //            "IO_UDP::send_ack - pushing (%d:%d) out to <%s:%d>\n",
00373   //            ack.next_expected,
00374   //            ack.highest_received,
00375   //            to.get_host_addr (),
00376   //            to.get_port_number ()));
00377 
00378   // @@ TODO: We could keep the header pre-initialized, and only
00379   // update the portions that do change...
00380   char header[16];
00381   header[0] = ACE_RMCast::MT_ACK;
00382 
00383   ACE_UINT32 tmp = ACE_HTONL (ack.next_expected);
00384   ACE_OS::memcpy (header + 1,
00385                   &tmp, sizeof(ACE_UINT32));
00386   tmp = ACE_HTONL (ack.highest_received);
00387   ACE_OS::memcpy (header + 1 + sizeof(ACE_UINT32),
00388                   &tmp, sizeof(ACE_UINT32));
00389 
00390   // ACE_SOCK_MCast_Dgram disallows sending, but it actually works.
00391   ACE_SOCK_Dgram &dgram = this->dgram_;
00392 
00393   if (dgram.send (header, 1 + 2*sizeof(ACE_UINT32), to) == -1)
00394     return -1;
00395 
00396   return 0;
00397 }

int ACE_RMCast_IO_UDP::send_ack_join ACE_RMCast::Ack_Join  ,
const ACE_INET_Addr  
 

Send the message to the ACE_INET_Addr argument.

These methods are used in the implementation of the ACE_RMCast_UDP_Proxy objects and the implementation of the inherited ACE_RMCast_Module methods in this class.

Definition at line 319 of file RMCast_IO_UDP.cpp.

References ACE_HTONL, dgram_, ACE_OS_String::memcpy, ACE_RMCast::MT_ACK_JOIN, ACE_RMCast::Ack_Join::next_sequence_number, and ACE_SOCK_Dgram::send.

Referenced by ack_join, and ACE_RMCast_UDP_Proxy::reply_ack_join.

00321 {
00322   //ACE_DEBUG ((LM_DEBUG,
00323   //            "IO_UDP::send_ack_join - pushing out to <%s:%d>\n",
00324   //            to.get_host_addr (),
00325   //            to.get_port_number ()));
00326 
00327   // @@ TODO: We could keep the header pre-initialized, and only
00328   // update the portions that do change...
00329   char header[16];
00330   header[0] = ACE_RMCast::MT_ACK_JOIN;
00331 
00332   ACE_UINT32 tmp = ACE_HTONL (ack_join.next_sequence_number);
00333   ACE_OS::memcpy (header + 1,
00334                   &tmp, sizeof(ACE_UINT32));
00335   // ACE_SOCK_MCast_Dgram disallows sending, but it actually works.
00336   ACE_SOCK_Dgram &dgram = this->dgram_;
00337 
00338   if (dgram.send (header, 1 + sizeof(ACE_UINT32), to) == -1)
00339     return -1;
00340 
00341   return 0;
00342 }

int ACE_RMCast_IO_UDP::send_ack_leave ACE_RMCast::Ack_Leave  ,
const ACE_INET_Addr  
 

Send the message to the ACE_INET_Addr argument.

These methods are used in the implementation of the ACE_RMCast_UDP_Proxy objects and the implementation of the inherited ACE_RMCast_Module methods in this class.

Definition at line 345 of file RMCast_IO_UDP.cpp.

References dgram_, ACE_RMCast::MT_ACK_LEAVE, and ACE_SOCK_Dgram::send.

Referenced by ack_leave, and ACE_RMCast_UDP_Proxy::reply_ack_leave.

00347 {
00348   //ACE_DEBUG ((LM_DEBUG,
00349   //            "IO_UDP::send_ack_leave - pushing out to <%s:%d>\n",
00350   //            to.get_host_addr (),
00351   //            to.get_port_number ()));
00352 
00353   // @@ TODO: We could keep the header pre-initialized, and only
00354   // update the portions that do change...
00355   char header[16];
00356   header[0] = ACE_RMCast::MT_ACK_LEAVE;
00357 
00358   // ACE_SOCK_MCast_Dgram disallows sending, but it actually works.
00359   ACE_SOCK_Dgram &dgram = this->dgram_;
00360 
00361   if (dgram.send (header, 1, to) == -1)
00362     return -1;
00363 
00364   return 0;
00365 }

int ACE_RMCast_IO_UDP::send_data ACE_RMCast::Data  ,
const ACE_INET_Addr  
 

Send the message to the ACE_INET_Addr argument.

These methods are used in the implementation of the ACE_RMCast_UDP_Proxy objects and the implementation of the inherited ACE_RMCast_Module methods in this class.

Definition at line 231 of file RMCast_IO_UDP.cpp.

References ACE_HEX_DUMP, ACE_HTONL, ACE_IOV_MAX, ACE_Message_Block::cont, dgram_, ACE_RMCast::Data::fragment_offset, iovec::iov_base, iovec::iov_len, IOV_MAX, ACE_Message_Block::length, LM_DEBUG, ACE_OS_String::memcpy, ACE_RMCast::MT_DATA, ACE_RMCast::Data::payload, ACE_Message_Block::rd_ptr, ACE_SOCK_Dgram::send, ACE_RMCast::Data::sequence_number, ACE_OS::sleep, and ACE_RMCast::Data::total_size.

Referenced by data, and ACE_RMCast_UDP_Proxy::reply_data.

00233 {
00234   //ACE_DEBUG ((LM_DEBUG,
00235   //            "IO_UDP::send_data - pushing out to <%s:%d>\n",
00236   //            to.get_host_addr (),
00237   //            to.get_port_number ()));
00238 
00239   // The first message block contains the header
00240   // @@ TODO: We could keep the header pre-initialized, and only
00241   // update the portions that do change...
00242   ACE_UINT32 tmp;
00243   char header[1 + 3 * sizeof(ACE_UINT32)];
00244   header[0] = ACE_RMCast::MT_DATA;
00245 
00246   tmp = ACE_HTONL (data.sequence_number);
00247   ACE_OS::memcpy (header + 1,
00248                   &tmp, sizeof(ACE_UINT32));
00249   tmp = ACE_HTONL (data.total_size);
00250   ACE_OS::memcpy (header + 1 + sizeof(ACE_UINT32),
00251                   &tmp, sizeof(ACE_UINT32));
00252   tmp = ACE_HTONL (data.fragment_offset);
00253   ACE_OS::memcpy (header + 1 + 2 * sizeof(ACE_UINT32),
00254                   &tmp, sizeof(ACE_UINT32));
00255 
00256   iovec iov[ACE_IOV_MAX];
00257   int iovcnt = 1;
00258 
00259   iov[0].iov_base = header;
00260   iov[0].iov_len = sizeof(header);
00261 
00262   ACE_Message_Block *mb = data.payload;
00263 
00264   for (const ACE_Message_Block *i = mb; i != 0; i = i->cont ())
00265     {
00266       iov[iovcnt].iov_base = i->rd_ptr ();
00267       iov[iovcnt].iov_len = ACE_static_cast (u_long, i->length ());
00268       iovcnt++;
00269       if (iovcnt >= IOV_MAX)
00270         return -1;
00271     }
00272 
00273   // @@ This pacing stuff here reduced the number of packet lost in
00274   // loopback tests, but it should be taken out for real applications
00275   // (or at least made configurable!)
00276   ACE_Time_Value tv (0, 10000);
00277   ACE_OS::sleep (tv);
00278 
00279   // ACE_SOCK_MCast_Dgram disallows sending, but it actually works.
00280   ACE_SOCK_Dgram &dgram = this->dgram_;
00281 
00282   if (dgram.send (iov, iovcnt, to) == -1)
00283     return -1;
00284 
00285 #if 0
00286   ACE_HEX_DUMP ((LM_DEBUG,
00287                  (char*)iov[0].iov_base,
00288                  iov[0].iov_len,
00289                  "Sending"));
00290 #endif
00291 
00292   return 0;
00293 }

int ACE_RMCast_IO_UDP::send_join ACE_RMCast::Join  ,
const ACE_INET_Addr  
 

Send the message to the ACE_INET_Addr argument.

These methods are used in the implementation of the ACE_RMCast_UDP_Proxy objects and the implementation of the inherited ACE_RMCast_Module methods in this class.

Definition at line 400 of file RMCast_IO_UDP.cpp.

References dgram_, ACE_RMCast::MT_JOIN, and ACE_SOCK_Dgram::send.

Referenced by join, and ACE_RMCast_UDP_Proxy::reply_join.

00402 {
00403   //ACE_DEBUG ((LM_DEBUG,
00404   //            "IO_UDP::send_join - pushing out to <%s:%d>\n",
00405   //            to.get_host_addr (),
00406   //            to.get_port_number ()));
00407 
00408   // @@ TODO: We could keep the header pre-initialized, and only
00409   // update the portions that do change...
00410   char header[16];
00411   header[0] = ACE_RMCast::MT_JOIN;
00412 
00413   // ACE_SOCK_MCast_Dgram disallows sending, but it actually works.
00414   ACE_SOCK_Dgram &dgram = this->dgram_;
00415 
00416   if (dgram.send (header, 1, to) == -1)
00417     return -1;
00418 
00419   return 0;
00420 }

int ACE_RMCast_IO_UDP::send_leave ACE_RMCast::Leave  ,
const ACE_INET_Addr  
 

Send the message to the ACE_INET_Addr argument.

These methods are used in the implementation of the ACE_RMCast_UDP_Proxy objects and the implementation of the inherited ACE_RMCast_Module methods in this class.

Definition at line 423 of file RMCast_IO_UDP.cpp.

References dgram_, ACE_RMCast::MT_LEAVE, and ACE_SOCK_Dgram::send.

Referenced by leave, and ACE_RMCast_UDP_Proxy::reply_leave.

00425 {
00426   //ACE_DEBUG ((LM_DEBUG,
00427   //            "IO_UDP::send_leave - pushing out to <%s:%d>\n",
00428   //            to.get_host_addr (),
00429   //            to.get_port_number ()));
00430 
00431   // @@ TODO: We could keep the header pre-initialized, and only
00432   // update the portions that do change...
00433   char header[16];
00434   header[0] = ACE_RMCast::MT_LEAVE;
00435 
00436   // ACE_SOCK_MCast_Dgram disallows sending, but it actually works.
00437   ACE_SOCK_Dgram &dgram = this->dgram_;
00438 
00439   if (dgram.send (header, 1, to) == -1)
00440     return -1;
00441 
00442   return 0;
00443 }

int ACE_RMCast_IO_UDP::send_poll ACE_RMCast::Poll  ,
const ACE_INET_Addr  
 

Send the message to the ACE_INET_Addr argument.

These methods are used in the implementation of the ACE_RMCast_UDP_Proxy objects and the implementation of the inherited ACE_RMCast_Module methods in this class.

Definition at line 296 of file RMCast_IO_UDP.cpp.

References dgram_, ACE_RMCast::MT_POLL, and ACE_SOCK_Dgram::send.

Referenced by poll, and ACE_RMCast_UDP_Proxy::reply_poll.

00298 {
00299   //ACE_DEBUG ((LM_DEBUG,
00300   //            "IO_UDP::send_poll - pushing out to <%s:%d>\n",
00301   //            to.get_host_addr (),
00302   //            to.get_port_number ()));
00303 
00304   // @@ TODO: We could keep the header pre-initialized, and only
00305   // update the portions that do change...
00306   char header[16];
00307   header[0] = ACE_RMCast::MT_POLL;
00308 
00309   // ACE_SOCK_MCast_Dgram disallows sending, but it actually works.
00310   ACE_SOCK_Dgram &dgram = this->dgram_;
00311 
00312   if (dgram.send (header, 1, to) == -1)
00313     return -1;
00314 
00315   return 0;
00316 }

int ACE_RMCast_IO_UDP::subscribe const ACE_INET_Addr   mcast_addr,
int    reuse_addr = 1,
const ACE_TCHAR   net_if = 0,
int    protocol_family = PF_INET,
int    protocol = 0
 

Join a new multicast group.

Start receiving data for the <mcast_addr> multicast group. Please read the documentation of ACE_SOCK_Dgram_Mcast for more details.

Definition at line 35 of file RMCast_IO_UDP.cpp.

References ACE_TCHAR, dgram_, mcast_group_, and ACE_SOCK_Dgram_Mcast::subscribe.

Referenced by ACE_RMCast_UDP_Reliable_Receiver::init.

00040 {
00041   this->mcast_group_ = mcast_addr;
00042   return this->dgram_.subscribe (mcast_addr,
00043                                  reuse_addr,
00044                                  net_if,
00045                                  protocol_family,
00046                                  protocol);
00047 }


Member Data Documentation

ACE_SOCK_Dgram_Mcast ACE_RMCast_IO_UDP::dgram_ [private]
 

The socket used to receive and send data.

Definition at line 125 of file RMCast_IO_UDP.h.

Referenced by get_handle, handle_events, handle_input, init, send_ack, send_ack_join, send_ack_leave, send_data, send_join, send_leave, send_poll, and subscribe.

ACE_RMCast_Module_Factory* ACE_RMCast_IO_UDP::factory_ [private]
 

The factory used to create the modules attached to each proxy.

Definition at line 119 of file RMCast_IO_UDP.h.

Referenced by handle_input.

Map ACE_RMCast_IO_UDP::map_ [private]
 

The collection of proxies.

Definition at line 130 of file RMCast_IO_UDP.h.

Referenced by allocate_and_bind_proxy, and handle_input.

ACE_INET_Addr ACE_RMCast_IO_UDP::mcast_group_ [private]
 

The multicast group we subscribe and send to.

Definition at line 122 of file RMCast_IO_UDP.h.

Referenced by init, and subscribe.


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