summaryrefslogtreecommitdiff
path: root/TAO/examples/PluggableUDP/DIOP/DIOP_Endpoint.i
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/examples/PluggableUDP/DIOP/DIOP_Endpoint.i')
-rw-r--r--TAO/examples/PluggableUDP/DIOP/DIOP_Endpoint.i52
1 files changed, 52 insertions, 0 deletions
diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Endpoint.i b/TAO/examples/PluggableUDP/DIOP/DIOP_Endpoint.i
new file mode 100644
index 00000000000..ad9b9d97a30
--- /dev/null
+++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Endpoint.i
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+// $Id$
+
+ACE_INLINE const ACE_INET_Addr &
+TAO_DIOP_Endpoint::object_addr (void) const
+{
+ // The object_addr_ is initialized here, rather than at IOR decode
+ // time for several reasons:
+ // 1. A request on the object may never be invoked.
+ // 2. The DNS setup may have changed dynamically.
+ // ...etc..
+
+ // We need to modify the object_addr_ in this method. Do so using a
+ // non-const copy of the <this> pointer.
+ TAO_DIOP_Endpoint *endpoint =
+ ACE_const_cast (TAO_DIOP_Endpoint *,
+ this);
+
+ if (this->object_addr_.get_type () != AF_INET
+ && endpoint->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+ {
+ // If this call fails, it most likely due a hostname lookup
+ // failure caused by a DNS misconfiguration. If a request is
+ // made to the object at the given host and port, then a
+ // CORBA::TRANSIENT() exception should be thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag to
+ // denote that ACE_INET_Addr initialization failed.
+ endpoint->object_addr_.set_type (-1);
+ }
+
+ return this->object_addr_;
+}
+
+ACE_INLINE const char *
+TAO_DIOP_Endpoint::host (void) const
+{
+ return this->host_.in ();
+}
+
+ACE_INLINE CORBA::UShort
+TAO_DIOP_Endpoint::port (void) const
+{
+ return this->port_;
+}
+
+ACE_INLINE CORBA::UShort
+TAO_DIOP_Endpoint::port (CORBA::UShort p)
+{
+ return this->port_ = p;
+}