diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 1999-05-27 17:45:50 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 1999-05-27 17:45:50 +0000 |
commit | cb8b8fbce4a7d66ef2320548969d90f1d64c19ee (patch) | |
tree | 450c93e2122cf7994dffc57b43f94cb2b06ce89c /TAO | |
parent | 6ffa81ef2c3a17b21bee6ecf243f314fac16a3fd (diff) | |
download | ATCD-cb8b8fbce4a7d66ef2320548969d90f1d64c19ee.tar.gz |
Updates/fixes for "iioploc" style URLs and endpoints.
Also fixed problem where preconnects were being added to the endpoint set
instead of the preconnect set.
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/tao/Acceptor_Registry.cpp | 13 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.cpp | 76 | ||||
-rw-r--r-- | TAO/tao/IIOP_Profile.cpp | 34 | ||||
-rw-r--r-- | TAO/tao/IIOP_Profile.h | 1 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 29 | ||||
-rw-r--r-- | TAO/tao/Pluggable.cpp | 67 | ||||
-rw-r--r-- | TAO/tao/Pluggable.h | 2 | ||||
-rw-r--r-- | TAO/tao/UIOP_Connector.cpp | 37 | ||||
-rw-r--r-- | TAO/tao/UIOP_Connector.h | 1 | ||||
-rw-r--r-- | TAO/tao/UIOP_Profile.cpp | 34 | ||||
-rw-r--r-- | TAO/tao/UIOP_Profile.h | 1 | ||||
-rw-r--r-- | TAO/tao/params.cpp | 11 |
12 files changed, 125 insertions, 181 deletions
diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp index 2f4f7d5ce82..f98f913cfab 100644 --- a/TAO/tao/Acceptor_Registry.cpp +++ b/TAO/tao/Acceptor_Registry.cpp @@ -163,7 +163,9 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) } ACE_CString prefix = iop.substring (0, indx); + ACE_CString addrs = iop.substring (indx+3); + if (addrs [addrs.length () - 1] == '/') addrs [addrs.length () - 1] = '\0'; // get rid of trailing / @@ -193,6 +195,17 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) (*factory)->factory ()->make_acceptor (); if (acceptor != 0) { + // Check if an "N.n@" version prefix was specified. + // @@ For now, we just drop the version prefix. + // At some point in the future it may become + // useful. + const char *temp_iop = address.c_str (); + if (isdigit (temp_iop[0]) && + temp_iop[1] == '.' && + isdigit (temp_iop[2]) && + temp_iop[3] == '@') + address = address.substring (4); + // add acceptor to list. this->acceptors_.insert (acceptor); diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 810c2792287..8d874987925 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -21,6 +21,8 @@ #include "tao/Client_Strategy_Factory.h" #include "tao/Environment.h" +ACE_RCSID(tao, IIOP_Connector, "$Id$") + TAO_IIOP_Connector::TAO_IIOP_Connector (void) : TAO_Connector (TAO_IOP_TAG_INTERNET_IOP), base_connector_ () @@ -107,59 +109,15 @@ TAO_IIOP_Connector::connect (TAO_Profile *profile, int TAO_IIOP_Connector::preconnect (const char *preconnects) { - char *preconnections = ACE_OS::strdup (preconnects); - - // @@ Fred&Ossama: cleanup this code before the merge! -#if 0 - if (preconnections) - { - ACE_INET_Addr dest; - TAO_Client_Connection_Handler *handler; - ACE_Unbounded_Stack<TAO_Client_Connection_Handler *> handlers; + // Check for the proper protocol prefix. + if (this->check_prefix (preconnects) != 0) + return 0; // Failure: zero successful preconnections - char *nextptr = 0; - char *where = 0; + const char *protocol_removed = ACE_OS::strstr (preconnects, "://") + 3; + // "+ 3" since strlen of "://" is 3. - for (where = ACE::strsplit_r (preconnections, ",", nextptr); - where != 0; - where = ACE::strsplit_r (0, ",", nextptr)) - { - char *tport = 0; - char *thost = where; - char *sep = ACE_OS::strchr (where, ':'); + char *preconnections = ACE_OS::strdup (protocol_removed); - if (sep) - { - *sep = '\0'; - tport = sep + 1; - - dest.set (ACE_OS::atoi (tport), - thost); - - // Try to establish the connection - handler = 0; - if (this->base_connector_.connect (handler, dest) == 0) - // Save it for later so we can mark it as idle - handlers.push (handler); - else - ACE_ERROR ((LM_ERROR, - "(%P|%t) Unable to preconnect to host '%s', port %d.\n", - dest.get_host_name (), - dest.get_port_number ())); - } - else - ACE_ERROR ((LM_ERROR, - "(%P|%t) Yow! Couldn't find a ':' separator in '%s' spec.\n", - where)); - } - - // Walk the stack of handlers and mark each one as idle now. - handler = 0; - while (handlers.pop (handler) == 0) - handler->idle (); - - } -#else int successes = 0; if (preconnections) { @@ -172,8 +130,20 @@ TAO_IIOP_Connector::preconnect (const char *preconnects) where != 0; where = ACE::strsplit_r (0, ",", nextptr)) { + int version_offset = 0; + // Additional offset to remove version from preconnect, if it exists. + + if (isdigit (where[0]) && + where[1] == '.' && + isdigit (where[2]) && + where[3] == '@') + version_offset = 4; + + // @@ For now, we just drop the version prefix. However, at + // some point in the future the version may become useful. + char *tport = 0; - char *thost = where; + char *thost = where + version_offset; char *sep = ACE_OS::strchr (where, ':'); if (sep) @@ -186,7 +156,8 @@ TAO_IIOP_Connector::preconnect (const char *preconnects) } else ACE_ERROR ((LM_ERROR, - "(%P|%t) Yow! Couldn't find a ':' separator in '%s' spec.\n", + "(%P|%t) Couldn't find a ':' separator " + "in '%s' spec.\n", where)); } @@ -231,7 +202,6 @@ TAO_IIOP_Connector::preconnect (const char *preconnects) } } } -#endif /* 0 */ ACE_OS::free (preconnections); diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp index 89d54b15b88..fd8423a2d06 100644 --- a/TAO/tao/IIOP_Profile.cpp +++ b/TAO/tao/IIOP_Profile.cpp @@ -17,7 +17,6 @@ ACE_RCSID(tao, IIOP_Profile, "$Id$") # include "tao/IIOP_Profile.i" #endif /* __ACE_INLINE__ */ - static const char *prefix_ = "iiop:"; const char TAO_IIOP_Profile::object_key_delimiter = '/'; @@ -356,29 +355,21 @@ TAO_IIOP_Profile::parse_string (const char *string, if (!string || !*string) return 0; - // Remove the "N.n//" prefix, and verify the version is one - // that we accept + // Remove the "N.n@" version prefix, if it exists, and verify the + // version is one that we accept. - if (isdigit (string [0]) - && isdigit (string [2]) - && string [1] == '.' - && string [3] == '/' - && string [4] == '/') + // Check for version + if (isdigit (string [0]) && + string[1] == '.' && + isdigit (string [2]) && + string[3] == '@') { // @@ This may fail for non-ascii character sets [but take that // with a grain of salt] this->version_.set_version ((char) (string [0] - '0'), (char) (string [2] - '0')); - string += 5; - // Skip over the "N.n//" - } - else - { - // ACE_THROW_RETURN (CORBA::MARSHAL (), 0); - // The version is optional so don't throw an exception. - - string += 2; - // Skip over the "//" + string += 4; + // Skip over the "N.n@" } if (this->version_.major != TAO_IIOP_Profile::DEF_IIOP_MAJOR || @@ -600,8 +591,11 @@ TAO_IIOP_Profile::to_string (CORBA::Environment &env) this->object_key ()); u_int buflen = (ACE_OS::strlen (::prefix_) + - 1 /* major # */ + 1 /* minor # */ + 1 /* decimal point */ + 2 /* double-slash separator */ + + 1 /* major version */ + + 1 /* decimal point */ + + 1 /* minor version */ + + 1 /* `@' character */ + ACE_OS::strlen (this->host_) + 1 /* colon separator */ + 5 /* port number */ + @@ -614,7 +608,7 @@ TAO_IIOP_Profile::to_string (CORBA::Environment &env) static const char digits [] = "0123456789"; ACE_OS::sprintf (buf, - "%s%c.%c//%s:%d%c%s", + "%s//%c.%c@%s:%d%c%s", ::prefix_, digits [this->version_.major], digits [this->version_.minor], diff --git a/TAO/tao/IIOP_Profile.h b/TAO/tao/IIOP_Profile.h index 353ce618baf..85ef98434ed 100644 --- a/TAO/tao/IIOP_Profile.h +++ b/TAO/tao/IIOP_Profile.h @@ -46,6 +46,7 @@ public: }; static const char object_key_delimiter; + // The object key delimiter that IIOP uses or expects. static const char *prefix (void); // Return the char string prefix. diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index f4d6ee96417..d0e61955300 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -255,19 +255,20 @@ TAO_ORB_Core::init (int &argc, char *argv[]) { // Each "endpoint" is of the form: // - // protocol:V.v//addr1,addr2,...,addrN/ + // protocol://V.v@addr1,addr2,...,addrN // // or: // - // protocol://addr1,addr2,...,addrN/ + // protocol://addr1,addr2,...,addrN // - // where "V.v" is an optional version. All preconnect or endpoint - // strings should be of the above form(s). + // where "V.v" is an optional protocol version for each + // addr. All preconnect or endpoint strings should be of + // the above form(s). // // Multiple sets of endpoint may be seperated by a semi-colon `;'. // For example: // - // iiop://space:2001,odyssey:2010/;uiop://foo,bar/ + // iioploc://space:2001,1.2@odyssey:2010;uiop://foo,bar // // All preconnect or endpoint strings should be of the above form(s). @@ -490,21 +491,25 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // Get a string which describes the connections we want to // cache up-front, thus reducing the latency of the first call. // - // For example, specify -ORBpreconnect once for each protocol - // -ORBpreconnect iiop://tango:10015,watusi:10016/ - // -ORBpreconnect busX_iop://board1:0x07450000,board2,0x08450000/ - // Or chain all possible endpoint designations together + // For example, specify -ORBpreconnect once for each + // protocol: + // + // -ORBpreconnect iiop://tango:10015,watusi:10016 + // -ORBpreconnect busX_iop://board1:0x07450000,board2,0x08450000 + // + // Or chain all possible endpoint designations together: + // // -ORBpreconnect iiop://tango:10015,watusi:10016/; // busX_iop://board1:0x07450000,board2,0x08450000/ // - // The old style command line was meant for IIOP: + // The old style command line only works for IIOP: // -ORBpreconnect tango:10015,tango:10015,watusi:10016 if (arg_shifter.is_parameter_next ()) { ACE_CString preconnections (arg_shifter.get_current ()); - if (this->orb_params ()->endpoints (preconnections) != 0) + if (this->orb_params ()->preconnects (preconnections) != 0) { // Handle old style preconnects for backward compatibility. // The old style preconnects only work for IIOP! @@ -527,7 +532,7 @@ TAO_ORB_Core::init (int &argc, char *argv[]) "will be used:\n%s\n", preconnections.c_str())); - this->orb_params ()->endpoints (preconnections); + this->orb_params ()->preconnects (preconnections); } } } diff --git a/TAO/tao/Pluggable.cpp b/TAO/tao/Pluggable.cpp index 6263d230bcc..b4860c92ca4 100644 --- a/TAO/tao/Pluggable.cpp +++ b/TAO/tao/Pluggable.cpp @@ -264,8 +264,8 @@ TAO_Connector::make_mprofile (const char *string, ior.set (string, ACE_OS::strlen (string), 1); - // Find out where the protocol name ends - int ior_index = ior.find (':'); + // Find out where the protocol ends + int ior_index = ior.find ("://"); if (ior_index == ACE_CString::npos) { @@ -274,11 +274,10 @@ TAO_Connector::make_mprofile (const char *string, } else { - ior_index++; - // Add the length of the colon to the IOR index (i.e. 1) + ior_index += 3; + // Add the length of the colon and the two forward slashes `://' + // to the IOR string index (i.e. 3) } - - const char endpoint_delimiter = ','; // The delimiter used to seperate inidividual addresses. @@ -302,52 +301,17 @@ TAO_Connector::make_mprofile (const char *string, // Error while setting the MProfile size! } - // Find the version, if it exists, and keep track of it so that it - // may be passed to each Profile. - - int version_index; - // Index denoting where version is located in the IOR - - if (ior.find ("//") == ior_index) - { - version_index = 0; - // No version provided - // `protocol://' - } - else if (ior.find ("//") == ior_index + 3) - { - version_index = ior_index; - // Version provided - // `protocol:N.n//' - - ior_index += 5; - // Skip over the `N.n//' - } - else - { - ACE_THROW_RETURN (CORBA::INITIALIZE (), -1); - // Problem in IOR between protocol prefix and double slash "//" - } - // The idea behind the following loop is to split the IOR into several // strings that can be parsed by each profile. // For example, - // `1.3//moo,shu,chicken/arf' + // `//1.3@moo,shu,1.1chicken/arf' // will be parsed into: - // `1.3//moo/arf' - // `1.3//shu/arf' - // `1.3//chicken/arf' - // - // If no version is provided then the string will be of the form: - // `//moo/arf' + // `//1.3@moo/arf' + // `//shu/arf' + // `//1.1chicken/arf' int objkey_index = ior.find (this->object_key_delimiter (), ior_index); // Find the object key - // - // Typically, a forward slash '/' is used to delimit endpoints from the - // object key. However, some protocols may use forward slashes in - // the endpoints themselves. To prevent ambiguities from arising, a - // protocol specific object key delimiter can be used. if (objkey_index == 0 || objkey_index == ACE_CString::npos) { @@ -372,22 +336,11 @@ TAO_Connector::make_mprofile (const char *string, { ACE_CString endpoint = ior.substring (begin, end); - if (version_index > 0) - { - endpoint = ior.substring (version_index, 5) + endpoint; - // Concatenate version string and endpoint - } - else - { - endpoint = ior.substring (ior_index - 2, 2) + endpoint; - // No version provided - } - endpoint += ior.substring (objkey_index); // Add the object key to the string. // The endpoint should now be of the form: - // `N.n://endpoint/object_key' + // `//N.n@endpoint/object_key' // or // `//endpoint/object_key' diff --git a/TAO/tao/Pluggable.h b/TAO/tao/Pluggable.h index 0a8372ce668..48db683313f 100644 --- a/TAO/tao/Pluggable.h +++ b/TAO/tao/Pluggable.h @@ -422,7 +422,7 @@ protected: // with a given pluggable protocol. virtual char object_key_delimiter (void) const = 0; - // Return the object key delimiter to be used. + // Return the object key delimiter to use or expect. private: CORBA::ULong tag_; diff --git a/TAO/tao/UIOP_Connector.cpp b/TAO/tao/UIOP_Connector.cpp index 6c6f3fa8641..788b7948197 100644 --- a/TAO/tao/UIOP_Connector.cpp +++ b/TAO/tao/UIOP_Connector.cpp @@ -25,6 +25,8 @@ #include "tao/ORB_Core.h" #include "tao/Environment.h" +ACE_RCSID(tao, UIOP_Connector, "$Id$") + // **************************************************************** TAO_UIOP_MT_Connect_Creation_Strategy:: @@ -119,7 +121,14 @@ TAO_UIOP_Connector::connect (TAO_Profile *profile, int TAO_UIOP_Connector::preconnect (const char *preconnects) { - char *preconnections = ACE_OS::strdup (preconnects); + // Check for the proper protocol prefix. + if (this->check_prefix (preconnects) != 0) + return 0; // Failure: zero successful preconnections + + const char *protocol_removed = ACE_OS::strstr (preconnects, "://") + 3; + // "+ 3" since strlen of "://" is 3. + + char *preconnections = ACE_OS::strdup (protocol_removed); int successes = 0; if (preconnections) @@ -134,20 +143,22 @@ TAO_UIOP_Connector::preconnect (const char *preconnects) where = ACE::strsplit_r (0, ",", nextptr)) { char *rendezvous_point = where; - char *sep = ACE_OS::strchr (where, ':'); - if (sep) - { - *sep = '\0'; + int version_offset = 0; + // Additional offset to remove version from preconnect, if it exists. - dest.set (rendezvous_point); - dests.push (dest); - } - else - ACE_ERROR ((LM_ERROR, - "(%P|%t) Couldn't find a ':' separator in '%s'" - " spec.\n", - where)); + if (isdigit (rendezvous_point[0]) && + rendezvous_point[1] == '.' && + isdigit (rendezvous_point[2]) && + rendezvous_point[3] == '@') + version_offset = 4; + + // @@ For now, we just drop the version prefix. However, at + // some point in the future the version may become useful. + + dest.set (rendezvous_point + version_offset); + + dests.push (dest); } // Create an array of addresses from the stack, as well as an diff --git a/TAO/tao/UIOP_Connector.h b/TAO/tao/UIOP_Connector.h index 02a30486a82..0d7014b0a35 100644 --- a/TAO/tao/UIOP_Connector.h +++ b/TAO/tao/UIOP_Connector.h @@ -89,6 +89,7 @@ protected: virtual char object_key_delimiter (void) const; +protected: typedef ACE_NOOP_Creation_Strategy<TAO_UIOP_Client_Connection_Handler> TAO_NULL_CREATION_STRATEGY; diff --git a/TAO/tao/UIOP_Profile.cpp b/TAO/tao/UIOP_Profile.cpp index 84e004903e8..7c2541463bd 100644 --- a/TAO/tao/UIOP_Profile.cpp +++ b/TAO/tao/UIOP_Profile.cpp @@ -261,28 +261,21 @@ TAO_UIOP_Profile::parse_string (const char *string, if (!string || !*string) return 0; - // Remove the "N.n//" prefix, and verify the version is one - // that we accept - - if (isdigit (string [0]) - && isdigit (string [2]) - && string [1] == '.' - && string [3] == '/' - && string [4] == '/') + // Remove the "N.n@" version prefix, if it exists, and verify the + // version is one that we accept. + + // Check for version + if (isdigit (string [0]) && + string[1] == '.' && + isdigit (string [2]) && + string[3] == '@') { // @@ This may fail for non-ascii character sets [but take that // with a grain of salt] this->version_.set_version ((char) (string [0] - '0'), (char) (string [2] - '0')); - string += 5; - } - else - { - // ACE_THROW_RETURN (CORBA::MARSHAL (), 0); - // The version is optional so don't throw an exception. - - string += 2; - // Skip over the "//" + string += 4; + // Skip over the "N.n@" } if (this->version_.major != TAO_UIOP_Profile::DEF_UIOP_MAJOR || @@ -484,8 +477,11 @@ TAO_UIOP_Profile::to_string (CORBA::Environment &) this->object_key ()); u_int buflen = (ACE_OS::strlen (::prefix_) + - 1 /* major # */ + 1 /* minor # */ + 1 /* decimal point */ + 2 /* double-slash separator */ + + 1 /* major version */ + + 1 /* decimal point */ + + 1 /* minor version */ + + 1 /* `@' character */ + ACE_OS::strlen (this->rendezvous_point_) + 1 /* object key separator */ + ACE_OS::strlen (key) + @@ -496,7 +492,7 @@ TAO_UIOP_Profile::to_string (CORBA::Environment &) static const char digits [] = "0123456789"; ACE_OS::sprintf (buf, - "%s%c.%c//%s%c%s", + "%s//%c.%c@%s%c%s", ::prefix_, digits [this->version_.major], digits [this->version_.minor], diff --git a/TAO/tao/UIOP_Profile.h b/TAO/tao/UIOP_Profile.h index 156311ffc7a..7965daadf39 100644 --- a/TAO/tao/UIOP_Profile.h +++ b/TAO/tao/UIOP_Profile.h @@ -50,6 +50,7 @@ public: }; static const char object_key_delimiter; + // The object key delimiter that UIOP uses or expects. static const char *prefix (void); // Return the char string prefix. diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp index 0c0bf82167a..39f1d9fe0c4 100644 --- a/TAO/tao/params.cpp +++ b/TAO/tao/params.cpp @@ -34,7 +34,7 @@ TAO_ORB_Parameters::parse_endpoints (ACE_CString &endpoints, // Parse the string into seperate endpoints, where `endpoints' is of // the form: // - // protocol1:V.v//addr1,...,addrN/;protocol2:W.w//addr1,...,addrN/;... + // protocol1://V,v@addr1,...,addrN;protocol2://addr1,...,W.w@addrN;... // // A single endpoint, instead of several, can be added just as well. @@ -49,8 +49,8 @@ TAO_ORB_Parameters::parse_endpoints (ACE_CString &endpoints, endpoints[length - 1] == endpoints_delimiter) { return -1; - // Failure: endpoints string has an empty endpoint at the beginning - // or the end of the string (e.g. ";uiop://foo;iiop:1.3//bar") + // Failure: endpoints string has an empty endpoint at the beginning + // or the end of the string (e.g. ";uiop://foo;iiop://1.3@bar") } if (length > 0) @@ -84,11 +84,10 @@ TAO_ORB_Parameters::parse_endpoints (ACE_CString &endpoints, // from the offset `begin' to the end of the string. // Check for a valid URL style endpoint set - int check_offset = endpt.find (':'); + int check_offset = endpt.find ("://"); if (check_offset > 0 && - check_offset != endpt.npos && - endpt.find ("//", check_offset + 1) != endpt.npos) + check_offset != endpt.npos) { endpoints_list.insert (endpt); // Insert endpoint into list |