summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
Diffstat (limited to 'TAO')
-rw-r--r--TAO/tao/DynamicAny/DynCommon.h65
-rw-r--r--TAO/tao/ORB_Constants.h3
-rw-r--r--TAO/tao/Strategies.mpc1
-rw-r--r--TAO/tao/Strategies/COIOP_Acceptor.cpp385
-rw-r--r--TAO/tao/Strategies/COIOP_Acceptor.h127
-rw-r--r--TAO/tao/Strategies/COIOP_Connection_Handler.cpp146
-rw-r--r--TAO/tao/Strategies/COIOP_Connection_Handler.h102
-rw-r--r--TAO/tao/Strategies/COIOP_Connector.cpp167
-rw-r--r--TAO/tao/Strategies/COIOP_Connector.h110
-rw-r--r--TAO/tao/Strategies/COIOP_Endpoint.cpp119
-rw-r--r--TAO/tao/Strategies/COIOP_Endpoint.h104
-rw-r--r--TAO/tao/Strategies/COIOP_Endpoint.inl13
-rw-r--r--TAO/tao/Strategies/COIOP_Endpoints.pidl41
-rw-r--r--TAO/tao/Strategies/COIOP_Factory.cpp98
-rw-r--r--TAO/tao/Strategies/COIOP_Factory.h81
-rw-r--r--TAO/tao/Strategies/COIOP_Profile.cpp397
-rw-r--r--TAO/tao/Strategies/COIOP_Profile.h120
-rw-r--r--TAO/tao/Strategies/COIOP_Transport.cpp165
-rw-r--r--TAO/tao/Strategies/COIOP_Transport.h129
-rw-r--r--TAO/tao/Strategies/advanced_resource.cpp11
20 files changed, 2347 insertions, 37 deletions
diff --git a/TAO/tao/DynamicAny/DynCommon.h b/TAO/tao/DynamicAny/DynCommon.h
index 83cd4dc12bf..c15cd5f5e24 100644
--- a/TAO/tao/DynamicAny/DynCommon.h
+++ b/TAO/tao/DynamicAny/DynCommon.h
@@ -21,11 +21,6 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#if defined (_MSC_VER)
-# pragma warning(push)
-# pragma warning (disable:4250)
-#endif /* _MSC_VER */
-
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
/**
@@ -439,7 +434,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::AbstractBase_ptr get_abstract (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -447,7 +442,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_boolean_seq (
const CORBA::BooleanSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -456,7 +451,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_octet_seq (
const CORBA::OctetSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -465,7 +460,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_char_seq (
const CORBA::CharSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -474,7 +469,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_short_seq (
const CORBA::ShortSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -483,7 +478,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_ushort_seq (
const CORBA::UShortSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -492,7 +487,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_long_seq (
const CORBA::LongSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -501,7 +496,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_ulong_seq (
const CORBA::ULongSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -510,7 +505,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_float_seq (
const CORBA::FloatSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -519,7 +514,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_double_seq (
const CORBA::DoubleSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -528,7 +523,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_longlong_seq (
const CORBA::LongLongSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -537,7 +532,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_ulonglong_seq (
const CORBA::ULongLongSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -546,7 +541,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_longdouble_seq (
const CORBA::LongDoubleSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -555,7 +550,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual void insert_wchar_seq (
const CORBA::WCharSeq & value
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -564,7 +559,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::BooleanSeq * get_boolean_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -572,7 +567,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::OctetSeq * get_octet_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -580,7 +575,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::CharSeq * get_char_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -588,7 +583,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::ShortSeq * get_short_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -596,7 +591,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::UShortSeq * get_ushort_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -604,7 +599,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::LongSeq * get_long_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -612,7 +607,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::ULongSeq * get_ulong_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -620,7 +615,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::FloatSeq * get_float_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -628,7 +623,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::DoubleSeq * get_double_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -636,7 +631,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::LongLongSeq * get_longlong_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -644,7 +639,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::ULongLongSeq * get_ulonglong_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -652,7 +647,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::LongDoubleSeq * get_longdouble_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -660,7 +655,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
virtual CORBA::WCharSeq * get_wchar_seq (
ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((
@@ -668,7 +663,7 @@ public:
DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue
));
-
+
/// This sets one of two flags in this base class. CORBA 2.4.2
/// requires that destroy() do nothing if it is called on
/// the result of current_component(), the only non-deep-copying
@@ -740,9 +735,5 @@ private:
TAO_END_VERSIONED_NAMESPACE_DECL
-#if defined(_MSC_VER)
-# pragma warning(pop)
-#endif /* _MSC_VER */
-
#include /**/ "ace/post.h"
#endif /* TAO_DYNCOMMON_H */
diff --git a/TAO/tao/ORB_Constants.h b/TAO/tao/ORB_Constants.h
index 31449c5ee40..afa933dfdae 100644
--- a/TAO/tao/ORB_Constants.h
+++ b/TAO/tao/ORB_Constants.h
@@ -179,6 +179,9 @@ const CORBA::ULong TAO_TAG_SHMEM_PROFILE = 0x54414f02U;
/// UDP
const CORBA::ULong TAO_TAG_DIOP_PROFILE = 0x54414f04U;
+/// COIOP
+const CORBA::ULong TAO_TAG_COIOP_PROFILE = 0x54414f05U;
+
/// SCIOP
const CORBA::ULong TAO_TAG_SCIOP_PROFILE = 0x54414f0EU;
diff --git a/TAO/tao/Strategies.mpc b/TAO/tao/Strategies.mpc
index c98ab463c1c..15a60e3197b 100644
--- a/TAO/tao/Strategies.mpc
+++ b/TAO/tao/Strategies.mpc
@@ -37,6 +37,7 @@ project : taolib, core, core_anytypecode, tao_versioning_idl_defaults {
idlflags -= -St
Strategies/uiop_endpoints.pidl
Strategies/sciop_endpoints.pidl
+ Strategies/COIOP_Endpoints.pidl
}
Pkgconfig_Files {
diff --git a/TAO/tao/Strategies/COIOP_Acceptor.cpp b/TAO/tao/Strategies/COIOP_Acceptor.cpp
new file mode 100644
index 00000000000..977868b541b
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Acceptor.cpp
@@ -0,0 +1,385 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#include "tao/Strategies/COIOP_Acceptor.h"
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/COIOP_Profile.h"
+#include "tao/MProfile.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/CDR.h"
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (Strategies,
+ COIOP_Acceptor,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_COIOP_Acceptor::TAO_COIOP_Acceptor (CORBA::Boolean flag)
+ : TAO_Acceptor (TAO_TAG_COIOP_PROFILE),
+ uuid_ (*ACE_Utils::UUID_GENERATOR::instance ()->generateUUID ()),
+ version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR),
+ orb_core_ (0),
+ lite_flag_ (flag)
+{
+}
+
+TAO_COIOP_Acceptor::~TAO_COIOP_Acceptor (void)
+{
+ // Make sure we are closed before we start destroying the
+ // strategies.
+ this->close ();
+}
+
+// TODO =
+// 2) For V1.[1,2] there are tagged components
+
+int
+TAO_COIOP_Acceptor::create_profile (const TAO::ObjectKey & object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Check if multiple endpoints should be put in one profile or if
+ // they should be spread across multiple profiles.
+ if (priority == TAO_INVALID_PRIORITY)
+ return this->create_new_profile (object_key,
+ mprofile,
+ priority);
+ else
+ return this->create_shared_profile (object_key,
+ mprofile,
+ priority);
+}
+
+int
+TAO_COIOP_Acceptor::create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Adding this->endpoint_count_ to the TAO_MProfile.
+ if (mprofile.grow (1) == -1)
+ return -1;
+
+ TAO_COIOP_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_COIOP_Profile (uuid_,
+ object_key,
+ this->version_,
+ this->orb_core_),
+ -1);
+ pfile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (pfile) == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ return -1;
+ }
+
+ // Do not add any tagged components to the profile if configured
+ // by the user not to do so, or if an IIOP 1.0 endpoint is being
+ // created (IIOP 1.0 did not support tagged components).
+ if (this->orb_core_->orb_params ()->std_profile_components () != 0
+ && (this->version_.major >= 1 && this->version_.minor > 0))
+ {
+ pfile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(pfile->tagged_components());
+ }
+
+ return 0;
+}
+
+int
+TAO_COIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ size_t index = 0;
+ TAO_Profile *pfile = 0;
+ TAO_COIOP_Profile *coiop_profile = 0;
+
+ // First see if <mprofile> already contains a COIOP profile.
+ for (TAO_PHandle i = 0; i != mprofile.profile_count (); ++i)
+ {
+ pfile = mprofile.get_profile (i);
+ if (pfile->tag () == TAO_TAG_COIOP_PROFILE)
+ {
+ coiop_profile = dynamic_cast<TAO_COIOP_Profile *> (pfile);
+ break;
+ }
+ }
+
+ // If <mprofile> doesn't contain a COIOP_Profile, we need to create
+ // one.
+ if (coiop_profile == 0)
+ {
+ ACE_NEW_RETURN (coiop_profile,
+ TAO_COIOP_Profile (uuid_,
+ object_key,
+ this->version_,
+ this->orb_core_),
+ -1);
+ coiop_profile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (coiop_profile) == -1)
+ {
+ coiop_profile->_decr_refcnt ();
+ coiop_profile = 0;
+ return -1;
+ }
+
+ if (this->orb_core_->orb_params ()->std_profile_components () != 0
+ && (this->version_.major >= 1 && this->version_.minor >= 1))
+ {
+ coiop_profile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(pfile->tagged_components());
+ }
+
+ index = 1;
+ }
+
+ TAO_COIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_COIOP_Endpoint (uuid_),
+ -1);
+ endpoint->priority (priority);
+ coiop_profile->add_endpoint (endpoint);
+
+ return 0;
+}
+
+int
+TAO_COIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint)
+{
+ const TAO_COIOP_Endpoint *endp =
+ dynamic_cast<const TAO_COIOP_Endpoint *> (endpoint);
+
+ // Make sure the dynamically cast pointer is valid.
+ if (endp == 0)
+ return false;
+
+ return (endp->uuid() == uuid_);
+}
+
+int
+TAO_COIOP_Acceptor::close (void)
+{
+ return 0;
+}
+
+int
+TAO_COIOP_Acceptor::open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *,
+ int major,
+ int minor,
+ const char *address,
+ const char *options)
+{
+ this->orb_core_ = orb_core;
+
+ if (major >=0 && minor >= 0)
+ this->version_.set_version (static_cast<CORBA::Octet> (major),
+ static_cast<CORBA::Octet> (minor));
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ uuid_.from_string (address);
+
+ return 0;
+}
+
+int
+TAO_COIOP_Acceptor::open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *,
+ int major,
+ int minor,
+ const char *options)
+{
+ this->orb_core_ = orb_core;
+
+ if (major >=0 && minor >= 0)
+ this->version_.set_version (static_cast<CORBA::Octet> (major),
+ static_cast<CORBA::Octet> (minor));
+
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ return 0;
+}
+
+CORBA::ULong
+TAO_COIOP_Acceptor::endpoint_count (void)
+{
+ return 1;
+}
+
+int
+TAO_COIOP_Acceptor::object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &object_key)
+{
+ // Create the decoding stream from the encapsulation in the buffer,
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ TAO_InputCDR cdr (profile.profile_data.mb ());
+#else
+ TAO_InputCDR cdr (reinterpret_cast<char*> (profile.profile_data.get_buffer ()),
+ profile.profile_data.length ());
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+
+ CORBA::Octet major;
+ CORBA::Octet minor = CORBA::Octet();
+
+ // Read the version. We just read it here. We don't*do any*
+ // processing.
+ if (!(cdr.read_octet (major)
+ && cdr.read_octet (minor)))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) COIOP_Profile::decode - v%d.%d\n"),
+ major,
+ minor));
+ }
+ return -1;
+ }
+
+ CORBA::String_var uuid;
+
+ // Get host and port. No processing here too..
+ if (cdr.read_string (uuid.out ()) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_COIOP_Acceptor::object_key - ")
+ ACE_TEXT ("error while decoding host/port")));
+ }
+ return -1;
+ }
+
+ // ... and object key.
+ if ((cdr >> object_key) == 0)
+ return -1;
+
+ // We are NOT bothered about the rest.
+
+ return 1;
+}
+
+
+int
+TAO_COIOP_Acceptor::parse_options (const char *str)
+{
+ if (str == 0)
+ return 0; // No options to parse. Not a problem.
+
+ // Use an option format similar to the one used for CGI scripts in
+ // HTTP URLs.
+ // e.g.: option1=foo&option2=bar
+
+ ACE_CString options (str);
+
+ size_t len = options.length ();
+
+ const char option_delimiter = '&';
+
+ // Count the number of options.
+
+ CORBA::ULong option_count = 1;
+ // Number of endpoints in the string (initialized to 1).
+
+ // Only check for endpoints after the protocol specification and
+ // before the object key.
+ for (size_t i = 0; i < len; ++i)
+ if (options[i] == option_delimiter)
+ option_count++;
+
+ // The idea behind the following loop is to split the options into
+ // (option, name) pairs.
+ // For example,
+ // `option1=foo&option2=bar'
+ // will be parsed into:
+ // `option1=foo'
+ // `option2=bar'
+
+ ACE_CString::size_type begin = 0;
+ ACE_CString::size_type end = 0;
+
+ for (CORBA::ULong j = 0; j < option_count; ++j)
+ {
+ if (j < option_count - 1)
+ end = options.find (option_delimiter, begin);
+ else
+ end = len;
+
+ if (end == begin)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length COIOP option.\n")),
+ -1);
+ }
+ else if (end != ACE_CString::npos)
+ {
+ ACE_CString opt = options.substring (begin, end);
+
+ ACE_CString::size_type const slot = opt.find ("=");
+
+ if (slot == len - 1
+ || slot == ACE_CString::npos)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) COIOP option <%s> is ")
+ ACE_TEXT ("missing a value.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (opt.c_str ())),
+ -1);
+
+ ACE_CString name = opt.substring (0, slot);
+ ACE_CString value = opt.substring (slot + 1);
+
+ if (name.length () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length COIOP ")
+ ACE_TEXT ("option name.\n")),
+ -1);
+
+ if (name == "priority")
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid COIOP endpoint format: ")
+ ACE_TEXT ("endpoint priorities no longer supported. \n")),
+ -1);
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid COIOP option: <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (name.c_str ())),
+ -1);
+ }
+
+ begin = end + 1;
+ }
+ else
+ {
+ break; // No other options.
+ }
+ }
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
diff --git a/TAO/tao/Strategies/COIOP_Acceptor.h b/TAO/tao/Strategies/COIOP_Acceptor.h
new file mode 100644
index 00000000000..35f7967be94
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Acceptor.h
@@ -0,0 +1,127 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file COIOP_Acceptor.h
+ *
+ * $Id$
+ *
+ * COIOP specific acceptor processing
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_COIOP_ACCEPTOR_H
+#define TAO_COIOP_ACCEPTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Transport_Acceptor.h"
+#include "tao/Acceptor_Impl.h"
+#include "tao/GIOP_Message_Version.h"
+#include "ace/UUID.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO COIOP_Acceptor concrete call defination
+
+/**
+ * @class TAO_COIOP_Acceptor
+ *
+ * @brief TAO_COIOP_Acceptor
+ *
+ * The COIOP-specific bridge class for the concrete acceptor.
+ */
+class TAO_Strategies_Export TAO_COIOP_Acceptor : public TAO_Acceptor
+{
+public:
+ /// Constructor.
+ TAO_COIOP_Acceptor (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_COIOP_Acceptor (void);
+
+ /**
+ * @name The TAO_Acceptor Methods
+ *
+ * Please check the documentation in Transport_Acceptor.h for details.
+ */
+ //@{
+ virtual int open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *address,
+ const char *options = 0);
+ virtual int open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *options = 0);
+ virtual int close (void);
+ virtual int create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ virtual int is_collocated (const TAO_Endpoint *endpoint);
+ virtual CORBA::ULong endpoint_count (void);
+
+ virtual int object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &key);
+ //@}
+
+protected:
+
+ /// Parse protocol specific options.
+ virtual int parse_options (const char *options);
+
+ /// Helper method to add a new profile to the mprofile for
+ /// each endpoint.
+ int create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ /// Helper method to create a profile that contains all of
+ /// our endpoints.
+ int create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+protected:
+
+ /**
+ * Cache the information about the endpoints serviced by this
+ * acceptor.
+ */
+ ACE_Utils::UUID uuid_;
+
+ /**
+ * The GIOP version for this endpoint
+ * @@ Theoretically they shouldn't be here!! We need to look at a
+ * way to move this out
+ */
+ TAO_GIOP_Message_Version version_;
+
+ /// ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+ /// Should we use GIOP lite??
+ CORBA::Boolean lite_flag_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COIOP_ACCEPTOR_H */
diff --git a/TAO/tao/Strategies/COIOP_Connection_Handler.cpp b/TAO/tao/Strategies/COIOP_Connection_Handler.cpp
new file mode 100644
index 00000000000..2cfa182aaa2
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Connection_Handler.cpp
@@ -0,0 +1,146 @@
+// $Id$
+
+#include "tao/Strategies/COIOP_Connection_Handler.h"
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Timeprobe.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/CDR.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Resume_Handle.h"
+
+#include "tao/Strategies/COIOP_Transport.h"
+#include "tao/Strategies/COIOP_Endpoint.h"
+
+ACE_RCSID(tao, COIOP_Connect, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_COIOP_Connection_Handler::TAO_COIOP_Connection_Handler (ACE_Thread_Manager *t)
+ : TAO_COIOP_SVC_HANDLER (t, 0 , 0),
+ TAO_Connection_Handler (0)
+{
+ // This constructor should *never* get called, it is just here to
+ // make the compiler happy: the default implementation of the
+ // Creation_Strategy requires a constructor with that signature, we
+ // don't use that implementation, but some (most?) compilers
+ // instantiate it anyway.
+ ACE_ASSERT (0);
+}
+
+
+TAO_COIOP_Connection_Handler::TAO_COIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_COIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
+ TAO_Connection_Handler (orb_core)
+{
+ TAO_COIOP_Transport* specific_transport = 0;
+ ACE_NEW (specific_transport,
+ TAO_COIOP_Transport(this, orb_core, flag));
+
+ // store this pointer (indirectly increment ref count)
+ this->transport (specific_transport);
+}
+
+
+TAO_COIOP_Connection_Handler::~TAO_COIOP_Connection_Handler (void)
+{
+ delete this->transport ();
+
+ int const result =
+ this->release_os_resources ();
+
+ if (result == -1 && TAO_debug_level)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("TAO (%P|%t) - COIOP_Connection_Handler::")
+ ACE_TEXT("~COIOP_Connection_Handler, ")
+ ACE_TEXT("release_os_resources() failed %m\n")));
+ }
+ delete this->transport ();
+}
+
+int
+TAO_COIOP_Connection_Handler::open_handler (void *v)
+{
+ return this->open (v);
+}
+
+int
+TAO_COIOP_Connection_Handler::open (void*)
+{
+ return 0;
+}
+
+int
+TAO_COIOP_Connection_Handler::resume_handler (void)
+{
+ return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER;
+}
+
+int
+TAO_COIOP_Connection_Handler::close_connection (void)
+{
+ return this->close_connection_eh (this);
+}
+
+int
+TAO_COIOP_Connection_Handler::handle_input (ACE_HANDLE h)
+{
+ return this->handle_input_eh (h, this);
+}
+
+int
+TAO_COIOP_Connection_Handler::handle_output (ACE_HANDLE handle)
+{
+ int const result =
+ this->handle_output_eh (handle, this);
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ return 0;
+ }
+
+ return result;
+}
+
+int
+TAO_COIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ // We don't use this upcall from the Reactor. However, we should
+ // override this since the base class returns -1 which will result
+ // in handle_close() getting called.
+ return 0;
+}
+
+int
+TAO_COIOP_Connection_Handler::handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask)
+{
+ // No asserts here since the handler is registered with the Reactor
+ // and the handler ownership is given to the Reactor. When the
+ // Reactor closes, it will call handle_close() on the handler. It
+ // is however important to overwrite handle_close() to do nothing
+ // since the base class does too much.
+ return 0;
+}
+
+int
+TAO_COIOP_Connection_Handler::close (u_long)
+{
+ return this->close_handler ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
diff --git a/TAO/tao/Strategies/COIOP_Connection_Handler.h b/TAO/tao/Strategies/COIOP_Connection_Handler.h
new file mode 100644
index 00000000000..f289b67b134
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Connection_Handler.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file COIOP_Connection_Handler.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+// ===================================================================
+
+#ifndef TAO_COIOP_CONNECTION_HANDLER_H
+#define TAO_COIOP_CONNECTION_HANDLER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Connection_Handler.h"
+#include "tao/Strategies/COIOP_Transport.h"
+#include "ace/Reactor.h"
+#include "ace/Acceptor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward Decls
+class TAO_Pluggable_Messaging;
+
+// ****************************************************************
+
+/**
+ * @class TAO_COIOP_Connection_Handler
+ *
+ * @brief Handles requests on a single connection.
+ *
+ * The Connection handler which is common for the Acceptor and
+ * the Connector
+ */
+class TAO_Strategies_Export TAO_COIOP_Connection_Handler
+ : public TAO_COIOP_SVC_HANDLER,
+ public TAO_Connection_Handler
+{
+
+public:
+
+ TAO_COIOP_Connection_Handler (ACE_Thread_Manager* t = 0);
+
+ /// Constructor.
+ TAO_COIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Destructor.
+ ~TAO_COIOP_Connection_Handler (void);
+
+ /// Called by the <Strategy_Acceptor> when the handler is completely
+ /// connected. Argument is unused.
+ virtual int open (void *);
+
+ //@{
+ /**
+ * Connection_Handler overloads
+ */
+ virtual int open_handler (void *);
+ //@}
+
+ /// Close called by the Acceptor or Connector when connection
+ /// establishment fails.
+ int close (u_long = 0);
+
+ //@{
+ /** @name Event Handler overloads
+ */
+ virtual int resume_handler (void);
+ virtual int close_connection (void);
+ virtual int handle_input (ACE_HANDLE);
+ virtual int handle_output (ACE_HANDLE);
+ virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+ virtual int handle_timeout (const ACE_Time_Value &current_time,
+ const void *act = 0);
+ //@}
+
+ /// Add ourselves to Cache.
+ int add_transport_to_cache (void);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COIOP_CONNECTION_HANDLER_H */
diff --git a/TAO/tao/Strategies/COIOP_Connector.cpp b/TAO/tao/Strategies/COIOP_Connector.cpp
new file mode 100644
index 00000000000..4886def2ffe
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Connector.cpp
@@ -0,0 +1,167 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#include "tao/Strategies/COIOP_Connector.h"
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "ace/Connector.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+
+#include "tao/Strategies/COIOP_Profile.h"
+
+
+ACE_RCSID (Strategies,
+ COIOP_Connector,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_COIOP_Connector::TAO_COIOP_Connector (CORBA::Boolean flag)
+ : TAO_Connector (TAO_TAG_COIOP_PROFILE),
+ lite_flag_ (flag)
+{
+}
+
+TAO_COIOP_Connector::~TAO_COIOP_Connector (void)
+{
+}
+
+int
+TAO_COIOP_Connector::open (TAO_ORB_Core *orb_core)
+{
+ this->orb_core (orb_core);
+
+ // Create our connect strategy
+ if (this->create_connect_strategy () == -1)
+ return -1;
+
+ return 0;
+}
+
+int
+TAO_COIOP_Connector::close (void)
+{
+ return 0;
+}
+
+int
+TAO_COIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
+{
+ TAO_COIOP_Endpoint *COIOP_endpoint =
+ this->remote_endpoint (endpoint);
+
+ if (COIOP_endpoint == 0)
+ return -1;
+
+ return 0;
+}
+
+TAO_Transport *
+TAO_COIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *,
+ TAO_Transport_Descriptor_Interface &,
+ ACE_Time_Value * /*max_wait_time*/)
+{
+ // No remote connection possible with COIOP
+ return 0;
+}
+
+TAO_Profile *
+TAO_COIOP_Connector::create_profile (TAO_InputCDR& cdr)
+{
+ TAO_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_COIOP_Profile (this->orb_core ()),
+ 0);
+
+ int const r = pfile->decode (cdr);
+ if (r == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ }
+
+ return pfile;
+}
+
+TAO_Profile *
+TAO_COIOP_Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // The endpoint should be of the form:
+ // N.n@uuid/object_key
+ // or:
+ // uuid/object_key
+
+ TAO_Profile *profile = 0;
+ ACE_NEW_THROW_EX (profile,
+ TAO_COIOP_Profile (this->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return profile;
+}
+
+int
+TAO_COIOP_Connector::check_prefix (const char *endpoint)
+{
+ // Check for a valid string
+ if (!endpoint || !*endpoint)
+ return -1; // Failure
+
+ const char *protocol[] = { "COIOP", "COIOPloc" };
+
+ size_t const slot = ACE_OS::strchr (endpoint, ':') - endpoint;
+
+ size_t const len0 = ACE_OS::strlen (protocol[0]);
+ size_t const len1 = ACE_OS::strlen (protocol[1]);
+
+ // Check for the proper prefix in the IOR. If the proper prefix
+ // isn't in the IOR then it is not an IOR we can use.
+ if (slot == len0
+ && ACE_OS::strncasecmp (endpoint, protocol[0], len0) == 0)
+ return 0;
+ else if (slot == len1
+ && ACE_OS::strncasecmp (endpoint, protocol[1], len1) == 0)
+ return 0;
+
+ return -1;
+ // Failure: not an COIOP IOR
+ // DO NOT throw an exception here.
+}
+
+char
+TAO_COIOP_Connector::object_key_delimiter (void) const
+{
+ return TAO_COIOP_Profile::object_key_delimiter_;
+}
+
+TAO_COIOP_Endpoint *
+TAO_COIOP_Connector::remote_endpoint (TAO_Endpoint *endpoint)
+{
+ if (endpoint->tag () != TAO_TAG_COIOP_PROFILE)
+ return 0;
+
+ TAO_COIOP_Endpoint *COIOP_endpoint =
+ dynamic_cast<TAO_COIOP_Endpoint *> (endpoint );
+
+ return COIOP_endpoint;
+}
+
+int
+TAO_COIOP_Connector::cancel_svc_handler (
+ TAO_Connection_Handler * /* svc_handler */)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
diff --git a/TAO/tao/Strategies/COIOP_Connector.h b/TAO/tao/Strategies/COIOP_Connector.h
new file mode 100644
index 00000000000..f311f4a1c41
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Connector.h
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file COIOP_Connector.h
+ *
+ * $Id$
+ *
+ * COIOP specific connector processing
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_COIOP_CONNECTOR_H
+#define TAO_COIOP_CONNECTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/COIOP_Connection_Handler.h"
+#include "tao/Transport_Connector.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Endpoint;
+class TAO_COIOP_Endpoint;
+
+// ****************************************************************
+
+/**
+ * @class TAO_COIOP_Connector
+ *
+ * @brief COIOP-specific Connector bridge for pluggable protocols.
+ *
+ * Concrete instance of the TAO_Connector class. Responsible
+ * for establishing a connection with a server and is called from the
+ * Connector_Registory.
+ */
+class TAO_Strategies_Export TAO_COIOP_Connector : public TAO_Connector
+{
+public:
+ // = Initialization and termination methods.
+ /// Constructor.
+ TAO_COIOP_Connector (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_COIOP_Connector (void);
+
+ /**
+ * @name The TAO_Connector Methods
+ *
+ * Please check the documentation in Transport_Connector.h for details.
+ */
+ //@{
+ int open (TAO_ORB_Core *orb_core);
+ int close (void);
+
+ TAO_Profile *create_profile (TAO_InputCDR& cdr);
+
+ virtual int check_prefix (const char *endpoint);
+
+ virtual char object_key_delimiter (void) const;
+ //@}
+
+protected:
+
+ /**
+ * @name More TAO_Connector Methods
+ *
+ * Please check the documentation in Transport_Connector.h for details.
+ */
+ //@{
+ int set_validate_endpoint (TAO_Endpoint *ep);
+
+ TAO_Transport *make_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout = 0);
+
+ virtual TAO_Profile * make_profile (ACE_ENV_SINGLE_ARG_DECL);
+ //@}
+
+ /// Cancel the passed cvs handler from the connector
+ int cancel_svc_handler (TAO_Connection_Handler * svc_handler);
+
+protected:
+
+ /// Do we need to use a GIOP_Lite for sending messages?
+ CORBA::Boolean lite_flag_;
+
+private:
+
+ /// Return the remote endpoint, a helper function
+ TAO_COIOP_Endpoint *remote_endpoint (TAO_Endpoint *ep);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COIOP_CONNECTOR_H */
diff --git a/TAO/tao/Strategies/COIOP_Endpoint.cpp b/TAO/tao/Strategies/COIOP_Endpoint.cpp
new file mode 100644
index 00000000000..9f383b98a8d
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Endpoint.cpp
@@ -0,0 +1,119 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+
+#include "tao/Strategies/COIOP_Endpoint.h"
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/COIOP_Connection_Handler.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (Strategies,
+ COIOP_Endpoint,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Strategies/COIOP_Endpoint.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/os_include/os_netdb.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_COIOP_Endpoint::TAO_COIOP_Endpoint (const ACE_Utils::UUID& uuid)
+ : TAO_Endpoint (TAO_TAG_COIOP_PROFILE)
+ , uuid_ (uuid)
+ , next_ (0)
+{
+}
+
+TAO_COIOP_Endpoint::TAO_COIOP_Endpoint (void)
+ : TAO_Endpoint (TAO_TAG_COIOP_PROFILE),
+ uuid_ (),
+ next_ (0)
+{
+}
+
+TAO_COIOP_Endpoint::~TAO_COIOP_Endpoint (void)
+{
+
+}
+
+int
+TAO_COIOP_Endpoint::addr_to_string (char *buffer, size_t length)
+{
+ const ACE_CString *str = uuid_.to_string ();
+ size_t const actual_len =
+ str->length ();
+
+ if (length < actual_len)
+ return -1;
+
+ ACE_OS::sprintf (buffer, "%s",
+ str->c_str());
+
+ return 0;
+}
+
+TAO_Endpoint *
+TAO_COIOP_Endpoint::next (void)
+{
+ return 0;
+}
+
+TAO_Endpoint *
+TAO_COIOP_Endpoint::duplicate (void)
+{
+ TAO_COIOP_Endpoint *endpoint = 0;
+
+ ACE_NEW_RETURN (endpoint,
+ TAO_COIOP_Endpoint (this->uuid_),
+ 0);
+
+ return endpoint;
+}
+
+CORBA::Boolean
+TAO_COIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
+{
+ TAO_Endpoint *endpt = const_cast<TAO_Endpoint *> (other_endpoint);
+
+ TAO_COIOP_Endpoint *endpoint = dynamic_cast<TAO_COIOP_Endpoint *> (endpt);
+ if (endpoint == 0)
+ return false;
+
+ return (this->uuid_ == endpoint->uuid_);
+}
+
+CORBA::ULong
+TAO_COIOP_Endpoint::hash (void)
+{
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->hash_val_);
+ // .. DCL
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ const ACE_CString *stringval = this->uuid_.to_string ();
+ this->hash_val_ =
+ stringval->hash ();
+ }
+
+ return this->hash_val_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
diff --git a/TAO/tao/Strategies/COIOP_Endpoint.h b/TAO/tao/Strategies/COIOP_Endpoint.h
new file mode 100644
index 00000000000..9828c1fd510
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Endpoint.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file COIOP_Endpoint.h
+ *
+ * $Id$
+ *
+ * COIOP implementation of PP Framework Endpoint interface.
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_COIOP_ENDPOINT_H
+#define TAO_COIOP_ENDPOINT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Endpoint.h"
+#include "ace/UUID.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_COIOP_Connection_Handler;
+
+/**
+ * @class TAO_COIOP_Endpoint
+ *
+ * @brief TAO_COIOP_Endpoint
+ *
+ * COIOP-specific implementation of PP Framework Endpoint interface.
+ */
+class TAO_Strategies_Export TAO_COIOP_Endpoint : public TAO_Endpoint
+{
+public:
+
+ friend class TAO_COIOP_Profile;
+ friend class TAO_SSLIOP_Profile;
+
+ // = Initialization and termination methods.
+
+ /// Default constructor.
+ TAO_COIOP_Endpoint (void);
+
+ /// Constructor. This is the most efficient constructor since it
+ /// does not require any address resolution processing.
+ TAO_COIOP_Endpoint (const ACE_Utils::UUID& uuid);
+
+ /// Destructor.
+ ~TAO_COIOP_Endpoint (void);
+
+ /**
+ * @name TAO_Endpoint Methods
+ *
+ * Please check the documentation in Endpoint.h for details.
+ */
+ //@{
+ virtual TAO_Endpoint *next (void);
+ virtual int addr_to_string (char *buffer, size_t length);
+ virtual TAO_Endpoint *duplicate (void);
+
+ /// Return true if this endpoint is equivalent to <other_endpoint>. Two
+ /// endpoints are equivalent iff their port and host are the same.
+ CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
+
+ /// Return a hash value for this object.
+ CORBA::ULong hash (void);
+ //@}
+
+ // = COIOP_Endpoint-specific methods.
+
+ /// Return a pointer to the host string. This object maintains
+ /// ownership of this string.
+ const ACE_Utils::UUID& uuid (void) const;
+
+private:
+ /// UUID uniquely identifying this COIOP endpoint
+ mutable ACE_Utils::UUID uuid_;
+
+ /// COIOP Endpoints can be stringed into a list. Return the next
+ /// endpoint in the list, if any.
+ TAO_COIOP_Endpoint *next_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Strategies/COIOP_Endpoint.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_COIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/COIOP_Endpoint.inl b/TAO/tao/Strategies/COIOP_Endpoint.inl
new file mode 100644
index 00000000000..fc263f51058
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Endpoint.inl
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const ACE_Utils::UUID&
+TAO_COIOP_Endpoint::uuid (void) const
+{
+ return this->uuid_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/COIOP_Endpoints.pidl b/TAO/tao/Strategies/COIOP_Endpoints.pidl
new file mode 100644
index 00000000000..6bdb9181b99
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Endpoints.pidl
@@ -0,0 +1,41 @@
+//
+// $Id$
+
+/**
+ * This file contains idl definition for data structures used to
+ * encapsulate data in TAO_TAG_ENDPOINTS tagged component. This
+ * TAO-specific component is used for transmission of multiple
+ * endpoints per single profile. Data structures defined here are
+ * used for transmission of COIOP endpoints. See COIOP_Profile.*
+ * for more details.
+ *
+ * This file was used to generate the code in
+ * COIOP_EndpointsC.* The command used to generate code
+ * is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -Sci \
+ * -Wb,export_macro=TAO_Export \
+ * -Wb,export_include="tao/TAO_Export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * COIOP_Endpoints.pidl
+ */
+
+#ifndef _TAO_COIOP_ENDPOINTS_IDL_
+#define _TAO_COIOP_ENDPOINTS_IDL_
+
+module TAO
+{
+ /// Stores information for a single COIOP endpoint.
+ struct COIOP_Endpoint_Info
+ {
+ string uuid;
+ short priority;
+ };
+
+ /// Stores information for a collection of COIOP endpoints.
+ typedef sequence <COIOP_Endpoint_Info> COIOPEndpointSequence;
+};
+
+#endif /* _TAO_IIOP_ENDPOINTS_IDL_ */
diff --git a/TAO/tao/Strategies/COIOP_Factory.cpp b/TAO/tao/Strategies/COIOP_Factory.cpp
new file mode 100644
index 00000000000..655ca4386ab
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Factory.cpp
@@ -0,0 +1,98 @@
+// $Id$
+
+#include "tao/Strategies/COIOP_Factory.h"
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/COIOP_Acceptor.h"
+#include "tao/Strategies/COIOP_Connector.h"
+
+#include "tao/ORB_Constants.h"
+
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (Strategies,
+ COIOP_Factory,
+ "$Id$")
+
+static const char the_prefix[] = "COIOP";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_COIOP_Protocol_Factory::TAO_COIOP_Protocol_Factory (void)
+ : TAO_Protocol_Factory (TAO_TAG_COIOP_PROFILE)
+{
+}
+
+TAO_COIOP_Protocol_Factory::~TAO_COIOP_Protocol_Factory (void)
+{
+}
+
+int
+TAO_COIOP_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::the_prefix) == 0);
+}
+
+const char *
+TAO_COIOP_Protocol_Factory::prefix (void) const
+{
+ return ::the_prefix;
+}
+
+char
+TAO_COIOP_Protocol_Factory::options_delimiter (void) const
+{
+ return '/';
+}
+
+TAO_Acceptor *
+TAO_COIOP_Protocol_Factory::make_acceptor (void)
+{
+ TAO_Acceptor *acceptor = 0;
+
+ ACE_NEW_RETURN (acceptor,
+ TAO_COIOP_Acceptor,
+ 0);
+
+ return acceptor;
+}
+
+int
+TAO_COIOP_Protocol_Factory::init (int /* argc */,
+ ACE_TCHAR* /* argv */ [])
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_COIOP_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ ACE_NEW_RETURN (connector,
+ TAO_COIOP_Connector,
+ 0);
+ return connector;
+}
+
+int
+TAO_COIOP_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_COIOP_Protocol_Factory,
+ ACE_TEXT ("COIOP_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_COIOP_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO_Strategies, TAO_COIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
diff --git a/TAO/tao/Strategies/COIOP_Factory.h b/TAO/tao/Strategies/COIOP_Factory.h
new file mode 100644
index 00000000000..f63cfebf274
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Factory.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file COIOP_Factory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_COIOP_FACTORY_H
+#define TAO_COIOP_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Protocol_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Strategies_Export TAO_COIOP_Protocol_Factory
+ : public TAO_Protocol_Factory
+{
+public:
+ /// Constructor.
+ TAO_COIOP_Protocol_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_COIOP_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ /**
+ * @name Protocol factory methods
+ *
+ * Check Protocol_Factory.h for a description of these methods.
+ */
+ //@{
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+ //@}
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_COIOP_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_COIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COIOP_FACTORY_H */
diff --git a/TAO/tao/Strategies/COIOP_Profile.cpp b/TAO/tao/Strategies/COIOP_Profile.cpp
new file mode 100644
index 00000000000..5357ad8203f
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Profile.cpp
@@ -0,0 +1,397 @@
+// $Id$
+
+#include "tao/Strategies/COIOP_Profile.h"
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Strategies/COIOP_EndpointsC.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (Strategies,
+ COIOP_Profile,
+ "$Id$")
+
+static const char the_prefix[] = "niop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+const char TAO_COIOP_Profile::object_key_delimiter_ = '/';
+
+char
+TAO_COIOP_Profile::object_key_delimiter (void) const
+{
+ return TAO_COIOP_Profile::object_key_delimiter_;
+}
+
+TAO_COIOP_Profile::TAO_COIOP_Profile (const ACE_Utils::UUID& uuid,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_COIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (uuid),
+ count_ (1)
+{
+}
+
+TAO_COIOP_Profile::TAO_COIOP_Profile (TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_COIOP_PROFILE,
+ orb_core,
+ TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
+ endpoint_ (),
+ count_ (1)
+{
+}
+
+TAO_COIOP_Profile::~TAO_COIOP_Profile (void)
+{
+ // Clean up the list of endpoints since we own it.
+ // Skip the head, since it is not dynamically allocated.
+ TAO_Endpoint *tmp = 0;
+
+ for (TAO_Endpoint *next = this->endpoint ()->next ();
+ next != 0;
+ next = tmp)
+ {
+ tmp = next->next ();
+ delete next;
+ }
+}
+
+// return codes:
+// -1 -> error
+// 0 -> can't understand this version
+// 1 -> success.
+
+int
+TAO_COIOP_Profile::decode_profile (TAO_InputCDR& cdr)
+{
+ // @@ NOTE: This code is repeated thrice. Need to factor out in a
+ // better manner.
+ // Decode uuid into the <endpoint_>.
+ CORBA::String_var uuid;
+ if (cdr.read_string (uuid.out ()) == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) COIOP_Profile::decode - ")
+ ACE_TEXT ("error while uuid")));
+ return -1;
+ }
+
+ if (cdr.good_bit ())
+ {
+ this->endpoint_.uuid_.from_string (uuid.in());
+
+ return 1;
+ }
+
+ return -1;
+}
+
+void
+TAO_COIOP_Profile::parse_string_i (const char *ior
+ ACE_ENV_ARG_DECL)
+{
+ // Pull off the "hostname:port/" part of the objref
+ // Copy the string because we are going to modify it...
+ const char *okd =
+ ACE_OS::strchr (ior, this->object_key_delimiter_);
+
+ if (okd == 0 || okd == ior)
+ {
+ // No object key delimiter or no hostname specified.
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ // Length of host string.
+ CORBA::ULong length_host = okd - ior;
+
+ CORBA::String_var tmp = CORBA::string_alloc (length_host);
+
+ // Skip the trailing '/'
+ ACE_OS::strncpy (tmp.inout (), ior, length_host);
+ tmp[length_host] = '\0';
+
+ this->endpoint_.uuid_.from_string (tmp._retn ());
+
+ TAO::ObjectKey ok;
+ TAO::ObjectKey::decode_string_to_sequence (ok,
+ okd + 1);
+
+ (void) this->orb_core ()->object_key_table ().bind (ok,
+ this->ref_object_key_);
+}
+
+CORBA::Boolean
+TAO_COIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile)
+{
+ const TAO_COIOP_Profile *op =
+ dynamic_cast<const TAO_COIOP_Profile *> (other_profile);
+
+ // Check endpoints equivalence.
+ const TAO_COIOP_Endpoint *other_endp = &op->endpoint_;
+ for (TAO_COIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ if (endp->is_equivalent (other_endp))
+ other_endp = other_endp->next_;
+ else
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::ULong
+TAO_COIOP_Profile::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // Get the hashvalue for all endpoints.
+ CORBA::ULong hashval = 0;
+ for (TAO_COIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ hashval += endp->hash ();
+ }
+
+ hashval += this->version_.minor;
+ hashval += this->tag ();
+
+ const TAO::ObjectKey &ok =
+ this->ref_object_key_->object_key ();
+
+ if (ok.length () >= 4)
+ {
+ hashval += ok[1];
+ hashval += ok[3];
+ }
+
+ hashval += this->hash_service_i (max);
+
+ return hashval % max;
+}
+
+TAO_Endpoint*
+TAO_COIOP_Profile::endpoint (void)
+{
+ return &this->endpoint_;
+}
+
+CORBA::ULong
+TAO_COIOP_Profile::endpoint_count (void) const
+{
+ return this->count_;
+}
+
+void
+TAO_COIOP_Profile::add_endpoint (TAO_COIOP_Endpoint *endp)
+{
+ endp->next_ = this->endpoint_.next_;
+ this->endpoint_.next_ = endp;
+
+ this->count_++;
+}
+
+char *
+TAO_COIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ CORBA::String_var key;
+ TAO::ObjectKey::encode_sequence_to_string (key.inout(),
+ this->ref_object_key_->object_key ());
+
+ const ACE_CString * uuidstr = this->endpoint_.uuid_.to_string ();
+ size_t buflen = (8 /* "corbaloc" */ +
+ 1 /* colon separator */ +
+ ACE_OS::strlen (::the_prefix) +
+ 1 /* colon separator */ +
+ 1 /* major version */ +
+ 1 /* decimal point */ +
+ 1 /* minor version */ +
+ 1 /* `@' character */ +
+ uuidstr->length() +
+ 1 /* colon separator */ +
+ 5 /* port number */ +
+ 1 /* object key separator */ +
+ ACE_OS::strlen (key.in ()));
+
+ char * buf = CORBA::string_alloc (static_cast<CORBA::ULong> (buflen));
+
+ static const char digits [] = "0123456789";
+
+ ACE_OS::sprintf (buf,
+ "corbaloc:%s:%c.%c@%s%c%s",
+ ::the_prefix,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ uuidstr->c_str (),
+ this->object_key_delimiter_,
+ key.in ());
+
+ return buf;
+}
+
+const char *
+TAO_COIOP_Profile::prefix (void)
+{
+ return ::the_prefix;
+}
+
+void
+TAO_COIOP_Profile::create_profile_body (TAO_OutputCDR &encap) const
+{
+ encap.write_octet (TAO_ENCAP_BYTE_ORDER);
+
+ // The GIOP version
+ encap.write_octet (this->version_.major);
+ encap.write_octet (this->version_.minor);
+
+ // STRING hostname from profile
+ const ACE_CString * uuid_str = this->endpoint_.uuid_.to_string();
+ encap.write_string (uuid_str->c_str ());
+
+ // OCTET SEQUENCE for object key
+ if (this->ref_object_key_)
+ encap << this->ref_object_key_->object_key ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO - COIOP_Profile::create_profile_body "
+ "no object key marshalled \n"));
+ }
+
+ if (this->version_.major > 1
+ || this->version_.minor > 0)
+ this->tagged_components ().encode (encap);
+}
+
+int
+TAO_COIOP_Profile::encode_endpoints (void)
+{
+ // Create a data structure and fill it with endpoint info for wire
+ // transfer.
+ // We include information for the head of the list
+ // together with other endpoints because even though its addressing
+ // info is transmitted using standard ProfileBody components, its
+ // priority is not!
+
+ TAO::COIOPEndpointSequence endpoints;
+ endpoints.length (this->count_);
+
+ const TAO_COIOP_Endpoint *endpoint = &this->endpoint_;
+ for (CORBA::ULong i = 0;
+ i < this->count_;
+ ++i)
+ {
+ const ACE_CString* uuidstr = endpoint->uuid_.to_string();
+ CORBA::String_var uuid (uuidstr->c_str());
+ endpoints[i].uuid = uuid;
+ endpoints[i].priority = endpoint->priority ();
+
+ endpoint = endpoint->next_;
+ }
+
+ // Encode the data structure.
+ TAO_OutputCDR out_cdr;
+ if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ == 0)
+ || (out_cdr << endpoints) == 0)
+ return -1;
+ size_t length = out_cdr.total_length ();
+
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+ tagged_component.component_data.length (static_cast<CORBA::ULong> (length));
+ CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ for (const ACE_Message_Block *iterator = out_cdr.begin ();
+ iterator != 0;
+ iterator = iterator->cont ())
+ {
+ size_t i_length = iterator->length ();
+ ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
+
+ buf += i_length;
+ }
+
+ // Add component with encoded endpoint data to this profile's
+ // TaggedComponents.
+ tagged_components_.set_component (tagged_component);
+
+ return 0;
+}
+
+int
+TAO_COIOP_Profile::decode_endpoints (void)
+{
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+
+ if (this->tagged_components_.get_component (tagged_component))
+ {
+ const CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ TAO_InputCDR in_cdr (reinterpret_cast<const char*> (buf),
+ tagged_component.component_data.length ());
+
+ // Extract the Byte Order.
+ CORBA::Boolean byte_order;
+ if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+ in_cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ // Extract endpoints sequence.
+ TAO::COIOPEndpointSequence endpoints;
+
+ if (! (in_cdr >> endpoints))
+ return -1;
+
+ // Get the priority of the first endpoint (head of the list.
+ // It's other data is extracted as part of the standard profile
+ // decoding.
+ this->endpoint_.priority (endpoints[0].priority);
+
+ // Use information extracted from the tagged component to
+ // populate the profile. Skip the first endpoint, since it is
+ // always extracted through standard profile body. Also, begin
+ // from the end of the sequence to preserve endpoint order,
+ // since <add_endpoint> method reverses the order of endpoints
+ // in the list.
+ for (CORBA::ULong i = endpoints.length () - 1;
+ i > 0;
+ --i)
+ {
+ TAO_COIOP_Endpoint *endpoint = 0;
+ CORBA::String_var strvar = CORBA::string_dup (endpoints[i].uuid);
+ ACE_Utils::UUID uuid1 (strvar.in());
+ ACE_NEW_RETURN (endpoint,
+ TAO_COIOP_Endpoint (uuid1),
+ -1);
+
+ this->add_endpoint (endpoint);
+ }
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
diff --git a/TAO/tao/Strategies/COIOP_Profile.h b/TAO/tao/Strategies/COIOP_Profile.h
new file mode 100644
index 00000000000..9f8af464281
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Profile.h
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file COIOP_Profile.h
+ *
+ * $Id$
+ *
+ * COIOP profile specific processing
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_COIOP_PROFILE_H
+#define TAO_COIOP_PROFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/COIOP_Endpoint.h"
+#include "tao/Profile.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO COIOP_Profile concrete Profile definitions
+/**
+ * @class TAO_COIOP_Profile
+ *
+ * @brief This class defines the protocol specific attributes required
+ * for locating ORBs over a TCP/IP network.
+ *
+ * This class defines the COIOP profile as specified in the CORBA
+ * specification.
+ */
+class TAO_Strategies_Export TAO_COIOP_Profile : public TAO_Profile
+{
+public:
+ /// The object key delimiter that COIOP uses or expects.
+ static const char object_key_delimiter_;
+ virtual char object_key_delimiter (void) const;
+
+ /// Return the char string prefix.
+ static const char *prefix (void);
+
+ /// Profile constructor, this is the most efficient since it
+ /// doesn't require any address resolution processing.
+ TAO_COIOP_Profile (const ACE_Utils::UUID& uuid,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, default.
+ TAO_COIOP_Profile (TAO_ORB_Core *orb_core);
+
+ /// Destructor is to be called only through <_decr_refcnt>.
+ ~TAO_COIOP_Profile (void);
+
+ /// Template methods. Please tao/Profile.h for documentation.
+ virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL);
+ virtual int encode_endpoints (void);
+ virtual TAO_Endpoint *endpoint (void);
+ virtual CORBA::ULong endpoint_count (void) const;
+ virtual CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL);
+ /**
+ * Add <endp> to this profile's list of endpoints (it is inserted
+ * next to the head of the list). This profiles takes ownership of
+ * <endp>.
+ */
+ void add_endpoint (TAO_COIOP_Endpoint *endp);
+
+protected:
+
+ /// Template methods. Please see tao/Profile.h for documentation.
+ virtual int decode_profile (TAO_InputCDR& cdr);
+ virtual void parse_string_i (const char *string
+ ACE_ENV_ARG_DECL);
+ 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);
+
+protected:
+
+ /**
+ * 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 TAG_ALTERNATE_COIOP_ADDRESS
+ * feature.
+ * Addressing info of the default endpoint, i.e., head of the list,
+ * is transmitted using standard COIOP ProfileBody components. See
+ * <encode_endpoints> method documentation above for how the rest of
+ * the endpoint list is transmitted.
+ */
+ TAO_COIOP_Endpoint endpoint_;
+
+ /// Number of endpoints in the list headed by <endpoint_>.
+ CORBA::ULong count_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/COIOP_Transport.cpp b/TAO/tao/Strategies/COIOP_Transport.cpp
new file mode 100644
index 00000000000..93c665bf99f
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Transport.cpp
@@ -0,0 +1,165 @@
+// $Id$
+
+#include "tao/Strategies/COIOP_Transport.h"
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/COIOP_Connection_Handler.h"
+#include "tao/Strategies/COIOP_Acceptor.h"
+#include "tao/Strategies/COIOP_Profile.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/operation_details.h"
+#include "tao/Timeprobe.h"
+#include "tao/CDR.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Resume_Handle.h"
+#include "tao/GIOP_Message_Base.h"
+#include "tao/GIOP_Message_Lite.h"
+
+ACE_RCSID (tao, COIOP_Transport, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_COIOP_Transport::TAO_COIOP_Transport (TAO_COIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_Transport (TAO_TAG_COIOP_PROFILE,
+ orb_core)
+ , connection_handler_ (handler)
+ , messaging_object_ (0)
+{
+/*
+ * Hook to customize the messaging object when the concrete messaging
+ * object is known a priori. In this case, the flag is ignored.
+ */
+//@@ MESSAGING_SPL_COMMENT_HOOK_START
+
+ // @@ Michael: Set the input CDR size to ACE_MAX_DGRAM_SIZE so that
+ // we read the whole UDP packet on a single read.
+ if (flag)
+ {
+ // Use the lite version of the protocol
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Lite (orb_core));
+ }
+ else
+ {
+ // Use the normal GIOP object
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Base (orb_core,
+ this));
+ }
+
+//@@ MESSAGING_SPL_COMMENT_HOOK_END
+
+}
+
+TAO_COIOP_Transport::~TAO_COIOP_Transport (void)
+{
+ delete this->messaging_object_;
+}
+
+ACE_Event_Handler *
+TAO_COIOP_Transport::event_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Connection_Handler *
+TAO_COIOP_Transport::connection_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Pluggable_Messaging *
+TAO_COIOP_Transport::messaging_object (void)
+{
+ return this->messaging_object_;
+}
+
+ssize_t
+TAO_COIOP_Transport::send (iovec *,
+ int ,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *)
+{
+ // We don't send data over the wire with COIOP
+ bytes_transferred = 0;
+
+ return 1;
+}
+
+ssize_t
+TAO_COIOP_Transport::recv (char *,
+ size_t ,
+ const ACE_Time_Value *)
+{
+ return 0;
+}
+
+int
+TAO_COIOP_Transport::handle_input (TAO_Resume_Handle &,
+ ACE_Time_Value *,
+ int /*block*/)
+{
+ return 0;
+}
+
+
+int
+TAO_COIOP_Transport::register_handler (void)
+{
+ // We do never register register the handler with the reactor
+ // as we never need to be informed about any incoming data,
+ // assuming we only use one-ways.
+ // If we would register and ICMP Messages would arrive, e.g
+ // due to a not reachable server, we would get informed - as this
+ // disturbs the general COIOP assumptions of not being
+ // interested in any network failures, we ignore ICMP messages.
+ return 0;
+}
+
+
+int
+TAO_COIOP_Transport::send_request (TAO_Stub *,
+ TAO_ORB_Core *,
+ TAO_OutputCDR &,
+ int,
+ ACE_Time_Value *)
+{
+ return 0;
+}
+
+int
+TAO_COIOP_Transport::send_message (TAO_OutputCDR &,
+ TAO_Stub *,
+ int,
+ ACE_Time_Value *)
+{
+ return 1;
+}
+
+int
+TAO_COIOP_Transport::send_message_shared (TAO_Stub *,
+ int,
+ const ACE_Message_Block *,
+ ACE_Time_Value *)
+{
+ return 1;
+}
+
+int
+TAO_COIOP_Transport::messaging_init (CORBA::Octet major,
+ CORBA::Octet minor)
+{
+ this->messaging_object_->init (major, minor);
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
diff --git a/TAO/tao/Strategies/COIOP_Transport.h b/TAO/tao/Strategies/COIOP_Transport.h
new file mode 100644
index 00000000000..56eecf56ea3
--- /dev/null
+++ b/TAO/tao/Strategies/COIOP_Transport.h
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file COIOP_Transport.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_COIOP_TRANSPORT_H
+#define TAO_COIOP_TRANSPORT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Transport.h"
+#include "ace/SOCK_Stream.h"
+#include "ace/Svc_Handler.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward decls.
+class TAO_COIOP_Connection_Handler;
+class TAO_ORB_Core;
+class TAO_Operation_Details;
+class TAO_Pluggable_Messaging;
+class TAO_Acceptor;
+
+// Service Handler for this transport
+typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+ TAO_COIOP_SVC_HANDLER;
+
+/**
+ * @class TAO_COIOP_Transport
+ *
+ * @brief Specialization of the base TAO_Transport class to handle the
+ * COIOP protocol.
+ */
+class TAO_Strategies_Export TAO_COIOP_Transport : public TAO_Transport
+{
+public:
+
+ /// Constructor.
+ TAO_COIOP_Transport (TAO_COIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Default destructor.
+ ~TAO_COIOP_Transport (void);
+
+ /// Look for the documentation in Transport.h.
+ virtual int handle_input (TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time = 0,
+ int block = 0);
+protected:
+ /** @name Overridden Template Methods
+ *
+ * These are implementations of template methods declared by TAO_Transport.
+ */
+ //@{
+
+ virtual ACE_Event_Handler * event_handler_i (void);
+ virtual TAO_Connection_Handler *connection_handler_i (void);
+ virtual TAO_Pluggable_Messaging *messaging_object (void);
+
+ /// Write the complete Message_Block chain to the connection.
+ virtual ssize_t send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time);
+
+ /// Read len bytes from into buf.
+ virtual ssize_t recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *s = 0);
+
+ virtual int send_message_shared (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int register_handler (void);
+
+ ///@}
+public:
+ /// @todo These methods IMHO should have more meaningful names.
+ /// The names seem to indicate nothing.
+ virtual int send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub = 0,
+ int message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
+ ACE_Time_Value *max_time_wait = 0);
+
+ /// Initialising the messaging object
+ virtual int messaging_init (CORBA::Octet major,
+ CORBA::Octet minor);
+
+private:
+
+ /// The connection service handler used for accessing lower layer
+ /// communication protocols.
+ TAO_COIOP_Connection_Handler *connection_handler_;
+
+ /// Our messaging object.
+ TAO_Pluggable_Messaging *messaging_object_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COIOP_TRANSPORT_H */
diff --git a/TAO/tao/Strategies/advanced_resource.cpp b/TAO/tao/Strategies/advanced_resource.cpp
index 57d5fd5cdaa..443c51e58c6 100644
--- a/TAO/tao/Strategies/advanced_resource.cpp
+++ b/TAO/tao/Strategies/advanced_resource.cpp
@@ -6,6 +6,7 @@
#include "tao/Strategies/SHMIOP_Factory.h"
#include "tao/Strategies/DIOP_Factory.h"
#include "tao/Strategies/SCIOP_Factory.h"
+#include "tao/Strategies/COIOP_Factory.h"
#include "tao/Strategies/LFU_Connection_Purging_Strategy.h"
#include "tao/Strategies/FIFO_Connection_Purging_Strategy.h"
@@ -58,6 +59,10 @@ TAO_Resource_Factory_Changer::TAO_Resource_Factory_Changer (void)
#if TAO_HAS_SCIOP == 1
ACE_Service_Config::process_directive (ace_svc_desc_TAO_SCIOP_Protocol_Factory);
#endif /* TAO_HAS_SCIOP == 1 */
+
+#if TAO_HAS_COIOP == 1
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_COIOP_Protocol_Factory);
+#endif /* TAO_HAS_SCIOP == 1 */
}
TAO_Advanced_Resource_Factory::TAO_Advanced_Resource_Factory (void)
@@ -351,6 +356,12 @@ TAO_Advanced_Resource_Factory::init_protocol_factories (void)
return -1;
#endif /* TAO_HAS_SCIOP && TAO_HAS_SCIOP != 0 */
+#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
+ if (TAO::details::load_protocol_factory <TAO_COIOP_Protocol_Factory> (
+ this->protocol_factories_, "COIOP_Factory") == -1)
+ return -1;
+#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */
+
return 0;
}