Merge pull request #2306 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / DevGuideExamples / EventServices / RTEC_MCast_Federated / SimpleAddressServer.cpp
blob3bbccdf1b265dfd149db0d982ef3a22de713d28c
1 // SimpleAddressServer.cpp
3 #include "SimpleAddressServer.h"
4 #include "ace/INET_Addr.h"
5 #include "ace/OS_NS_string.h"
7 SimpleAddressServer::SimpleAddressServer (const ACE_INET_Addr& address) {
8 #if defined (ACE_HAS_IPV6)
9 if (address.get_type() == PF_INET6)
11 RtecUDPAdmin::UDP_Addr_v6 v6;
12 sockaddr_in6 *in6 =
13 reinterpret_cast<sockaddr_in6 *>(address.get_addr());
14 ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16);
15 v6.port = address.get_port_number();
16 this->address_.v6_addr (v6);
17 return;
19 #endif /* ACE_HAS_IPV6 */
20 RtecUDPAdmin::UDP_Addr v4;
21 v4.ipaddr = address.get_ip_address ();
22 v4.port = address.get_port_number ();
23 this->address_.v4_addr (v4);
26 void
27 SimpleAddressServer::get_addr (const RtecEventComm::EventHeader&,
28 RtecUDPAdmin::UDP_Addr& address)
30 if (this->address_._d() == RtecUDPAdmin::Rtec_inet6)
31 throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
32 address = this->address_.v4_addr();
35 void
36 SimpleAddressServer::get_address(const RtecEventComm::EventHeader&,
37 RtecUDPAdmin::UDP_Address& address)
39 address = this->address_;