#include <UIOP_Profile.h>
Inheritance diagram for TAO_UIOP_Profile:
Public Member Functions | |
virtual char | object_key_delimiter (void) const |
TAO_UIOP_Profile (const ACE_UNIX_Addr &addr, const TAO::ObjectKey &object_key, const TAO_GIOP_Message_Version &version, TAO_ORB_Core *orb_core) | |
TAO_UIOP_Profile (const char *rendezvous_point, const TAO::ObjectKey &object_key, const ACE_UNIX_Addr &addr, const TAO_GIOP_Message_Version &version, TAO_ORB_Core *orb_core) | |
Profile constructor. | |
TAO_UIOP_Profile (TAO_ORB_Core *orb_core) | |
Profile constructor, default. | |
~TAO_UIOP_Profile (void) | |
Destructor is to be called only through . | |
virtual char * | to_string () |
Template methods. Please see Profile.h for documentation. | |
virtual int | encode_endpoints (void) |
virtual TAO_Endpoint * | endpoint (void) |
virtual CORBA::ULong | endpoint_count (void) const |
virtual CORBA::ULong | hash (CORBA::ULong max) |
void | add_endpoint (TAO_UIOP_Endpoint *endp) |
Static Public Member Functions | |
const char * | prefix (void) |
Return the char string prefix. | |
Static Public Attributes | |
const char | object_key_delimiter_ = '|' |
The object key delimiter that UIOP uses or expects. | |
Protected Member Functions | |
virtual int | decode_profile (TAO_InputCDR &cdr) |
virtual void | parse_string_i (const char *string) |
virtual void | create_profile_body (TAO_OutputCDR &cdr) const |
virtual int | decode_endpoints (void) |
virtual CORBA::Boolean | do_is_equivalent (const TAO_Profile *other_profile) |
Private Attributes | |
TAO_UIOP_Endpoint | endpoint_ |
CORBA::ULong | count_ |
Number of endpoints in the list headed by . |
This class defines the UIOP profile.
Definition at line 47 of file UIOP_Profile.h.
|
Profile constructor, same as above except the object_key has already been marshaled. (actually, no marshalling for this protocol) Definition at line 33 of file UIOP_Profile.cpp. References TAO_TAG_UIOP_PROFILE.
00037 : TAO_Profile (TAO_TAG_UIOP_PROFILE, 00038 orb_core, 00039 object_key, 00040 version), 00041 endpoint_ (addr), 00042 count_ (1) 00043 { 00044 } |
|
Profile constructor.
Definition at line 46 of file UIOP_Profile.cpp. References TAO_TAG_UIOP_PROFILE.
00051 : TAO_Profile (TAO_TAG_UIOP_PROFILE, 00052 orb_core, 00053 object_key, 00054 version), 00055 endpoint_ (addr), 00056 count_ (1) 00057 { 00058 } |
|
Profile constructor, default.
Definition at line 60 of file UIOP_Profile.cpp. References TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR, and TAO_TAG_UIOP_PROFILE.
00061 : TAO_Profile (TAO_TAG_UIOP_PROFILE, 00062 orb_core, 00063 TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, 00064 TAO_DEF_GIOP_MINOR)), 00065 endpoint_ (), 00066 count_ (1) 00067 { 00068 } |
|
Destructor is to be called only through .
Definition at line 70 of file UIOP_Profile.cpp. References endpoint(), and TAO_Endpoint::next().
00071 { 00072 // Clean up the list of endpoints since we own it. 00073 // Skip the head, since it is not dynamically allocated. 00074 TAO_Endpoint *tmp = 0; 00075 00076 for (TAO_Endpoint *next = this->endpoint ()->next (); 00077 next != 0; 00078 next = tmp) 00079 { 00080 tmp = next->next (); 00081 delete next; 00082 } 00083 } |
|
Add to this profile's list of endpoints (it is inserted next to the head of the list). This profiles takes ownership of . Definition at line 236 of file UIOP_Profile.cpp. References TAO_UIOP_Endpoint::next_. Referenced by TAO_UIOP_Acceptor::create_shared_profile(), and decode_endpoints().
|
|
Implements TAO_Profile. Definition at line 320 of file UIOP_Profile.cpp. References ACE_ERROR, TAO_Tagged_Components::encode(), LM_ERROR, TAO_GIOP_Message_Version::major, TAO_GIOP_Message_Version::minor, TAO::Refcounted_ObjectKey::object_key(), TAO_Profile::tagged_components(), TAO_ENCAP_BYTE_ORDER, ACE_OutputCDR::write_octet(), and ACE_OutputCDR::write_string().
00321 { 00322 // CHAR describing byte order, starting the encapsulation 00323 encap.write_octet (TAO_ENCAP_BYTE_ORDER); 00324 00325 // The GIOP version 00326 encap.write_octet (this->version_.major); 00327 encap.write_octet (this->version_.minor); 00328 00329 // STRING rendezvous_pointname from profile 00330 encap.write_string (this->endpoint_.rendezvous_point ()); 00331 00332 // OCTET SEQUENCE for object key 00333 if (this->ref_object_key_) 00334 encap << this->ref_object_key_->object_key (); 00335 else 00336 { 00337 ACE_ERROR ((LM_ERROR, 00338 "(%P|%t) TAO - UIOP_Profile::create_profile_body " 00339 "no object key marshalled \n")); 00340 } 00341 00342 if (this->version_.major > 1 00343 || this->version_.minor > 0) 00344 this->tagged_components ().encode (encap); 00345 } |
|
Implements TAO_Profile. Definition at line 383 of file UIOP_Profile.cpp. References ACE_DEBUG, ACE_NEW_RETURN, ACE_TEXT, add_endpoint(), IOP::TaggedComponent::component_data, TAO::unbounded_value_sequence< T >::get_buffer(), TAO_Tagged_Components::get_component(), TAO::unbounded_value_sequence< TAO_UIOP_Endpoint_Info >::length(), TAO::unbounded_value_sequence< T >::length(), LM_DEBUG, TAO_UIOP_Endpoint::object_addr_, TAO_Endpoint::priority(), ACE_InputCDR::reset_byte_order(), ACE_UNIX_Addr::set(), IOP::TaggedComponent::tag, and TAO_debug_level.
00384 { 00385 IOP::TaggedComponent tagged_component; 00386 tagged_component.tag = TAO_TAG_ENDPOINTS; 00387 00388 if (this->tagged_components_.get_component (tagged_component)) 00389 { 00390 const CORBA::Octet *buf = 00391 tagged_component.component_data.get_buffer (); 00392 00393 TAO_InputCDR in_cdr (reinterpret_cast <const char*>(buf), 00394 tagged_component.component_data.length ()); 00395 00396 // Extract the Byte Order. 00397 CORBA::Boolean byte_order; 00398 if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) 00399 return -1; 00400 in_cdr.reset_byte_order (static_cast<int>(byte_order)); 00401 00402 // Extract endpoints sequence. 00403 TAO_UIOPEndpointSequence endpoints; 00404 00405 if ((in_cdr >> endpoints) == 0) 00406 return -1; 00407 00408 // Get the priority of the first endpoint (head of the list. 00409 // It's other data is extracted as part of the standard profile 00410 // decoding. 00411 this->endpoint_.priority (endpoints[0].priority); 00412 00413 // Use information extracted from the tagged component to 00414 // populate the profile. Skip the first endpoint, since it is 00415 // always extracted through standard profile body. Also, begin 00416 // from the end of the sequence to preserve endpoint order, 00417 // since <add_endpoint> method reverses the order of endpoints 00418 // in the list. 00419 for (CORBA::ULong i = endpoints.length () - 1; 00420 i > 0; 00421 --i) 00422 { 00423 TAO_UIOP_Endpoint *endpoint = 0; 00424 ACE_NEW_RETURN (endpoint, 00425 TAO_UIOP_Endpoint, 00426 -1); 00427 this->add_endpoint (endpoint); 00428 if (endpoint->object_addr_.set 00429 (endpoints[i].rendezvous_point) 00430 == -1) 00431 { 00432 // In the case of an ACE_UNIX_Addr, this should call should 00433 // never fail! 00434 // If the call fails, allow the profile to be created, and rely 00435 // on TAO's connection handling to throw the appropriate 00436 // exception. 00437 if (TAO_debug_level > 0) 00438 { 00439 ACE_DEBUG ((LM_DEBUG, 00440 ACE_TEXT ("TAO (%P|%t) UIOP_Profile::decode_endpoints - ") 00441 ACE_TEXT ("ACE_UNIX_Addr::set() failed\n"))); 00442 } 00443 00444 } 00445 endpoint->priority (endpoints[i].priority); 00446 } 00447 } 00448 00449 return 0; 00450 } |
|
Protected template methods. Please see documentation in Profile.h for details. Implements TAO_Profile. Definition at line 286 of file UIOP_Profile.cpp. References ACE_DEBUG, ACE_TEXT, LM_DEBUG, TAO_UIOP_Endpoint::object_addr_, ACE_InputCDR::read_string(), ACE_UNIX_Addr::set(), and TAO_debug_level.
00287 { 00288 char *rendezvous = 0; 00289 00290 // Get rendezvous_point 00291 if (cdr.read_string (rendezvous) == 0) 00292 { 00293 ACE_DEBUG ((LM_DEBUG, "error decoding UIOP rendezvous_point")); 00294 return -1; 00295 } 00296 00297 if (this->endpoint_.object_addr_.set (rendezvous) == -1) 00298 { 00299 // In the case of an ACE_UNIX_Addr, this should call should 00300 // never fail! 00301 // 00302 // If the call fails, allow the profile to be created, and rely 00303 // on TAO's connection handling to throw the appropriate 00304 // exception. 00305 if (TAO_debug_level > 0) 00306 { 00307 ACE_DEBUG ((LM_DEBUG, 00308 ACE_TEXT ("TAO (%P|%t) UIOP_Profile::decode - ") 00309 ACE_TEXT ("ACE_UNIX_Addr::set() failed\n"))); 00310 } 00311 } 00312 00313 // Clean up 00314 delete [] rendezvous; 00315 00316 return 1; 00317 } |
|
Implements TAO_Profile. Definition at line 182 of file UIOP_Profile.cpp. References endpoint_, TAO_UIOP_Endpoint::is_equivalent(), and TAO_UIOP_Endpoint::next_.
00183 { 00184 const TAO_UIOP_Profile *op = 00185 dynamic_cast <const TAO_UIOP_Profile *> (other_profile); 00186 00187 if (op == 0) 00188 return 0; 00189 00190 // Check endpoints equivalence. 00191 const TAO_UIOP_Endpoint *other_endp = &op->endpoint_; 00192 for (TAO_UIOP_Endpoint *endp = &this->endpoint_; 00193 endp != 0; 00194 endp = endp->next_) 00195 { 00196 if (endp->is_equivalent (other_endp)) 00197 other_endp = other_endp->next_; 00198 else 00199 return 0; 00200 } 00201 00202 return 1; 00203 } |
|
Implements TAO_Profile. Definition at line 348 of file UIOP_Profile.cpp. References TAO::unbounded_value_sequence< TAO_UIOP_Endpoint_Info >::length(), TAO_UIOP_Endpoint::next_, TAO_Endpoint::priority(), TAO_UIOP_Endpoint::rendezvous_point(), TAO_Profile::set_tagged_components(), and TAO_ENCAP_BYTE_ORDER.
00349 { 00350 // Create a data structure and fill it with endpoint info for wire 00351 // transfer. 00352 // We include information for the head of the list 00353 // together with other endpoints because even though its addressing 00354 // info is transmitted using standard ProfileBody components, its 00355 // priority is not! 00356 TAO_UIOPEndpointSequence endpoints; 00357 endpoints.length (this->count_); 00358 00359 TAO_UIOP_Endpoint *endpoint = &this->endpoint_; 00360 for (size_t i = 0; 00361 i < this->count_; 00362 ++i) 00363 { 00364 endpoints[i].rendezvous_point = endpoint->rendezvous_point (); 00365 endpoints[i].priority = endpoint->priority (); 00366 00367 endpoint = endpoint->next_; 00368 } 00369 00370 // Encode the data structure. 00371 TAO_OutputCDR out_cdr; 00372 if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) 00373 == 0) 00374 || (out_cdr << endpoints) == 0) 00375 return -1; 00376 00377 this->set_tagged_components (out_cdr); 00378 00379 return 0; 00380 } |
|
Implements TAO_Profile. Definition at line 86 of file UIOP_Profile.cpp. Referenced by TAO_UIOP_Acceptor::create_new_profile(), and ~TAO_UIOP_Profile().
00087 { 00088 return &this->endpoint_; 00089 } |
|
Implements TAO_Profile. Definition at line 92 of file UIOP_Profile.cpp.
00093 { 00094 return this->count_; 00095 } |
|
Implements TAO_Profile. Definition at line 206 of file UIOP_Profile.cpp. References TAO_UIOP_Endpoint::hash(), TAO_Profile::hash_service_i(), TAO::unbounded_value_sequence< T >::length(), TAO_GIOP_Message_Version::minor, TAO_UIOP_Endpoint::next_, TAO::Refcounted_ObjectKey::object_key(), and TAO_Profile::tag().
00208 { 00209 // Get the hashvalue for all endpoints. 00210 CORBA::ULong hashval = 0; 00211 for (TAO_UIOP_Endpoint *endp = &this->endpoint_; 00212 endp != 0; 00213 endp = endp->next_) 00214 { 00215 hashval += endp->hash (); 00216 } 00217 00218 hashval += this->version_.minor; 00219 hashval += this->tag (); 00220 00221 const TAO::ObjectKey &ok = 00222 this->ref_object_key_->object_key (); 00223 00224 if (ok.length () >= 4) 00225 { 00226 hashval += ok[1]; 00227 hashval += ok[3]; 00228 } 00229 00230 hashval += this->hash_service_i (max); 00231 00232 return hashval % max; 00233 } |
|
Implements TAO_Profile. Definition at line 28 of file UIOP_Profile.cpp. References object_key_delimiter_.
00029 { 00030 return TAO_UIOP_Profile::object_key_delimiter_; 00031 } |
|
Implements TAO_Profile. Definition at line 98 of file UIOP_Profile.cpp. References ACE_THROW, TAO::ObjectKey_Table::bind(), TAO::ObjectKey::decode_string_to_sequence(), TAO_GIOP_Message_Version::major, TAO_GIOP_Message_Version::minor, TAO_UIOP_Endpoint::object_addr_, TAO_ORB_Core::object_key_table(), TAO_Profile::orb_core(), ACE_UNIX_Addr::set(), TAO_GIOP_Message_Version::set_version(), ACE_OS::strchr(), CORBA::string_alloc(), ACE_OS::strncpy(), TAO_DEF_GIOP_MAJOR, and TAO_DEF_GIOP_MINOR.
00100 { 00101 if (!string || !*string) 00102 { 00103 ACE_THROW (CORBA::INV_OBJREF ( 00104 CORBA::SystemException::_tao_minor_code ( 00105 0, 00106 EINVAL), 00107 CORBA::COMPLETED_NO)); 00108 } 00109 00110 // Remove the "N.n@" version prefix, if it exists, and verify the 00111 // version is one that we accept. 00112 00113 // Check for version 00114 if (isdigit (string [0]) && 00115 string[1] == '.' && 00116 isdigit (string [2]) && 00117 string[3] == '@') 00118 { 00119 // @@ This may fail for non-ascii character sets [but take that 00120 // with a grain of salt] 00121 this->version_.set_version ((char) (string [0] - '0'), 00122 (char) (string [2] - '0')); 00123 string += 4; 00124 // Skip over the "N.n@" 00125 } 00126 00127 if (this->version_.major != TAO_DEF_GIOP_MAJOR || 00128 this->version_.minor > TAO_DEF_GIOP_MINOR) 00129 { 00130 ACE_THROW (CORBA::INV_OBJREF ( 00131 CORBA::SystemException::_tao_minor_code ( 00132 0, 00133 EINVAL), 00134 CORBA::COMPLETED_NO)); 00135 } 00136 00137 00138 // Pull off the "rendezvous point" part of the objref 00139 // Copy the string because we are going to modify it... 00140 CORBA::String_var copy (string); 00141 00142 char *start = copy.inout (); 00143 char *cp = ACE_OS::strchr (start, this->object_key_delimiter_); 00144 00145 if (cp == 0) 00146 { 00147 ACE_THROW (CORBA::INV_OBJREF ( 00148 CORBA::SystemException::_tao_minor_code ( 00149 TAO::VMCID, 00150 EINVAL), 00151 CORBA::COMPLETED_NO)); 00152 // No rendezvous point specified 00153 } 00154 00155 CORBA::ULong length = cp - start; 00156 00157 CORBA::String_var rendezvous = CORBA::string_alloc (length); 00158 00159 ACE_OS::strncpy (rendezvous.inout (), start, length); 00160 rendezvous[length] = '\0'; 00161 00162 if (this->endpoint_.object_addr_.set (rendezvous.in ()) != 0) 00163 { 00164 ACE_THROW (CORBA::INV_OBJREF ( 00165 CORBA::SystemException::_tao_minor_code ( 00166 TAO::VMCID, 00167 EINVAL), 00168 CORBA::COMPLETED_NO)); 00169 } 00170 00171 start = ++cp; // increment past the object key separator 00172 00173 TAO::ObjectKey ok; 00174 TAO::ObjectKey::decode_string_to_sequence (ok, 00175 start); 00176 00177 (void) this->orb_core ()->object_key_table ().bind (ok, 00178 this->ref_object_key_); 00179 } |
|
Return the char string prefix.
Definition at line 280 of file UIOP_Profile.cpp.
00281 { 00282 return ::prefix_; 00283 } |
|
Template methods. Please see Profile.h for documentation.
Implements TAO_Profile. Definition at line 246 of file UIOP_Profile.cpp. References TAO::ObjectKey::encode_sequence_to_string(), TAO::Refcounted_ObjectKey::object_key(), object_key_delimiter_, prefix_, ACE_OS::sprintf(), CORBA::string_alloc(), and ACE_OS::strlen().
00247 { 00248 CORBA::String_var key; 00249 TAO::ObjectKey::encode_sequence_to_string (key.inout(), 00250 this->ref_object_key_->object_key ()); 00251 00252 u_int buflen = (8 /* "corbaloc" */ + 00253 1 /* colon separator */ + 00254 ACE_OS::strlen (::prefix_) + 00255 1 /* colon separator */ + 00256 1 /* major version */ + 00257 1 /* decimal point */ + 00258 1 /* minor version */ + 00259 1 /* `@' character */ + 00260 ACE_OS::strlen (this->endpoint_.rendezvous_point ()) + 00261 1 /* object key separator */ + 00262 ACE_OS::strlen (key.in ())); 00263 00264 char * buf = CORBA::string_alloc (buflen); 00265 00266 static const char digits [] = "0123456789"; 00267 00268 ACE_OS::sprintf (buf, 00269 "corbaloc:%s:%c.%c@%s%c%s", 00270 ::prefix_, 00271 digits [this->version_.major], 00272 digits [this->version_.minor], 00273 this->endpoint_.rendezvous_point (), 00274 this->object_key_delimiter_, 00275 key.in ()); 00276 return buf; 00277 } |
|
Number of endpoints in the list headed by .
Definition at line 121 of file UIOP_Profile.h. |
|
Head of this profile's list of endpoints. This endpoint is not dynamically allocated because a profile always contains at least one endpoint. Currently, a profile contains more than one endpoint, i.e., list contains more than just the head, only when RTCORBA is enabled. However, in the near future, this will be used in nonRT mode as well, e.g., to support a la TAG_ALTERNATE_IIOP_ADDRESS feature. Addressing info of the default endpoint, i.e., head of the list, is transmitted using standard UIOP ProfileBody components. See method documentation above for how the rest of the endpoint list is transmitted. Definition at line 118 of file UIOP_Profile.h. Referenced by do_is_equivalent(). |
|
The object key delimiter that UIOP uses or expects.
Definition at line 25 of file UIOP_Profile.cpp. Referenced by object_key_delimiter(), and to_string(). |