summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/ChangeLog73
-rw-r--r--TAO/orbsvcs/examples/RtEC/MCast/AddrServer.cpp7
-rw-r--r--TAO/orbsvcs/examples/RtEC/MCast/AddrServer.h3
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.h9
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp42
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h2
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp33
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp28
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h2
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp6
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h7
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.inl17
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp36
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp13
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.h3
-rw-r--r--TAO/orbsvcs/orbsvcs/RtecUDPAdmin.idl55
-rw-r--r--TAO/orbsvcs/tests/Event/Basic/BCast.cpp16
-rw-r--r--TAO/orbsvcs/tests/Event/Basic/BCast.h26
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/AddrServer/AddrServer.mpc31
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/AddrServer/Client.cpp127
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/AddrServer/README17
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/AddrServer/Server.cpp84
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/AddrServer/TestAddrServer.cpp69
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/AddrServer/TestAddrServer.h30
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/AddrServerMain.cpp132
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/Barrier.idl9
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp2
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp149
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/README16
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc29
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.cpp41
-rw-r--r--TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.h13
-rwxr-xr-xTAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/run_test.pl16
-rw-r--r--TAO/orbsvcs/tests/Event/UDP/AddrServer.cpp35
-rw-r--r--TAO/orbsvcs/tests/Event/UDP/AddrServer.h9
-rw-r--r--TAO/orbsvcs/tests/Event/UDP/receiver.cpp7
-rw-r--r--TAO/orbsvcs/tests/Event/UDP/sender.cpp6
37 files changed, 1050 insertions, 150 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 56cfc9910b1..8a8299aed64 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,76 @@
+Tue May 29 14:11:17 UTC 2007 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * orbsvcs/examples/RtEC/MCast/AddrServer.h:
+ * orbsvcs/examples/RtEC/MCast/AddrServer.cpp:
+
+ Added changes required by new interface.
+
+ * orbsvcs/orbsvcs/Event/ECG_Adapters.h:
+ * orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h:
+ * orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp:
+ * orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp:
+ * orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h:
+ * orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp:
+ * orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp:
+ * orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h:
+ * orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.inl:
+ * orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp:
+ * orbsvcs/orbsvcs/Event/EC_UDP_Admin.h:
+ * orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp:
+
+ * orbsvcs/orbsvcs/RtecUDPAdmin.idl:
+
+ Support for IPv6 addresses used to federate event channels via
+ multicast. The AddressServer interface is extended to support
+ either IPv4 or IPv6 addresses, retaining backwards
+ compatibility. The interface differs from the solution
+ originally coded for TAO 1.4a, as that solution does not support
+ a single address server shared by many event channels in a mixed
+ host environment. Support for the 1.4a variant is not provided
+ at this time, but could be added in the future if necessary.
+ Given the nature of the bug and the lack of complaint from any
+ 1.4a users (including the original funder) it seems unlikely
+ that this lack of support will cause a problem.
+
+ * orbsvcs/tests/Event/Basic/BCast.h:
+ * orbsvcs/tests/Event/Basic/BCast.cpp:
+
+ Removed redundant address server implementation.
+
+ * orbsvcs/tests/Event/Mcast/AddrServer:
+
+ This is a new test added to validate the sharing of an address
+ server in a mixed host environment. In this case, mixed host
+ means different OSes and byte orders, which impacts the encoding
+ of address data.
+
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/AddrServerMain.cpp:
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/Barrier.idl:
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp:
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp:
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/README:
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc:
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.h:
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.cpp:
+ * orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/run_test.pl:
+
+ Modified the test to support IPv6 federation. Use run_test.pl
+ -ipv6 to test. Also extended the test suite to enable running a
+ distributed test across many hosts. A new executable,
+ AddrServer, is generated that registers with the naming
+ service. The AddrServer also acts as a synchronization point,
+ supporting a new Barrier interface. This allows the test to be
+ manually started on many hosts, with each supplier instance
+ starting only when all expected suppliers have contacted the
+ barrier.
+
+ * orbsvcs/tests/Event/UDP/AddrServer.h:
+ * orbsvcs/tests/Event/UDP/AddrServer.cpp:
+ * orbsvcs/tests/Event/UDP/receiver.cpp:
+ * orbsvcs/tests/Event/UDP/sender.cpp:
+
+ Cleaned up the code to build with the new address server interface.
+
Tue May 29 09:39:55 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
* tests/MT_BiDir/run_test.pl:
diff --git a/TAO/orbsvcs/examples/RtEC/MCast/AddrServer.cpp b/TAO/orbsvcs/examples/RtEC/MCast/AddrServer.cpp
index 79c0d07e1bf..66e1c5117bc 100644
--- a/TAO/orbsvcs/examples/RtEC/MCast/AddrServer.cpp
+++ b/TAO/orbsvcs/examples/RtEC/MCast/AddrServer.cpp
@@ -15,3 +15,10 @@ AddrServer::get_addr (const RtecEventComm::EventHeader&,
{
addr = this->addr_;
}
+
+void
+AddrServer::get_address (const RtecEventComm::EventHeader&,
+ RtecUDPAdmin::UDP_Address_out addr)
+{
+ addr.v4_addr(this->addr_);
+}
diff --git a/TAO/orbsvcs/examples/RtEC/MCast/AddrServer.h b/TAO/orbsvcs/examples/RtEC/MCast/AddrServer.h
index de7aeb6d590..ce633025591 100644
--- a/TAO/orbsvcs/examples/RtEC/MCast/AddrServer.h
+++ b/TAO/orbsvcs/examples/RtEC/MCast/AddrServer.h
@@ -42,6 +42,9 @@ public:
virtual void get_addr (const RtecEventComm::EventHeader& header,
RtecUDPAdmin::UDP_Addr_out addr);
+ virtual void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr);
+
private:
RtecUDPAdmin::UDP_Addr addr_;
// The address
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.h
index 676d9b62b71..36c69f2d036 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.h
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_Adapters.h
@@ -65,8 +65,15 @@ public:
virtual int handle_input (ACE_SOCK_Dgram& dgram) = 0;
+ /// Call the RtecUDPAdmin::AddrServer::get_addr. Throws exception
+ /// if nil Address Server was specified in init ().
virtual void get_addr (const RtecEventComm::EventHeader& header,
- RtecUDPAdmin::UDP_Addr_out addr) = 0;
+ RtecUDPAdmin::UDP_Addr_out addr) = 0;
+
+ /// Call the RtecUDPAdmin::AddrServer::get_address. Throws exception
+ /// if nil Address Server was specified in init ().
+ virtual void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr) = 0;
};
typedef ACE_Refcounted_Auto_Ptr<TAO_ECG_Handler_Shutdown,
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp
index 73980d20c69..322bbef29bd 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.cpp
@@ -136,17 +136,59 @@ TAO_ECG_Complex_Address_Server::get_addr (
if (this->mcast_mapping_.find (key, mapping_entry) == -1)
{
// Key was not found in the mapping. Use default.
+#if defined (ACE_HAS_IPV6)
+ if (this->default_addr_.get_type() == PF_INET6)
+ throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
+#endif /* ACE_HAS_IPV6 */
addr.ipaddr = this->default_addr_.get_ip_address ();
addr.port = this->default_addr_.get_port_number ();
}
else
{
+#if defined (ACE_HAS_IPV6)
+ if (mapping_entry->int_id_.get_type() == PF_INET6)
+ throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
+#endif /* ACE_HAS_IPV6 */
addr.ipaddr = mapping_entry->int_id_.get_ip_address ();
addr.port = mapping_entry->int_id_.get_port_number ();
}
}
void
+TAO_ECG_Complex_Address_Server::get_address (
+ const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr)
+{
+ CORBA::Long key;
+ if (this->is_source_mapping_)
+ key = header.source;
+ else
+ key = header.type;
+
+ MAP::ENTRY * mapping_entry = 0;
+ ACE_INET_Addr &src_addr =
+ (this->mcast_mapping_.find (key, mapping_entry) == -1) ?
+ this->default_addr_ : mapping_entry->int_id_;
+#if defined (ACE_HAS_IPV6)
+ if (src_addr.get_type() == PF_INET6)
+ {
+ RtecUDPAdmin::UDP_Addr_v6 v6;
+ sockaddr_in6 *in6 =
+ reinterpret_cast<sockaddr_in6 *>(src_addr.get_addr());
+ ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16);
+ v6.port = src_addr.get_port_number();
+ addr.v6_addr (v6);
+ return;
+ }
+#endif /* ACE_HAS_IPV6 */
+ RtecUDPAdmin::UDP_Addr v4;
+ v4.ipaddr = src_addr.get_ip_address();
+ v4.port = src_addr.get_port_number();
+ addr.v4_addr (v4);
+}
+
+
+void
TAO_ECG_Complex_Address_Server::dump_content (void)
{
ACE_DEBUG ((LM_DEBUG, "Default address: %s:%d\n",
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h
index 4f51296ef99..d5cf9b79530 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_Complex_Address_Server.h
@@ -71,6 +71,8 @@ public:
// = The RtecUDPAdmin::AddrServer methods
virtual void get_addr (const RtecEventComm::EventHeader& header,
RtecUDPAdmin::UDP_Addr_out addr);
+ virtual void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr6);
/// Prints out complete content of the address server. Useful for
/// debugging.
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp
index 82405c6d2b6..c66d8a90aec 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_Mcast_EH.cpp
@@ -156,11 +156,38 @@ TAO_ECG_Mcast_EH::compute_required_subscriptions (
{
continue;
}
- RtecUDPAdmin::UDP_Addr addr;
- this->receiver_->get_addr (header, addr);
+ ACE_INET_Addr inet_addr;
+ try
+ {
+ // Grab the right mcast group for this event...
+ RtecUDPAdmin::UDP_Address_var udp_addr;
+
+ this->receiver_->get_address (header, udp_addr.out());
+ switch (udp_addr->_d())
+ {
+ case RtecUDPAdmin::INET:
+ inet_addr.set(udp_addr->v4_addr().port,
+ udp_addr->v4_addr().ipaddr);
+ break;
+ case RtecUDPAdmin::INET6:
+#if defined (ACE_HAS_IPV6)
+ inet_addr.set_type(PF_INET6);
+#endif
+ inet_addr.set_address(udp_addr->v6_addr().ipaddr,16,0);
+ inet_addr.set_port_number(udp_addr->v6_addr().port);
+ break;
+ }
+ }
+ catch (const ::CORBA::BAD_OPERATION &)
+ {
+ // server only supports IPv4
+ // Grab the right mcast group for this event...
+ RtecUDPAdmin::UDP_Addr udp_addr;
+ this->receiver_->get_addr (header, udp_addr);
+ inet_addr.set (udp_addr.port, udp_addr.ipaddr);
+ }
- ACE_INET_Addr inet_addr (addr.port, addr.ipaddr);
// Ignore errors, if the element is in the set we simply ignore
// the problem...
(void) multicast_addresses.insert (inet_addr);
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp
index 9d10b9f730c..73e6ae0e2a9 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.cpp
@@ -27,10 +27,38 @@ TAO_ECG_Simple_Address_Server::get_addr (
const RtecEventComm::EventHeader& /*header*/,
RtecUDPAdmin::UDP_Addr_out addr)
{
+#if defined (ACE_HAS_IPV6)
+ if (this->addr_.get_type() == PF_INET6)
+ throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
+#endif /* ACE_HAS_IPV6 */
// unsigned long
addr.ipaddr = this->addr_.get_ip_address ();
// unsigned short
addr.port = this->addr_.get_port_number ();
}
+
+void
+TAO_ECG_Simple_Address_Server::get_address (const RtecEventComm::EventHeader& ,
+ RtecUDPAdmin::UDP_Address_out addr)
+{
+#if defined (ACE_HAS_IPV6)
+ if (this->addr_.get_type() == PF_INET6)
+ {
+ RtecUDPAdmin::UDP_Addr_v6 v6;
+ sockaddr_in6 *in6 =
+ reinterpret_cast<sockaddr_in6 *>(this->addr_.get_addr());
+ ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16);
+ v6.port = this->addr_.get_port_number();
+ addr.v6_addr (v6);
+ return;
+ }
+#endif /* ACE_HAS_IPV6 */
+ RtecUDPAdmin::UDP_Addr v4;
+ v4.ipaddr = this->addr_.get_ip_address();
+ v4.port = this->addr_.get_port_number();
+ addr.v4_addr (v4);
+}
+
+
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h
index 8bddc3cc95d..b2bc0405641 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_Simple_Address_Server.h
@@ -45,6 +45,8 @@ public:
// = The RtecUDPAdmin::AddrServer methods
virtual void get_addr (const RtecEventComm::EventHeader& header,
RtecUDPAdmin::UDP_Addr_out addr);
+ virtual void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr6);
protected:
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp
index 39003c47bba..07d399ad3aa 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Out_Endpoint.cpp
@@ -3,6 +3,7 @@
#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.h"
#include "ace/INET_Addr.h"
#include "ace/Sock_Connect.h"
+#include "ace/OS_NS_string.h"
#if !defined(__ACE_INLINE__)
#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.inl"
@@ -46,7 +47,10 @@ TAO_ECG_UDP_Out_Endpoint::is_loopback (const ACE_INET_Addr& from)
i != this->ifs_ + this->if_count_;
++i)
{
- if ((*i).get_ip_address () == from.get_ip_address ())
+ if (i->get_addr_size() == from.get_addr_size() &&
+ ACE_OS::memcmp( i->get_addr(),
+ from.get_addr(),
+ from.get_addr_size()))
return true;
}
return false;
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h
index 6e580beeb0d..2cb717b5ac8 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.h
@@ -164,10 +164,15 @@ public:
/// Accessor.
/// Call the RtecUDPAdmin::AddrServer::get_addr. Throws exception
- /// if nill Address Server was specified in init ().
+ /// if nil Address Server was specified in init ().
void get_addr (const RtecEventComm::EventHeader& header,
RtecUDPAdmin::UDP_Addr_out addr);
+ /// Call the RtecUDPAdmin::AddrServer::get_address. Throws exception
+ /// if nil Address Server was specified in init ().
+ void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr);
+
/// The PushSupplier idl method.
/// Invokes shutdown (), which may result in the object being deleted, if
/// refcounting is used to manage its lifetime.
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.inl b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.inl
index 8c0ab413f76..130b967dd1d 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.inl
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.inl
@@ -100,4 +100,21 @@ TAO_ECG_UDP_Receiver::get_addr (const RtecEventComm::EventHeader& header,
this->addr_server_->get_addr (header, addr);
}
+ACE_INLINE void
+TAO_ECG_UDP_Receiver::get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr)
+{
+ if (CORBA::is_nil (this->addr_server_.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO_ECG_UDP_Receiver::get_addr() called but "
+ "nil Address Server was supplied during "
+ "initialization through init().\n"));
+
+ throw CORBA::INTERNAL ();
+ }
+
+ this->addr_server_->get_address (header, addr);
+}
+
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp
index fbf072250d8..ebf3071ba7c 100644
--- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Sender.cpp
@@ -199,12 +199,36 @@ TAO_ECG_UDP_Sender::push (const RtecEventComm::EventSet &events)
|| !(cdr << e.data))
throw CORBA::MARSHAL ();
- // Grab the right mcast group for this event...
- RtecUDPAdmin::UDP_Addr udp_addr;
- this->addr_server_->get_addr (header, udp_addr);
-
- ACE_INET_Addr inet_addr (udp_addr.port,
- udp_addr.ipaddr);
+ ACE_INET_Addr inet_addr;
+ try
+ {
+ // Grab the right mcast group for this event...
+ RtecUDPAdmin::UDP_Address_var udp_addr;
+
+ this->addr_server_->get_address (header, udp_addr.out());
+ switch (udp_addr->_d())
+ {
+ case RtecUDPAdmin::INET:
+ inet_addr.set(udp_addr->v4_addr().port,
+ udp_addr->v4_addr().ipaddr);
+ break;
+ case RtecUDPAdmin::INET6:
+#if defined (ACE_HAS_IPV6)
+ inet_addr.set_type(PF_INET6);
+#endif
+ inet_addr.set_address(udp_addr->v6_addr().ipaddr,16,0);
+ inet_addr.set_port_number(udp_addr->v6_addr().port);
+ break;
+ }
+ }
+ catch (const ::CORBA::BAD_OPERATION &)
+ {
+ // server only supports IPv4
+ // Grab the right mcast group for this event...
+ RtecUDPAdmin::UDP_Addr udp_addr;
+ this->addr_server_->get_addr (header, udp_addr);
+ inet_addr.set (udp_addr.port, udp_addr.ipaddr);
+ }
this->cdr_sender_.send_message (cdr, inet_addr);
}
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp
index 2a75a4a9a9a..51438a687d2 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.cpp
@@ -1,6 +1,7 @@
// $Id$
#include "orbsvcs/Event/EC_UDP_Admin.h"
+#include "ace/INET_Addr.h"
ACE_RCSID (Event,
EC_UDP_Admin,
@@ -25,4 +26,16 @@ TAO_EC_Simple_AddrServer::get_addr (const RtecEventComm::EventHeader& header,
addr.port = this->port_;
}
+
+void
+TAO_EC_Simple_AddrServer::get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr)
+{
+ RtecUDPAdmin::UDP_Addr v4;
+ v4.ipaddr = header.type;
+ v4.port = this->port_;
+ addr.v4_addr(v4);
+}
+
+
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.h b/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.h
index 01ea084fa39..abefa575c07 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.h
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_UDP_Admin.h
@@ -48,6 +48,9 @@ public:
virtual void get_addr (const RtecEventComm::EventHeader& header,
RtecUDPAdmin::UDP_Addr_out addr);
+ virtual void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr);
+
private:
CORBA::UShort port_;
};
diff --git a/TAO/orbsvcs/orbsvcs/RtecUDPAdmin.idl b/TAO/orbsvcs/orbsvcs/RtecUDPAdmin.idl
index b63f52fe9a2..849c4096a9e 100644
--- a/TAO/orbsvcs/orbsvcs/RtecUDPAdmin.idl
+++ b/TAO/orbsvcs/orbsvcs/RtecUDPAdmin.idl
@@ -16,6 +16,7 @@
#define TAO_RTEC_UDP_ADMIN_IDL
#include "RtecEventComm.idl"
+#include "tao/OctetSeq.pidl"
/**
* @namespace RtecUDPAdmin
@@ -39,6 +40,46 @@ module RtecUDPAdmin
};
/**
+ * @struct UDP_Addr_v6
+ *
+ * @brief Represent a UDP SAP sufficient to hold an IPv6 address.
+ */
+
+ struct UDP_Addr_v6
+ {
+ char ipaddr[16]; // used to match with ACE_INET_Addr::set_address
+ unsigned short port;
+ };
+
+ /**
+ * @enum Address_Family
+ *
+ * @brief Defines the address family identifiers. The more familiar
+ * AF_INET, AF_INET6 are not used to avoid potential confusion.
+ *
+ */
+ enum Address_Family
+ {
+ INET,
+ INET6
+ };
+
+ /**
+ * @union UDP_Address
+ *
+ * @brief Holds either an IPv4 or IPv6 address and used for the
+ * return value from get_address below.
+ *
+ */
+ union UDP_Address switch (Address_Family)
+ {
+ case INET:
+ UDP_Addr v4_addr;
+ case INET6:
+ UDP_Addr_v6 v6_addr;
+ };
+
+ /**
* @interface AddrServer
*
* @brief Defines a interface to configure the mapping between
@@ -47,14 +88,26 @@ module RtecUDPAdmin
*/
interface AddrServer
{
- /// Get the UDP address give the event header
+ /// Get the UDP address given the event header
/**
+ * @deprecated, applications should use get_ip_address, which
+ * supports both IPv4 and IPv6 addresses.
* @param header The event header, used to fetch the type and
* source of the event
* @param addr Return the address used for the given event type
*/
void get_addr (in RtecEventComm::EventHeader header,
out UDP_Addr addr);
+
+ /// Get the UDP address given the event header, supports either
+ /// IPv4 or IPv6
+ /**
+ * @param header The event header, used to fetch the type and
+ * source of the event
+ * @param addr Return the address used for the given event type
+ */
+ void get_address (in RtecEventComm::EventHeader header,
+ out UDP_Address addr);
};
};
diff --git a/TAO/orbsvcs/tests/Event/Basic/BCast.cpp b/TAO/orbsvcs/tests/Event/Basic/BCast.cpp
index 345bcd20d64..7749612c581 100644
--- a/TAO/orbsvcs/tests/Event/Basic/BCast.cpp
+++ b/TAO/orbsvcs/tests/Event/Basic/BCast.cpp
@@ -133,19 +133,3 @@ EC_BCast::dump_results (void)
{
this->EC_Driver::dump_results ();
}
-
-// ****************************************************************
-
-Simple_Address_Server::
-Simple_Address_Server (const ACE_INET_Addr& address)
-{
- this->address_.ipaddr = address.get_ip_address ();
- this->address_.port = address.get_port_number ();
-}
-
-void
-Simple_Address_Server::get_addr (const RtecEventComm::EventHeader&,
- RtecUDPAdmin::UDP_Addr& address)
-{
- address = this->address_;
-}
diff --git a/TAO/orbsvcs/tests/Event/Basic/BCast.h b/TAO/orbsvcs/tests/Event/Basic/BCast.h
index de5000e101e..7505a06a1b7 100644
--- a/TAO/orbsvcs/tests/Event/Basic/BCast.h
+++ b/TAO/orbsvcs/tests/Event/Basic/BCast.h
@@ -14,11 +14,6 @@
#define EC_BCAST_H
#include "Driver.h"
-#include "orbsvcs/RtecUDPAdminS.h"
-
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-class ACE_INET_Addr;
-ACE_END_VERSIONED_NAMESPACE_DECL
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -59,25 +54,4 @@ private:
u_short bcast_port_;
};
-// ****************************************************************
-
-/**
- * @class Simple_Address_Server
- *
- * A fixed address server
- */
-class Simple_Address_Server : public POA_RtecUDPAdmin::AddrServer
-{
-public:
- /// constructo
- Simple_Address_Server (const ACE_INET_Addr& address);
-
- virtual void get_addr (const RtecEventComm::EventHeader& header,
- RtecUDPAdmin::UDP_Addr& address);
-
-private:
- /// The UDP addres...
- RtecUDPAdmin::UDP_Addr address_;
-};
-
#endif /* EC_BCAST_H */
diff --git a/TAO/orbsvcs/tests/Event/Mcast/AddrServer/AddrServer.mpc b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/AddrServer.mpc
new file mode 100644
index 00000000000..736b40d3533
--- /dev/null
+++ b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/AddrServer.mpc
@@ -0,0 +1,31 @@
+// -*- MPC -*-
+// $Id$
+
+project(*Server): rteventexe, rtevent_serv {
+ exename = server
+
+ specific(automake) {
+ includes += $(srcdir)/../Common
+ } else {
+ includes += ../Common
+ }
+
+ Source_Files {
+ TestAddrServer.cpp
+ Server.cpp
+ }
+}
+
+project(*Client): rteventexe, {
+ exename = client
+
+ specific(automake) {
+ includes += $(srcdir)/../Common
+ } else {
+ includes += ../Common
+ }
+
+ Source_Files {
+ Client.cpp
+ }
+}
diff --git a/TAO/orbsvcs/tests/Event/Mcast/AddrServer/Client.cpp b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/Client.cpp
new file mode 100644
index 00000000000..aab7bee8b44
--- /dev/null
+++ b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/Client.cpp
@@ -0,0 +1,127 @@
+// $Id$
+
+#include "ace/INET_Addr.h"
+#include "orbsvcs/RtecUDPAdminC.h"
+#include "orbsvcs/RtecEventCommC.h"
+
+ACE_RCSID(Hello, client, "$Id$")
+
+const char *ior = "file://as.ior";
+
+int
+main (int argc, char *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "");
+
+ for (int i = 1; i < argc; i++)
+ {
+ if (strcasecmp(argv[i], "-k") == 0)
+ {
+ if (argv[i+1] != 0)
+ ior = argv[++i];
+ }
+ else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ 1);
+ }
+
+ CORBA::Object_var tmp =
+ orb->string_to_object(ior);
+
+ RtecUDPAdmin::AddrServer_var as =
+ RtecUDPAdmin::AddrServer::_narrow (tmp.in());
+
+ if (CORBA::is_nil (as.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Nil AddrServer reference <%s>\n",
+ ior),
+ 1);
+ }
+
+ RtecEventComm::EventHeader header;
+ header.type = 0;
+ ACE_INET_Addr addr;
+
+
+ ACE_INET_Addr inet_addr;
+ try
+ {
+ RtecUDPAdmin::UDP_Address_var udp_addr;
+
+ as->get_address (header, udp_addr.out());
+ switch (udp_addr->_d())
+ {
+ case RtecUDPAdmin::INET:
+ inet_addr.set(udp_addr->v4_addr().port,
+ udp_addr->v4_addr().ipaddr);
+ break;
+ case RtecUDPAdmin::INET6:
+ inet_addr.set_type(PF_INET6);
+ inet_addr.set_address(udp_addr->v6_addr().ipaddr,16,0);
+ inet_addr.set_port_number(udp_addr->v6_addr().port);
+ break;
+ }
+ }
+ catch (const ::CORBA::BAD_OPERATION &)
+ {
+ // server only supports IPv4
+ // Grab the right mcast group for this event...
+ RtecUDPAdmin::UDP_Addr udp_addr;
+ as->get_addr (header, udp_addr);
+ inet_addr.set (udp_addr.port, udp_addr.ipaddr);
+ }
+
+ char buffer[256];
+ inet_addr.addr_to_string (buffer,256);
+ ACE_DEBUG ((LM_DEBUG,"Should be IPv4: %s\n",buffer));
+ ACE_OS::memset (buffer,0,255);
+ header.type = 1;
+ try
+ {
+ RtecUDPAdmin::UDP_Address_var udp_addr;
+
+ as->get_address (header, udp_addr.out());
+ switch (udp_addr->_d())
+ {
+ case RtecUDPAdmin::INET:
+ inet_addr.set(udp_addr->v4_addr().port,
+ udp_addr->v4_addr().ipaddr);
+ break;
+ case RtecUDPAdmin::INET6:
+ inet_addr.set_type(PF_INET6);
+ inet_addr.set_address(udp_addr->v6_addr().ipaddr,16,0);
+ inet_addr.set_port_number(udp_addr->v6_addr().port);
+ break;
+ }
+ }
+ catch (const ::CORBA::BAD_OPERATION &)
+ {
+ // server only supports IPv4
+ // Grab the right mcast group for this event...
+ RtecUDPAdmin::UDP_Addr udp_addr;
+ as->get_addr (header, udp_addr);
+ inet_addr.set (udp_addr.port, udp_addr.ipaddr);
+ }
+
+ ACE_OS::memset(buffer,0,256);
+ inet_addr.addr_to_string (buffer,256);
+ ACE_DEBUG ((LM_DEBUG,"Should be IPv6: %s\n",buffer));
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Exception caught:");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Event/Mcast/AddrServer/README b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/README
new file mode 100644
index 00000000000..89d4b2a1155
--- /dev/null
+++ b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/README
@@ -0,0 +1,17 @@
+Real-Time Event Service Address Server test
+
+This directory contains a simple test intended to be run manually across
+hosts of different architectures. The server reports the IP address served
+as does the client. These should match.
+
+To run the server:
+
+./server -o <ior_file>
+
+To run the client:
+./client -k file://<ior_file>
+
+Default IOR file is ./as.ior
+
+There is no run_test.pl script as this test is only interesting when run
+across multiple hosts.
diff --git a/TAO/orbsvcs/tests/Event/Mcast/AddrServer/Server.cpp b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/Server.cpp
new file mode 100644
index 00000000000..1722c854051
--- /dev/null
+++ b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/Server.cpp
@@ -0,0 +1,84 @@
+// $Id$
+
+// AddrServerMain.cpp
+// Main program for a common Address server instance to be shared by all
+// event channels
+
+#include "TestAddrServer.h"
+#include "ace/OS_NS_stdio.h"
+
+int main (int argc, char* argv[])
+{
+#if defined ACE_HAS_IPV6
+ try
+ {
+ // Initialize the ORB.
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ const char *ior_file_name = "as.ior";
+ const char* address = "224.6.6.1";
+ const char* address6 = "FF01::ABCD";
+ u_short port = 12345;
+
+ for (int i = 0; argv[i] != 0; i++)
+ {
+ if (strcasecmp(argv[i], "-o") == 0)
+ {
+ if (argv[i+1] != 0)
+ ior_file_name = argv[++i];
+ }
+
+ }
+
+ // Get the POA
+ CORBA::Object_var tmpobj = orb->resolve_initial_references ("RootPOA");
+ PortableServer::POA_var poa =
+ PortableServer::POA::_narrow (tmpobj.in ());
+ PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
+ poa_manager->activate ();
+
+ // Initialize the address server with the desired address.
+ // This will be used by the sender object and the multicast
+ // receiver.
+ ACE_INET_Addr addr (port, address);
+ ACE_INET_Addr addr6 (port, address6);
+
+ TestAddrServer_i impl (addr,addr6);
+
+ PortableServer::ObjectId_var oid = poa->activate_object(&impl);
+ tmpobj = poa->id_to_reference(oid.in());
+
+ CORBA::String_var ior = orb->object_to_string (tmpobj.in());
+
+ // Output the IOR to the <ior_output_file>
+ FILE *output_file= ACE_OS::fopen (ior_file_name, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s\n",
+ ior_file_name),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+
+ // run the ORB
+ orb->run();
+ orb->destroy();
+ return 0;
+ }
+ catch (CORBA::Exception& exc)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Caught CORBA::Exception\n%s (%s)\n",
+ exc._name (), exc._rep_id ()));
+ }
+#else
+ ACE_UNUSED_ARG (argc);
+ ACE_UNUSED_ARG (argv);
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("This test requires ACE to be built ")
+ ACE_TEXT ("with support for IPv6\n")));
+#endif /* ACE_HAS_IPV6 */
+
+ return 1;
+}
diff --git a/TAO/orbsvcs/tests/Event/Mcast/AddrServer/TestAddrServer.cpp b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/TestAddrServer.cpp
new file mode 100644
index 00000000000..ba282de4cb2
--- /dev/null
+++ b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/TestAddrServer.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+// TestAddrServer.cpp
+
+#include "TestAddrServer.h"
+#include "tao/SystemException.h"
+
+TestAddrServer_i::TestAddrServer_i (const ACE_INET_Addr& addr,
+ const ACE_INET_Addr& addr6)
+{
+ this->addr_ = addr;
+ this->addr6_ = addr6;
+
+ char abuf[256];
+ addr_.addr_to_string (abuf,256);
+
+ ACE_DEBUG ((LM_DEBUG,"Test Addr (v4) = %s\n",abuf));
+
+ addr6_.addr_to_string (abuf,256);
+
+ ACE_DEBUG ((LM_DEBUG,"Test Addr (v6) = %s\n",abuf));
+
+}
+
+void
+TestAddrServer_i::get_addr (const RtecEventComm::EventHeader& h,
+ RtecUDPAdmin::UDP_Addr& address)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_INET_Addr &addr = (h.type == 0) ? this->addr_ : this->addr6_;
+
+#if defined (ACE_HAS_IPV6)
+
+ if (addr.get_type() == PF_INET6)
+ throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
+#endif /* ACE_HAS_IPV6 */
+ address.ipaddr = addr.get_ip_address ();
+ address.port = addr.get_port_number ();
+}
+
+void
+TestAddrServer_i::get_address (const RtecEventComm::EventHeader& h,
+ RtecUDPAdmin::UDP_Address_out outaddr)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_INET_Addr &addr = (h.type == 0) ? this->addr_ : this->addr6_;
+ char abuf[256];
+ addr.addr_to_string (abuf,256);
+
+ ACE_DEBUG ((LM_DEBUG,"get_address returning = %s\n",abuf));
+
+#if defined (ACE_HAS_IPV6)
+ if (addr.get_type() == PF_INET6)
+ {
+ RtecUDPAdmin::UDP_Addr_v6 v6;
+ sockaddr_in6 *in6 =
+ reinterpret_cast<sockaddr_in6 *>(addr.get_addr());
+ ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16);
+ v6.port = addr.get_port_number();
+ outaddr.v6_addr (v6);
+ return;
+ }
+#endif /* ACE_HAS_IPV6 */
+ RtecUDPAdmin::UDP_Addr v4;
+ v4.ipaddr = addr.get_ip_address ();
+ v4.port = addr.get_port_number ();
+ outaddr.v4_addr (v4);
+
+}
diff --git a/TAO/orbsvcs/tests/Event/Mcast/AddrServer/TestAddrServer.h b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/TestAddrServer.h
new file mode 100644
index 00000000000..61132ef7f5f
--- /dev/null
+++ b/TAO/orbsvcs/tests/Event/Mcast/AddrServer/TestAddrServer.h
@@ -0,0 +1,30 @@
+// $Id$
+
+// TestAddrServer.h
+
+#ifndef TEST_ADDR_SERVER_H
+#define TEST_ADDR_SERVER_H
+
+#include <orbsvcs/RtecUDPAdminS.h>
+#include <ace/INET_Addr.h>
+
+class TestAddrServer_i : public POA_RtecUDPAdmin::AddrServer {
+public:
+ TestAddrServer_i (const ACE_INET_Addr& addr,
+ const ACE_INET_Addr& addr6);
+
+ virtual void get_addr (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Addr& address)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr6)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ ACE_INET_Addr addr_;
+ ACE_INET_Addr addr6_;
+
+};
+
+#endif
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/AddrServerMain.cpp b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/AddrServerMain.cpp
new file mode 100644
index 00000000000..1c3f97b642d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/AddrServerMain.cpp
@@ -0,0 +1,132 @@
+// $Id$
+
+// AddrServerMain.cpp
+// Main program for a common Address server instance to be shared by all
+// event channels
+
+#include "SimpleAddressServer.h"
+#include "BarrierS.h"
+
+#include "orbsvcs/CosNamingC.h"
+
+#include "ace/Barrier.h"
+#include "ace/Task.h"
+#include "ace/Auto_Ptr.h"
+#include <fstream>
+
+class Barrier_i : public virtual POA_Barrier
+{
+public:
+ Barrier_i (int count) : barrier_(count)
+ {
+ ACE_DEBUG ((LM_DEBUG,"Barrier, count = %d\n", count));
+ }
+
+ void wait (void)
+ {
+ ACE_DEBUG ((LM_DEBUG,"%t entering wait%d\n"));
+ this->barrier_.wait();
+ ACE_DEBUG ((LM_DEBUG,"%t exiting wait%d\n"));
+ }
+
+private:
+ ACE_Barrier barrier_;
+};
+
+class ORB_Task : public ACE_Task_Base
+{
+public:
+ ORB_Task (CORBA::ORB_ptr orb) : orb_ (CORBA::ORB::_duplicate (orb)) {}
+
+ int svc () { this->orb_->run(); return 1; }
+
+private:
+ CORBA::ORB_var orb_;
+};
+
+int main (int argc, char* argv[])
+{
+ try
+ {
+ // Initialize the ORB.
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ const char* address = "localhost";
+ int num_nodes = 2;
+
+ u_short port = 12345;
+
+ for (int i = 0; argv[i] != 0; i++)
+ {
+ if (strcasecmp(argv[i], "-address") == 0)
+ {
+ if (argv[i+1] != 0)
+ address = argv[++i];
+ else
+ ACE_ERROR_RETURN ((LM_ERROR, "Missing address\n"),0);
+ }
+ else if (strcasecmp(argv[i], "-port") == 0)
+ {
+ if (argv[i+1] != 0)
+ port = ACE_OS::atoi(argv[++i]);
+ else
+ ACE_ERROR_RETURN ((LM_ERROR, "Missing port\n"),0);
+ }
+ else if (strcasecmp(argv[i], "-nodes") == 0)
+ {
+ if (argv[i+1] != 0)
+ num_nodes = ACE_OS::atoi(argv[++i]);
+ else
+ ACE_ERROR_RETURN ((LM_ERROR, "Missing node count\n"),0);
+ }
+ }
+
+ // Get the POA
+ CORBA::Object_var tmpobj = orb->resolve_initial_references ("RootPOA");
+ PortableServer::POA_var poa = PortableServer::POA::_narrow (tmpobj.in ());
+ PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
+ poa_manager->activate ();
+
+ // Find the Naming Service.
+ tmpobj = orb->resolve_initial_references("NameService");
+ CosNaming::NamingContextExt_var root_context =
+ CosNaming::NamingContextExt::_narrow(tmpobj.in());
+
+ // Initialize the address server with the desired address.
+ // This will be used by the sender object and the multicast
+ // receiver.
+ ACE_INET_Addr send_addr (port, address);
+ SimpleAddressServer addr_srv_impl (send_addr);
+
+ PortableServer::ObjectId_var oid = poa->activate_object(&addr_srv_impl);
+ tmpobj = poa->id_to_reference(oid.in());
+
+ // Bind the Addr server using Naming Services
+ CosNaming::Name_var name = root_context->to_name("Echo_address");
+ root_context->rebind(name.in(), tmpobj.in());
+
+ // Activate a barrier object
+ Barrier_i barrier_impl(num_nodes);
+
+ oid = poa->activate_object(&barrier_impl);
+ tmpobj = poa->id_to_reference(oid.in());
+
+ name = root_context->to_name ("Echo_barrier");
+ root_context->rebind(name.in(), tmpobj.in());
+
+ // run the ORB
+ ORB_Task orb_task(orb.in());
+ orb_task.activate ( THR_NEW_LWP | THR_JOINABLE,
+ num_nodes+1);
+ orb_task.wait();
+ orb->destroy();
+ return 0;
+ }
+ catch (CORBA::Exception& exc)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Caught CORBA::Exception\n%s (%s)\n",
+ exc._name (), exc._rep_id ()));
+ }
+ return 1;
+}
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/Barrier.idl b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/Barrier.idl
new file mode 100644
index 00000000000..6a92f9d161b
--- /dev/null
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/Barrier.idl
@@ -0,0 +1,9 @@
+// $Id$
+
+/// A simple way to have a distributed synchronization point for a specific
+/// number of participants.
+interface Barrier {
+ /// Wait until the implementation specified number of participants have
+ /// called, then simply return.
+ void wait ();
+};
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp
index 68515ac1a09..3c4bbb43e56 100644
--- a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventConsumer_i.cpp
@@ -27,7 +27,7 @@ void EchoEventConsumer_i::push(const RtecEventComm::EventSet& events)
// Extract event data from the any.
const char* eventData;
std::ostringstream out;
- out << "Received event,"
+ out << "[" << getpid() << "] Received event,"
<< " type: " << events[i].header.type
<< " source: " << events[i].header.source;
if (events[i].data.any_value >>= eventData) {
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp
index a8aeeaa652a..463de7b0a36 100644
--- a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp
@@ -5,6 +5,7 @@
#include "EchoEventSupplier_i.h"
#include "SimpleAddressServer.h"
+#include "BarrierC.h"
#include "orbsvcs/RtecEventCommC.h"
#include "orbsvcs/RtecEventChannelAdminC.h"
@@ -29,6 +30,8 @@ const RtecEventComm::EventType MY_EVENT_TYPE = ACE_ES_EVENT_UNDEFINED + 1;
const int EVENT_DELAY_MS = 10;
+// Initialize the ORB.
+
int main (int argc, char* argv[])
{
try
@@ -44,54 +47,53 @@ int main (int argc, char* argv[])
const char* iorfile = 0;
u_short port = 12345;
u_short listenport = 12345;
+
int mcast = 1;
- for (int i = 0; argv[i] != 0; i++) {
- if (strcmp(argv[i], "-ecname") == 0) {
- if (argv[i+1] != 0) {
- i++;
- ecname = argv[i];
- } else {
- ACE_ERROR ((LM_ERROR,
- "Missing Event channel name\n"));
- }
- } else if (strcmp(argv[i], "-address") == 0) {
- if (argv[i+1] != 0) {
- i++;
- address = argv[i];
- } else {
- ACE_ERROR ((LM_ERROR,
- "Missing address\n"));
- }
- } else if (strcmp(argv[i], "-port") == 0) {
- if (argv[i+1] != 0) {
- i++;
- port = ACE_OS::atoi(argv[i]);
- } else {
- ACE_ERROR ((LM_ERROR,
- "Missing port\n"));
- }
- } else if (strcmp(argv[i], "-listenport") == 0) {
- if (argv[i+1] != 0) {
- i++;
- listenport = ACE_OS::atoi(argv[i]);
- } else {
- ACE_ERROR ((LM_ERROR,
- "Missing port\n"));
- }
- } else if (strcmp(argv[i], "-iorfile") == 0) {
- if (argv[i+1] != 0) {
- i++;
- iorfile = argv[i];
- }
- } else if (strcmp(argv[i], "-udp") == 0) {
- mcast = 0;
+ for (int i = 0; argv[i] != 0; i++)
+ {
+ if (strcasecmp(argv[i], "-ecname") == 0)
+ {
+ if (argv[i+1] != 0)
+ ecname = argv[++i];
+ else
+ ACE_ERROR_RETURN ((LM_ERROR, "Missing Event channel name\n"),0);
+ }
+ else if (strcasecmp(argv[i], "-address") == 0)
+ {
+ if (argv[i+1] != 0)
+ address = argv[++i];
+ else
+ ACE_ERROR_RETURN ((LM_ERROR, "Missing address\n"),0);
+ }
+ else if (strcasecmp(argv[i], "-port") == 0)
+ {
+ if (argv[i+1] != 0)
+ port = ACE_OS::atoi(argv[++i]);
+ else
+ ACE_ERROR_RETURN ((LM_ERROR, "Missing port\n"),0);
+ }
+ else if (strcasecmp(argv[i], "-listenport") == 0)
+ {
+ if (argv[i+1] != 0)
+ listenport = ACE_OS::atoi(argv[++i]);
+ else
+ ACE_ERROR_RETURN ((LM_ERROR, "Missing port\n"), 0);
+ }
+ else if (strcmp(argv[i], "-iorfile") == 0)
+ {
+ if (argv[i+1] != 0)
+ iorfile = argv[++i];
+ else
+ ACE_ERROR_RETURN ((LM_ERROR, "Missing ior file\n"), 0);
+ }
+ else if (strcmp(argv[i], "-udp") == 0)
+ mcast = 0;
}
- }
// Get the POA
- CORBA::Object_var object = orb->resolve_initial_references ("RootPOA");
- PortableServer::POA_var poa = PortableServer::POA::_narrow (object.in ());
+ CORBA::Object_var tmpobj = orb->resolve_initial_references ("RootPOA");
+ PortableServer::POA_var poa = PortableServer::POA::_narrow (tmpobj.in ());
PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
poa_manager->activate ();
@@ -100,13 +102,14 @@ int main (int argc, char* argv[])
TAO_EC_Event_Channel ec_impl (attributes);
ec_impl.activate ();
PortableServer::ObjectId_var oid = poa->activate_object(&ec_impl);
- CORBA::Object_var ec_obj = poa->id_to_reference(oid.in());
+ tmpobj = poa->id_to_reference(oid.in());
RtecEventChannelAdmin::EventChannel_var ec =
- RtecEventChannelAdmin::EventChannel::_narrow(ec_obj.in());
+ RtecEventChannelAdmin::EventChannel::_narrow(tmpobj.in());
// Find the Naming Service.
- CORBA::Object_var obj = orb->resolve_initial_references("NameService");
- CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in());
+ tmpobj = orb->resolve_initial_references("NameService");
+ CosNaming::NamingContextExt_var root_context =
+ CosNaming::NamingContextExt::_narrow(tmpobj.in());
// Bind the Event Channel using Naming Services
CosNaming::Name_var name = root_context->to_name(ecname);
@@ -122,26 +125,37 @@ int main (int argc, char* argv[])
// Register it with the RootPOA.
oid = poa->activate_object(&servant);
- CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in());
+ tmpobj = poa->id_to_reference(oid.in());
RtecEventComm::PushSupplier_var supplier =
- RtecEventComm::PushSupplier::_narrow(supplier_obj.in());
+ RtecEventComm::PushSupplier::_narrow(tmpobj.in());
// Connect to the EC.
ACE_SupplierQOS_Factory qos;
qos.insert (MY_SOURCE_ID, MY_EVENT_TYPE, 0, 1);
consumer->connect_push_supplier (supplier.in (), qos.get_SupplierQOS ());
- // Initialize the address server with the desired address.
- // This will be used by the sender object and the multicast
- // receiver.
+ // Initialize the address server with the desired address. This will
+ // be used by the sender object and the multicast receiver only if
+ // one is not otherwise available via the naming service.
ACE_INET_Addr send_addr (port, address);
SimpleAddressServer addr_srv_impl (send_addr);
- PortableServer::ObjectId_var addr_srv_oid =
- poa->activate_object(&addr_srv_impl);
- CORBA::Object_var addr_srv_obj = poa->id_to_reference(addr_srv_oid.in());
+ try
+ {
+ tmpobj = root_context->resolve_str ("Echo_address");
+ }
+ catch (const ::CosNaming::NamingContext::NotFound &)
+ {
+ // Create an instance of the addr server for local use
+
+ PortableServer::ObjectId_var addr_srv_oid =
+ poa->activate_object(&addr_srv_impl);
+ tmpobj =
+ poa->id_to_reference(addr_srv_oid.in());
+ }
+
RtecUDPAdmin::AddrServer_var addr_srv =
- RtecUDPAdmin::AddrServer::_narrow(addr_srv_obj.in());
+ RtecUDPAdmin::AddrServer::_narrow(tmpobj.in());
// Create and initialize the sender object
TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> sender =
@@ -153,7 +167,7 @@ int main (int argc, char* argv[])
1);
}
- // TAO_ECG_UDP_Sender::init() takes a TAO_ECG_Refcounted_Endpoint.
+ // TAO_ECG_UDP_Sender::init() takes a TAO_ECG_Refcounted_Endpoint.
// If we don't clone our endpoint and pass &endpoint, the sender will
// attempt to delete endpoint during shutdown.
TAO_ECG_UDP_Out_Endpoint* clone;
@@ -199,14 +213,27 @@ int main (int argc, char* argv[])
auto_ptr<TAO_ECG_UDP_EH> udp_eh (new TAO_ECG_UDP_EH (receiver.in()));
udp_eh->reactor (orb->orb_core ()->reactor ());
ACE_INET_Addr local_addr (listenport);
- if (udp_eh->open (local_addr) == -1) {
- ACE_ERROR ((LM_ERROR,
- "Cannot open EH\n"));
- }
+ if (udp_eh->open (local_addr) == -1)
+ ACE_ERROR ((LM_ERROR,"Cannot open EH\n"));
+
ACE_AUTO_PTR_RESET(eh,udp_eh.release(),ACE_Event_Handler);
//eh.reset(udp_eh.release());
}
+ // Check to see if there is a Barrier server available and if so,
+ // wait for it.
+ try
+ {
+ tmpobj = root_context->resolve_str ("Echo_barrier");
+ Barrier_var barrier = Barrier::_narrow (tmpobj.in());
+ if (!CORBA::is_nil(barrier.in()))
+ barrier->wait();
+ }
+ catch (const ::CORBA::Exception &)
+ {
+ // no worries, just keep going.
+ }
+
// Create an event (just a string in this case).
const CORBA::String_var eventData = CORBA::string_dup(ecname);
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/README b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/README
index 548f8a03a48..8f1b47d3e44 100644
--- a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/README
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/README
@@ -124,7 +124,23 @@ SimpleAddressServer.{h,cpp}
to listen to based on consumer subscriptions. This simple
implementation always returns the same address.
+-------------------------------------------------------------------------
+
+AddrServerMain.cpp
+
+ A main wrapper for running a stand-alone SimpleAddressServer instance.
+ This is used to support a test that spans multiple hosts to insure
+ proper functionality of the address server.
+
+-------------------------------------------------------------------------
+
+Barrier.idl
+ This idl file defines a simple interface that presents a barrier for
+ synchronizing multiple senders. The implementation is in the stand
+ alone address server, which must be told how many clients to expect.
+ It then starts that number of threads plus an additional thread so
+ that an ACE_Barrier may be used to implement the waiting.
Exeuction via Perl Script
-------------------------
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc
index a255da56843..20b3d7bf071 100644
--- a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc
@@ -10,10 +10,15 @@ project(*Supplier): namingexe, rteventexe, rtevent_serv {
includes += ../Common
}
+ IDL_Files {
+ Barrier.idl
+ }
+
Source_Files {
+ SimpleAddressServer.cpp
+ BarrierC.cpp
EchoEventSupplierMain.cpp
EchoEventSupplier_i.cpp
- SimpleAddressServer.cpp
}
}
@@ -31,3 +36,25 @@ project(*Consumer): namingexe, rteventexe, {
EchoEventConsumer_i.cpp
}
}
+
+project(*AddrServer): namingexe, rtevent_serv {
+ exename = AddrServer
+
+ specific(automake) {
+ includes += $(srcdir)/../Common
+ } else {
+ includes += ../Common
+ }
+
+ IDL_Files {
+ Barrier.idl
+ }
+
+ Source_Files {
+ BarrierC.cpp
+ BarrierS.cpp
+ AddrServerMain.cpp
+ SimpleAddressServer.cpp
+ }
+
+}
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.cpp b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.cpp
index 9007b31369a..12b0a091d2f 100644
--- a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.cpp
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.cpp
@@ -3,16 +3,43 @@
// SimpleAddressServer.cpp
#include "SimpleAddressServer.h"
-#include <ace/INET_Addr.h>
+#include "tao/SystemException.h"
-SimpleAddressServer::SimpleAddressServer (const ACE_INET_Addr& address) {
- this->address_.ipaddr = address.get_ip_address ();
- this->address_.port = address.get_port_number ();
+SimpleAddressServer::SimpleAddressServer (const ACE_INET_Addr& address)
+{
+ this->addr_ = address;
}
void
SimpleAddressServer::get_addr (const RtecEventComm::EventHeader&,
- RtecUDPAdmin::UDP_Addr& address)
- throw (CORBA::SystemException) {
- address = this->address_;
+ RtecUDPAdmin::UDP_Addr& address)
+{
+#if defined (ACE_HAS_IPV6)
+ if (this->addr_.get_type() == PF_INET6)
+ throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
+#endif /* ACE_HAS_IPV6 */
+ address.ipaddr = this->addr_.get_ip_address ();
+ address.port = this->addr_.get_port_number ();
+}
+
+void
+SimpleAddressServer::get_address (const RtecEventComm::EventHeader& ,
+ RtecUDPAdmin::UDP_Address_out addr)
+{
+#if defined (ACE_HAS_IPV6)
+ if (this->addr_.get_type() == PF_INET6)
+ {
+ RtecUDPAdmin::UDP_Addr_v6 v6;
+ sockaddr_in6 *in6 =
+ reinterpret_cast<sockaddr_in6 *>(this->addr_.get_addr());
+ ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16);
+ v6.port = this->addr_.get_port_number();
+ addr.v6_addr (v6);
+ return;
+ }
+#endif /* ACE_HAS_IPV6 */
+ RtecUDPAdmin::UDP_Addr v4;
+ v4.ipaddr = this->addr_.get_ip_address();
+ v4.port = this->addr_.get_port_number();
+ addr.v4_addr (v4);
}
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.h b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.h
index 5c2c92454c6..7c192e1c50c 100644
--- a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.h
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/SimpleAddressServer.h
@@ -6,20 +6,19 @@
#define SIMPLEADDRESSSERVER_H
#include <orbsvcs/RtecUDPAdminS.h>
-
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-class ACE_INET_Addr;
-ACE_END_VERSIONED_NAMESPACE_DECL
+#include <ace/INET_Addr.h>
class SimpleAddressServer : public POA_RtecUDPAdmin::AddrServer {
public:
SimpleAddressServer (const ACE_INET_Addr& address);
virtual void get_addr (const RtecEventComm::EventHeader& header,
- RtecUDPAdmin::UDP_Addr& address)
- throw (CORBA::SystemException);
+ RtecUDPAdmin::UDP_Addr& address);
+
+ virtual void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr6);
private:
- RtecUDPAdmin::UDP_Addr address_;
+ ACE_INET_Addr addr_;
};
#endif
diff --git a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/run_test.pl b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/run_test.pl
index 6c1ca982250..927fe48690c 100755
--- a/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/run_test.pl
+++ b/TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/run_test.pl
@@ -14,6 +14,7 @@ sub usage() {
print " run_test [-h] [-debug]\n\n";
print " -udp -- Federate using udp\n";
print " -mcast -- Federate using multicast (the default)\n";
+ print " -ipv6 -- Use an IPv6 mcast addr for federating\n";
print " -h -- Prints this information\n";
print " -debug -- Sets the debug flag for the test\n";
exit;
@@ -21,6 +22,8 @@ sub usage() {
my $udp = 0;
my $i = 0;
+my $mcast_addr = "224.9.9.2";
+
my $flags = "";
while ($i <= $#ARGV) {
if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-help" ||
@@ -32,6 +35,8 @@ while ($i <= $#ARGV) {
$udp = 1;
} elsif ($ARGV[$i] eq "-mcast") {
$udp = 0;
+ } elsif ($ARGV[$i] eq "-ipv6") {
+ $mcast_addr = "FF01::255";
} else {
print "ERROR: Unknown Option: ".$ARGV[$i]."\n\n";
usage ();
@@ -84,8 +89,11 @@ $args1 = "$flags $arg_ns_ref -ORBSvcConf $supplier_conf_file $end_point -iorfile
if ($udp) {
$args1 .= " -udp -ecname ec1 -port $port1 -listenport $port2 ";
} else {
- $args1 .= " -ecname ec1 -address 224.9.9.2 -port $mport ";
+ $args1 .= " -ecname ec1 -address $mcast_addr -port $mport ";
}
+
+print "starting first supplier with args $args1\n";
+
$S1 = new PerlACE::Process("EchoEventSupplier", $args1);
$S1->Spawn();
@@ -93,8 +101,12 @@ $args2 = "$flags $arg_ns_ref -ORBSvcConf $supplier_conf_file $end_point -iorfile
if ($udp) {
$args2 .= " -udp -ecname ec2 -port $port2 -listenport $port1 ";
} else {
- $args2 .= " -ecname ec2 -address 224.9.9.2 -port $mport ";
+ $args2 .= " -ecname ec2 -address $mcast_addr -port $mport ";
}
+
+print "starting second supplier with args $args2\n";
+
+
$S2 = new PerlACE::Process("EchoEventSupplier", $args2);
$S2->Spawn();
diff --git a/TAO/orbsvcs/tests/Event/UDP/AddrServer.cpp b/TAO/orbsvcs/tests/Event/UDP/AddrServer.cpp
index 79c0d07e1bf..0ee93ca95cb 100644
--- a/TAO/orbsvcs/tests/Event/UDP/AddrServer.cpp
+++ b/TAO/orbsvcs/tests/Event/UDP/AddrServer.cpp
@@ -1,17 +1,46 @@
// $Id$
#include "AddrServer.h"
+#include "tao/SystemException.h"
ACE_RCSID(EC_Examples, AddrServer, "$Id$")
-AddrServer::AddrServer (const RtecUDPAdmin::UDP_Addr& addr)
- : addr_ (addr)
+AddrServer::AddrServer (const ACE_INET_Addr& addr)
{
+ this->addr_ = addr;
}
void
AddrServer::get_addr (const RtecEventComm::EventHeader&,
RtecUDPAdmin::UDP_Addr_out addr)
{
- addr = this->addr_;
+#if defined (ACE_HAS_IPV6)
+ if (this->addr_.get_type() == PF_INET6)
+ throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES);
+#endif /* ACE_HAS_IPV6 */
+ addr.ipaddr = this->addr_.get_ip_address ();
+ addr.port = this->addr_.get_port_number ();
+}
+
+
+void
+AddrServer::get_address (const RtecEventComm::EventHeader& ,
+ RtecUDPAdmin::UDP_Address_out addr)
+{
+#if defined (ACE_HAS_IPV6)
+ if (this->addr_.get_type() == PF_INET6)
+ {
+ RtecUDPAdmin::UDP_Addr_v6 v6;
+ sockaddr_in6 *in6 =
+ reinterpret_cast<sockaddr_in6 *>(this->addr_.get_addr());
+ ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16);
+ v6.port = this->addr_.get_port_number();
+ addr.v6_addr (v6);
+ return;
+ }
+#endif /* ACE_HAS_IPV6 */
+ RtecUDPAdmin::UDP_Addr v4;
+ v4.ipaddr = this->addr_.get_ip_address();
+ v4.port = this->addr_.get_port_number();
+ addr.v4_addr (v4);
}
diff --git a/TAO/orbsvcs/tests/Event/UDP/AddrServer.h b/TAO/orbsvcs/tests/Event/UDP/AddrServer.h
index de7aeb6d590..2df463629ac 100644
--- a/TAO/orbsvcs/tests/Event/UDP/AddrServer.h
+++ b/TAO/orbsvcs/tests/Event/UDP/AddrServer.h
@@ -19,6 +19,7 @@
#include /**/ "ace/pre.h"
#include "orbsvcs/RtecUDPAdminS.h"
+#include "ace/INET_Addr.h"
class AddrServer : public POA_RtecUDPAdmin::AddrServer
{
@@ -35,15 +36,19 @@ class AddrServer : public POA_RtecUDPAdmin::AddrServer
// provided at initialization time.
//
public:
- AddrServer (const RtecUDPAdmin::UDP_Addr& addr);
+ AddrServer (const ACE_INET_Addr& addr);
// Constructor
// = The RtecUDPAdmin::AddrServer methods
virtual void get_addr (const RtecEventComm::EventHeader& header,
RtecUDPAdmin::UDP_Addr_out addr);
+ virtual void get_address (const RtecEventComm::EventHeader& header,
+ RtecUDPAdmin::UDP_Address_out addr6);
+
+
private:
- RtecUDPAdmin::UDP_Addr addr_;
+ ACE_INET_Addr addr_;
// The address
};
diff --git a/TAO/orbsvcs/tests/Event/UDP/receiver.cpp b/TAO/orbsvcs/tests/Event/UDP/receiver.cpp
index ebf2a1e055a..392f753848e 100644
--- a/TAO/orbsvcs/tests/Event/UDP/receiver.cpp
+++ b/TAO/orbsvcs/tests/Event/UDP/receiver.cpp
@@ -139,12 +139,8 @@ main (int argc, char* argv[])
ACE_DEBUG ((LM_DEBUG,
"udp mcast address is: %s\n",
udp_mcast_address));
- RtecUDPAdmin::UDP_Addr addr;
- addr.ipaddr = udp_addr.get_ip_address ();
- addr.port = udp_addr.get_port_number ();
-
// Now we create and activate the servant
- AddrServer as_impl (addr);
+ AddrServer as_impl (udp_addr);
RtecUDPAdmin::AddrServer_var address_server =
as_impl._this ();
@@ -333,4 +329,3 @@ int parse_args (int argc, char *argv[])
// Indicates sucessful parsing of the command line
return 0;
}
-
diff --git a/TAO/orbsvcs/tests/Event/UDP/sender.cpp b/TAO/orbsvcs/tests/Event/UDP/sender.cpp
index 6c710e7fc21..73b0b9d8fcc 100644
--- a/TAO/orbsvcs/tests/Event/UDP/sender.cpp
+++ b/TAO/orbsvcs/tests/Event/UDP/sender.cpp
@@ -126,12 +126,9 @@ main (int argc, char* argv[])
ACE_DEBUG ((LM_DEBUG,
"udp mcast address is: %s\n",
udp_mcast_address));
- RtecUDPAdmin::UDP_Addr addr;
- addr.ipaddr = udp_addr.get_ip_address ();
- addr.port = udp_addr.get_port_number ();
// Now we create and activate the servant
- AddrServer as_impl (addr);
+ AddrServer as_impl (udp_addr);
RtecUDPAdmin::AddrServer_var address_server =
as_impl._this ();
@@ -282,4 +279,3 @@ int parse_args (int argc, char *argv[])
// Indicates sucessful parsing of the command line
return 0;
}
-