summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/ChangeLog-99c31
-rw-r--r--TAO/tao/CDR.cpp109
-rw-r--r--TAO/tao/CDR.h46
-rw-r--r--TAO/tao/Connect.cpp28
-rw-r--r--TAO/tao/Exception.cpp38
-rw-r--r--TAO/tao/GIOP.cpp7
-rw-r--r--TAO/tao/IIOP_ORB.cpp11
-rw-r--r--TAO/tao/IIOP_Profile.cpp95
-rw-r--r--TAO/tao/IIOP_Profile.h9
-rw-r--r--TAO/tao/IIOP_Profile.i2
-rw-r--r--TAO/tao/Invocation.cpp20
-rw-r--r--TAO/tao/MProfile.h18
-rw-r--r--TAO/tao/MProfile.i10
-rw-r--r--TAO/tao/Object.cpp528
-rw-r--r--TAO/tao/Object.h8
-rw-r--r--TAO/tao/Object.i2
-rw-r--r--TAO/tao/Pluggable.h5
-rw-r--r--TAO/tao/Server_Request.cpp23
-rw-r--r--TAO/tao/Stub.h9
-rw-r--r--TAO/tao/Stub.i25
-rw-r--r--TAO/tao/decode.cpp192
-rw-r--r--TAO/tao/encode.cpp65
-rwxr-xr-xTAO/tests/Param_Test/run_test.pl4
23 files changed, 670 insertions, 615 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index 3e91342935f..e8cb03fda73 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,34 @@
+Thu Mar 11 19:07:20 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * tao/CDR.h:
+ * tao/CDR.cpp:
+ * tao/Connect.cpp:
+ * tao/Exception.cpp:
+ * tao/IIOP_ORB.cpp:
+ * tao/IIOP_Profile.h:
+ * tao/IIOP_Profile.i:
+ * tao/IIOP_Profile.cpp:
+ * tao/MProfile.h:
+ * tao/MProfile.i:
+ * tao/Object.h:
+ * tao/Object.i:
+ * tao/Object.cpp:
+ * tao/Pluggable.h:
+ * tao/Server_Request.cpp:
+ * tao/Stub.h:
+ * tao/Stub.i:
+ * tao/decode.cpp:
+ * tao/encode.cpp:
+ Implemented compiled marshaling and demarshaling of object
+ references.
+ Removed uses of do_static_call() from the
+ CORBA::Object class in favor of compiled marshaling.
+ Removed several uses of interpretive marshaling, we can use
+ compiled marshaling now.
+
+ * tests/Param_Test/run_test.pl:
+ The client cleanly shutdowns the server now.
+
Thu Mar 11 16:36:34 1999 Jeff Parsons <parsons@cs.wustl.edu>
* TAO_IDL/be/be_visitor_interface/interface_ch.cpp:
diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp
index 407d04cbbcc..3d18664af30 100644
--- a/TAO/tao/CDR.cpp
+++ b/TAO/tao/CDR.cpp
@@ -83,8 +83,8 @@ TAO_OutputCDR::TAO_OutputCDR (size_t size,
size_t memcpy_tradeoff)
: ACE_OutputCDR (size,
byte_order,
- buffer_allocator
- ? buffer_allocator
+ buffer_allocator
+ ? buffer_allocator
: TAO_ORB_Core_instance ()->output_cdr_buffer_allocator (),
data_block_allocator
? data_block_allocator
@@ -96,7 +96,7 @@ TAO_OutputCDR::TAO_OutputCDR (size_t size,
ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR1_ENTER);
}
-TAO_OutputCDR::TAO_OutputCDR (char *data,
+TAO_OutputCDR::TAO_OutputCDR (char *data,
size_t size,
int byte_order,
ACE_Allocator *buffer_allocator,
@@ -105,8 +105,8 @@ TAO_OutputCDR::TAO_OutputCDR (char *data,
: ACE_OutputCDR (data,
size,
byte_order,
- buffer_allocator
- ? buffer_allocator
+ buffer_allocator
+ ? buffer_allocator
: TAO_ORB_Core_instance ()->output_cdr_buffer_allocator (),
data_block_allocator
? data_block_allocator
@@ -126,7 +126,7 @@ TAO_OutputCDR::TAO_OutputCDR (ACE_Message_Block *data,
memcpy_tradeoff
? memcpy_tradeoff
: TAO_ORB_Core_instance ()->orb_params ()->cdr_memcpy_tradeoff ())
-{
+{
ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR3_ENTER);
}
@@ -141,7 +141,7 @@ TAO_OutputCDR::encode (CORBA::TypeCode_ptr tc,
CORBA::Environment &TAO_IN_ENV)
{
TAO_Marshal_Object *mobj =
- TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
+ TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
TAO_IN_ENV);
TAO_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);
@@ -159,10 +159,10 @@ operator<< (TAO_OutputCDR& cdr, const CORBA::Any &x)
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_ANY::instance ()->encode (0,
- &x,
- 0,
- &cdr,
+ TAO_MARSHAL_ANY::instance ()->encode (0,
+ &x,
+ 0,
+ &cdr,
TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -179,33 +179,6 @@ operator<< (TAO_OutputCDR& cdr, const CORBA::Any &x)
}
CORBA::Boolean
-operator<< (TAO_OutputCDR& cdr, const CORBA::Object *x)
-{
- TAO_TRY
- {
- // @@ This function should *not* use the interpreter, there must
- // be a way to do this with just CDR operations!!!!
- CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_OBJREF::instance ()->encode (0,
- &x,
- 0,
- &cdr,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (status == CORBA::TypeCode::TRAVERSE_CONTINUE)
- return 1;
- // else return 0 at the end of the function
- }
- TAO_CATCH (CORBA_Exception, ex)
- {
- return 0;
- }
- TAO_ENDTRY;
- return 0;
-}
-
-CORBA::Boolean
operator<< (TAO_OutputCDR& cdr, const CORBA::TypeCode *x)
{
TAO_TRY
@@ -213,10 +186,10 @@ operator<< (TAO_OutputCDR& cdr, const CORBA::TypeCode *x)
// @@ This function should *not* use the interpreter, there must
// be a way to do this with just CDR operations!!!!
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_TYPECODE::instance ()->encode (0,
- &x,
- 0,
- &cdr,
+ TAO_MARSHAL_TYPECODE::instance ()->encode (0,
+ &x,
+ 0,
+ &cdr,
TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -238,7 +211,7 @@ TAO_OutputCDR::append (CORBA::TypeCode_ptr tc,
CORBA::Environment &TAO_IN_ENV)
{
TAO_Marshal_Object *mobj =
- TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
+ TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
TAO_IN_ENV);
TAO_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);
@@ -250,7 +223,7 @@ TAO_OutputCDR::append (CORBA::TypeCode_ptr tc,
// ****************************************************************
-TAO_InputCDR::TAO_InputCDR (const char *buf,
+TAO_InputCDR::TAO_InputCDR (const char *buf,
size_t bufsiz,
int byte_order)
: ACE_InputCDR (buf,
@@ -306,7 +279,7 @@ TAO_InputCDR::TAO_InputCDR (const TAO_OutputCDR& rhs,
ACE_Allocator* data_block_allocator)
: ACE_InputCDR (rhs,
buffer_allocator
- ? buffer_allocator
+ ? buffer_allocator
: TAO_ORB_Core_instance ()->output_cdr_buffer_allocator (),
data_block_allocator
? data_block_allocator
@@ -325,7 +298,7 @@ TAO_InputCDR::decode (CORBA::TypeCode_ptr tc,
CORBA::Environment &TAO_IN_ENV)
{
TAO_Marshal_Object *mobj =
- TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
+ TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
TAO_IN_ENV);
TAO_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);
@@ -340,7 +313,7 @@ TAO_InputCDR::skip (CORBA::TypeCode_ptr tc,
CORBA::Environment &TAO_IN_ENV)
{
TAO_Marshal_Object *mobj =
- TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
+ TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
TAO_IN_ENV);
TAO_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);
@@ -356,10 +329,10 @@ operator>> (TAO_InputCDR& cdr, CORBA::Any &x)
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_ANY::instance ()->decode (0,
- &x,
- 0,
- &cdr,
+ TAO_MARSHAL_ANY::instance ()->decode (0,
+ &x,
+ 0,
+ &cdr,
TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -376,40 +349,15 @@ operator>> (TAO_InputCDR& cdr, CORBA::Any &x)
}
CORBA::Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Object *&x)
-{
- TAO_TRY
- {
- CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_OBJREF::instance ()->decode (0,
- &x,
- 0,
- &cdr,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (status != CORBA::TypeCode::TRAVERSE_CONTINUE)
- return 0;
- }
- TAO_CATCH (CORBA_Exception, ex)
- {
- return 0;
- }
- TAO_ENDTRY;
-
- return 1;
-}
-
-CORBA::Boolean
operator>> (TAO_InputCDR& cdr, CORBA::TypeCode *&x)
{
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_TYPECODE::instance ()->decode (0,
- &x,
- 0,
- &cdr,
+ TAO_MARSHAL_TYPECODE::instance ()->decode (0,
+ &x,
+ 0,
+ &cdr,
TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -424,4 +372,3 @@ operator>> (TAO_InputCDR& cdr, CORBA::TypeCode *&x)
return 1;
}
-
diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h
index 4d7721a6b66..35bb33eb0df 100644
--- a/TAO/tao/CDR.h
+++ b/TAO/tao/CDR.h
@@ -85,7 +85,7 @@ public:
// Default constructor, allocates <size> bytes in the internal
// buffer, if <size> == 0 it allocates the default size.
- TAO_OutputCDR (char *data,
+ TAO_OutputCDR (char *data,
size_t size,
int byte_order = ACE_CDR_BYTE_ORDER,
ACE_Allocator* buffer_allocator = 0,
@@ -105,7 +105,7 @@ public:
CORBA::TypeCode::traverse_status append (CORBA::TypeCode_ptr tc,
TAO_InputCDR *src,
- CORBA_Environment &TAO_IN_ENV =
+ CORBA_Environment &TAO_IN_ENV =
CORBA::default_environment ());
// Append the contents of the CDR stream based on information
// described by <tc>; returning any errors in <TAO_IN_ENV>.
@@ -118,7 +118,7 @@ public:
CORBA::TypeCode::traverse_status encode (CORBA::TypeCode_ptr tc,
const void *data,
const void *,
- CORBA_Environment &TAO_IN_ENV =
+ CORBA_Environment &TAO_IN_ENV =
CORBA::default_environment ());
// Marshalls the contents of <data> as described by the TypeCode in
// <tc>. Any errors are reported though the <TAO_IN_ENV> parameter.
@@ -155,7 +155,7 @@ public:
friend class TAO_GIOP;
// This class is able to "read" an InputCDR from a socket.
- TAO_InputCDR (const char* buf,
+ TAO_InputCDR (const char* buf,
size_t bufsiz,
int byte_order = ACE_CDR_BYTE_ORDER);
// Create an input stream from an arbitrary buffer, care must be
@@ -191,7 +191,7 @@ public:
// This creates an encapsulated stream, the first byte must be (per
// the spec) the byte order of the encapsulation.
- // The default values for the allocators
+ // The default values for the allocators
// in this constructor are not 0, but are generated by the
// ORB. Refer to the constructor body in CDR.cpp for the
// code that supplies these values to the base class constructor.
@@ -210,14 +210,14 @@ public:
CORBA::TypeCode_ptr tc,
const void *data,
const void *,
- CORBA_Environment &TAO_IN_ENV =
+ CORBA_Environment &TAO_IN_ENV =
CORBA::default_environment ());
// Demarshall the contents of the CDR stream into <data> as
// described by <tc>; returning any errors in <TAO_IN_ENV>.
CORBA::TypeCode::traverse_status skip (
CORBA::TypeCode_ptr tc,
- CORBA_Environment &TAO_IN_ENV =
+ CORBA_Environment &TAO_IN_ENV =
CORBA::default_environment ());
// Skip the contents of the CDR stream based on information
// described by <tc>; returning any errors in <TAO_IN_ENV>.
@@ -227,15 +227,11 @@ public:
extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR& cdr,
const CORBA::Any &x);
extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR& cdr,
- const CORBA::Object *x);
-extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR& cdr,
const CORBA::TypeCode *x);
extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR& cdr,
CORBA::Any &x);
extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::Object *&x);
-extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR& cdr,
CORBA::TypeCode *&x);
#if defined(__ACE_INLINE__)
@@ -244,13 +240,13 @@ extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR& cdr,
// CDR output operators for CORBA types
-extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::Short x);
-extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::UShort x);
-extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::Long x);
-extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::ULong x);
extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::LongLong x);
@@ -258,22 +254,22 @@ extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::ULongLong x);
extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR& os,
CORBA::LongDouble x);
-extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::Float x);
-extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::Double x);
-extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+extern TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
const CORBA::Char* x);
// CDR input operators for CORBA types
-extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Short &x);
-extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::UShort &x);
-extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Long &x);
-extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::ULong &x);
extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::LongLong &x);
@@ -281,11 +277,11 @@ extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::ULongLong &x);
extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::LongDouble &x);
-extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Float &x);
-extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Double &x);
-extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+extern TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Char* &x);
#endif /* __ACE_INLINE */
diff --git a/TAO/tao/Connect.cpp b/TAO/tao/Connect.cpp
index 3b51b892ae9..bd5f6566117 100644
--- a/TAO/tao/Connect.cpp
+++ b/TAO/tao/Connect.cpp
@@ -412,16 +412,14 @@ TAO_Server_Connection_Handler::handle_locate (TAO_InputCDR &input,
if (status == TAO_GIOP_OBJECT_FORWARD)
{
CORBA::Object_ptr object_ptr = forward_location_var.in ();
- output.encode (CORBA::_tc_Object,
- &object_ptr,
- 0,
- env);
-
- // If encoding went fine
- if (env.exception () != 0)
+ if ((output << object_ptr) == 0)
{
- env.print_exception ("TAO_Server_Connection_Handler::handle_locate:"
- " forwarding parameter encode failed");
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Server_Connection_Handler::handle_locate - "
+ "error marshaling forwarded reference\n"));
+ }
response_required = 0;
return -1;
}
@@ -465,11 +463,7 @@ TAO_Server_Connection_Handler::send_error (CORBA::ULong request_id,
// create and write a dummy context
TAO_GIOP_ServiceContextList resp_ctx;
resp_ctx.length (0);
- output.encode (TC_ServiceContextList,
- &resp_ctx,
- 0,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ output << resp_ctx;
// Write the request ID
output.write_ulong (request_id);
@@ -496,11 +490,7 @@ TAO_Server_Connection_Handler::send_error (CORBA::ULong request_id,
CORBA::Object_ptr object_ptr =
forward_request_ptr->forward_reference.in();
- output.encode (CORBA::_tc_Object,
- &object_ptr,
- 0,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ output << object_ptr;
}
// end of the forwarding code ****************************
else
diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp
index 84d85fa879e..051ad19e32c 100644
--- a/TAO/tao/Exception.cpp
+++ b/TAO/tao/Exception.cpp
@@ -311,17 +311,11 @@ TAO_Exceptions::make_unknown_user_typecode (CORBA::TypeCode_ptr &tcp,
const char* name = "UnknownUserException";
const char* field_name = "exception";
- if (stream.write_octet (TAO_ENCAP_BYTE_ORDER) != 1
- || stream.encode (CORBA::_tc_string,
- &interface_id, 0,
- TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE
- || stream.encode (CORBA::_tc_string,
- &name, 0,
- TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE
- || stream.write_ulong (1L) != 1
- || stream.encode (CORBA::_tc_string,
- &field_name, 0,
- TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ if (stream.write_octet (TAO_ENCAP_BYTE_ORDER) == 0
+ || stream.write_string (interface_id) == 0
+ || stream.write_string (name) == 0
+ || stream.write_ulong (1L) == 0
+ || stream.write_string (field_name) == 0
|| stream.encode (CORBA::_tc_TypeCode,
&CORBA::_tc_any, 0,
TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE)
@@ -369,26 +363,18 @@ TAO_Exceptions::make_standard_typecode (CORBA::TypeCode_ptr &tcp,
// exceptions?
assert (ACE_OS::strlen (full_id) <= sizeof full_id);
- if (stream.write_octet (TAO_ENCAP_BYTE_ORDER) != 1
- || stream.encode (CORBA::_tc_string,
- &strptr, 0,
- TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE
- || stream.encode (CORBA::_tc_string,
- &name, 0,
- TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ if (stream.write_octet (TAO_ENCAP_BYTE_ORDER) == 0
+ || stream.write_string (strptr) == 0
+ || stream.write_string (name) == 0
|| stream.write_ulong (2L) != 1
- || stream.encode (CORBA::_tc_string,
- &minor, 0,
- TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ || stream.write_string (minor) == 0
|| stream.encode (CORBA::_tc_TypeCode,
&CORBA::_tc_ulong, 0,
TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE
- || stream.encode (CORBA::_tc_string,
- &completed, 0,
- TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ || stream.write_string (completed) == 0
|| stream.encode (CORBA::_tc_TypeCode,
- &TC_completion_status, 0,
- TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE)
+ &TC_completion_status, 0,
+ TAO_IN_ENV) != CORBA::TypeCode::TRAVERSE_CONTINUE)
TAO_THROW (CORBA_INITIALIZE (CORBA::COMPLETED_NO));
// OK, we stuffed the buffer we were given (or grew a bigger one;
diff --git a/TAO/tao/GIOP.cpp b/TAO/tao/GIOP.cpp
index 1df9981c94f..6c09312107e 100644
--- a/TAO/tao/GIOP.cpp
+++ b/TAO/tao/GIOP.cpp
@@ -678,15 +678,12 @@ TAO_GIOP::parse_header (TAO_InputCDR &cdr,
CORBA::Boolean
TAO_GIOP_LocateRequestHeader::init (TAO_InputCDR &msg,
- CORBA::Environment &ACE_TRY_ENV)
+ CORBA::Environment &)
{
ACE_FUNCTION_TIMEPROBE (TAO_GIOP_LOCATE_REQUEST_HEADER_INIT_START);
return (msg.read_ulong (this->request_id)
- && msg.decode (TC_opaque,
- &this->object_key,
- 0,
- ACE_TRY_ENV));
+ && (msg >> this->object_key) != 0);
}
CORBA::Boolean
diff --git a/TAO/tao/IIOP_ORB.cpp b/TAO/tao/IIOP_ORB.cpp
index c5269c92675..aa6b43781d6 100644
--- a/TAO/tao/IIOP_ORB.cpp
+++ b/TAO/tao/IIOP_ORB.cpp
@@ -62,9 +62,7 @@ IIOP_ORB::object_to_string (CORBA::Object_ptr obj,
// Marshal the objref into an encapsulation bytestream.
(void) cdr.write_octet (TAO_ENCAP_BYTE_ORDER);
- if (cdr.encode (CORBA::_tc_Object,
- &obj, 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE)
+ if ((cdr << obj) == 0)
return 0;
// Now hexify the encapsulated CDR data into a string, and
@@ -163,11 +161,8 @@ ior_string_to_object (const char *str,
mb.wr_ptr (len);
TAO_InputCDR stream (&mb, byte_order);
- CORBA::Object_ptr objref=0;
- if (stream.decode (CORBA::_tc_Object,
- &objref, 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE)
- objref = 0;
+ CORBA::Object_ptr objref = CORBA::Object::_nil ();
+ stream >> objref;
return objref;
}
diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp
index ff459147a03..2de0c61438a 100644
--- a/TAO/tao/IIOP_Profile.cpp
+++ b/TAO/tao/IIOP_Profile.cpp
@@ -8,6 +8,7 @@
#include "tao/ORB.h"
#include "tao/MProfile.h"
#include "tao/ORB_Core.h"
+#include "tao/debug.h"
ACE_RCSID(tao, IIOP_Profile, "$Id$")
@@ -319,7 +320,7 @@ TAO_Transport *
TAO_IIOP_Profile::transport (void)
{
// do I need to do a dynamic cast here?
- if (hint_)
+ if (hint_)
return hint_->transport ();
else
return 0;
@@ -339,12 +340,15 @@ TAO_IIOP_Profile::parse (TAO_InputCDR& cdr,
// Read and verify major, minor versions, ignoring IIOP
// profiles whose versions we don't understand.
//
+ // @@ Fred: if we find a version like 1.5 we are supposed to handle
+ // it, i.e. read the fields we know about and ignore the rest!
+ //
// XXX this doesn't actually go back and skip the whole
// encapsulation...
if (!(cdr.read_octet (this->version_.major)
- && this->version_.major == TAO_IIOP_Profile::DEF_IIOP_MAJOR
- && cdr.read_octet (this->version_.minor)
- && this->version_.minor <= TAO_IIOP_Profile::DEF_IIOP_MINOR))
+ && this->version_.major == TAO_IIOP_Profile::DEF_IIOP_MAJOR
+ && cdr.read_octet (this->version_.minor)
+ && this->version_.minor <= TAO_IIOP_Profile::DEF_IIOP_MINOR))
{
ACE_DEBUG ((LM_DEBUG,
"detected new v%d.%d IIOP profile",
@@ -360,13 +364,9 @@ TAO_IIOP_Profile::parse (TAO_InputCDR& cdr,
}
// Get host and port
- if (cdr.decode (CORBA::_tc_string,
- &this->host_,
- 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE
- || !cdr.read_ushort (this->port_))
+ if (cdr.read_string (this->host_) == 0
+ || cdr.read_ushort (this->port_) == 0)
{
- env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
ACE_DEBUG ((LM_DEBUG, "error decoding IIOP host/port"));
return -1;
}
@@ -375,25 +375,22 @@ TAO_IIOP_Profile::parse (TAO_InputCDR& cdr,
// ... and object key.
- // @@ This is a hack. This code was moved from encode.cpp
- // but it is not clear to me what is going on. So I have
- // passed a reference to continue_decoding into this method
- // continue_decoding is used in STUB_Object::decode ()
- continue_decoding = cdr.decode (TC_opaque,
- &this->object_key_,
- 0,
- env) == CORBA::TypeCode::TRAVERSE_CONTINUE;
+ if ((cdr >> this->object_key_) == 0)
+ return -1;
- if (cdr.length () != 0)
+ if (cdr.length () != 0 && TAO_debug_level)
{
- env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
+ // If there is extra data in the profile we are supposed to
+ // ignore it, but print a warning just in case...
ACE_DEBUG ((LM_DEBUG,
"%d bytes out of %d left after IIOP profile data\n",
cdr.length (),
encap_len));
- return -1;
}
- return 1;
+ if (cdr.good_bit ())
+ return 1;
+
+ return -1;
}
int
@@ -742,20 +739,21 @@ TAO_IIOP_Profile::prefix (void)
return ::prefix_;
}
-CORBA::TypeCode::traverse_status
-TAO_IIOP_Profile::encode (TAO_OutputCDR *&stream,
- CORBA::Environment &env)
+int
+TAO_IIOP_Profile::encode (TAO_OutputCDR &stream) const
{
// UNSIGNED LONG, tag for this protocol profile;
- stream->write_ulong (TAO_IOP_TAG_INTERNET_IOP);
-
+ // @@ it seems like this is not a good separation of concerns, why
+ // do we write the TAG here? That's generic code and should be
+ // handled by the object reference writer (IMHO).
+ stream.write_ulong (TAO_IOP_TAG_INTERNET_IOP);
+
// UNSIGNED LONG, number of succeeding bytes in the
// encapsulation. We don't actually need to make the
// encapsulation, as nothing needs stronger alignment than
// this longword; it guarantees the rest is aligned for us.
- u_int hostlen;
- hostlen = ACE_OS::strlen ((char *) this->host_);
+ CORBA::ULong hostlen = ACE_OS::strlen ((char *) this->host_);
CORBA::ULong encap_len =
1 // byte order
+ 1 // version major
@@ -768,44 +766,23 @@ TAO_IIOP_Profile::encode (TAO_OutputCDR *&stream,
+ ( hostlen & 02) // optional pad short
+ 4 // sizeof (key length)
+ this->object_key_.length (); // key length.
- stream->write_ulong (encap_len);
-
-#if 0
- size_t current_len = stream->length ();
-#endif /* 0 */
+ stream.write_ulong (encap_len);
// CHAR describing byte order, starting the encapsulation
- stream->write_octet (TAO_ENCAP_BYTE_ORDER);
+ stream.write_octet (TAO_ENCAP_BYTE_ORDER);
// IIOP::TAO_IOP_Version, two characters (version 1.0) padding
- stream->write_char (this->version_.major);
- stream->write_char (this->version_.minor);
+ stream.write_char (this->version_.major);
+ stream.write_char (this->version_.minor);
// STRING hostname from profile
- stream->encode (CORBA::_tc_string,
- &this->host_,
- 0,
- env);
+ stream.write_string (this->host_);
// UNSIGNED SHORT port number
- stream->write_ushort (this->port_);
+ stream.write_ushort (this->port_);
// OCTET SEQUENCE for object key
- stream->encode (TC_opaque,
- &this->object_key_,
- 0,
- env);
-
-#if 0
- // This is good for debugging the computation of the key
- // length.
- size_t final_len = stream->length ();
- ACE_DEBUG ((LM_DEBUG, "ObjRef::encode: "
- "stored_len = %d, "
- "real_len = %d\n",
- encap_len,
- final_len - current_len));
-#endif /* 0 */
-
- return CORBA::TypeCode::TRAVERSE_CONTINUE;
+ stream << this->object_key_;
+
+ return 1;
}
diff --git a/TAO/tao/IIOP_Profile.h b/TAO/tao/IIOP_Profile.h
index dfcac43ea50..4f7c8633180 100644
--- a/TAO/tao/IIOP_Profile.h
+++ b/TAO/tao/IIOP_Profile.h
@@ -32,11 +32,11 @@ class TAO_Export TAO_IIOP_Profile : public TAO_Profile
{
// = TITLE
// This class defines the protocol specific attributes required
- // for locating ORBs over a TCP/IP network.
+ // for locating ORBs over a TCP/IP network.
//
// = DESCRIPTION
// This class defines the IIOP profile as specified in the CORBA
- // specification.
+ // specification.
public:
// = Currently, TAO supports IIOP 1.0.
enum
@@ -108,7 +108,7 @@ public:
~TAO_IIOP_Profile (void);
// Destructor is to be called only through <_decr_refcnt>.
- CORBA::ULong tag (void);
+ CORBA::ULong tag (void) const;
// The tag, each concrete class will have a specific tag value. for
// example we are TAO_IOP_TAG_INTERNET_IOP.
@@ -132,8 +132,7 @@ public:
const TAO_opaque& body (void) const;
// Create IIOP_Profile Object from marshalled data.
- CORBA::TypeCode::traverse_status encode (TAO_OutputCDR *&stream,
- CORBA::Environment &env);
+ virtual int encode (TAO_OutputCDR &stream) const;
// Encode this profile in a stream, i.e. marshal it.
const TAO_ObjectKey &object_key (void) const;
diff --git a/TAO/tao/IIOP_Profile.i b/TAO/tao/IIOP_Profile.i
index 3d8ccb15635..e9372931c24 100644
--- a/TAO/tao/IIOP_Profile.i
+++ b/TAO/tao/IIOP_Profile.i
@@ -1,7 +1,7 @@
// $Id$
ACE_INLINE CORBA::ULong
-TAO_IIOP_Profile::tag (void)
+TAO_IIOP_Profile::tag (void) const
{
return this->tag_;
}
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index 52730788cc0..6dbcd6bcc18 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -377,23 +377,12 @@ TAO_GIOP_Invocation::location_forward (TAO_InputCDR &inp_stream,
CORBA::Object_ptr object_ptr = 0;
TAO_Transport *transport = this->data_->profile_in_use ()->transport ();
- ACE_TRY
+ if ( (inp_stream >> object_ptr) != 0)
{
- inp_stream.decode (CORBA::_tc_Object,
- &object_ptr,
- 0,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
- ACE_CATCH (CORBA_SystemException, ex)
- {
- // Handle the exception for this level here and throw it out again.
- ACE_PRINT_EXCEPTION (ex, "invoke, location forward (decode)");
transport->close_connection ();
- ACE_RETHROW;
+ ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::COMPLETED_NO),
+ TAO_GIOP_SYSTEM_EXCEPTION);
}
- ACE_ENDTRY;
- ACE_CHECK_RETURN (TAO_GIOP_SYSTEM_EXCEPTION);
// The object pointer has to be changed to a STUB_Object pointer
// in order to extract the profile.
@@ -403,7 +392,8 @@ TAO_GIOP_Invocation::location_forward (TAO_InputCDR &inp_stream,
if (stubobj == 0)
{
transport->close_connection ();
- ACE_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_NO), TAO_GIOP_SYSTEM_EXCEPTION);
+ ACE_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_NO),
+ TAO_GIOP_SYSTEM_EXCEPTION);
}
// Make a copy of the IIOP profile in the forwarded objref,
diff --git a/TAO/tao/MProfile.h b/TAO/tao/MProfile.h
index f96bced1cfa..4f44e2c43d7 100644
--- a/TAO/tao/MProfile.h
+++ b/TAO/tao/MProfile.h
@@ -24,18 +24,18 @@
class TAO_Profile;
typedef TAO_Profile *TAO_Profile_ptr;
-typedef CORBA::ULong TAO_PHandle;
+typedef CORBA::ULong TAO_PHandle;
-class TAO_Export TAO_MProfile
+class TAO_Export TAO_MProfile
{
// = TITLE
// This class implements the basic interface for supporting
// multiple profiles.
- //
+ //
// = DESCRIPTION
// Multiple profiles can be treated either as a circular queue or
// a linear array of profiles.
- //
+ //
// It is assumed that locking will only be required when a profile
// list is associated with a STUB_Object. Thus when the
// STUB_Object accepts ownership of an MProfile it also assumes
@@ -45,7 +45,7 @@ public:
TAO_MProfile (CORBA::ULong sz);
TAO_MProfile (TAO_MProfile *mprofiles);
- // **NOTE: IF mprofiles->last_ > 0, THEN this->size_ will be set to
+ // **NOTE: IF mprofiles->last_ > 0, THEN this->size_ will be set to
// mprofiles->last_. Otherwise this->size_ - mprofiles->size_.
// Furthermore, current_ is set back to 0! i.e. rewound.
// The reference count on any profiles in mprofiles is increment
@@ -83,9 +83,13 @@ public:
TAO_PHandle get_current_handle (void);
// Returns the index for the current profile.
- CORBA::ULong profile_count (void);
+ CORBA::ULong profile_count (void) const;
// Returns the number of profiles stored in the list (last_).
+ const TAO_Profile* get_profile (CORBA::ULong index) const;
+ // Return the profile at position <index>.
+ // If <index> is out of range it returns 0.
+
void rewind (void);
// Sets the current index back to 0.
@@ -102,7 +106,7 @@ public:
// forwarded This object is the set of forwarding profiles.
TAO_MProfile *forward_from (void);
- // Returns a pointer to the profile which was forwarded.
+ // Returns a pointer to the profile which was forwarded.
CORBA::Boolean is_equivalent (TAO_MProfile *first,
TAO_MProfile *second,
diff --git a/TAO/tao/MProfile.i b/TAO/tao/MProfile.i
index 62c0518a1fc..2f6c3d36c4f 100644
--- a/TAO/tao/MProfile.i
+++ b/TAO/tao/MProfile.i
@@ -174,11 +174,19 @@ TAO_MProfile::forward_from (void)
}
ACE_INLINE CORBA::ULong
-TAO_MProfile::profile_count (void)
+TAO_MProfile::profile_count (void) const
{
return this->last_;
}
+ACE_INLINE const TAO_Profile*
+TAO_MProfile::get_profile (CORBA::ULong index) const
+{
+ if (index >= this->last_)
+ return 0;
+ return this->pfiles_[index];
+}
+
ACE_INLINE TAO_Profile_ptr *
TAO_MProfile::pfiles (void) const
{
diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp
index e1acb89e9c4..2984de7a9ad 100644
--- a/TAO/tao/Object.cpp
+++ b/TAO/tao/Object.cpp
@@ -10,6 +10,11 @@
#include "tao/Servant_Base.h"
#include "tao/Request.h"
#include "tao/varout.h"
+#include "tao/IIOP_Profile.h"
+#include "tao/GIOP.h"
+#include "tao/ORB_Core.h"
+#include "tao/Invocation.h"
+#include "ace/Auto_Ptr.h"
#if !defined (__ACE_INLINE__)
# include "tao/Object.i"
@@ -43,42 +48,97 @@ CORBA_Object::CORBA_Object (STUB_Object *protocol_proxy,
}
CORBA::InterfaceDef_ptr
-CORBA_Object::_get_interface (CORBA::Environment &env)
+CORBA_Object::_get_interface (CORBA::Environment &ACE_TRY_ENV)
{
- static const TAO_Param_Data Object_get_interface_params [] =
+ // @@ TODO this method will require some modifications once the
+ // interface repository is implemented. The modifications are
+ // documented with @@ comments.
+
+ // @@ this should use the _nil() method...
+ CORBA::InterfaceDef_ptr _tao_retval = 0;
+
+ STUB_Object *istub = this->_stubobj ();
+ if (istub == 0)
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (CORBA::COMPLETED_NO), _tao_retval);
+
+
+ TAO_GIOP_Twoway_Invocation _tao_call (
+ istub,
+ "_interface",
+ TAO_ORB_Core_instance ()
+ );
+
+
+ // If we get forwarded we have to return to this point:
+_tao_start_again:
+
+ ACE_TRY_EX (_tao_START_FAILED)
+ {
+ _tao_call.start (ACE_TRY_ENV);
+ ACE_TRY_CHECK_EX (_tao_START_FAILED);
+ }
+ ACE_CATCH (CORBA_SystemException, ex)
+ {
+ if (istub->next_profile_retry ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval);
+
+ TAO_GIOP_ReplyStatusType _invoke_status;
+ ACE_TRY_EX (_tao_INVOKE_FAILED)
+ {
+ _invoke_status =
+ _tao_call.invoke (0, 0, ACE_TRY_ENV);
+ ACE_TRY_CHECK_EX (_tao_INVOKE_FAILED);
+ }
+ ACE_CATCH (CORBA_SystemException, ex)
+ {
+ if (istub->next_profile_retry ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval);
+
+ if (_invoke_status == TAO_GIOP_NO_EXCEPTION)
{
- { CORBA::_tc_Object, PARAM_RETURN, 0 }
- // XXX should be tc_InterfaceDef
- };
+ istub->set_valid_profile ();
+ TAO_InputCDR &_tao_in = _tao_call.inp_stream ();
+#if 0
+ // @@ The extraction operation (>>) for InterfaceDef will be
+ // defined, and thus this code will work. Right now we raise a
+ // MARSHAL exception....
+ if (!(
+ (_tao_in >> _tao_retval)
+ ))
+#endif
+ ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::COMPLETED_NO), _tao_retval);
+
+ }
+ else if (_invoke_status == TAO_GIOP_LOCATION_FORWARD)
+ {
+ if (istub->next_profile ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_THROW_RETURN (CORBA::TRANSIENT (CORBA::COMPLETED_NO), _tao_retval);
- static const TAO_Call_Data Object_get_interface_calldata =
+ }
+ else
{
- "_interface",
- 1,
- 1,
- &Object_get_interface_params [0],
- 0, 0
- };
-
- CORBA::InterfaceDef_ptr retval = 0;
-
- // NOTE: If istub->type_id is nonzero, we could try asking a "local"
- // interface repository and avoid costly network I/O. (It's wrong
- // to have different data associated with the same interface ID in
- // different repositories; the interface is the interface, it
- // doesn't change!)
- //
- // We need to be prepared to ask the object itself for this
- // information though, since there's no guarantee that any local
- // interface repository will really have records of this particular
- // interface.
- void* _tao_arguments[1];
- void** _tao_current_arg = _tao_arguments;
- *_tao_current_arg = &retval; _tao_current_arg++;
- this->_stubobj ()->do_static_call (env,
- &Object_get_interface_calldata,
- _tao_arguments);
- return retval;
+ ACE_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_MAYBE), _tao_retval);
+
+ }
+ return _tao_retval;
}
// IS_A ... ask the object if it's an instance of the type whose
@@ -86,25 +146,11 @@ CORBA_Object::_get_interface (CORBA::Environment &env)
CORBA::Boolean
CORBA_Object::_is_a (const CORBA::Char *type_id,
- CORBA::Environment &env)
+ CORBA::Environment &ACE_TRY_ENV)
{
- static const TAO_Param_Data Object_is_a_params [] =
- {
- { CORBA::_tc_boolean, PARAM_RETURN, 0 },
- { CORBA::_tc_string, PARAM_IN, 0 }
- };
-
- static const TAO_Call_Data Object_is_a_calldata =
- {
- "_is_a", 1,
- 2, &Object_is_a_params [0],
- 0, 0
- };
-
// If the object is collocated then try locally....
if (this->is_collocated_ && this->servant_ != 0)
- return this->servant_->_is_a (type_id, env);
-
+ return this->servant_->_is_a (type_id, ACE_TRY_ENV);
// NOTE: if istub->type_id is nonzero and we have local knowledge of
// it, we can answer this question without a costly remote call.
@@ -126,21 +172,91 @@ CORBA_Object::_is_a (const CORBA::Char *type_id,
&& ACE_OS::strcmp ((char *) type_id, (char *) this->_stubobj ()->type_id) == 0)
return 1;
- // Our local knowledge about this type is insufficient to say
- // whether this reference is to an object of a type which "is_a"
- // subtype of the type whose ID is passed as a parameter. The
- // implementation always knows the answer to that question, however!
-
- CORBA::Boolean retval = 0;
-
- void* _tao_arguments[2];
- void** _tao_current_arg = _tao_arguments;
- *_tao_current_arg = &retval; _tao_current_arg++;
- *_tao_current_arg = &type_id; _tao_current_arg++;
- this->_stubobj ()->do_static_call (env,
- &Object_is_a_calldata,
- _tao_arguments);
- return retval;
+ CORBA::Boolean _tao_retval = 0;
+
+ STUB_Object *istub = this->_stubobj ();
+ if (istub == 0)
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (CORBA::COMPLETED_NO), _tao_retval);
+
+
+ TAO_GIOP_Twoway_Invocation _tao_call (
+ istub,
+ "_is_a",
+ TAO_ORB_Core_instance ()
+ );
+
+
+ // If we get forwarded we have to return to this point:
+_tao_start_again:
+
+ ACE_TRY_EX (_tao_START_FAILED)
+ {
+ _tao_call.start (ACE_TRY_ENV);
+ ACE_TRY_CHECK_EX (_tao_START_FAILED);
+ }
+ ACE_CATCH (CORBA_SystemException, ex)
+ {
+ if (istub->next_profile_retry ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval);
+
+ TAO_OutputCDR &_tao_out = _tao_call.out_stream ();
+ if (!(
+ (_tao_out << type_id)
+ ))
+ ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::COMPLETED_NO), _tao_retval);
+
+ TAO_GIOP_ReplyStatusType _invoke_status;
+ ACE_TRY_EX (_tao_INVOKE_FAILED)
+ {
+ _invoke_status =
+ _tao_call.invoke (0, 0, ACE_TRY_ENV);
+ ACE_TRY_CHECK_EX (_tao_INVOKE_FAILED);
+ }
+ ACE_CATCH (CORBA_SystemException, ex)
+ {
+ if (istub->next_profile_retry ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval);
+
+ if (_invoke_status == TAO_GIOP_NO_EXCEPTION)
+ {
+ istub->set_valid_profile ();
+ TAO_InputCDR &_tao_in = _tao_call.inp_stream ();
+ if (!(
+ (_tao_in >> CORBA::Any::to_boolean (_tao_retval))
+ ))
+ ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::COMPLETED_NO), _tao_retval);
+
+ }
+ else if (_invoke_status == TAO_GIOP_LOCATION_FORWARD)
+ {
+ if (istub->next_profile ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_THROW_RETURN (CORBA::TRANSIENT (CORBA::COMPLETED_NO), _tao_retval);
+
+ }
+ else
+ {
+ ACE_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_MAYBE), _tao_retval);
+
+ }
+ return _tao_retval;
}
const char*
@@ -172,42 +288,87 @@ CORBA_Object::_get_implementation (CORBA::Environment &)
// the latter case, return FALSE.
CORBA::Boolean
-CORBA_Object::_non_existent (CORBA::Environment &env)
+CORBA_Object::_non_existent (CORBA::Environment &ACE_TRY_ENV)
{
- static const TAO_Param_Data Object_non_existent_params [] =
- {
- { CORBA::_tc_boolean, PARAM_RETURN, 0 }
- };
+ CORBA::Boolean _tao_retval = 0;
- static const TAO_Call_Data Object_non_existent_calldata =
- {
- "_non_existent", 1,
- 1, &Object_non_existent_params [0],
- 0, 0
- };
+ STUB_Object *istub = this->_stubobj ();
+ if (istub == 0)
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (CORBA::COMPLETED_NO), _tao_retval);
- CORBA::Boolean retval = 0;
+
+ TAO_GIOP_Twoway_Invocation _tao_call (
+ istub,
+ "_non_existent",
+ TAO_ORB_Core_instance ()
+ );
+
- void* _tao_arguments[1];
- void** _tao_current_arg = _tao_arguments;
- *_tao_current_arg = &retval; _tao_current_arg++;
+ // If we get forwarded we have to return to this point:
+_tao_start_again:
- TAO_TRY_VAR (env)
+ ACE_TRY_EX (_tao_START_FAILED)
{
- this->_stubobj ()->do_static_call (env,
- &Object_non_existent_calldata,
- _tao_arguments);
- TAO_CHECK_ENV;
+ _tao_call.start (ACE_TRY_ENV);
+ ACE_TRY_CHECK_EX (_tao_START_FAILED);
}
- TAO_CATCH (CORBA::OBJECT_NOT_EXIST, ex)
+ ACE_CATCH (CORBA_SystemException, ex)
{
- ACE_UNUSED_ARG (ex);
- env.clear ();
- return 1;
+ if (istub->next_profile_retry ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_RETHROW;
}
- TAO_ENDTRY;
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval);
- return 0;
+ TAO_GIOP_ReplyStatusType _invoke_status;
+ ACE_TRY_EX (_tao_INVOKE_FAILED)
+ {
+ _invoke_status =
+ _tao_call.invoke (0, 0, ACE_TRY_ENV);
+ ACE_TRY_CHECK_EX (_tao_INVOKE_FAILED);
+ }
+ ACE_CATCH (CORBA_SystemException, ex)
+ {
+ if (istub->next_profile_retry ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval);
+
+ if (_invoke_status == TAO_GIOP_NO_EXCEPTION)
+ {
+ istub->set_valid_profile ();
+ TAO_InputCDR &_tao_in = _tao_call.inp_stream ();
+ if (!(
+ (_tao_in >> CORBA::Any::to_boolean (_tao_retval))
+ ))
+ ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::COMPLETED_NO), _tao_retval);
+
+ }
+ else if (_invoke_status == TAO_GIOP_LOCATION_FORWARD)
+ {
+ if (istub->next_profile ())
+ {
+ ACE_TRY_ENV.clear ();
+ goto _tao_start_again;
+ }
+ ACE_THROW_RETURN (CORBA::TRANSIENT (CORBA::COMPLETED_NO), _tao_retval);
+
+ }
+ else
+ {
+ ACE_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_MAYBE), _tao_retval);
+
+ }
+ return _tao_retval;
}
// Quickly hash an object reference's representation data. Used to
@@ -252,7 +413,7 @@ CORBA::Object::_key (CORBA::Environment &env)
// @@ This doesn't seemed to be used anyplace! It should go away!! FRED
-void
+void
CORBA::Object::_use_locate_requests (CORBA::Boolean use_it)
{
if ( this->_stubobj () )
@@ -281,6 +442,189 @@ CORBA_Object::_request (const CORBA::Char *operation,
return new CORBA::Request (this, operation);
}
+// ****************************************************************
+
+CORBA::Boolean
+operator<< (TAO_OutputCDR& cdr, const CORBA_Object* x)
+{
+ if (x == 0)
+ {
+ // NIL objrefs ... marshal as empty type hint, no elements.
+ cdr.write_ulong (1);
+ cdr.write_char ('\0');
+ cdr.write_ulong (0);
+ return cdr.good_bit ();
+ }
+
+ STUB_Object *stubobj = x->_stubobj ();
+
+ if (stubobj == 0)
+ return 0;
+
+ // STRING, a type ID hint
+ if ((cdr << stubobj->type_id) == 0)
+ return 0;
+
+ const TAO_MProfile& mprofile =
+ stubobj->get_base_profiles ();
+
+ CORBA::ULong profile_count = mprofile.profile_count ();
+ if ((cdr << profile_count) == 0)
+ return 0;
+
+ // @@ The MProfile should be locked during this iteration, is there
+ // anyway to achieve that?
+ for (CORBA::ULong i = 0; i < profile_count; ++i)
+ {
+ const TAO_Profile* p = mprofile.get_profile (i);
+ if (p->encode (cdr) == 0)
+ return 0;
+ }
+ return cdr.good_bit ();
+}
+
+CORBA::Boolean
+operator>> (TAO_InputCDR& cdr, CORBA_Object*& x)
+{
+ CORBA::String_var type_hint;
+
+ if ((cdr >> type_hint.inout ()) == 0)
+ return 0;
+
+ CORBA::ULong profile_count;
+ if ((cdr >> profile_count) == 0)
+ return 0;
+
+ if (profile_count == 0)
+ {
+ x = CORBA::Object::_nil ();
+ return cdr.good_bit ();
+ }
+
+ // get a profile container to store all profiles in the IOR.
+ auto_ptr<TAO_MProfile> mp (new TAO_MProfile (profile_count));
+
+ while (profile_count-- != 0 && cdr.good_bit ())
+ {
+ CORBA::ULong tag;
+
+ // If there is an error we abort
+ if ((cdr >> tag) == 0)
+ continue;
+
+ // @@ For now we just take IIOP_Profiles, FRED
+ // @@ fred: this is something that we *must* handle correctly,
+ // the TAO_Profile class must be concrete (or we must have a
+ // TAO_Generic_Profile class), any profile we don't anything
+ // about should be converted in one of those
+ // TAO_Generic_Profiles.
+ // Also: the right component to decide if we can handle a
+ // profile or not is the connector registry.
+ // Carlos.
+ //
+ if (tag != TAO_IOP_TAG_INTERNET_IOP)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "unknown profile tag %d skipping\n", tag));
+ cdr.skip_string ();
+ continue;
+ }
+
+ // OK, we've got an IIOP profile. It's going to be
+ // encapsulated ProfileData. Create a new decoding stream and
+ // context for it, and tell the "parent" stream that this data
+ // isn't part of it any more.
+
+ // ProfileData is encoded as a sequence of octet. So first get
+ // the length of the sequence.
+ CORBA::ULong encap_len;
+ if ((cdr >> encap_len) == 0)
+ continue;
+
+ // Create the decoding stream from the encapsulation in the
+ // buffer, and skip the encapsulation.
+ TAO_InputCDR str (cdr, encap_len);
+
+ if (str.good_bit () == 0
+ || cdr.skip_bytes (encap_len) == 0)
+ continue;
+
+ // get the default IIOP Profile and fill in the blanks
+ // with str.
+ // @@ use an auto_ptr<> here!
+ TAO_IIOP_Profile *pfile;
+ ACE_NEW_RETURN (pfile, TAO_IIOP_Profile, 0);
+
+ int r = 0;
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::Boolean continue_decoding;
+ r = pfile->parse (str, continue_decoding, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR,
+ "IIOP_Profile::parse raised exception!"
+ " Shouldn't happen\n"));
+ ACE_TRY_ENV.print_exception ("IIOP_Profile::parse");
+ pfile->_decr_refcnt ();
+ return 0;
+ }
+ ACE_ENDTRY;
+
+ switch (r)
+ {
+ case -1:
+ pfile->_decr_refcnt ();
+ return 0;
+ case 0:
+ pfile->_decr_refcnt ();
+ break;
+ case 1:
+ default:
+ mp->give_profile (pfile);
+ // all other return values indicate success
+ // we do not decrement reference count on profile since we
+ // are giving it to the MProfile!
+ break;
+ } // switch
+
+ } // while loop
+
+ // make sure we got some profiles!
+ if (mp->profile_count () == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "no IIOP v%d.%d (or earlier) profile in IOR!\n",
+ TAO_IIOP_Profile::DEF_IIOP_MAJOR,
+ TAO_IIOP_Profile::DEF_IIOP_MINOR));
+ return 0;
+ }
+
+ // Ownership of type_hint is given to STUB_Object
+ // STUB_Object will make a copy of mp!
+ STUB_Object *objdata;
+ ACE_NEW_RETURN (objdata, STUB_Object (type_hint._retn (),
+ mp.get ()), 0);
+
+ if (objdata == 0)
+ return 0;
+
+ // Create a new CORBA_Object and give it the STUB_Object just
+ // created.
+ TAO_ServantBase *servant =
+ TAO_ORB_Core_instance ()->orb ()->_get_collocated_servant (objdata);
+
+ ACE_NEW_RETURN (x, CORBA_Object (objdata, servant, servant != 0), 0);
+
+ // the corba proxy would have already incremented the reference count on
+ // the objdata. So we decrement it here by 1 so that the objdata is now
+ // fully owned by the corba_proxy that was created.
+ // objdata->_decr_refcnt ();
+
+ return cdr.good_bit ();
+}
// ****************************************************************
@@ -291,9 +635,13 @@ TAO_Object_Field::~TAO_Object_Field (void)
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class TAO_Object_Field_T<CORBA_Object>;
+template class auto_ptr<TAO_MProfile>;
+template class ACE_Auto_Ptr<TAO_MProfile>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate TAO_Object_Field_T<CORBA_Object>
+#pragma instantiate auto_ptr<TAO_MProfile>;
+#pragma instantiate ACE_Auto_Basic_Ptr<TAO_MProfile>;
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h
index 92d443b9bb2..d7acf571c0f 100644
--- a/TAO/tao/Object.h
+++ b/TAO/tao/Object.h
@@ -127,7 +127,7 @@ public:
// Return the object key as an out parameter. Caller should release
// return value when finished with it.
- virtual STUB_Object *_stubobj (void);
+ virtual STUB_Object *_stubobj (void) const;
// get the underlying stub object
virtual void _use_locate_requests (CORBA::Boolean use_it);
@@ -232,6 +232,12 @@ public:
virtual void _release (void) = 0;
};
+extern TAO_Export CORBA::Boolean
+operator<< (TAO_OutputCDR&, const CORBA_Object*);
+
+extern TAO_Export CORBA::Boolean
+operator>> (TAO_InputCDR&, CORBA_Object*&);
+
#if defined (__ACE_INLINE__)
# include "tao/Object.i"
#endif /* __ACE_INLINE__ */
diff --git a/TAO/tao/Object.i b/TAO/tao/Object.i
index 849345c2047..e5f68aab7e8 100644
--- a/TAO/tao/Object.i
+++ b/TAO/tao/Object.i
@@ -52,7 +52,7 @@ CORBA::is_nil (CORBA::Object_ptr obj)
}
ACE_INLINE STUB_Object *
-CORBA_Object::_stubobj (void)
+CORBA_Object::_stubobj (void) const
{
return this->protocol_proxy_;
}
diff --git a/TAO/tao/Pluggable.h b/TAO/tao/Pluggable.h
index 0b23881c961..e330a14111e 100644
--- a/TAO/tao/Pluggable.h
+++ b/TAO/tao/Pluggable.h
@@ -148,7 +148,7 @@ class TAO_Export TAO_Profile
// = DESCRIPTION
// @@ Fred, please fill in here.
public:
- virtual CORBA::ULong tag (void) = 0;
+ virtual CORBA::ULong tag (void) const = 0;
// The tag, each concrete class will have a specific tag value.
virtual TAO_Transport *transport (void) = 0;
@@ -172,8 +172,7 @@ public:
// The body, an octet sequence that represent the marshaled
// profile.
- virtual CORBA::TypeCode::traverse_status encode (TAO_OutputCDR *&stream,
- CORBA::Environment &env) = 0;
+ virtual int encode (TAO_OutputCDR &stream) const = 0;
// Encode this profile in a stream, i.e. marshal it.
virtual const TAO_ObjectKey &object_key (void) const = 0;
diff --git a/TAO/tao/Server_Request.cpp b/TAO/tao/Server_Request.cpp
index 3ae646d3e16..2fbf834786b 100644
--- a/TAO/tao/Server_Request.cpp
+++ b/TAO/tao/Server_Request.cpp
@@ -476,10 +476,7 @@ IIOP_ServerRequest::init_reply (CORBA::Environment &env)
TAO_GIOP_ServiceContextList resp_ctx;
resp_ctx.length (0);
- this->outgoing_->encode (TC_ServiceContextList,
- &resp_ctx,
- 0,
- env);
+ *this->outgoing_ << resp_ctx;
this->outgoing_->write_ulong (this->request_id_);
// Standard exceptions are caught in Connect::handle_input
@@ -490,15 +487,11 @@ IIOP_ServerRequest::init_reply (CORBA::Environment &env)
this->outgoing_->write_ulong (TAO_GIOP_LOCATION_FORWARD);
CORBA::Object_ptr object_ptr = this->forward_location_.in ();
- (void) this->outgoing_->encode (CORBA::_tc_Object,
- &object_ptr,
- 0,
- env);
-
- // If encoding went fine
- if (env.exception () != 0)
+ if ((*this->outgoing_ << object_ptr) == 0)
{
- env.print_exception ("ServerRequest::marshal - forwarding parameter encode failed");
+ ACE_DEBUG ((LM_DEBUG,
+ "ServerRequest::marshal - "
+ "encoding forwarded objref failed\n"));
return;
}
}
@@ -552,13 +545,13 @@ IIOP_ServerRequest::dsi_marshal (CORBA::Environment &env)
void* value = ACE_const_cast(void*,this->retval_->value ());
if (this->retval_->any_owns_data ())
{
- (void) this->outgoing_->encode (tc.in (), value, 0, env);
+ (void) this->outgoing_->encode (tc.in (), value, 0, env);
}
else
- {
+ {
TAO_InputCDR cdr ((ACE_Message_Block *)value);
(void) this->outgoing_->append (tc.in (), &cdr, env);
- }
+ }
}
// ... Followed by "inout" and "out" parameters, left to right
diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h
index 093c6b002b2..8fb8c491384 100644
--- a/TAO/tao/Stub.h
+++ b/TAO/tao/Stub.h
@@ -265,7 +265,7 @@ public:
// equivalent).
CORBA::Boolean is_equivalent (CORBA::Object_ptr other_obj,
- CORBA_Environment &TAO_IN_ENV = CORBA::default_environment ());
+ CORBA_Environment &TAO_IN_ENV = CORBA::default_environment ());
// XXX All objref representations should know how to marshal
// themselves. That will involve ensuring that the IOR that gets
// marshaled talks a specific protocol, otherwise the target of a
@@ -296,7 +296,7 @@ public:
// degenerate case where only one profile is wanted. This method
// is depricated and is here ONLY for compatibility with multiple
// profile unfriendly code! The profile is given to the MProfile
- // object.
+ // object.
STUB_Object (char *repository_id,
TAO_MProfile *profiles);
@@ -320,6 +320,9 @@ public:
// although the user can call get_profiles then reorder
// the list and give it back to STUB_Object.
+ const TAO_MProfile& get_base_profiles (void) const;
+ // Obtain a reference to the basic profile set.
+
// manage forward and base profiles.
TAO_Profile *next_profile (void);
// THREAD SAFE. If forward_profiles is null then this will
@@ -367,7 +370,7 @@ public:
CORBA::Boolean next_profile_retry (void);
// THREAD SAFE
- // used to get the next profile after the one being used has
+ // used to get the next profile after the one being used has
// failed during the initial connect or send of the message!
protected:
diff --git a/TAO/tao/Stub.i b/TAO/tao/Stub.i
index 5b4110f31f4..cc5f92446d7 100644
--- a/TAO/tao/Stub.i
+++ b/TAO/tao/Stub.i
@@ -28,7 +28,7 @@ STUB_Object::set_profile_in_use_i (TAO_Profile *pfile)
}
ACE_INLINE
-void
+void
STUB_Object::reset_first_locate_request (void)
{
first_locate_request_ = 1;
@@ -104,16 +104,16 @@ STUB_Object::~STUB_Object (void)
if (forward_profiles_)
reset_profiles ();
- if (this->profile_in_use_ != 0)
+ if (this->profile_in_use_ != 0)
{
this->profile_in_use_->reset_hint ();
// decrease reference count on profile
- this->profile_in_use_->_decr_refcnt ();
+ this->profile_in_use_->_decr_refcnt ();
this->profile_in_use_ = 0;
}
if (this->profile_lock_ptr_)
- delete this->profile_lock_ptr_;
+ delete this->profile_lock_ptr_;
}
@@ -125,7 +125,7 @@ STUB_Object::profile_in_use (void)
}
ACE_INLINE
-void
+void
STUB_Object::use_locate_requests (CORBA::Boolean use_it)
{
if (use_it)
@@ -133,16 +133,16 @@ STUB_Object::use_locate_requests (CORBA::Boolean use_it)
this->first_locate_request_ = 1;
this->use_locate_request_ = 1;
}
- else
+ else
{
// Don't use it.
this->first_locate_request_ = 0;
this->use_locate_request_ = 0;
- }
-}
+ }
+}
ACE_INLINE
-TAO_MProfile *
+TAO_MProfile *
STUB_Object::get_profiles (void)
{
return new TAO_MProfile (&base_profiles_);
@@ -284,4 +284,9 @@ STUB_Object::next_profile_retry (void)
return 0;
}
}
-
+
+ACE_INLINE const TAO_MProfile&
+STUB_Object::get_base_profiles (void) const
+{
+ return this->base_profiles_;
+}
diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp
index 4aa12166636..2261aecdfe7 100644
--- a/TAO/tao/decode.cpp
+++ b/TAO/tao/decode.cpp
@@ -29,7 +29,6 @@
#include "tao/GIOP.h"
#include "tao/Any.h"
#include "tao/Principal.h"
-#include "tao/IIOP_Profile.h"
#include "tao/MProfile.h"
#include "tao/Object.h"
#include "tao/Stub.h"
@@ -553,39 +552,20 @@ TAO_Marshal_Principal::decode (CORBA::TypeCode_ptr,
void *context,
CORBA::Environment &env)
{
- CORBA::Boolean continue_decoding = 1;
-
// Context is the CDR stream.
TAO_InputCDR *stream = (TAO_InputCDR *) context;
- CORBA::Principal_ptr *pp = (CORBA::Principal_ptr *) data;
- CORBA::ULong len;
+ CORBA::Principal_ptr x;
- continue_decoding = stream->read_ulong (len);
- if (len == 0 || !continue_decoding)
- *pp = 0; // null principal
- else
+ if ((*stream >> x) == 0)
{
- // Allocate storage for Principal and its buffer.
- ACE_NEW_RETURN (*pp,
- CORBA::Principal,
- CORBA::TypeCode::TRAVERSE_CONTINUE);
- (*pp)->id.length (len);
-
- continue_decoding =
- stream->read_octet_array ((*pp)->id.get_buffer (), len);
- }
-
- if (continue_decoding == 1)
- return CORBA::TypeCode::TRAVERSE_CONTINUE;
- else
- {
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO_Marshal_Principal::decode detected error\n"));
+ *(CORBA_Principal_ptr*)data = CORBA::Principal::_nil ();
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
return CORBA::TypeCode::TRAVERSE_STOP;
}
+
+ *(CORBA_Principal **)data = x;
+ return CORBA::TypeCode::TRAVERSE_CONTINUE;
}
// Decode obj ref. An IOR
@@ -596,170 +576,20 @@ TAO_Marshal_ObjRef::decode (CORBA::TypeCode_ptr,
void *context,
CORBA::Environment &env)
{
- CORBA::Boolean continue_decoding = 1;
-
// Context is the CDR stream.
TAO_InputCDR *stream = (TAO_InputCDR *) context;
- CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE;
- CORBA::String type_hint;
-
- // First, read the type hint. This will be the type_id encoded in an
- // object reference.
- stream->decode (CORBA::_tc_string, &type_hint, 0, env);
-
- // @@ TODO: Only IIOP profiles are parsed here! We should use the
- // connector registry to isolate this code from the particulars of
- // all the protocols.
- // Also: the connector registry should create a base TAO_Profile if
- // it does not find the right protocol to handle the current one.
-
- CORBA::ULong profiles;
- STUB_Object *objdata = 0;
-
- // get the count of profiles that follow
- continue_decoding = stream->read_ulong (profiles);
-
- // No profiles means a NIL objref.
-
- if (profiles == 0)
- {
- *(CORBA::Object_ptr *) data = CORBA::Object::_nil ();
- CORBA::string_free (type_hint);
- type_hint = 0;
- return CORBA_TypeCode::TRAVERSE_CONTINUE;
- }
-
- // get a profile container to store all profiles in the IOR.
- TAO_MProfile *mp = new TAO_MProfile (profiles);
-
- while (profiles-- != 0 )
- {
- // @@ For now we just take IIOP_Profiles, FRED
- // We keep decoding until we find a valid IIOP profile.
- CORBA::ULong tag;
-
- // get the profile ID tag
- if ( (continue_decoding = stream->read_ulong (tag)) == 0)
- {
- ACE_DEBUG ((LM_DEBUG, "cannot read profile tag\n"));
- continue;
- }
-
- if (tag != TAO_IOP_TAG_INTERNET_IOP ) // || objdata != 0)
- {
- continue_decoding = stream->skip_string ();
- ACE_DEBUG ((LM_DEBUG, "unknown tag %d skipping\n", tag));
- continue;
- }
- // OK, we've got an IIOP profile. It's going to be
- // encapsulated ProfileData. Create a new decoding stream and
- // context for it, and tell the "parent" stream that this data
- // isn't part of it any more.
+ CORBA::Object_ptr object;
- CORBA::ULong encap_len;
- // ProfileData is encoded as a sequence of octet. So first get
- // the length of the sequence.
- if ( (continue_decoding = stream->read_ulong (encap_len)) == 0)
- {
- ACE_DEBUG ((LM_DEBUG, "cannot read encap length\n"));
- continue;
- }
-
- // Create the decoding stream from the encapsulation in the
- // buffer, and skip the encapsulation.
- TAO_InputCDR str (*stream, encap_len);
-
- continue_decoding =
- str.good_bit ()
- && stream->skip_bytes(encap_len);
-
- if (!continue_decoding)
- {
- ACE_DEBUG ((LM_DEBUG,
- "problem decoding encapsulated stream, "
- "len = %d\n", encap_len));
- continue;
- }
-
- // get the default IIOP Profile and fill in the blanks
- // with str.
- TAO_IIOP_Profile *pfile = new TAO_IIOP_Profile;
-
- // return code will be -1 if an error occurs
- // otherwise 0 for stop (can't read this profile type or version)
- // and 1 for continue.
- // @@ check with carlos about how TRAVERSE_CONTINUE is used! FRED
- switch (pfile->parse (str, continue_decoding, env))
- {
- case -1:
- pfile->_decr_refcnt ();
- return CORBA::TypeCode::TRAVERSE_STOP;
- case 0:
- pfile->_decr_refcnt ();
- break;
- case 1:
- default:
- mp->give_profile (pfile);
- // all other return values indicate success
- // we do not decrement reference count on profile since we are giving
- // it to the MProfile!
- break;
- } // switch
- continue;
- } // while loop
-
- // make sure we got some profiles!
- if (mp->profile_count () == 0)
+ if ((*stream >> object) == 0)
{
+ *(CORBA_Object_ptr*)data = CORBA::Object::_nil ();
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
- ACE_DEBUG ((LM_DEBUG, "no IIOP v%d.%d (or earlier) profile in IOR!\n",
- TAO_IIOP_Profile::DEF_IIOP_MAJOR,
- TAO_IIOP_Profile::DEF_IIOP_MINOR));
- // get rid of the original MProfile!
- delete mp;
-
return CORBA::TypeCode::TRAVERSE_STOP;
}
- // Ownership of type_hint is given to STUB_Object
- // STUB_Object will make a copy of mp!
- objdata = new STUB_Object (type_hint, mp);
-
- // get rid of the original MProfile!
- delete mp;
-
- if ( objdata == 0)
- return CORBA::TypeCode::TRAVERSE_STOP;
-
- // Create a new CORBA_Object and give it the STUB_Object just
- // created.
- TAO_ServantBase *servant =
- TAO_ORB_Core_instance ()->orb ()->_get_collocated_servant (objdata);
- CORBA_Object *corba_proxy = 0;
-
- corba_proxy = new CORBA_Object (objdata, servant, servant != 0);
-
- if (corba_proxy)
- *(CORBA_Object **)data = corba_proxy;
- else
- continue_decoding = 0;
-
- // the corba proxy would have already incremented the reference count on
- // the objdata. So we decrement it here by 1 so that the objdata is now
- // fully owned by the corba_proxy that was created.
- // objdata->_decr_refcnt ();
-
- if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE
- && continue_decoding == 1)
- return CORBA::TypeCode::TRAVERSE_CONTINUE;
- else
- {
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG, "marshaling decode_objref detected error\n"));
- env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
- return CORBA::TypeCode::TRAVERSE_STOP;
- }
+ *(CORBA_Object **)data = object;
+ return CORBA::TypeCode::TRAVERSE_CONTINUE;
}
// Decode structs.
diff --git a/TAO/tao/encode.cpp b/TAO/tao/encode.cpp
index 4b074ac3471..d617374520e 100644
--- a/TAO/tao/encode.cpp
+++ b/TAO/tao/encode.cpp
@@ -237,26 +237,12 @@ TAO_Marshal_Principal::encode (CORBA::TypeCode_ptr,
CORBA::Principal_ptr p = *(CORBA::Principal_ptr *) data;
- if (p != 0)
+ if ((*stream << p) == 0)
{
- continue_encoding = stream->write_long (p->id.length ());
-
- continue_encoding = continue_encoding &&
- stream->write_octet_array (p->id.get_buffer (),
- p->id.length ());
- }
- else
- continue_encoding = stream->write_long (0);
- if (continue_encoding == 1)
- return CORBA::TypeCode::TRAVERSE_CONTINUE;
- else
- {
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO_Marshal_Principal::encode detected error\n"));
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
return CORBA::TypeCode::TRAVERSE_STOP;
}
+ return CORBA::TypeCode::TRAVERSE_CONTINUE;
}
// encode obj ref
@@ -278,49 +264,12 @@ TAO_Marshal_ObjRef::encode (CORBA::TypeCode_ptr,
// @@ Seems to break here!
CORBA::Object_ptr obj = *(CORBA::Object_ptr *) data;
- // NIL objrefs ... marshal as empty type hint, no elements.
-
- if (CORBA::is_nil (obj))
- {
- // encode an empty type_id i.e., an empty string
- stream->write_ulong (1);
- stream->write_char (0);
-
- // Number of profiles = 0
- stream->write_ulong (0);
-
- return CORBA::TypeCode::TRAVERSE_CONTINUE;
- }
- else
+ if ((*stream << obj) == 0)
{
-
- // All other objrefs ... narrow to a "real type" that we
- // recognize, then marshal.
- //
- // XXX this will be changed so it narrows to STUB_Object and
- // then asks that surrogate/proxy to marshal itself.
- //
- // For now, the original code is minimally changed.
- // @@ Need to pass this stuff of to IIOP_Profile and let it
- // marshal it's own self. This will be make_body
-
- // @@ FRED: we will only encode he profile_in_use!!
- // @@ need to add support for multiple profiles. Move this part
- // @@ to MProfile!!
-
- STUB_Object *stubobj = obj->_stubobj ();
-
- // STRING, a type ID hint
- stream->encode (CORBA::_tc_string, &stubobj->type_id, 0, env);
-
- // UNSIGNED LONG, value one, count of the sequence of
- // encapsulated protocol profiles;
- stream->write_ulong (1);
-
- stubobj->profile_in_use ()->encode (stream, env);
-
- return CORBA::TypeCode::TRAVERSE_CONTINUE;
+ env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
+ return CORBA::TypeCode::TRAVERSE_STOP;
}
+ return CORBA::TypeCode::TRAVERSE_CONTINUE;
}
// encode structs
@@ -676,7 +625,7 @@ TAO_Marshal_Union::encode (CORBA::TypeCode_ptr tc,
else // error getting member count
{
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_NO));
- if (TAO_debug_level > 0)
+ if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Union::encode - error getting "
"member count\n"));
diff --git a/TAO/tests/Param_Test/run_test.pl b/TAO/tests/Param_Test/run_test.pl
index f34f1921f7d..92a9249519c 100755
--- a/TAO/tests/Param_Test/run_test.pl
+++ b/TAO/tests/Param_Test/run_test.pl
@@ -26,13 +26,15 @@ sub run_test
ACE::waitforfile ($iorfile);
system ($EXEPREFIX."client $debug -f $iorfile -i $invocation -t ".
- "$type -n $num");
+ "$type -n $num -x");
# @@
# Someday, a better way of doing this should be found. Or at least
# something that can tell if a server is still alive. There is kill -0 on
# Unix, but on NT ???
+ sleep 3;
+
$SV->Kill (); $SV->Wait ();
unlink ($iorfile);
}