Defines the Profile interface. More...
#include <Profile.h>


Public Member Functions | |
| TAO_Profile (CORBA::ULong tag, TAO_ORB_Core *orb_core, const TAO_GIOP_Message_Version &version) | |
| Constructor. | |
Non virtual methods for the profile classes. | |
| CORBA::ULong | tag (void) const |
| The tag, each concrete class will have a specific tag value. | |
| const TAO_GIOP_Message_Version & | version (void) const |
| TAO_ORB_Core * | orb_core (void) const |
| Get a pointer to the TAO_ORB_Core. | |
| unsigned long | _incr_refcnt (void) |
| Increase the reference count by one on this object. | |
| unsigned long | _decr_refcnt (void) |
| void | forward_to (TAO_MProfile *mprofiles) |
| Keep a pointer to the forwarded profile. | |
| TAO_MProfile * | forward_to (void) |
| MProfile accessor. | |
| const TAO_Tagged_Components & | tagged_components (void) const |
| TAO_Tagged_Components & | tagged_components (void) |
| The tag, each concrete class will have a specific tag value. | |
| void | add_tagged_component (const IOP::TaggedComponent &component) |
| Add the given tagged component to the profile. | |
| CORBA::Short | addressing_mode (void) const |
| const TAO::ObjectKey & | object_key (void) const |
| TAO::ObjectKey * | _key (void) const |
Template methods that needs to be implemented by the | |
| virtual int | encode (TAO_OutputCDR &stream) const |
| Encode this profile in a stream, i.e. marshal it. | |
| virtual int | decode (TAO_InputCDR &cdr) |
| Initialize this object using the given CDR octet string. | |
| IOP::TaggedProfile * | create_tagged_profile (void) |
| virtual void | policies (CORBA::PolicyList *policy_list) |
| virtual void | get_policies (CORBA::PolicyList &policy_list) |
| Accessor for the client exposed policies of this profile. | |
| virtual int | supports_multicast (void) const |
| Returns true if this profile can specify multicast endpoints. | |
| virtual bool | supports_non_blocking_oneways (void) const |
| Returns true if this profile supports non blocking oneways. | |
| virtual void | addressing_mode (CORBA::Short addr_mode) |
| virtual char | object_key_delimiter (void) const =0 |
| The object key delimiter. | |
| virtual void | parse_string (const char *string) |
| virtual char * | to_string (void)=0 |
| virtual int | encode_endpoints (void)=0 |
| virtual int | encode_alternate_endpoints (void) |
| virtual TAO_Endpoint * | endpoint (void)=0 |
| virtual TAO_Endpoint * | base_endpoint (void) |
| virtual CORBA::ULong | endpoint_count (void) const =0 |
| Return how many endpoints this profile contains. | |
| TAO_Endpoint * | first_filtered_endpoint (void) |
| TAO_Endpoint * | next_filtered_endpoint (TAO_Endpoint *source) |
| virtual void | remove_generic_endpoint (TAO_Endpoint *ep) |
| virtual void | add_generic_endpoint (TAO_Endpoint *ep) |
| Add a protocol-agnostic endpoint. | |
| CORBA::Boolean | is_equivalent (const TAO_Profile *other_profile) |
| Verify profile equivalance. | |
| CORBA::Boolean | compare_key (const TAO_Profile *other) const |
| virtual CORBA::ULong | hash (CORBA::ULong max)=0 |
| Return a hash value for this object. | |
Protected Member Functions | |
| virtual | ~TAO_Profile (void) |
| If you have a virtual method you need a virtual dtor. | |
| TAO_Profile (CORBA::ULong tag, TAO_ORB_Core *orb_core, const TAO::ObjectKey &key, const TAO_GIOP_Message_Version &version) | |
| To be used by inherited classes. | |
| void | set_tagged_components (TAO_OutputCDR &cdr) |
| virtual CORBA::Boolean | do_is_equivalent (const TAO_Profile *other)=0 |
| Profile equivalence template method invoked on subclasses. | |
| virtual TAO_Service_Callbacks::Profile_Equivalence | is_equivalent_hook (const TAO_Profile *other) |
| Allow services to apply their own definition of "equivalence.". | |
| CORBA::ULong | hash_service_i (CORBA::ULong m) |
Protected template methods. | |
| virtual int | decode_profile (TAO_InputCDR &cdr)=0 |
| Decode the protocol specific profile details. | |
| virtual void | create_profile_body (TAO_OutputCDR &cdr) const =0 |
| Creates an encapsulation of the ProfileBody struct in the cdr. | |
| virtual int | decode_endpoints (void)=0 |
| virtual void | parse_string_i (const char *string)=0 |
| Protocol specific implementation of parse_string (). | |
Protected Attributes | |
| TAO_GIOP_Message_Version | version_ |
| IIOP version number. | |
| TAO_Tagged_Components | tagged_components_ |
| The tagged components. | |
| CORBA::Boolean | are_policies_parsed_ |
| CORBA::Short | addressing_mode_ |
| IOP::TaggedProfile * | tagged_profile_ |
| Our tagged profile. | |
| TAO::Refcounted_ObjectKey * | ref_object_key_ |
| Object_key associated with this profile. | |
Private Member Functions | |
| TAO_MProfile * | forward_to_i (void) |
| This object keeps ownership of this object. | |
| void | verify_orb_configuration (void) |
| void | verify_profile_version (void) |
| TAO_Profile (const TAO_Profile &) | |
| void | operator= (const TAO_Profile &) |
Private Attributes | |
| CORBA::ULong const | tag_ |
| IOP protocol tag. | |
| TAO_ORB_Core *const | orb_core_ |
| Pointer to the ORB core. | |
| TAO_MProfile * | forward_to_ |
| TAO_Configurable_Refcount | refcount_ |
| Number of outstanding references to this object. | |
| TAO_SYNCH_MUTEX | tagged_profile_lock_ |
| A lock that protects creation of the tagged profile. | |
| bool | tagged_profile_created_ |
Defines the Profile interface.
An abstract base class for representing object location information. This is based on the CORBA IOR definitions.
Definition at line 54 of file Profile.h.
| TAO_Profile::TAO_Profile | ( | CORBA::ULong | tag, | |
| TAO_ORB_Core * | orb_core, | |||
| const TAO_GIOP_Message_Version & | version | |||
| ) |
Constructor.
Definition at line 53 of file Profile.cpp.
00056 : version_ (version) 00057 , are_policies_parsed_ (false) 00058 , addressing_mode_ (0) 00059 , tagged_profile_ (0) 00060 , ref_object_key_ (0) 00061 , tag_ (tag) 00062 , orb_core_ (orb_core) 00063 , forward_to_ (0) 00064 , refcount_ (this->orb_core_-> 00065 client_factory ()->create_profile_refcount ()) 00066 , tagged_profile_lock_ () 00067 , tagged_profile_created_ (false) 00068 { 00069 }
| TAO_Profile::~TAO_Profile | ( | void | ) | [protected, virtual] |
If you have a virtual method you need a virtual dtor.
Definition at line 71 of file Profile.cpp.
00072 { 00073 if (this->tagged_profile_) 00074 { 00075 delete this->tagged_profile_; 00076 } 00077 00078 this->orb_core_->object_key_table ().unbind (this->ref_object_key_); 00079 00080 //@@ TAO_PROFILE_SPL_DESTRUCTOR_ADD_HOOK 00081 }
| TAO_Profile::TAO_Profile | ( | CORBA::ULong | tag, | |
| TAO_ORB_Core * | orb_core, | |||
| const TAO::ObjectKey & | key, | |||
| const TAO_GIOP_Message_Version & | version | |||
| ) | [protected] |
To be used by inherited classes.
| TAO_Profile::TAO_Profile | ( | const TAO_Profile & | ) | [private] |
| unsigned long TAO_Profile::_decr_refcnt | ( | void | ) |
Decrement the object's reference count. When this count goes to 0 this object will be deleted.
Definition at line 74 of file Profile.inl.
| unsigned long TAO_Profile::_incr_refcnt | ( | void | ) |
Increase the reference count by one on this object.
Definition at line 68 of file Profile.inl.
| TAO::ObjectKey * TAO_Profile::_key | ( | void | ) | const |
Obtain the object key, return 0 if the profile cannot be parsed. The memory is owned by the caller!
Reimplemented in TAO_Unknown_Profile.
Definition at line 108 of file Profile.cpp.
00109 { 00110 TAO::ObjectKey *key = 0; 00111 00112 if (this->ref_object_key_) 00113 { 00114 ACE_NEW_RETURN (key, 00115 TAO::ObjectKey (this->ref_object_key_->object_key ()), 00116 0); 00117 } 00118 return key; 00119 }
| void TAO_Profile::add_generic_endpoint | ( | TAO_Endpoint * | ep | ) | [virtual] |
Add a protocol-agnostic endpoint.
Definition at line 724 of file Profile.cpp.
| void TAO_Profile::add_tagged_component | ( | const IOP::TaggedComponent & | component | ) |
Add the given tagged component to the profile.
Definition at line 84 of file Profile.cpp.
00085 { 00086 // Sanity checks. 00087 this->verify_orb_configuration (); 00088 00089 this->verify_profile_version (); 00090 00091 // ---------------------------------------------------------------- 00092 00093 // Add the given tagged component to this profile. 00094 // 00095 // Note that multiple tagged profiles with the same tag value may be 00096 // added, unless the tagged component is known to be unique by TAO. 00097 this->tagged_components_.set_component (component); 00098 }
| void TAO_Profile::addressing_mode | ( | CORBA::Short | addr_mode | ) | [virtual] |
Set the addressing mode if a remote servant replies with an addressing mode exception. If this profile doesn't support a particular addressing mode, this method needs to be overridden signal the appropriate error.
** RACE CONDITION NOTE **
Currently, getting and setting the addressing mode is not protected by a mutex. Theoretically, this could cause a race condition if one thread sends a request, then gets an exception from the remote servant to change the addressing mode, and then another thread sends a different request to the same servant using the wrong addressing mode. The result of this is that we'll get another address change exception. (Annoying, but not that bad.)
In practice at the current time, the above theoretical case never happens since the target specification always uses the object key except for MIOP requests. Remote ORBs can't respond to MIOP requests even to send exceptions, so even in this case, the race condition can't happen.
Therefore, for the time being, there is no lock to protect the addressing mode. Given that the addressing mode is checked in the critical path, this decision seems like a good thing.
Definition at line 605 of file Profile.cpp.
00606 { 00607 // ** See race condition note about addressing mode in Profile.h ** 00608 switch (addr) 00609 { 00610 case TAO_Target_Specification::Key_Addr: 00611 case TAO_Target_Specification::Profile_Addr: 00612 case TAO_Target_Specification::Reference_Addr: 00613 this->addressing_mode_ = addr; 00614 break; 00615 00616 default: 00617 throw ::CORBA::BAD_PARAM ( 00618 CORBA::SystemException::_tao_minor_code ( 00619 0, 00620 EINVAL), 00621 CORBA::COMPLETED_NO); 00622 } 00623 }
| CORBA::Short TAO_Profile::addressing_mode | ( | void | ) | const |
Return the current addressing mode for this profile. In almost all cases, this is TAO_Target_Specification::Key_Addr.
Definition at line 56 of file Profile.inl.
00057 { 00058 return this->addressing_mode_; 00059 }
| TAO_Endpoint * TAO_Profile::base_endpoint | ( | void | ) | [virtual] |
Return a pointer to this profile's endpoint. If the most derived profile type uses an endpoint that is a type that does not derive from the endpoint type of the base profile, then this method returns the base type's endpoint. For example, SSLIOP_Profile derives from IIOP_Profile, but SSLIOP_Endpoint does not derive from IIOP_Endpoint. Because SSLIOP is tagged the same as IIOP, this method is required to facilitate the Endpoint Policy's filtering function. The default implementation of base_endpoint simply returns endpoint.
Definition at line 102 of file Profile.cpp.
00103 { 00104 return this->endpoint(); 00105 }
| CORBA::Boolean TAO_Profile::compare_key | ( | const TAO_Profile * | other | ) | const |
Compare the object key for this profile with that of another. This is weaker than is_equivalent
Definition at line 699 of file Profile.cpp.
00700 { 00701 return (this->ref_object_key_ == other->ref_object_key_) || 00702 ((this->ref_object_key_ != 0 && 00703 other->ref_object_key_ != 0 && 00704 this->ref_object_key_->object_key() == 00705 other->ref_object_key_->object_key())); 00706 }
| virtual void TAO_Profile::create_profile_body | ( | TAO_OutputCDR & | cdr | ) | const [protected, pure virtual] |
Creates an encapsulation of the ProfileBody struct in the cdr.
Implemented in TAO_Unknown_Profile.
| IOP::TaggedProfile * TAO_Profile::create_tagged_profile | ( | void | ) |
This method is used to get the IOP::TaggedProfile. The profile information that is received from the server side would have already been decoded. So this method will just make a IOP::TaggedProfile struct from the existing information and return the reference to that. This method is necessary for GIOP 1.2.
Definition at line 248 of file Profile.cpp.
00249 { 00250 if (this->tagged_profile_created_) 00251 return this->tagged_profile_; 00252 00253 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00254 guard, 00255 this->tagged_profile_lock_, 00256 this->tagged_profile_); 00257 00258 // .. DCL 00259 if (!this->tagged_profile_created_) 00260 { 00261 ACE_NEW_RETURN (this->tagged_profile_, 00262 IOP::TaggedProfile, 00263 0); 00264 00265 // As we have not created we will now create the TaggedProfile 00266 this->tagged_profile_->tag = this->tag_; 00267 00268 // Create the encapsulation.... 00269 TAO_OutputCDR encap (ACE_DEFAULT_CDR_BUFSIZE, 00270 TAO_ENCAP_BYTE_ORDER, 00271 this->orb_core ()->output_cdr_buffer_allocator (), 00272 this->orb_core ()->output_cdr_dblock_allocator (), 00273 this->orb_core ()->output_cdr_msgblock_allocator (), 00274 this->orb_core ()->orb_params ()->cdr_memcpy_tradeoff (), 00275 TAO_DEF_GIOP_MAJOR, 00276 TAO_DEF_GIOP_MINOR); 00277 00278 // Create the profile body 00279 this->create_profile_body (encap); 00280 00281 CORBA::ULong const length = 00282 static_cast <CORBA::ULong> (encap.total_length ()); 00283 00284 #if (TAO_NO_COPY_OCTET_SEQUENCES == 1) 00285 // Place the message block in to the Sequence of Octets that we 00286 // have 00287 this->tagged_profile_->profile_data.replace (length, encap.begin ()); 00288 #else 00289 this->tagged_profile_->profile_data.length (length); 00290 CORBA::Octet *buffer = 00291 this->tagged_profile_->profile_data.get_buffer (); 00292 00293 for (const ACE_Message_Block *i = encap.begin (); 00294 i != encap.end (); 00295 i = i->next ()) 00296 { 00297 ACE_OS::memcpy (buffer, i->rd_ptr (), i->length ()); 00298 buffer += i->length (); 00299 } 00300 #endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ 00301 00302 this->tagged_profile_created_ = true; 00303 } 00304 00305 return this->tagged_profile_; 00306 }
| int TAO_Profile::decode | ( | TAO_InputCDR & | cdr | ) | [virtual] |
Initialize this object using the given CDR octet string.
Reimplemented in TAO_Unknown_Profile.
Definition at line 156 of file Profile.cpp.
00157 { 00158 #if !defined (ACE_NLOGGING) 00159 size_t const encap_len = cdr.length (); 00160 #endif 00161 00162 // Read and verify major, minor versions, ignoring profiles 00163 // whose versions we don't understand. 00164 if (!(cdr.read_octet (this->version_.major) 00165 && this->version_.major == TAO_DEF_GIOP_MAJOR 00166 && cdr.read_octet (this->version_.minor) 00167 && this->version_.minor <= TAO_DEF_GIOP_MINOR)) 00168 { 00169 if (TAO_debug_level > 0) 00170 { 00171 ACE_DEBUG ((LM_DEBUG, 00172 ACE_TEXT ("TAO (%P|%t) - Profile::decode - v%d.%d\n"), 00173 this->version_.major, 00174 this->version_.minor)); 00175 } 00176 00177 return -1; 00178 } 00179 00180 // Transport specific details 00181 if (this->decode_profile (cdr) < 0) 00182 { 00183 return -1; 00184 } 00185 00186 // @@NOTE: This place *may* need strategizing. Here are the 00187 // issues. Placing the ObjectKey in the table adds an allocation and 00188 // a lock while decoding. This is bad for some cases especially if 00189 // the application is marshalling object references across to the 00190 // server end. But the server could use "lazy" evaluation and avoid 00191 // this during marshalling. 00192 // 00193 // The only place this will get important is when a thead tries to 00194 // use the object reference to create a CORBA object to make an 00195 // invocation. Since creation of a CORBA object itself is expensive, 00196 // it looks like we may not need to worry much. 00197 // 00198 // Remember strategizing needs reconciliation of forces imposed 00199 // by runtime memory growth. Doing a random strategization would 00200 // destroy the wins in runtime memory growth got by using this 00201 // table scheme. 00202 TAO::ObjectKey ok; 00203 00204 // ... and object key. 00205 if (TAO::ObjectKey::demarshal_key (ok, cdr) == 0) 00206 { 00207 return -1; 00208 } 00209 00210 TAO::ObjectKey_Table &okt = this->orb_core ()->object_key_table (); 00211 00212 if (okt.bind (ok, this->ref_object_key_) == -1) 00213 { 00214 return -1; 00215 } 00216 00217 // Tagged Components *only* exist after version 1.0! 00218 // For GIOP 1.2, IIOP and GIOP have same version numbers! 00219 if (this->version_.major > 1 || this->version_.minor > 0) 00220 { 00221 if (this->tagged_components_.decode (cdr) == 0) 00222 { 00223 return -1; 00224 } 00225 } 00226 00227 if (cdr.length () != 0 && TAO_debug_level) 00228 { 00229 // If there is extra data in the profile we are supposed to 00230 // ignore it, but print a warning just in case... 00231 ACE_DEBUG ((LM_DEBUG, 00232 ACE_TEXT ("%d bytes out of %d left after profile data\n"), 00233 cdr.length (), 00234 encap_len)); 00235 } 00236 00237 // Decode any additional endpoints per profile. This is used by RTCORBA 00238 // and by IIOP when TAG_ALTERNATE_IIOP_ADDRESS components are present. 00239 if (this->decode_endpoints () == -1) 00240 { 00241 return -1; 00242 } 00243 00244 return 1; 00245 }
| virtual int TAO_Profile::decode_endpoints | ( | void | ) | [protected, pure virtual] |
Helper for decode(). Decodes endpoints from a tagged component. Decode only if RTCORBA is enabled. Furthermore, we may not find TAO_TAG_ENDPOINTS component, e.g., if we are talking to nonRT version of TAO or some other ORB. This is not an error, and we must proceed. Return 0 on success and -1 on failure.
Implemented in TAO_Unknown_Profile.
| virtual int TAO_Profile::decode_profile | ( | TAO_InputCDR & | cdr | ) | [protected, pure virtual] |
Decode the protocol specific profile details.
Implemented in TAO_Unknown_Profile.
| virtual CORBA::Boolean TAO_Profile::do_is_equivalent | ( | const TAO_Profile * | other | ) | [protected, pure virtual] |
Profile equivalence template method invoked on subclasses.
TAO_Profile subclasses must implement this template method so that they can apply their own definition of profile equivalence.
| int TAO_Profile::encode | ( | TAO_OutputCDR & | stream | ) | const [virtual] |
Encode this profile in a stream, i.e. marshal it.
Reimplemented in TAO_Unknown_Profile.
Definition at line 123 of file Profile.cpp.
00124 { 00125 // UNSIGNED LONG, protocol tag 00126 stream.write_ulong (this->tag_); 00127 00128 // Create the encapsulation.... 00129 TAO_OutputCDR encap (ACE_CDR::DEFAULT_BUFSIZE, 00130 TAO_ENCAP_BYTE_ORDER, 00131 this->orb_core ()->output_cdr_buffer_allocator (), 00132 this->orb_core ()->output_cdr_dblock_allocator (), 00133 this->orb_core ()->output_cdr_msgblock_allocator (), 00134 this->orb_core ()->orb_params ()->cdr_memcpy_tradeoff (), 00135 TAO_DEF_GIOP_MAJOR, 00136 TAO_DEF_GIOP_MINOR); 00137 00138 #if defined (TAO_ZERO_TAO_OUTPUTCDR_ALLOCATED_BUFFERS) 00139 // Support limited oref ACE_OS::strcmp 00140 (void) ACE_OS::memset (encap.current()->wr_ptr (), 00141 0, 00142 encap.current()->space ()); 00143 #endif /* TAO_ZERO_TAO_OUTPUTCDR_ALLOCATED_BUFFERS */ 00144 00145 // Create the profile body 00146 this->create_profile_body (encap); 00147 00148 // write the encapsulation as an octet sequence... 00149 stream << CORBA::ULong (encap.total_length ()); 00150 stream.write_octet_array_mb (encap.begin ()); 00151 00152 return 1; 00153 }
| int TAO_Profile::encode_alternate_endpoints | ( | void | ) | [virtual] |
Encodes this profile's endpoints into protocol specific tagged components. This is used for non-RTCORBA applications that share endpoints on profiles. The only known implementation is IIOP, using TAG_ALTERNATE_IIOP_ADDRESS components.
Definition at line 750 of file Profile.cpp.
00751 { 00752 // this should be a pure virtual, but there are many 00753 // existing specializations that would need to be 00754 // modified. This maintains the existing behavior, since 00755 // the previous version of the POA did not gather alternate 00756 // endpoints. 00757 00758 return 0; 00759 }
| virtual int TAO_Profile::encode_endpoints | ( | void | ) | [pure virtual] |
Encodes this profile's endpoints into a tagged component. This is done only if RTCORBA is enabled, since currently this is the only case when we have more than one endpoint per profile.
Implemented in TAO_Unknown_Profile.
| virtual TAO_Endpoint* TAO_Profile::endpoint | ( | void | ) | [pure virtual] |
Return a pointer to this profile's endpoint. If the profile contains more than one endpoint, i.e., a list, the method returns the head of the list.
Implemented in TAO_Unknown_Profile.
| virtual CORBA::ULong TAO_Profile::endpoint_count | ( | void | ) | const [pure virtual] |
Return how many endpoints this profile contains.
Implemented in TAO_Unknown_Profile.
| TAO_Endpoint * TAO_Profile::first_filtered_endpoint | ( | void | ) |
Return the first endpoint in the list that matches some filtering constraint, such as IPv6 compatibility for IIOP endpoints. This method is implemented in terms of TAO_Endpoint::next_filtered().
Definition at line 709 of file Profile.cpp.
00710 { 00711 TAO_Endpoint *ep = this->endpoint(); 00712 return ep == 0 ? 0 : ep->next_filtered(this->orb_core_,0); 00713 }
| TAO_MProfile * TAO_Profile::forward_to | ( | void | ) |
MProfile accessor.
Definition at line 32 of file Profile.inl.
00033 { 00034 return this->forward_to_; 00035 }
| void TAO_Profile::forward_to | ( | TAO_MProfile * | mprofiles | ) |
Keep a pointer to the forwarded profile.
Definition at line 26 of file Profile.inl.
00027 { 00028 this->forward_to_ = mprofiles; 00029 }
| TAO_MProfile * TAO_Profile::forward_to_i | ( | void | ) | [private] |
This object keeps ownership of this object.
Definition at line 38 of file Profile.inl.
00039 { 00040 return this->forward_to_; 00041 }
| void TAO_Profile::get_policies | ( | CORBA::PolicyList & | policy_list | ) | [virtual] |
Accessor for the client exposed policies of this profile.
Definition at line 422 of file Profile.cpp.
00423 { 00424 #if !defined(CORBA_E_MICRO) 00425 if (!this->are_policies_parsed_) 00426 // None has already parsed the policies. 00427 { 00428 IOP::TaggedComponent tagged_component; 00429 tagged_component.tag = Messaging::TAG_POLICIES; 00430 00431 // This gets a component with the proper "tag" field 00432 // if it exists. 00433 if (this->tagged_components_.get_component (tagged_component)) 00434 { 00435 const CORBA::Octet *buf = 00436 tagged_component.component_data.get_buffer (); 00437 00438 TAO_InputCDR in_cdr (reinterpret_cast <const char *> (buf), 00439 tagged_component.component_data.length ()); 00440 00441 // Extract the Byte Order 00442 CORBA::Boolean byte_order; 00443 00444 if (!(in_cdr >> ACE_InputCDR::to_boolean (byte_order))) 00445 { 00446 return; 00447 } 00448 00449 in_cdr.reset_byte_order (static_cast <int> (byte_order)); 00450 00451 // Now we take out the Messaging::PolicyValueSeq out from the 00452 // CDR. 00453 Messaging::PolicyValueSeq policy_value_seq; 00454 00455 if (!(in_cdr >> policy_value_seq)) 00456 { 00457 throw ::CORBA::INV_OBJREF (); 00458 } 00459 00460 // Here we extract the Messaging::PolicyValue out of the sequence 00461 // and we convert those into the proper CORBA::Policy 00462 CORBA::ULong const length = policy_value_seq.length (); 00463 00464 for (CORBA::ULong i = 0; i < length; ++i) 00465 { 00466 try 00467 { 00468 CORBA::Policy_var policy = 00469 this->orb_core_->orb ()->_create_policy ( 00470 policy_value_seq[i].ptype); 00471 00472 if (!CORBA::is_nil (policy.in ())) 00473 { 00474 buf = policy_value_seq[i].pvalue.get_buffer (); 00475 00476 TAO_InputCDR in_cdr ( 00477 reinterpret_cast <const char*> (buf), 00478 policy_value_seq[i].pvalue.length ()); 00479 00480 if (!(in_cdr >> ACE_InputCDR::to_boolean (byte_order))) 00481 throw ::CORBA::INV_OBJREF (); 00482 00483 in_cdr.reset_byte_order (static_cast <int> (byte_order)); 00484 00485 if (!policy->_tao_decode (in_cdr)) 00486 throw ::CORBA::INV_OBJREF (); 00487 00488 // Increase the policy length with 1 when we know we support 00489 // this policy, this way we don't get nil values in the list 00490 pl.length (pl.length () + 1); 00491 00492 pl[i] = policy._retn (); 00493 } 00494 else 00495 { 00496 // This case should occure when in the IOR are 00497 // embedded policies that TAO doesn't support, 00498 // so as specified by the RT-CORBA 00499 // spec. ptc/99-05-03 we just ignore these 00500 // un-understood policies. 00501 if (TAO_debug_level >= 5) 00502 ACE_DEBUG ((LM_DEBUG, 00503 ACE_TEXT ("The IOR contains unsupported ") 00504 ACE_TEXT ("policies.\n"))); 00505 } 00506 } 00507 catch (const ::CORBA::Exception& ex) 00508 { 00509 // This case should occur when in the IOR are 00510 // embedded policies that TAO doesn't support, so as 00511 // specified by the RT-CORBA spec. ptc/99-05-03 we 00512 // just ignore these un-understood policies. 00513 00514 if (TAO_debug_level >= 5) 00515 ex._tao_print_exception ( 00516 ACE_TEXT ("IOR contains ") 00517 ACE_TEXT ("unsupported policies.")); 00518 } 00519 } 00520 } 00521 } 00522 #else 00523 ACE_UNUSED_ARG (pl); 00524 #endif 00525 }
| virtual CORBA::ULong TAO_Profile::hash | ( | CORBA::ULong | max | ) | [pure virtual] |
Return a hash value for this object.
Implemented in TAO_Unknown_Profile.
| CORBA::ULong TAO_Profile::hash_service_i | ( | CORBA::ULong | m | ) | [protected] |
Definition at line 737 of file Profile.cpp.
00738 { 00739 return this->orb_core_->hash_service (this, m); 00740 }
| CORBA::Boolean TAO_Profile::is_equivalent | ( | const TAO_Profile * | other_profile | ) |
Verify profile equivalance.
Two profiles are equivalent if their tag, object_key, version and all endpoints are the same.
true if this profile is equivalent to other_profile. Definition at line 673 of file Profile.cpp.
00674 { 00675 CORBA::Boolean result = false; 00676 if (other) 00677 { 00678 TAO_Service_Callbacks::Profile_Equivalence callback 00679 = this->is_equivalent_hook (other); 00680 switch (callback) 00681 { 00682 case TAO_Service_Callbacks::DONT_KNOW: 00683 return this->tag () == other->tag () 00684 && this->version_ == other->version () 00685 && this->endpoint_count () == other->endpoint_count () 00686 && this->object_key () == other->object_key () 00687 && this->do_is_equivalent (other); 00688 case TAO_Service_Callbacks::EQUIVALENT: 00689 result = true; 00690 break; 00691 case TAO_Service_Callbacks::NOT_EQUIVALENT: 00692 break; 00693 } 00694 } 00695 return result; 00696 }
| TAO_Service_Callbacks::Profile_Equivalence TAO_Profile::is_equivalent_hook | ( | const TAO_Profile * | other | ) | [protected, virtual] |
Allow services to apply their own definition of "equivalence.".
This method differs from the do_is_equivalent() template method in that it has a default implementation that may or not be applicable to all TAO_Profile subclasses.
Definition at line 730 of file Profile.cpp.
00731 { 00732 // Allow services to apply their own definition of "equivalence." 00733 return this->orb_core_->is_profile_equivalent (this, other); 00734 }
| TAO_Endpoint * TAO_Profile::next_filtered_endpoint | ( | TAO_Endpoint * | source | ) |
Return the next filtered endpoint in the list after the one passed in. This method is implemented in terms of TAO_Endpoint;:next_filtered(). If the supplied source endpoint is null, this returns the first filtered endpoint.
Definition at line 716 of file Profile.cpp.
00717 { 00718 if (source == 0) 00719 return this->first_filtered_endpoint(); 00720 return source->next_filtered(this->orb_core_,this->endpoint()); 00721 }
| const TAO::ObjectKey & TAO_Profile::object_key | ( | void | ) | const |
Definition at line 62 of file Profile.inl.
00063 { 00064 return this->ref_object_key_->object_key (); 00065 }
| virtual char TAO_Profile::object_key_delimiter | ( | void | ) | const [pure virtual] |
The object key delimiter.
Implemented in TAO_Unknown_Profile.
| void TAO_Profile::operator= | ( | const TAO_Profile & | ) | [private] |
| TAO_ORB_Core * TAO_Profile::orb_core | ( | void | ) | const |
Get a pointer to the TAO_ORB_Core.
Definition at line 20 of file Profile.inl.
00021 { 00022 return this->orb_core_; 00023 }
| void TAO_Profile::parse_string | ( | const char * | string | ) | [virtual] |
Initialize this object using the given input string. Supports URL style of object references
Reimplemented in TAO_Unknown_Profile.
Definition at line 626 of file Profile.cpp.
00627 { 00628 if (!ior || !*ior) 00629 { 00630 throw ::CORBA::INV_OBJREF ( 00631 CORBA::SystemException::_tao_minor_code ( 00632 0, 00633 EINVAL), 00634 CORBA::COMPLETED_NO); 00635 } 00636 00637 // Remove the "N.n@" version prefix, if it exists, and verify the 00638 // version is one that we accept. 00639 00640 // Check for version 00641 if (ACE_OS::ace_isdigit (ior [0]) && 00642 ior[1] == '.' && 00643 ACE_OS::ace_isdigit (ior [2]) && 00644 ior[3] == '@') 00645 { 00646 // @@ This may fail for non-ascii character sets [but take that 00647 // with a grain of salt] 00648 this->version_.set_version ((char) (ior[0] - '0'), 00649 (char) (ior[2] - '0')); 00650 ior += 4; 00651 // Skip over the "N.n@" 00652 } 00653 else 00654 { 00655 // CORBA spec requires 1.0 if a version isn't specified. 00656 this->version_.set_version (1, 0); 00657 } 00658 00659 if (this->version_.major != TAO_DEF_GIOP_MAJOR || 00660 this->version_.minor > TAO_DEF_GIOP_MINOR) 00661 { 00662 throw ::CORBA::INV_OBJREF ( 00663 CORBA::SystemException::_tao_minor_code ( 00664 0, 00665 EINVAL), 00666 CORBA::COMPLETED_NO); 00667 } 00668 00669 this->parse_string_i (ior); 00670 }
| virtual void TAO_Profile::parse_string_i | ( | const char * | string | ) | [protected, pure virtual] |
Protocol specific implementation of parse_string ().
Implemented in TAO_Unknown_Profile.
| void TAO_Profile::policies | ( | CORBA::PolicyList * | policy_list | ) | [virtual] |
This method sets the client exposed policies, i.e., the ones propagated in the IOR, for this profile.
Definition at line 335 of file Profile.cpp.
00336 { 00337 if (policy_list == 0) 00338 { 00339 if (TAO_debug_level) 00340 { 00341 ACE_DEBUG ((LM_DEBUG, 00342 ACE_TEXT ("TAO_Profile::policies: ") 00343 ACE_TEXT ("Null Policy List!\n"))); 00344 } 00345 00346 return; 00347 } 00348 00349 Messaging::PolicyValueSeq policy_value_seq; 00350 00351 size_t length = 0; 00352 CORBA::Octet *buf = 0; 00353 00354 // This loop iterates through CORBA::PolicyList to convert 00355 // each CORBA::Policy into a CORBA::PolicyValue 00356 CORBA::ULong const plen = policy_list->length (); 00357 00358 policy_value_seq.length (plen); 00359 00360 for (CORBA::ULong i = 0; i < plen; ++i) 00361 { 00362 TAO_OutputCDR out_CDR; 00363 policy_value_seq[i].ptype = (*policy_list)[i]->policy_type (); 00364 00365 if (!(out_CDR << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) 00366 return; 00367 00368 if (!((*policy_list)[i]->_tao_encode (out_CDR))) 00369 return; 00370 00371 length = out_CDR.total_length (); 00372 policy_value_seq[i].pvalue.length (static_cast <CORBA::ULong>(length)); 00373 00374 buf = policy_value_seq[i].pvalue.get_buffer (); 00375 00376 // Copy the CDR buffer data into the octet sequence buffer. 00377 00378 for (const ACE_Message_Block *iterator = out_CDR.begin (); 00379 iterator != 0; 00380 iterator = iterator->cont ()) 00381 { 00382 ACE_OS::memcpy (buf, iterator->rd_ptr (), iterator->length ()); 00383 buf += iterator->length (); 00384 } 00385 } 00386 00387 TAO_OutputCDR out_cdr; 00388 // Now we have to embed the Messaging::PolicyValueSeq into 00389 // a TaggedComponent. 00390 00391 IOP::TaggedComponent tagged_component; 00392 tagged_component.tag = Messaging::TAG_POLICIES; 00393 00394 if (!(out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) 00395 return; 00396 00397 if (!(out_cdr << policy_value_seq)) 00398 return; 00399 00400 length = out_cdr.total_length (); 00401 00402 tagged_component.component_data.length (static_cast <CORBA::ULong>(length)); 00403 buf = tagged_component.component_data.get_buffer (); 00404 00405 for (const ACE_Message_Block *iterator = out_cdr.begin (); 00406 iterator != 0; 00407 iterator = iterator->cont ()) 00408 { 00409 size_t const i_length = iterator->length (); 00410 ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length); 00411 00412 buf += i_length; 00413 } 00414 00415 // Eventually we add the TaggedComponent to the TAO_TaggedComponents 00416 // member variable. 00417 tagged_components_.set_component (tagged_component); 00418 this->are_policies_parsed_ = true; 00419 }
| void TAO_Profile::remove_generic_endpoint | ( | TAO_Endpoint * | ep | ) | [virtual] |
Remove the provided endpoint from the profile. Some subclasses of TAO_Profile already have a protocol-specific version of remove_endpoint, but this generic interface is required. The default implementation is a no-op. Protocol maintainers wishing to add support for the EndpointPolicy must implement remove_generic_endpoint to call their protocol-specific version of remove_endpoint
Definition at line 762 of file Profile.cpp.
| void TAO_Profile::set_tagged_components | ( | TAO_OutputCDR & | cdr | ) | [protected] |
Helper method that encodes the endpoints for RTCORBA as tagged_components.
Definition at line 309 of file Profile.cpp.
00310 { 00311 CORBA::ULong const length = static_cast <CORBA::ULong> (out_cdr.total_length ()); 00312 00313 IOP::TaggedComponent tagged_component; 00314 tagged_component.tag = TAO_TAG_ENDPOINTS; 00315 tagged_component.component_data.length (length); 00316 CORBA::Octet *buf = tagged_component.component_data.get_buffer (); 00317 00318 for (const ACE_Message_Block *iterator = out_cdr.begin (); 00319 iterator != 0; 00320 iterator = iterator->cont ()) 00321 { 00322 size_t const i_length = iterator->length (); 00323 ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length); 00324 00325 buf += i_length; 00326 } 00327 00328 // Add component with encoded endpoint data to this profile's 00329 // TaggedComponents. 00330 tagged_components_.set_component (tagged_component); 00331 }
| int TAO_Profile::supports_multicast | ( | void | ) | const [virtual] |
Returns true if this profile can specify multicast endpoints.
Definition at line 592 of file Profile.cpp.
| bool TAO_Profile::supports_non_blocking_oneways | ( | void | ) | const [virtual] |
| CORBA::ULong TAO_Profile::tag | ( | void | ) | const |
The tag, each concrete class will have a specific tag value.
Definition at line 8 of file Profile.inl.
00009 { 00010 return this->tag_; 00011 }
| TAO_Tagged_Components & TAO_Profile::tagged_components | ( | void | ) |
The tag, each concrete class will have a specific tag value.
Definition at line 50 of file Profile.inl.
00051 { 00052 return this->tagged_components_; 00053 }
| const TAO_Tagged_Components & TAO_Profile::tagged_components | ( | void | ) | const |
Access the tagged components, notice that they they could be empty (or ignored) for non-GIOP protocols (and even for GIOP-1.0)
Definition at line 44 of file Profile.inl.
00045 { 00046 return this->tagged_components_; 00047 }
| virtual char* TAO_Profile::to_string | ( | void | ) | [pure virtual] |
Return a string representation for this profile. Client must deallocate memory. Only one endpoint is included into the string.
Implemented in TAO_Unknown_Profile.
| void TAO_Profile::verify_orb_configuration | ( | void | ) | [private] |
Verify that the current ORB's configuration supports tagged components in IORs.
Definition at line 528 of file Profile.cpp.
00529 { 00530 // If the ORB isn't configured to support tagged components, then 00531 // throw an exception. 00532 if (!this->orb_core_->orb_params ()->std_profile_components () 00533 || !this->orb_core_->orb ()->_use_omg_ior_format ()) 00534 { 00535 if (TAO_debug_level > 0) 00536 { 00537 ACE_ERROR ((LM_ERROR, 00538 ACE_TEXT ("(%P|%t) Cannot add ") 00539 ACE_TEXT ("IOP::TaggedComponent to profile.\n") 00540 ACE_TEXT ("(%P|%t) Standard profile components ") 00541 ACE_TEXT ("have been disabled or URL style IORs\n") 00542 ACE_TEXT ("(%P|%t) are in use. Try ") 00543 ACE_TEXT ("\"-ORBStdProfileComponents 1\" and/or\n") 00544 ACE_TEXT ("(%P|%t) \"-ORBObjRefStyle IOR\".\n"))); 00545 } 00546 00547 // According to the Portable Interceptor specification, we're 00548 // supposed to throw a CORBA::BAD_PARAM exception if it isn't 00549 // possible to add components to the profile. 00550 // @todo: We need the proper minor code as soon as the spec is 00551 // updated. 00552 throw ::CORBA::BAD_PARAM ( 00553 CORBA::SystemException::_tao_minor_code ( 00554 0, 00555 EINVAL), 00556 CORBA::COMPLETED_NO); 00557 } 00558 }
| void TAO_Profile::verify_profile_version | ( | void | ) | [private] |
Verify that the given profile supports tagged components, i.e. is not a GIOP 1.0 profile.
Definition at line 561 of file Profile.cpp.
00562 { 00563 // GIOP 1.0 does not support tagged components. Throw an exception 00564 // if the profile is a GIOP 1.0 profile. 00565 00566 if (this->version_.major == 1 && this->version_.minor == 0) 00567 { 00568 if (TAO_debug_level > 0) 00569 { 00570 ACE_ERROR ((LM_ERROR, 00571 ACE_TEXT ("(%P|%t) Cannot add ") 00572 ACE_TEXT ("IOP::TaggedComponent to GIOP 1.0") 00573 ACE_TEXT ("IOR profile.\n") 00574 ACE_TEXT ("(%P|%t) Try using a GIOP 1.1 or ") 00575 ACE_TEXT ("greater endpoint.\n"))); 00576 } 00577 00578 // According to the Portable Interceptor specification, we're 00579 // supposed to throw a CORBA::BAD_PARAM exception if it isn't 00580 // possible to add components to the profile. 00581 // @todo: We need the proper minor code as soon as the spec is 00582 // updated. 00583 throw ::CORBA::BAD_PARAM ( 00584 CORBA::SystemException::_tao_minor_code ( 00585 0, 00586 EINVAL), 00587 CORBA::COMPLETED_NO); 00588 } 00589 }
| const TAO_GIOP_Message_Version & TAO_Profile::version | ( | void | ) | const |
Return a pointer to this profile's version. This object maintains ownership.
Definition at line 14 of file Profile.inl.
00015 { 00016 return this->version_; 00017 }
CORBA::Short TAO_Profile::addressing_mode_ [protected] |
CORBA::Boolean TAO_Profile::are_policies_parsed_ [protected] |
TAO_MProfile* TAO_Profile::forward_to_ [private] |
The TAO_MProfile which contains the profiles for the forwarded object.
TAO_ORB_Core* const TAO_Profile::orb_core_ [private] |
TAO::Refcounted_ObjectKey* TAO_Profile::ref_object_key_ [protected] |
CORBA::ULong const TAO_Profile::tag_ [private] |
TAO_Tagged_Components TAO_Profile::tagged_components_ [protected] |
IOP::TaggedProfile* TAO_Profile::tagged_profile_ [protected] |
bool TAO_Profile::tagged_profile_created_ [private] |
TAO_SYNCH_MUTEX TAO_Profile::tagged_profile_lock_ [private] |
TAO_GIOP_Message_Version TAO_Profile::version_ [protected] |
1.6.1