Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / EC_MT_Mcast / AddrServer.cpp
blob6070cb41ea0168f226dd5c0b22d48a5fc301d713
1 // Reused from: $TAO_ROOT/orbsvcs/examples/RtEC/MCast
3 #include "AddrServer.h"
4 #include "ace/INET_Addr.h"
6 AddrServer::AddrServer (const ACE_INET_Addr& addr)
8 #if defined (ACE_HAS_IPV6)
9 if (addr.get_type() == PF_INET6)
11 RtecUDPAdmin::UDP_Addr_v6 v6;
12 sockaddr_in6 *in6 =
13 reinterpret_cast<sockaddr_in6 *>(addr.get_addr());
14 ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16);
15 v6.port = addr.get_port_number();
16 this->addr_.v6_addr (v6);
17 return;
19 #endif /* ACE_HAS_IPV6 */
20 RtecUDPAdmin::UDP_Addr v4;
21 v4.ipaddr = addr.get_ip_address ();
22 v4.port = addr.get_port_number ();
23 this->addr_.v4_addr (v4);
26 void
27 AddrServer::get_addr (const RtecEventComm::EventHeader&,
28 RtecUDPAdmin::UDP_Addr& addr)
30 if (this->addr_._d() == RtecUDPAdmin::Rtec_inet6)
31 throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
32 addr = this->addr_.v4_addr();
36 void
37 AddrServer::get_address (const RtecEventComm::EventHeader&,
38 RtecUDPAdmin::UDP_Address_out addr)
40 addr = this->addr_;