ECG_Simple_Address_Server.cpp

Go to the documentation of this file.
00001 // $Id: ECG_Simple_Address_Server.cpp 78519 2007-05-29 14:54:16Z mesnier_p $
00002 
00003 #include "orbsvcs/Event/ECG_Simple_Address_Server.h"
00004 
00005 #if !defined(__ACE_INLINE__)
00006 #include "orbsvcs/Event/ECG_Simple_Address_Server.inl"
00007 #endif /* __ACE_INLINE__ */
00008 
00009 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00010 
00011 TAO_ECG_Simple_Address_Server::TAO_ECG_Simple_Address_Server (void)
00012 {
00013 }
00014 
00015 TAO_ECG_Simple_Address_Server::~TAO_ECG_Simple_Address_Server (void)
00016 {
00017 }
00018 
00019 int
00020 TAO_ECG_Simple_Address_Server::init (const char *mcast_addr)
00021 {
00022   return this->addr_.set (mcast_addr);
00023 }
00024 
00025 void
00026 TAO_ECG_Simple_Address_Server::get_addr (
00027     const RtecEventComm::EventHeader& /*header*/,
00028     RtecUDPAdmin::UDP_Addr_out addr)
00029 {
00030 #if defined (ACE_HAS_IPV6)
00031   if (this->addr_.get_type() == PF_INET6)
00032     throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
00033 #endif /* ACE_HAS_IPV6 */
00034   // unsigned long
00035   addr.ipaddr = this->addr_.get_ip_address ();
00036   // unsigned short
00037   addr.port = this->addr_.get_port_number ();
00038 }
00039 
00040 
00041 void
00042 TAO_ECG_Simple_Address_Server::get_address (const RtecEventComm::EventHeader& ,
00043                                             RtecUDPAdmin::UDP_Address_out addr)
00044 {
00045 #if defined (ACE_HAS_IPV6)
00046   if (this->addr_.get_type() == PF_INET6)
00047     {
00048       RtecUDPAdmin::UDP_Addr_v6 v6;
00049       sockaddr_in6 *in6 =
00050         reinterpret_cast<sockaddr_in6 *>(this->addr_.get_addr());
00051       ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16);
00052       v6.port = this->addr_.get_port_number();
00053       addr.v6_addr (v6);
00054       return;
00055     }
00056 #endif /* ACE_HAS_IPV6 */
00057   RtecUDPAdmin::UDP_Addr v4;
00058   v4.ipaddr = this->addr_.get_ip_address();
00059   v4.port = this->addr_.get_port_number();
00060   addr.v4_addr (v4);
00061 }
00062 
00063 
00064 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:44:06 2010 for TAO_RTEvent by  doxygen 1.4.7