summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-02-26 19:02:02 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-02-26 19:02:02 +0000
commit1af225868d21696a42b2b05a603b10b223ffb275 (patch)
tree8ec517625095d98a7499dd9273d5c12d43e2b94e
parentb72efeee7b3acd3b11714a68cec27f0a763fc30b (diff)
downloadATCD-1af225868d21696a42b2b05a603b10b223ffb275.tar.gz
ChangeLogTag: Mon Feb 26 12:52:48 2001 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r--TAO/tao/Asynch_Invocation.h3
-rw-r--r--TAO/tao/Asynch_Invocation.i6
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation.h6
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation.inl12
-rw-r--r--TAO/tao/DynamicInterface/Request.cpp27
-rw-r--r--TAO/tao/DynamicInterface/Request.h9
-rw-r--r--TAO/tao/DynamicInterface/Request.inl12
-rw-r--r--TAO/tao/DynamicInterface/Server_Request.h6
-rw-r--r--TAO/tao/DynamicInterface/Server_Request.inl12
-rw-r--r--TAO/tao/GIOP_Message_Base.cpp3
-rw-r--r--TAO/tao/Invocation.cpp11
-rw-r--r--TAO/tao/Invocation.h12
-rw-r--r--TAO/tao/Invocation.i12
-rw-r--r--TAO/tests/DSI_Gateway/test_dsi.cpp7
14 files changed, 110 insertions, 28 deletions
diff --git a/TAO/tao/Asynch_Invocation.h b/TAO/tao/Asynch_Invocation.h
index c81a99b9ae1..1ac4ebbd925 100644
--- a/TAO/tao/Asynch_Invocation.h
+++ b/TAO/tao/Asynch_Invocation.h
@@ -52,7 +52,8 @@ public:
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core);
+ TAO_ORB_Core *orb_core,
+ int byte_order = TAO_ENCAP_BYTE_ORDER);
/// Send request, without blocking until any reply comes back.
virtual int invoke (CORBA_Environment &TAO_IN_ENV =
diff --git a/TAO/tao/Asynch_Invocation.i b/TAO/tao/Asynch_Invocation.i
index 55c806bb4eb..657dd6675af 100644
--- a/TAO/tao/Asynch_Invocation.i
+++ b/TAO/tao/Asynch_Invocation.i
@@ -9,13 +9,15 @@ TAO_GIOP_Asynch_Invocation::TAO_GIOP_Asynch_Invocation (
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core
+ TAO_ORB_Core *orb_core,
+ int byte_order
)
: TAO_GIOP_Invocation (stub,
operation,
opname_len,
argument_flag,
- orb_core),
+ orb_core,
+ byte_order),
rd_ (0)
{
}
diff --git a/TAO/tao/DynamicInterface/DII_Invocation.h b/TAO/tao/DynamicInterface/DII_Invocation.h
index 1309a7008b2..e25d13956b6 100644
--- a/TAO/tao/DynamicInterface/DII_Invocation.h
+++ b/TAO/tao/DynamicInterface/DII_Invocation.h
@@ -49,7 +49,8 @@ public:
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core);
+ TAO_ORB_Core *orb_core,
+ int byte_order = TAO_ENCAP_BYTE_ORDER);
// Constructor.
int invoke (CORBA::ExceptionList_ptr exceptions,
@@ -75,7 +76,8 @@ public:
TAO_GIOP_DII_Deferred_Invocation (TAO_Stub *data,
TAO_ORB_Core* orb_core,
CORBA::Boolean argument_flag,
- const CORBA::Request_ptr req);
+ const CORBA::Request_ptr req,
+ int byte_order = TAO_ENCAP_BYTE_ORDER);
// Constructor.
int invoke (CORBA_Environment &TAO_IN_ENV =
diff --git a/TAO/tao/DynamicInterface/DII_Invocation.inl b/TAO/tao/DynamicInterface/DII_Invocation.inl
index 5f1b33028d1..ce9cb080b4e 100644
--- a/TAO/tao/DynamicInterface/DII_Invocation.inl
+++ b/TAO/tao/DynamicInterface/DII_Invocation.inl
@@ -8,12 +8,14 @@ TAO_GIOP_DII_Invocation::TAO_GIOP_DII_Invocation (TAO_Stub *data,
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core)
+ TAO_ORB_Core *orb_core,
+ int byte_order)
: TAO_GIOP_Twoway_Invocation (data,
operation,
opname_len,
argument_flag,
- orb_core)
+ orb_core,
+ byte_order)
{
}
@@ -22,13 +24,15 @@ TAO_GIOP_DII_Deferred_Invocation::TAO_GIOP_DII_Deferred_Invocation (
TAO_Stub *stub,
TAO_ORB_Core *orb_core,
CORBA::Boolean argument_flag,
- const CORBA::Request_ptr req
+ const CORBA::Request_ptr req,
+ int byte_order
)
: TAO_GIOP_Asynch_Invocation (stub,
req->operation (),
ACE_OS::strlen (req->operation ()),
argument_flag,
- orb_core)
+ orb_core,
+ byte_order)
{
// New reply dispatcher on the heap, because
// we will go out of scope and hand over the
diff --git a/TAO/tao/DynamicInterface/Request.cpp b/TAO/tao/DynamicInterface/Request.cpp
index e14522f0bcd..aa261099450 100644
--- a/TAO/tao/DynamicInterface/Request.cpp
+++ b/TAO/tao/DynamicInterface/Request.cpp
@@ -76,7 +76,8 @@ CORBA_Request::CORBA_Request (CORBA::Object_ptr obj,
ctx_ (CORBA::Context::_nil ()),
refcount_ (1),
lazy_evaluation_ (0),
- response_received_ (0)
+ response_received_ (0),
+ byte_order_ (TAO_ENCAP_BYTE_ORDER)
{
this->target_ = CORBA::Object::_duplicate (obj);
this->opname_ = CORBA::string_dup (op);
@@ -102,7 +103,8 @@ CORBA_Request::CORBA_Request (CORBA::Object_ptr obj,
ctx_ (CORBA::Context::_nil ()),
refcount_ (1),
lazy_evaluation_ (0),
- response_received_ (0)
+ response_received_ (0),
+ byte_order_ (TAO_ENCAP_BYTE_ORDER)
{
this->target_ = CORBA::Object::_duplicate (obj);
this->opname_ = CORBA::string_dup (op);
@@ -147,7 +149,8 @@ CORBA_Request::invoke (CORBA::Environment &ACE_TRY_ENV)
this->opname_,
ACE_OS::strlen (this->opname_),
argument_flag,
- this->orb_->orb_core ());
+ this->orb_->orb_core (),
+ this->byte_order_);
// Loop as needed for forwarding.
for (;;)
@@ -198,6 +201,12 @@ CORBA_Request::invoke (CORBA::Environment &ACE_TRY_ENV)
break;
}
+ // If this request was created by a gateway, then result_
+ // and/or args_ are shared by a CORBA::ServerRequest, whose
+ // reply must be in the same byte order as the reply we are
+ // handling here. So we set the member to be accessed later.
+ this->byte_order_ = call.inp_stream ().byte_order ();
+
// Now, get all the "return", "out", and "inout" parameters
// from the response message body ... return parameter is
// first, the rest are in the order defined in the IDL spec
@@ -226,7 +235,8 @@ CORBA_Request::send_oneway (CORBA::Environment &ACE_TRY_ENV)
this->opname_,
ACE_OS::strlen (this->opname_),
argument_flag,
- this->orb_->orb_core ());
+ this->orb_->orb_core (),
+ this->byte_order_);
// Loop as needed for forwarding.
for (;;)
@@ -292,7 +302,8 @@ CORBA_Request::send_deferred (CORBA::Environment &ACE_TRY_ENV)
TAO_GIOP_DII_Deferred_Invocation call (this->target_->_stubobj (),
this->orb_->orb_core (),
argument_flag,
- this);
+ this,
+ this->byte_order_);
// Loop as needed for forwarding.
for (;;)
@@ -367,6 +378,12 @@ CORBA_Request::handle_response (TAO_InputCDR &incoming,
CORBA::ULong reply_status,
CORBA::Environment &ACE_TRY_ENV)
{
+ // If this request was created by a gateway, then result_
+ // and/or args_ are shared by a CORBA::ServerRequest, whose
+ // reply must be in the same byte order as the reply we are
+ // handling here. So we set the member to be accessed later.
+ this->byte_order_ = incoming.byte_order ();
+
switch (reply_status)
{
case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION:
diff --git a/TAO/tao/DynamicInterface/Request.h b/TAO/tao/DynamicInterface/Request.h
index bb6975e77d6..9d3740fea7a 100644
--- a/TAO/tao/DynamicInterface/Request.h
+++ b/TAO/tao/DynamicInterface/Request.h
@@ -141,6 +141,12 @@ public:
void _tao_lazy_evaluation (int lazy_evaluation);
// Set the lazy evaluation flag.
+ int _tao_byte_order (void) const;
+ // Get the byte order member.
+
+ void _tao_byte_order (int byte_order);
+ // Set the byte order member.
+
#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8
typedef CORBA_Request_ptr _ptr_type;
typedef CORBA_Request_var _var_type;
@@ -212,6 +218,9 @@ private:
CORBA::Boolean response_received_;
// Set to TRUE upon completion of invoke() or
// handle_response().
+
+ int byte_order_;
+ // Can be reset by a gateway when passing along a request.
};
typedef CORBA_Request* CORBA_Request_ptr;
diff --git a/TAO/tao/DynamicInterface/Request.inl b/TAO/tao/DynamicInterface/Request.inl
index a4b2024e3bd..9b217fd664c 100644
--- a/TAO/tao/DynamicInterface/Request.inl
+++ b/TAO/tao/DynamicInterface/Request.inl
@@ -135,6 +135,18 @@ CORBA_Request::_tao_lazy_evaluation (int lazy_evaluation)
this->lazy_evaluation_ = lazy_evaluation;
}
+ACE_INLINE int
+CORBA_Request::_tao_byte_order (void) const
+{
+ return this->byte_order_;
+}
+
+ACE_INLINE void
+CORBA_Request::_tao_byte_order (int byte_order)
+{
+ this->byte_order_ = byte_order;
+}
+
// *************************************************************
// Inline operations for class CORBA_Request_var
// *************************************************************
diff --git a/TAO/tao/DynamicInterface/Server_Request.h b/TAO/tao/DynamicInterface/Server_Request.h
index f312c8bdbd8..a42bdabc259 100644
--- a/TAO/tao/DynamicInterface/Server_Request.h
+++ b/TAO/tao/DynamicInterface/Server_Request.h
@@ -110,6 +110,12 @@ public:
void _tao_lazy_evaluation (int lazy_evaluation);
// Set the lazy evaluation flag.
+ int _tao_incoming_byte_order (void) const;
+ // Get the byte order of the incoming CDR stream.
+
+ void _tao_reply_byte_order (int byte_order);
+ // Set the byte order of the outgoing CDR stream.
+
#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8
typedef CORBA::ServerRequest_ptr _ptr_type;
#endif /* __GNUC__ */
diff --git a/TAO/tao/DynamicInterface/Server_Request.inl b/TAO/tao/DynamicInterface/Server_Request.inl
index e79890ee8cf..22742b0922f 100644
--- a/TAO/tao/DynamicInterface/Server_Request.inl
+++ b/TAO/tao/DynamicInterface/Server_Request.inl
@@ -42,3 +42,15 @@ CORBA_ServerRequest::_tao_lazy_evaluation (int lazy_evaluation)
this->lazy_evaluation_ = lazy_evaluation;
}
+ACE_INLINE int
+CORBA_ServerRequest::_tao_incoming_byte_order (void) const
+{
+ return this->orb_server_request_.incoming ().byte_order ();
+}
+
+ACE_INLINE void
+CORBA_ServerRequest::_tao_reply_byte_order (int byte_order)
+{
+ this->orb_server_request_.outgoing ().reset_byte_order (byte_order);
+}
+
diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp
index 25f046ff3a2..2aaaf4d7a7e 100644
--- a/TAO/tao/GIOP_Message_Base.cpp
+++ b/TAO/tao/GIOP_Message_Base.cpp
@@ -110,7 +110,6 @@ TAO_GIOP_Message_Base::generate_request_header (
}
return 0;
-
}
int
@@ -461,7 +460,7 @@ TAO_GIOP_Message_Base::write_protocol_header (
// fragmentation and when we want to use the other 6 bits in this
// octet we can have a virtual function do this for us as the
// version info , Bala
- msg.write_octet (TAO_ENCAP_BYTE_ORDER);
+ msg.write_octet (TAO_ENCAP_BYTE_ORDER ^ msg.do_byte_swap ());
msg.write_octet ((CORBA::Octet) t);
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index 77d331327cb..20d23592dd9 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -106,14 +106,15 @@ TAO_GIOP_Invocation::TAO_GIOP_Invocation (TAO_Stub *stub,
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core)
+ TAO_ORB_Core *orb_core,
+ int byte_order)
: stub_ (stub),
op_details_ (operation,
opname_len,
argument_flag),
out_stream_ (this->buffer_,
sizeof this->buffer_, /* ACE_CDR::DEFAULT_BUFSIZE */
- TAO_ENCAP_BYTE_ORDER,
+ byte_order,
orb_core->output_cdr_buffer_allocator (),
orb_core->output_cdr_dblock_allocator (),
orb_core->orb_params ()->cdr_memcpy_tradeoff (),
@@ -971,13 +972,15 @@ TAO_GIOP_Oneway_Invocation::TAO_GIOP_Oneway_Invocation (
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core
+ TAO_ORB_Core *orb_core,
+ int byte_order
)
: TAO_GIOP_Synch_Invocation (stub,
operation,
opname_len,
argument_flag,
- orb_core),
+ orb_core,
+ byte_order),
sync_scope_ (TAO::SYNC_WITH_TRANSPORT)
{
int has_synchronization = 0;
diff --git a/TAO/tao/Invocation.h b/TAO/tao/Invocation.h
index 7ddc8f11789..75def9aa75e 100644
--- a/TAO/tao/Invocation.h
+++ b/TAO/tao/Invocation.h
@@ -90,7 +90,8 @@ public:
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core);
+ TAO_ORB_Core *orb_core,
+ int byte_order = TAO_ENCAP_BYTE_ORDER);
/**
* This destructor is virtual so that the derived synchronous
@@ -357,7 +358,8 @@ public:
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core);
+ TAO_ORB_Core *orb_core,
+ int byte_order = TAO_ENCAP_BYTE_ORDER);
/// Destructor.
virtual ~TAO_GIOP_Synch_Invocation (void);
@@ -401,7 +403,8 @@ public:
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core);
+ TAO_ORB_Core *orb_core,
+ int byte_order = TAO_ENCAP_BYTE_ORDER);
/// Destructor.
virtual ~TAO_GIOP_Twoway_Invocation (void);
@@ -440,7 +443,8 @@ public:
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core);
+ TAO_ORB_Core *orb_core,
+ int byte_order = TAO_ENCAP_BYTE_ORDER);
/// Destructor.
virtual ~TAO_GIOP_Oneway_Invocation (void);
diff --git a/TAO/tao/Invocation.i b/TAO/tao/Invocation.i
index a5ae9d58abb..3d9276bae1b 100644
--- a/TAO/tao/Invocation.i
+++ b/TAO/tao/Invocation.i
@@ -110,13 +110,15 @@ TAO_GIOP_Synch_Invocation::TAO_GIOP_Synch_Invocation (
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core
+ TAO_ORB_Core *orb_core,
+ int byte_order
)
: TAO_GIOP_Invocation (stub,
operation,
opname_len,
argument_flag,
- orb_core),
+ orb_core,
+ byte_order),
rd_ (orb_core,
this->op_details_.service_info ())
{
@@ -136,13 +138,15 @@ TAO_GIOP_Twoway_Invocation::TAO_GIOP_Twoway_Invocation (
const char *operation,
CORBA::ULong opname_len,
CORBA::Boolean argument_flag,
- TAO_ORB_Core *orb_core
+ TAO_ORB_Core *orb_core,
+ int byte_order
)
: TAO_GIOP_Synch_Invocation (stub,
operation,
opname_len,
argument_flag,
- orb_core)
+ orb_core,
+ byte_order)
{
}
diff --git a/TAO/tests/DSI_Gateway/test_dsi.cpp b/TAO/tests/DSI_Gateway/test_dsi.cpp
index cd9d1596a06..cc796516824 100644
--- a/TAO/tests/DSI_Gateway/test_dsi.cpp
+++ b/TAO/tests/DSI_Gateway/test_dsi.cpp
@@ -43,8 +43,15 @@ DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request,
target_request->_tao_lazy_evaluation (1);
+ // Outgoing request must have the same byte order as the incoming one.
+ target_request->_tao_byte_order (request->_tao_incoming_byte_order ());
+
+ // Updates the byte order state, if necessary.
target_request->invoke (ACE_TRY_ENV);
ACE_CHECK;
+
+ // Outgoing reply must have the same byte order as the incoming one.
+ request->_tao_reply_byte_order (target_request->_tao_byte_order ());
}
CORBA::RepositoryId