diff options
author | fredk <fredk@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-08 05:18:31 +0000 |
---|---|---|
committer | fredk <fredk@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-08 05:18:31 +0000 |
commit | 4dd217472a51b3c90b24cce18cceea1de2a7c3e3 (patch) | |
tree | a5fb9781ba2480af2749ab41800c7f9e36411edd /TAO/tao | |
parent | 90177bfd2992f2b30a49693bbbae3046f640da59 (diff) | |
download | ATCD-4dd217472a51b3c90b24cce18cceea1de2a7c3e3.tar.gz |
Mostly commnet updates. Also changed add-to_string for the Profile classes
to accept a buffer. removed the Environment parameter
toTAO_XX_profile::_key () and also removed the body_ attribute and related
methods.
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/Acceptor_Registry.cpp | 25 | ||||
-rw-r--r-- | TAO/tao/Acceptor_Registry.h | 20 | ||||
-rw-r--r-- | TAO/tao/Connector_Registry.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/Connector_Registry.h | 8 | ||||
-rw-r--r-- | TAO/tao/IIOP_Acceptor.cpp | 30 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.h | 4 | ||||
-rw-r--r-- | TAO/tao/IIOP_Profile.cpp | 70 | ||||
-rw-r--r-- | TAO/tao/IIOP_Profile.h | 13 | ||||
-rw-r--r-- | TAO/tao/IIOP_Profile.i | 8 | ||||
-rw-r--r-- | TAO/tao/Invocation.cpp | 9 | ||||
-rw-r--r-- | TAO/tao/ORB.cpp | 17 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 11 | ||||
-rw-r--r-- | TAO/tao/Object.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/Pluggable.cpp | 13 | ||||
-rw-r--r-- | TAO/tao/Pluggable.h | 40 | ||||
-rw-r--r-- | TAO/tao/UIOP_Acceptor.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/UIOP_Connector.cpp | 17 | ||||
-rw-r--r-- | TAO/tao/UIOP_Profile.cpp | 66 | ||||
-rw-r--r-- | TAO/tao/UIOP_Profile.h | 13 | ||||
-rw-r--r-- | TAO/tao/UIOP_Profile.i | 8 | ||||
-rw-r--r-- | TAO/tao/UIOP_Transport.h | 4 |
22 files changed, 114 insertions, 290 deletions
diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp index 6c57b7e43e4..7af569dd697 100644 --- a/TAO/tao/Acceptor_Registry.cpp +++ b/TAO/tao/Acceptor_Registry.cpp @@ -57,11 +57,6 @@ TAO_Acceptor_Registry::make_mprofile (const TAO_ObjectKey &object_key, int TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile) { - // @@ Fred&Ossama: we should optimize this: we loop over the - // profiles here and in the ORB::is_collocated() method, maybe we - // should return the index of the profile that matched? What - // happens if the address matches but the object key does not? - // Should we keep on searching in the ORB loop? TAO_AcceptorSetItor end = this->end (); @@ -73,6 +68,7 @@ TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile) { const TAO_Profile *profile = mprofile.get_profile (j); + // Check the address for equality. if ((*i)->tag () == profile->tag () && (*i)->is_collocated (profile)) return 1; @@ -121,8 +117,10 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) -1); ACE_CString prefix = iop.substring (0, slot); - // @@ Fred, please document where the major number "3" comes - // from. + // IOP://address1,address2// + // ^ slot + // check for the presence of addresses. Get length and subtract + // 3 for the three chars :// if (slot == ACE_static_cast (int, iop.length () - 3)) { // Protocol was specified without an endpoint. According to @@ -135,8 +133,7 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) continue; } - // @@ Fred, please document where the major number "3" comes - // from. + // increment slot past the "://" (i.e. add 3) ACE_CString addrs = iop.substring (slot + 3); if (addrs [addrs.length () - 1] == '/') @@ -206,6 +203,8 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) return 0; } +// Used when no endpoints were specified. Open a default server +// for the indicated protocol. int TAO_Acceptor_Registry::open_default (TAO_ORB_Core *orb_core, ACE_CString *protocol_prefix) @@ -216,9 +215,7 @@ TAO_Acceptor_Registry::open_default (TAO_ORB_Core *orb_core, TAO_ProtocolFactorySetItor end = orb_core->protocol_factories ()->end (); - // @@ Fred, there should be more comments in this method so that - // people can tell what's going on... Can you please fix it? - + // loop through loaded protocols looking for protocol_prefix for (TAO_ProtocolFactorySetItor i = orb_core->protocol_factories ()->begin (); i != end; @@ -241,6 +238,7 @@ TAO_Acceptor_Registry::open_default (TAO_ORB_Core *orb_core, } } + // got it, make an acceptor TAO_Acceptor *acceptor = (*i)->factory ()->make_acceptor (); @@ -254,6 +252,9 @@ TAO_Acceptor_Registry::open_default (TAO_ORB_Core *orb_core, continue; } + // initialize the acceptor to listen on the default endpoint. For IIOP + // this will just be the default interface and let the kernel pick a port for + // us. if (acceptor->open_default (orb_core) == -1) { if (TAO_debug_level > 0) diff --git a/TAO/tao/Acceptor_Registry.h b/TAO/tao/Acceptor_Registry.h index 7b6db0eabe6..19fd16bc9d4 100644 --- a/TAO/tao/Acceptor_Registry.h +++ b/TAO/tao/Acceptor_Registry.h @@ -50,6 +50,7 @@ class TAO_Export TAO_Acceptor_Registry // = DESCRIPTION // This class maintains a list os acceptor factories // for all loaded ORB protocols. + // There is one Acceptor_Registry per ORB_Core. public: // = Initialization and termination methods. TAO_Acceptor_Registry (void); @@ -58,27 +59,8 @@ public: ~TAO_Acceptor_Registry (void); // Default destructor. - // @@ Fred, should this method be removed? If so, where should the - // comments be put? - - // virtual TAO_Acceptor *acceptor (const char *endpoint) = 0; - // Create a new acceptor from an endpoint specification, if - // the specification is not recognized then we return 0. - // Each protocol will be characterized by a prefix, so - // endpoints will be specified as: - // "iiop://macarena:0" - IIOP on macarena, port <any> - // "uiop:///foo/bar" - GIOP over unix domain, file /foo/bar - // "iiop://localhost:0" - IIOP, sap_any [any better idea?] - // "aal5giop:......" - GIOP over AAL5, how to specify the - // end point? - // this format is extensible, for example: - // "rtiiop://macarena:0,15" - real-time IIOP, host, port, prio. - int open (TAO_ORB_Core *orb_core); // Initialize all registered acceptors. Return -1 on error. - // @@ Fred&Ossama: What is the relationship between the ORB_Core and - // the Acceptor_Registry? Is there just one per orb core? Should tbe - // acceptor registry know which ORB_Core it belongs to? int close_all (void); // Close all open acceptors. diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp index fdb041e5d2e..81fc65c296c 100644 --- a/TAO/tao/Connector_Registry.cpp +++ b/TAO/tao/Connector_Registry.cpp @@ -114,13 +114,11 @@ TAO_Connector_Registry::preconnect (TAO_EndpointSet &preconnections) } int -TAO_Connector_Registry::connect (TAO_Stub *&obj, +TAO_Connector_Registry::connect (TAO_Profile *&profile, TAO_Transport *&transport) { - TAO_Profile *profile = obj->profile_in_use (); - // Here is where we get the appropriate connector object but we are - // the Connector Registry so call get_connector(tag) + // Find the appropriate connector object TAO_Connector *connector = this->get_connector (profile->tag ()); diff --git a/TAO/tao/Connector_Registry.h b/TAO/tao/Connector_Registry.h index 294d34c12f8..e90b11acc09 100644 --- a/TAO/tao/Connector_Registry.h +++ b/TAO/tao/Connector_Registry.h @@ -52,8 +52,10 @@ class TAO_Export TAO_Connector_Registry // Connector Registry and Generic Connector interface definitions. // All loaded ESIOP or GIOP connector bridges must register with // this object. - // @@ Fred: this class should be able to dynamically load a set of - // connectors using the service configurator. + // This class is able to dynamically load a set of + // concrete protocol connectors which have registered with the service + // configurator and added their Factory name to the Resource_Factory + // line of the svc.comf file. public: TAO_Connector_Registry (void); // Default constructor. @@ -74,7 +76,7 @@ public: // For this list of preconnections call the connector specific // preconnect method for each preconnection. - int connect (TAO_Stub *&obj, TAO_Transport *&); + int connect (TAO_Profile *&profile, TAO_Transport *&transport); // This is where the transport protocol is selected based on some // policy. This member will call the connect member of the // TAO_Connector class which in turn will call the concrete diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index f3d52cdfe6c..ec1cd8c4862 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -35,17 +35,12 @@ TAO_IIOP_Acceptor::TAO_IIOP_Acceptor (void) { } -// @@ Fred&Ossama: Maybe not for the current round of changes, but -// shouldn't the acceptor know which version to create? -// And isn't this the right place to setup the tagged components of -// a v1.[12] profile? - -// @@ Fred&Ossama: We need to check this interface: a single -// TAO_Acceptor may be bound to multiple addresses (think of a -// multihomed machine with an acceptor listening on the wildcard -// address), hence the "Right Thing" seems to be that we pass an -// MProfile that is filled up by the TAO_Acceptor class. -// @@ Right, I agree but for now we assume single endpoint. fredk +// TODO = +// 1) Set the version number for IIOP for which this acceptor is is valid +// 2) For V1.[1,2] there are tagged components +// 3) Create multiple profiles for wild carded endpoints (may be multiple +// interfaces over which we can receive requests. Thus a profile +// must be made for each one. int TAO_IIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, @@ -79,15 +74,8 @@ TAO_IIOP_Acceptor::is_collocated (const TAO_Profile* pfile) const TAO_IIOP_Profile *profile = ACE_dynamic_cast(const TAO_IIOP_Profile*, pfile); - // @@ We should probably cache this value, but then again some - // acceptors have multiple addresses. - // @@ Fred: any ideas on how to optimize that? - ACE_INET_Addr address; - if (this->base_acceptor_.acceptor ().get_local_addr (address) == -1) - return 0; - - // @@ Ossama: can you verify that this operator does the right thing? - return profile->object_addr () == address; + // compare the port and sin_addr (numeric host address) + return profile->object_addr () == this->address_; } ACE_Event_Handler * @@ -125,6 +113,8 @@ TAO_IIOP_Acceptor::open_default (TAO_ORB_Core *orb_core) addr.set (u_short(0), buffer, 1); + this->host_ = buffer; + return this->open_i (orb_core, addr); } diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 867af250af4..0ac5f4ceb31 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -126,12 +126,16 @@ TAO_IIOP_Connector::connect (TAO_Profile *profile, oa) == -1) { // Give users a clue to the problem. if (TAO_orbdebug) - ACE_DEBUG ((LM_ERROR, "(%P|%t) %s:%u, connection to " - "%s failed (%p)\n", - __FILE__, - __LINE__, - profile->addr_to_string (), - "errno")); + { + char buffer [MAXNAMELEN * 2]; + profile->addr_to_string (buffer, (MAXNAMELEN * 2) - 1); + ACE_DEBUG ((LM_ERROR, "(%P|%t) %s:%u, connection to " + "%s failed (%p)\n", + __FILE__, + __LINE__, + buffer, + "errno")); + } return -1; } diff --git a/TAO/tao/IIOP_Connector.h b/TAO/tao/IIOP_Connector.h index d5984b4a7e8..7b76c5a64d2 100644 --- a/TAO/tao/IIOP_Connector.h +++ b/TAO/tao/IIOP_Connector.h @@ -60,7 +60,9 @@ class TAO_Export TAO_IIOP_Connector : public TAO_Connector // IIOP-specific Connector bridge for pluggable protocols. // // = DESCRIPTION - // @@ Fred, please fill in here. + // Concrete instance of the TAO_Connector class. Responsible + // for establishing a connection with a server and is called from the + // Connector_Registory. // public: // = Initialization and termination methods. diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp index 270ac9e02ad..6464e3f745a 100644 --- a/TAO/tao/IIOP_Profile.cpp +++ b/TAO/tao/IIOP_Profile.cpp @@ -26,7 +26,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (0), - body_ (), version_ (DEF_IIOP_MAJOR, DEF_IIOP_MINOR), object_key_ (), object_addr_ (addr), @@ -39,7 +38,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, for (int i = 0; i < l; ++i) this->object_key_[i] = object_key[i]; - this->create_body (); } TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, @@ -47,14 +45,12 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (0), - body_ (), version_ (DEF_IIOP_MAJOR, DEF_IIOP_MINOR), object_key_ (object_key), object_addr_ (addr), hint_ (0) { this->set (addr); - this->create_body (); } TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, @@ -63,7 +59,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (0), - body_ (), version_ (version), object_key_ (), object_addr_ (addr), @@ -76,7 +71,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, for (int i = 0; i < l; ++i) this->object_key_[i] = object_key[i]; - this->create_body (); } TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, @@ -85,14 +79,12 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr& addr, : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (0), - body_ (), version_ (version), object_key_ (object_key), object_addr_ (addr), hint_ (0) { this->set (addr); - this->create_body (); } TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, @@ -101,7 +93,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (port), - body_ (), version_ (DEF_IIOP_MAJOR, DEF_IIOP_MINOR), object_key_ (object_key), object_addr_ (port, host), @@ -115,7 +106,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, ACE_OS::strcpy (this->host_, host); } - this->create_body (); } TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, @@ -125,7 +115,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (port), - body_ (), version_ (DEF_IIOP_MAJOR, DEF_IIOP_MINOR), object_key_ (object_key), object_addr_ (addr), @@ -139,7 +128,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, ACE_OS::strcpy (this->host_, host); } - this->create_body (); } TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, @@ -149,7 +137,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (port), - body_ (), version_ (DEF_IIOP_MAJOR, DEF_IIOP_MINOR), object_key_ (object_key), object_addr_ (port, host), @@ -161,14 +148,12 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host, char[ACE_OS::strlen (host) + 1]); ACE_OS::strcpy (this->host_, host); - this->create_body (); } TAO_IIOP_Profile::TAO_IIOP_Profile (const TAO_IIOP_Profile *pfile) : TAO_Profile (pfile->tag ()), host_(0), port_(pfile->port_), - body_(pfile->body_), version_(pfile->version_), object_key_(pfile->object_key_), object_addr_(pfile->object_addr_), @@ -186,7 +171,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const TAO_IIOP_Profile &pfile) : TAO_Profile (pfile.tag ()), host_(0), port_(pfile.port_), - body_(pfile.body_), version_(pfile.version_), object_key_(pfile.object_key_), object_addr_(pfile.object_addr_), @@ -204,7 +188,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const TAO_IOP_Version &version) : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (0), - body_ (), version_ (version), object_key_ (), object_addr_ (), @@ -217,7 +200,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const char *string, : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (0), - body_ (), version_ (DEF_IIOP_MAJOR, DEF_IIOP_MINOR), object_key_ (), object_addr_ (), @@ -230,7 +212,6 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (void) : TAO_Profile (TAO_IOP_TAG_INTERNET_IOP), host_ (0), port_ (0), - body_ (), version_ (DEF_IIOP_MAJOR, DEF_IIOP_MINOR), object_key_ (), object_addr_ (), @@ -437,41 +418,6 @@ TAO_IIOP_Profile::parse_string (const char *string, return 1; } -// TAO_InputCDR cdr (body.get_buffer (), body.length (), body[0]); -// -// @@ -// CORBA::Boolean byte_order; -// cdr >> CORBA::Any::to_boolean (byte_order); -// cdr >> this->version_.major; -// cdr >> this->version_.minor; -// cdr >> this->host_ (); -// cdr >> this->port_; -// cdr >> this->object_key_; -// this->object_addr_.set(this->port_, this->host_); -// } - -void -TAO_IIOP_Profile::create_body (void) -{ -} -// @@ -// TAO_OutputCDR cdr; -// cdr << TAO_ENCAP_BYTE_ORDER; -// cdr << this->version_.major; -// cdr << this->version_.minor; -// cdr << this->host_; -// cdr << this->port_; -// cdr << this->object_key_; -// -// // Create a copy by making a temporary TAO_opaque object. -// // @@ TODO the CDR stream may contain several fragments, need to -// // merge them... -// this->body_ = TAO_opaque (cdr.length (), // length -// cdr.length (), // maximum -// cdr.buffer (), // buffer -// 0); // not own -// } - CORBA::Boolean TAO_IIOP_Profile::is_equivalent (TAO_Profile *other_profile, CORBA::Environment &env) @@ -516,13 +462,19 @@ TAO_IIOP_Profile::hash (CORBA::ULong max, return hashval % max; } -char * -TAO_IIOP_Profile::addr_to_string(void) +int +TAO_IIOP_Profile::addr_to_string(char *buffer, size_t length) { - static char s[MAXHOSTNAMELEN + MAXHOSTNAMELEN]; - ACE_OS::sprintf (s, "%s:%d", + int actual_len = ACE_OS::strlen (this->host_) // chars in host name + + sizeof (':') // delimiter + + ACE_OS::strlen ("65536") // max port + + sizeof ('\0'); + if (length < actual_len) + return -1; + + ACE_OS::sprintf (buffer, "%s:%d", this->host_, port_); - return s; + return 0; } const char * diff --git a/TAO/tao/IIOP_Profile.h b/TAO/tao/IIOP_Profile.h index 071df9985b3..9b3daa5fa42 100644 --- a/TAO/tao/IIOP_Profile.h +++ b/TAO/tao/IIOP_Profile.h @@ -119,9 +119,6 @@ public: // Return a string representation for this profile. // client must deallocate memory. - const TAO_opaque& body (void) const; - // Create IIOP_Profile Object from marshalled data. - int decode (TAO_InputCDR& cdr); // Initialize this object using the given CDR octet string. @@ -134,7 +131,7 @@ public: TAO_ObjectKey &object_key (TAO_ObjectKey& objkey); // @@ deprecated. set the Object Key. - TAO_ObjectKey *_key (CORBA::Environment &env) const; + TAO_ObjectKey *_key (void) const; // Return a pointer to the Object Key. CORBA::Boolean is_equivalent (TAO_Profile *other_profile, @@ -147,7 +144,7 @@ public: CORBA::Environment &env); // Return a hash value for this object. - char *addr_to_string (void); + int addr_to_string (char *buffer, size_t length); // Return a string representation for the address. const ACE_INET_Addr &object_addr (void) const; @@ -191,9 +188,6 @@ private: int set (const ACE_INET_Addr &addr); // helper method to set the INET_Addr. - void create_body (void); - // Does the work for <add_profile>. - private: char *host_; @@ -202,9 +196,6 @@ private: CORBA::UShort port_; // TCP port number - TAO_opaque body_; - // Marshaled profile (CDR). - TAO_IOP_Version version_; // IIOP version number. diff --git a/TAO/tao/IIOP_Profile.i b/TAO/tao/IIOP_Profile.i index 21caded72a6..03fd29b7202 100644 --- a/TAO/tao/IIOP_Profile.i +++ b/TAO/tao/IIOP_Profile.i @@ -15,17 +15,11 @@ TAO_IIOP_Profile::object_key (TAO_ObjectKey& objkey) } ACE_INLINE TAO_ObjectKey * -TAO_IIOP_Profile::_key (CORBA::Environment &) const +TAO_IIOP_Profile::_key (void) const { return new TAO_ObjectKey (this->object_key_); } -ACE_INLINE const TAO_opaque& -TAO_IIOP_Profile::body (void) const -{ - return this->body_; -} - ACE_INLINE const ACE_INET_Addr& TAO_IIOP_Profile::object_addr (void) const { diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index 947b8c845b0..2f830d3374d 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -136,14 +136,11 @@ TAO_GIOP_Invocation::start (CORBA::Boolean is_roundtrip, // @@ It seems like this is the right spot to re-order the profiles // based on the policies in the ORB. - // The following text was here: - // The connection registry is also responsible for selecting the - // profile to use based on some policy or the current forwarding - // state. - // IMHO this is not right, the connector registry only finds one + // IMHO the connector registry only finds one // connector for the given policies, if the connector is not // available (say the user wants an ATM connection, but we don't // have the protocol) then we give it another profile to try. + // So the invocation Object should handle policy decisions. #if defined (TAO_HAS_CORBA_MESSAGING) #if 0 // @@ TODO implement once PP are merged in @@ -180,7 +177,7 @@ TAO_GIOP_Invocation::start (CORBA::Boolean is_roundtrip, if (this->transport_ != 0) this->transport_->idle (); - int result = conn_reg->connect (this->stub_, this->transport_); + int result = conn_reg->connect (this->profile_, this->transport_); if (result == 0) break; diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 301ce5ba479..e6d4a06ddc8 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -1654,9 +1654,9 @@ CORBA_ORB::_get_collocated_servant (TAO_Stub *sobj) return 0; // @@EXC@@ We should receive the <env> from the command line. - // @@ Fred: why do we need an environment for the - // Profile::_key() method? - // @@ No good reason, I will fix. + + // @@ What about forwarding. Which this approach we are never forwarded + // when we use collocation! CORBA::Environment ACE_TRY_ENV; @@ -1676,9 +1676,6 @@ CORBA_ORB::_get_collocated_servant (TAO_Stub *sobj) i != end; ++i) { - // @@ Fred&Ossama: how do we handle forwarding in this case? - // What happens if we are forwarded back to this ORB, or if a - // local stub is (or should) be forwarded to a remote one? const TAO_MProfile& mprofile = sobj->get_base_profiles (); if ((*i).int_id_->is_collocated (mprofile) == 0) @@ -1691,7 +1688,7 @@ CORBA_ORB::_get_collocated_servant (TAO_Stub *sobj) ++j) { const TAO_Profile* profile = mprofile.get_profile (j); - TAO_ObjectKey_var objkey = profile->_key (ACE_TRY_ENV); + TAO_ObjectKey_var objkey = profile->_key (); ACE_CHECK_RETURN (0); ACE_TRY @@ -1713,10 +1710,6 @@ CORBA_ORB::_get_collocated_servant (TAO_Stub *sobj) } else { - // @@ Fred&Ossama: how do we handle forwarding in this case? - // What happens if we are forwarded back to this ORB, or if a - // local stub is (or should) be forwarded to a remote one? - const TAO_MProfile& mprofile = sobj->get_base_profiles (); if (!this->orb_core_->is_collocated (mprofile)) return 0; @@ -1731,7 +1724,7 @@ CORBA_ORB::_get_collocated_servant (TAO_Stub *sobj) ++j) { const TAO_Profile* profile = mprofile.get_profile (j); - TAO_ObjectKey_var objkey = profile->_key (ACE_TRY_ENV); + TAO_ObjectKey_var objkey = profile->_key (); ACE_CHECK_RETURN (0); ACE_TRY_EX(LOCAL_ORB) diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index b0c938e5346..24ad8b5eb13 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1119,6 +1119,17 @@ TAO_ORB_Core::is_collocated (const TAO_MProfile& mprofile) if (this->acceptor_registry_ == 0) return 0; + // @@ Lots of issues arrise when dealing with collocation. What about + // forwarding or what if this is a multi-profile IOR where the order is + // significant and only one of the profiles is collocated. For example + // when using a multiple servers for fault tolerance. For now, we just + // look through all profiles and if any are colocated then we assume + // the object is collocated. + // @@ Note, if collocated we can not be forwarded! + // Also, acceptor_registry_->is_collocated (...) will check the + // address (ORB Host) but not the object_key. This should be checked + // also. + return this->acceptor_registry_->is_collocated (mprofile); } diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index 94289bc2c52..7feecd299ed 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -188,7 +188,7 @@ TAO_ObjectKey * CORBA::Object::_key (CORBA::Environment &env) { if (this->_stubobj () && this->_stubobj ()->profile_in_use ()) - return this->_stubobj ()->profile_in_use ()->_key (env); + return this->_stubobj ()->profile_in_use ()->_key (); ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Null stub obj!!!\n"), 0); } diff --git a/TAO/tao/Pluggable.cpp b/TAO/tao/Pluggable.cpp index 70464cde846..b4ed60f4ec4 100644 --- a/TAO/tao/Pluggable.cpp +++ b/TAO/tao/Pluggable.cpp @@ -127,12 +127,6 @@ TAO_Unknown_Profile::to_string (CORBA::Environment &) return 0; } -const TAO_opaque& -TAO_Unknown_Profile::body (void) const -{ - return this->body_; -} - int TAO_Unknown_Profile::decode (TAO_InputCDR& cdr) { @@ -157,9 +151,8 @@ TAO_Unknown_Profile::object_key (void) const } TAO_ObjectKey * -TAO_Unknown_Profile::_key (CORBA::Environment &) const +TAO_Unknown_Profile::_key (void) const { - // @@ THROW something??? return 0; } @@ -185,8 +178,8 @@ TAO_Unknown_Profile::hash (CORBA::ULong max, this->body_.length ()) % max); } -ASYS_TCHAR * -TAO_Unknown_Profile::addr_to_string(void) +int +TAO_Unknown_Profile::addr_to_string(char *buffer, size_t length) { return 0; } diff --git a/TAO/tao/Pluggable.h b/TAO/tao/Pluggable.h index 13edd52edac..92f6b6abc15 100644 --- a/TAO/tao/Pluggable.h +++ b/TAO/tao/Pluggable.h @@ -221,14 +221,6 @@ public: // Equality operator }; -// @@ Fred&Ossama: We need a *concrete* class (something that can be -// instantiated) that can be used to represent profiles for -// protocols we don't know. This is required in the spec because -// we are supposed to preserve foreign profiles when communicating -// with other ORBs. -// A simple class with noops for most methods and just the basics -// required for marshaling and demarshaling is what we need. -// class TAO_Export TAO_Profile { // = TITLE @@ -254,10 +246,6 @@ public: CORBA::ULong _decr_refcnt (void); // Decrement the object's reference count. When this count goes to // 0 this object will be deleted. - // @@ Fred&Ossama: guys, reference counting *should* be implemented - // in the base class, otherwise you are just going to end up - // repeating code and forcing the user to implement things not - // directly related to protocols. void forward_to (TAO_MProfile *mprofiles); // Keep a pointer to the forwarded profile @@ -274,19 +262,6 @@ public: // Return a string representation for this profile. client must // deallocate memory. - virtual const TAO_opaque &body (void) const = 0; - // The body, an octet sequence that represent the marshaled - // profile. - // @@ Fred: We have to think about this method: it basically - // requires the profile to keep both the <body> and the - // interpreted representation (as host/port/etc.) - // This is good for performance reasons, but it may consume - // too much memory, maybe a method like this: - // - // void body (TAO_opaque& return_body) const = 0; - // - // will work better. - virtual int decode (TAO_InputCDR& cdr) = 0; // Initialize this object using the given CDR octet string. @@ -299,7 +274,7 @@ public: TAO_ObjectKey &object_key (TAO_ObjectKey& objkey); // @@ deprecated. set the Object Key. - virtual TAO_ObjectKey *_key (CORBA::Environment &env) const = 0; + virtual TAO_ObjectKey *_key (void) const = 0; // Obtain the object key, return 0 if the profile cannot be parsed. // The memory is owned by the caller! @@ -313,9 +288,12 @@ public: CORBA::Environment &env) = 0; // Return a hash value for this object. - virtual ASYS_TCHAR *addr_to_string(void) = 0; - // Return a string representation for the address. - // @@ Fred: who owns the string returned? + virtual int addr_to_string(char *buffer, size_t length) = 0; + // Return a string representation for the address. Returns + // -1 if buffer is too small. The purpose of this method is to + // provide a general interface to the underlying address object's + // addr_to_string method. This allowsthe protocol implementor to + // select the appropriate string format. virtual void reset_hint (void) = 0; // This method is used with a connection has been reset requiring @@ -366,12 +344,12 @@ public: virtual int decode (TAO_InputCDR& cdr); virtual int encode (TAO_OutputCDR &stream) const; virtual const TAO_ObjectKey &object_key (void) const; - virtual TAO_ObjectKey *_key (CORBA::Environment &env) const; + virtual TAO_ObjectKey *_key (void) const; virtual CORBA::Boolean is_equivalent (TAO_Profile* other_profile, CORBA::Environment &env); virtual CORBA::ULong hash (CORBA::ULong max, CORBA::Environment &env); - virtual ASYS_TCHAR *addr_to_string(void); + virtual int addr_to_string(char *buffer, size_t length); virtual void reset_hint (void); private: diff --git a/TAO/tao/UIOP_Acceptor.cpp b/TAO/tao/UIOP_Acceptor.cpp index 27607d8d2c4..d78ad472da2 100644 --- a/TAO/tao/UIOP_Acceptor.cpp +++ b/TAO/tao/UIOP_Acceptor.cpp @@ -71,9 +71,7 @@ TAO_UIOP_Acceptor::is_collocated (const TAO_Profile* pfile) const TAO_UIOP_Profile *profile = ACE_dynamic_cast(const TAO_UIOP_Profile*, pfile); - // @@ We should probably cache this value, but then again some - // acceptors have multiple addresses. - // @@ Fred: any ideas on how to optimize that? + // for UNIX Files this is relatively cheap ACE_UNIX_Addr address; if (this->base_acceptor_.acceptor ().get_local_addr (address) == -1) return 0; diff --git a/TAO/tao/UIOP_Connector.cpp b/TAO/tao/UIOP_Connector.cpp index 000d501e8c9..f90d3c537c8 100644 --- a/TAO/tao/UIOP_Connector.cpp +++ b/TAO/tao/UIOP_Connector.cpp @@ -130,13 +130,16 @@ TAO_UIOP_Connector::connect (TAO_Profile *profile, oa) == -1) { // Give users a clue to the problem. if (TAO_orbdebug) - ACE_DEBUG ((LM_ERROR, "(%P|%t) %s:%u, connection to " - "%s failed (%p)\n", - __FILE__, - __LINE__, - profile->addr_to_string (), - "errno")); - + { + char buffer [MAXNAMELEN + 1]; + profile->addr_to_string (buffer, MAXNAMELEN); + ACE_DEBUG ((LM_ERROR, "(%P|%t) %s:%u, connection to " + "%s failed (%p)\n", + __FILE__, + __LINE__, + buffer, + "errno")); + } return -1; } diff --git a/TAO/tao/UIOP_Profile.cpp b/TAO/tao/UIOP_Profile.cpp index b8568dd8341..134a53d52f1 100644 --- a/TAO/tao/UIOP_Profile.cpp +++ b/TAO/tao/UIOP_Profile.cpp @@ -27,7 +27,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr& addr, const char *object_key) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (DEF_UIOP_MAJOR, DEF_UIOP_MINOR), object_key_ (), object_addr_ (addr), @@ -40,21 +39,18 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr& addr, for (int i = 0; i < l; ++i) this->object_key_[i] = object_key[i]; - this->create_body (); } TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr& addr, const TAO_ObjectKey& object_key) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (DEF_UIOP_MAJOR, DEF_UIOP_MINOR), object_key_ (object_key), object_addr_ (addr), hint_ (0) { this->set (addr); - this->create_body (); } TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr& addr, @@ -62,7 +58,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr& addr, const char *object_key) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (version), object_key_ (), object_addr_ (addr), @@ -75,7 +70,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr& addr, for (int i = 0; i < l; ++i) this->object_key_[i] = object_key[i]; - this->create_body (); } TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr& addr, @@ -83,21 +77,18 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr& addr, const TAO_ObjectKey& object_key) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (version), object_key_ (object_key), object_addr_ (addr), hint_ (0) { this->set (addr); - this->create_body (); } TAO_UIOP_Profile::TAO_UIOP_Profile (const char* rendezvous_point, const TAO_ObjectKey& object_key) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (DEF_UIOP_MAJOR, DEF_UIOP_MINOR), object_key_ (object_key), object_addr_ (rendezvous_point), @@ -111,7 +102,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const char* rendezvous_point, ACE_OS::strcpy (this->rendezvous_point_, rendezvous_point); } - this->create_body (); } TAO_UIOP_Profile::TAO_UIOP_Profile (const char* rendezvous_point, @@ -119,7 +109,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const char* rendezvous_point, const ACE_UNIX_Addr& addr) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (DEF_UIOP_MAJOR, DEF_UIOP_MINOR), object_key_ (object_key), object_addr_ (addr), @@ -133,7 +122,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const char* rendezvous_point, ACE_OS::strcpy (this->rendezvous_point_, rendezvous_point); } - this->create_body (); } TAO_UIOP_Profile::TAO_UIOP_Profile (const char* rendezvous_point, @@ -141,7 +129,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const char* rendezvous_point, const TAO_ObjectKey& object_key) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (DEF_UIOP_MAJOR, DEF_UIOP_MINOR), object_key_ (object_key), object_addr_ (rendezvous_point), @@ -153,13 +140,11 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const char* rendezvous_point, char[ACE_OS::strlen (rendezvous_point) + 1]); ACE_OS::strcpy (this->rendezvous_point_, rendezvous_point); - this->create_body (); } TAO_UIOP_Profile::TAO_UIOP_Profile (const TAO_UIOP_Profile *pfile) : TAO_Profile (pfile->tag ()), rendezvous_point_(0), - body_(pfile->body_), version_(pfile->version_), object_key_(pfile->object_key_), object_addr_(pfile->object_addr_), @@ -176,7 +161,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const TAO_UIOP_Profile *pfile) TAO_UIOP_Profile::TAO_UIOP_Profile (const TAO_UIOP_Profile &pfile) : TAO_Profile (pfile.tag ()), rendezvous_point_(0), - body_(pfile.body_), version_(pfile.version_), object_key_(pfile.object_key_), object_addr_(pfile.object_addr_), @@ -193,7 +177,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const TAO_UIOP_Profile &pfile) TAO_UIOP_Profile::TAO_UIOP_Profile (const TAO_IOP_Version &version) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (version), object_key_ (), object_addr_ (), @@ -205,7 +188,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const char *string, CORBA::Environment &env) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (DEF_UIOP_MAJOR, DEF_UIOP_MINOR), object_key_ (), object_addr_ (), @@ -217,7 +199,6 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const char *string, TAO_UIOP_Profile::TAO_UIOP_Profile (void) : TAO_Profile (TAO_IOP_TAG_UNIX_IOP), rendezvous_point_ (0), - body_ (), version_ (DEF_UIOP_MAJOR, DEF_UIOP_MINOR), object_key_ (), object_addr_ (), @@ -319,39 +300,6 @@ TAO_UIOP_Profile::parse_string (const char *string, return 1; } -// TAO_InputCDR cdr (body.get_buffer (), body.length (), body[0]); -// -// @@ -// CORBA::Boolean byte_order; -// cdr >> CORBA::Any::to_boolean (byte_order); -// cdr >> this->version_.major; -// cdr >> this->version_.minor; -// cdr >> this->rendezvous_point_; -// cdr >> this->object_key_; -// this->object_addr_.set (this->rendezvous_point_); -// } - -void -TAO_UIOP_Profile::create_body (void) -{ -} -// @@ -// TAO_OutputCDR cdr; -// cdr << TAO_ENCAP_BYTE_ORDER; -// cdr << this->version_.major; -// cdr << this->version_.minor; -// cdr << this->rendezvous_point_; -// cdr << this->object_key_; -// -// // Create a copy by making a temporary TAO_opaque object. -// // @@ TODO the CDR stream may contain several fragments, need to -// // merge them... -// this->body_ = TAO_opaque (cdr.length (), // length -// cdr.length (), // maximum -// cdr.buffer (), // buffer -// 0); // not own -// } - CORBA::Boolean TAO_UIOP_Profile::is_equivalent (TAO_Profile *other_profile, CORBA::Environment &env) @@ -397,13 +345,15 @@ TAO_UIOP_Profile::hash (CORBA::ULong max, return hashval % max; } -char * -TAO_UIOP_Profile::addr_to_string (void) +int +TAO_UIOP_Profile::addr_to_string (char *buffer, size_t length) { - static char s[MAXPATHLEN + 1]; - ACE_OS::sprintf (s, "%s", - this->rendezvous_point_); - return s; + if (length < (ACE_OS::strlen (rendezvous_point_) + 1)) + return -1; + + ACE_OS::strcpy (buffer, this->rendezvous_point_); + + return 0; } const char * diff --git a/TAO/tao/UIOP_Profile.h b/TAO/tao/UIOP_Profile.h index aa2db586572..c71dfc24b3f 100644 --- a/TAO/tao/UIOP_Profile.h +++ b/TAO/tao/UIOP_Profile.h @@ -118,9 +118,6 @@ public: // Return a string representation for this profile. // client must deallocate memory. - const TAO_opaque& body (void) const; - // Create UIOP_Profile Object from marshalled data. - int decode (TAO_InputCDR& cdr); // Initialize this object using the given CDR octet string. @@ -134,7 +131,7 @@ public: TAO_ObjectKey &object_key (TAO_ObjectKey& objkey); // @@ deprecated. set the Object Key. - TAO_ObjectKey *_key (CORBA::Environment &env) const; + TAO_ObjectKey *_key (void) const; // Return a pointer to the Object Key. CORBA::Boolean is_equivalent (TAO_Profile *other_profile, @@ -147,7 +144,7 @@ public: CORBA::Environment &env); // Return a hash value for this object. - char *addr_to_string (void); + int addr_to_string (char *buffer, size_t length); // Return a string representation for the address. const ACE_UNIX_Addr &object_addr (void) const; @@ -186,17 +183,11 @@ private: int set (const ACE_UNIX_Addr &addr); // helper method to set the UNIX_Addr. - void create_body (void); - // Does the work for <add_profile>. - private: char *rendezvous_point_; // String representing the rendezvous point. - TAO_opaque body_; - // Marshaled profile (CDR). - TAO_IOP_Version version_; // UIOP version number. diff --git a/TAO/tao/UIOP_Profile.i b/TAO/tao/UIOP_Profile.i index 2a69ed13cc8..84f86743705 100644 --- a/TAO/tao/UIOP_Profile.i +++ b/TAO/tao/UIOP_Profile.i @@ -17,17 +17,11 @@ TAO_UIOP_Profile::object_key (TAO_ObjectKey& objkey) } ACE_INLINE TAO_ObjectKey * -TAO_UIOP_Profile::_key (CORBA::Environment &) const +TAO_UIOP_Profile::_key (void) const { return new TAO_ObjectKey (this->object_key_); } -ACE_INLINE const TAO_opaque& -TAO_UIOP_Profile::body (void) const -{ - return this->body_; -} - ACE_INLINE const ACE_UNIX_Addr& TAO_UIOP_Profile::object_addr (void) const { diff --git a/TAO/tao/UIOP_Transport.h b/TAO/tao/UIOP_Transport.h index 1e0537fa791..98d4ecfe94f 100644 --- a/TAO/tao/UIOP_Transport.h +++ b/TAO/tao/UIOP_Transport.h @@ -38,7 +38,7 @@ class TAO_Export TAO_UIOP_Transport : public TAO_Transport // connection handler (handler_). // // = DESCRIPTION - // @@ Fred, please fill in here. + // Implements common IIOP methods for the Transport adaptor class. public: TAO_UIOP_Transport (TAO_UIOP_Handler_Base *handler, TAO_ORB_Core *orb_core); @@ -110,7 +110,7 @@ class TAO_Export TAO_UIOP_Client_Transport : public TAO_UIOP_Transport // server. // // = DESCRIPTION - // @@ Fred, please fill in here. + // Implements the methods specific to the client. public: TAO_UIOP_Client_Transport (TAO_UIOP_Client_Connection_Handler *handler, TAO_ORB_Core *orb_core); |