diff options
author | doccvs <doccvs@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-07-13 23:27:43 +0000 |
---|---|---|
committer | doccvs <doccvs@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-07-13 23:27:43 +0000 |
commit | bd63d6fb96004e9c1a91ba772aae5fed19c2e428 (patch) | |
tree | 143371a72cf206974c014022567d1c29645172c2 | |
parent | d14c26d9344f5e691ed744a7c0cf23b34b0eb48a (diff) | |
download | ATCD-bd63d6fb96004e9c1a91ba772aae5fed19c2e428.tar.gz |
ChangeLogTag: Thu Jul 13 16:25:25 2000 Priyanka Gontla <pgontla@ece.uci.edu>
-rw-r--r-- | TAO/tao/IIOP_Profile.cpp | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp index cea4fc9f718..76b87bcb2b4 100644 --- a/TAO/tao/IIOP_Profile.cpp +++ b/TAO/tao/IIOP_Profile.cpp @@ -252,19 +252,8 @@ TAO_IIOP_Profile::parse_string (const char *string, CORBA::String_var copy (string); char *start = copy.inout (); - char *cp = ACE_OS::strchr (start, ':'); // Look for a port - - if (cp == 0) - { - // No host/port delimiter! - ACE_THROW_RETURN (CORBA::INV_OBJREF ( - CORBA_SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - EINVAL), - CORBA::COMPLETED_NO), - -1); - } - + char *cp_pos = ACE_OS::strchr (start, ':'); // Look for a port + char *okd = ACE_OS::strchr (start, this->object_key_delimiter_); if (okd == 0) @@ -278,28 +267,61 @@ TAO_IIOP_Profile::parse_string (const char *string, -1); } - // Don't increment the pointer 'cp' directly since we still need - // to use it immediately after this block. + // The default port number. + const char def_port [] = ":683"; - CORBA::ULong length = okd - (cp + 1); - // Don't allocate space for the colon ':'. + // Length of port. + CORBA::ULong length = 0; - CORBA::String_var tmp = CORBA::string_alloc (length); + // Length of host string. + CORBA::ULong length_host = 0; + // Length of <char *cp> + CORBA::ULong length_cp = ACE_OS::strlen ((const char *)okd) + sizeof (def_port); + + char *cp = CORBA::string_alloc (length_cp); + + if (cp_pos == 0) + { + // No host/port delimiter! Dont raise an exception. Use the + // default port No. 683 + ACE_OS::strcpy (cp, def_port); + ACE_OS::strcat (cp, okd); + + length = ACE_OS::strlen ((const char *)cp) - ACE_OS::strlen ((const char *)okd) - 1; + + length_host = ACE_OS::strlen (start) + sizeof (def_port) - ACE_OS::strlen (cp) -1; + } + else + { + // The port is specified: + cp = cp_pos; + length = okd - (cp + 1); + length_host = cp - start; + } + + CORBA::String_var tmp = CORBA::string_alloc (length); + ACE_OS::strncpy (tmp.inout (), cp + 1, length); tmp[length] = '\0'; - + this->port_ = (CORBA::UShort) ACE_OS::atoi (tmp.in ()); - - length = cp - start; - - tmp = CORBA::string_alloc (length); - - ACE_OS::strncpy (tmp.inout (), start, length); - tmp[length] = '\0'; - + + tmp = CORBA::string_alloc (length_host); + + ACE_OS::strncpy (tmp.inout (), start, length_host); + tmp[length_host] = '\0'; + this->host_ = tmp._retn (); - + + ACE_INET_Addr host_addr; + + if (ACE_OS::strcmp (this->host_.in (), "") == 0) + { + // If no host is specified: assign the default host : the local host. + host_addr.get_host_name (ACE_const_cast (char *, this->host_.in ()), sizeof (this->host_)); + } + if (this->object_addr_.set (this->port_, this->host_.in ()) == -1) { |