summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormcorino <mcorino@users.noreply.github.com>2006-01-28 23:23:20 +0000
committermcorino <mcorino@users.noreply.github.com>2006-01-28 23:23:20 +0000
commit1289f49f5f08f6be13d6cff72951a1c97b9bb668 (patch)
tree80520a4fad61d3586742ecec30d35826bda8e304
parent0176c9129dd1a1fd0e0fa63a22937444dd69543d (diff)
downloadATCD-1289f49f5f08f6be13d6cff72951a1c97b9bb668.tar.gz
ChangeLogTag: Sat Jan 28 23:15:13 UTC 2006 Martin Corino <mcorino@remedy.nl>
-rw-r--r--TAO/ChangeLog15
-rw-r--r--TAO/tao/IIOP_Profile.cpp113
2 files changed, 80 insertions, 48 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index cdff519ac28..813f82dcdab 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,8 +1,19 @@
+Sat Jan 28 23:15:13 UTC 2006 Martin Corino <mcorino@remedy.nl>
+
+ * tao/IIOP_Profile.cpp:
+
+ Added enhancement to TAO_IIOP_Profile::to_string() to return
+ *all* endpoints in profile embedded in a corbaloc URL like:
+ corbaloc:iiop:1.2@host:port,iiop:1.2@host:port,.../key
+ Thanks to Victor Chernenko (GE Healthcare) for suggesting this
+ and providing a first patch.
+
+
Sat Jan 28 22:22:13 UTC 2006 William Otte <wotte@dre.vanderbilt.edu>
* tao/PortableServer/ServantRetentionStrategyNonRetain.cpp
-
- Fixed unused argument warning.
+
+ Fixed unused argument warning.
Fri Jan 27 22:03:14 UTC 2006 Ming Xiong <ming.xiong@vanderbilt.edu>
diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp
index 0f07764ff5a..49473e76178 100644
--- a/TAO/tao/IIOP_Profile.cpp
+++ b/TAO/tao/IIOP_Profile.cpp
@@ -24,7 +24,7 @@ TAO_IIOP_Profile::~TAO_IIOP_Profile (void)
// Clean up the list of endpoints since we own it.
// Skip the head, since it is not dynamically allocated.
TAO_Endpoint *tmp = 0;
-
+
for (TAO_Endpoint *next = this->endpoint ()->next ();
next != 0;
next = tmp)
@@ -372,64 +372,85 @@ TAO_IIOP_Profile::add_endpoint (TAO_IIOP_Endpoint *endp)
char *
TAO_IIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
{
+ // corbaloc:iiop:1.2@host:port,iiop:1.2@host:port,.../key
+
CORBA::String_var key;
TAO::ObjectKey::encode_sequence_to_string (key.inout(),
this->ref_object_key_->object_key ());
- size_t buflen = (8 /* "corbaloc" */ +
- 1 /* colon separator */ +
- ACE_OS::strlen (::the_prefix) +
- 1 /* colon separator */ +
- 1 /* major version */ +
- 1 /* decimal point */ +
- 1 /* minor version */ +
- 1 /* `@' character */ +
- ACE_OS::strlen (this->endpoint_.host ()) +
- 1 /* colon separator */ +
- 5 /* port number */ +
- 1 /* object key separator */ +
- ACE_OS::strlen (key.in ()));
+ size_t buflen = (
+ 8 /* "corbaloc" */ +
+ 1 /* colon separator */ +
+ 1 /* object key separator */ +
+ ACE_OS::strlen (key.in ()));
+ size_t pfx_len = (
+ ACE_OS::strlen (::the_prefix) /* "iiop" */ +
+ 1 /* colon separator */);
+
+ const TAO_IIOP_Endpoint *endp = 0;
+ for (endp = &this->endpoint_; endp != 0; endp = endp->next_)
+ {
+ buflen += (
+ pfx_len +
+ 1 /* major version */ +
+ 1 /* decimal point */ +
+ 1 /* minor version */ +
+ 1 /* `@' character */ +
+ ACE_OS::strlen (endp->host ()) +
+ 1 /* colon separator */ +
+ 5 /* port number */ +
+ 1 /* comma */);
#if defined (ACE_HAS_IPV6)
- if (this->endpoint_.is_ipv6_decimal_)
- buflen += 2; // room for '[' and ']'
+ if (endp.is_ipv6_decimal_)
+ buflen += 2; // room for '[' and ']'
#endif /* ACE_HAS_IPV6 */
+ }
+
+ static const char digits [] = "0123456789";
char * buf = CORBA::string_alloc (static_cast<CORBA::ULong> (buflen));
- static const char digits [] = "0123456789";
+ ACE_OS::strcpy(buf, "corbaloc:");
-#if defined (ACE_HAS_IPV6)
- if (this->endpoint_.is_ipv6_decimal_)
+ for (endp = &this->endpoint_; endp != 0; endp = endp->next_)
{
- // Don't publish scopeid if included.
- ACE_CString tmp(this->endpoint_.host ());
- ssize_t pos = tmp.find('%');
- if (pos != ACE_CString::npos)
+ if(&this->endpoint_ != endp)
+ ACE_OS::strcat(buf, ",");
+
+#if defined (ACE_HAS_IPV6)
+ if (endp.is_ipv6_decimal_)
{
- tmp = tmp.substr(0, pos + 1);
- tmp[pos] = '\0';
+ // Don't publish scopeid if included.
+ ACE_CString tmp(endp.host ());
+ ssize_t pos = tmp.find('%');
+ if (pos != ACE_CString::npos)
+ {
+ tmp = tmp.substr(0, pos + 1);
+ tmp[pos] = '\0';
+ }
+ ACE_OS::sprintf (buf + ACE_OS::strlen(buf),
+ "%s:%c.%c@[%s]:%d",
+ ::the_prefix,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ tmp.c_str (),
+ endp->port () );
}
- ACE_OS::sprintf (buf,
- "corbaloc:%s:%c.%c@[%s]:%d%c%s",
- ::the_prefix,
- digits [this->version_.major],
- digits [this->version_.minor],
- tmp.c_str (),
- this->endpoint_.port (),
- this->object_key_delimiter_,
- key.in ());
- }
- else
-#endif /* ACE_HAS_IPV6 */
- ACE_OS::sprintf (buf,
- "corbaloc:%s:%c.%c@%s:%d%c%s",
- ::the_prefix,
- digits [this->version_.major],
- digits [this->version_.minor],
- this->endpoint_.host (),
- this->endpoint_.port (),
- this->object_key_delimiter_,
- key.in ());
+ else
+#endif
+ ACE_OS::sprintf (buf + ACE_OS::strlen(buf),
+ "%s:%c.%c@%s:%d",
+ ::the_prefix,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ endp->host (),
+ endp->port () );
+
+ }
+ ACE_OS::sprintf (buf + ACE_OS::strlen(buf),
+ "%c%s",
+ this->object_key_delimiter_,
+ key.in ());
return buf;
}