summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2000-12-22 21:27:17 +0000
committerbala <balanatarajan@users.noreply.github.com>2000-12-22 21:27:17 +0000
commita841826f94054005f0def249b0f4edbb5599ee9d (patch)
tree80184b979308f65d156332fd6e9a926f9ebd7fd5
parent4154f6f60050515606b8c848bd1e20a40023dbfa (diff)
downloadATCD-a841826f94054005f0def249b0f4edbb5599ee9d.tar.gz
ChangeLogTag: Fri Dec 22 15:25:51 2000 Balachandran Natarajan <bala@cs.wustl.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a8
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp38
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h4
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp139
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h31
5 files changed, 219 insertions, 1 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index 2c0daeab08d..5f32d6aa6fc 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,11 @@
+Fri Dec 22 15:25:51 2000 Balachandran Natarajan <bala@cs.wustl.edu>
+
+ * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h:
+ * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp:
+ * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h:
+ * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp: Added bidirectional
+ support for SSLIOP.
+
Fri Dec 22 14:56:24 2000 Balachandran Natarajan <bala@cs.wustl.edu>
* tao/IIOP_Transport.h:
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp
index 93c6f22f842..c68fa0e95ed 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp
@@ -259,6 +259,44 @@ TAO_SSLIOP_Connection_Handler::add_handler_to_cache (void)
int
+TAO_SSLIOP_Connection_Handler::process_listen_point_list (
+ IIOP::ListenPointList &listen_list)
+{
+ // Get the size of the list
+ CORBA::ULong len = listen_list.length ();
+
+ for (CORBA::ULong i = 0; i < len; ++ i)
+ {
+ IIOP::ListenPoint listen_point = listen_list[i];
+ ACE_INET_Addr addr (listen_point.port,
+ listen_point.host.in ());
+
+
+ // Construct an IIOP_Endpoint object
+ TAO_SSLIOP_Endpoint endpoint (addr,
+ 0);
+
+ // Construct a property object
+ TAO_Base_Connection_Property prop (&endpoint);
+
+ // Mark the connection as bidirectional
+ prop.set_bidir_flag (1);
+
+ // The property for this handler has changed. Recache the
+ // handler with this property
+ int retval = this->recache_handler (&prop);
+ if (retval == -1)
+ return retval;
+
+ // Make the handler idle and ready for use
+ this->make_idle ();
+ }
+
+ return 0;
+}
+
+
+int
TAO_SSLIOP_Connection_Handler::handle_input (ACE_HANDLE h)
{
return this->handle_input_i (h);
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h
index 792641ccce0..ed5ea3e4134 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h
@@ -33,6 +33,7 @@
#include "tao/Wait_Strategy.h"
#include "tao/Connection_Handler.h"
#include "tao/IIOP_Connection_Handler.h"
+#include "tao/IIOPC.h"
#include "SSLIOP_Transport.h"
#include "SSLIOP_Current_Impl.h"
@@ -109,6 +110,9 @@ public:
/// Add ourselves to Cache.
int add_handler_to_cache (void);
+ /// Process the <listen_list>
+ int process_listen_point_list (IIOP::ListenPointList &listen_list);
+
/// Make the SSL session state available to the SSLIOP::Current
/// object.
int setup_ssl_state (TAO_ORB_Core *orb_core);
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp
index 6e480c5319d..c43ea151f87 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp
@@ -347,6 +347,24 @@ TAO_SSLIOP_Transport::send_request_header (TAO_Operation_Details &opdetails,
TAO_Target_Specification &spec,
TAO_OutputCDR &msg)
{
+ // Check whether we have a Bi Dir IIOP policy set, whether the
+ // messaging objects are ready to handle bidirectional connections
+ // and also make sure that we have not recd. or sent any information
+ // regarding this before...
+ if (this->orb_core ()->bidir_giop_policy () &&
+ this->messaging_object_->is_ready_for_bidirectional () &&
+ this->bidirectional_flag_ < 0)
+ {
+ this->set_bidir_context_info (opdetails);
+
+ // Set the flag to 0
+ this->bidirectional_flag_ = 0;
+ }
+
+ // Modify the request id if we have BiDirectional client/server
+ // setup
+ opdetails.modify_request_id (this->bidirectional_flag_);
+
// We are going to pass on this request to the underlying messaging
// layer. It should take care of this request
if (this->messaging_object_->generate_request_header (opdetails,
@@ -470,3 +488,124 @@ TAO_SSLIOP_Transport::process_message (void)
this->messaging_object_->reset ();
return 1;
}
+
+
+void
+TAO_SSLIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails)
+{
+
+ // Get a handle on to the acceptor registry
+ TAO_Acceptor_Registry * ar =
+ this->orb_core ()->acceptor_registry ();
+
+
+ // Get the first acceptor in the registry
+ TAO_AcceptorSetIterator acceptor = ar->begin ();
+
+ IIOP::ListenPointList listen_point_list;
+
+ for (;
+ acceptor != ar->end ();
+ acceptor++)
+ {
+ // Check whether it is a IIOP acceptor
+ if ((*acceptor)->tag () == TAO_TAG_IIOP_PROFILE)
+ {
+ this->get_listen_point (listen_point_list,
+ *acceptor);
+ }
+ }
+
+ // We have the ListenPointList at this point. Create a output CDR
+ // stream at this point
+ TAO_OutputCDR cdr;
+
+ // Marshall the information into the stream
+ if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)== 0)
+ || (cdr << listen_point_list) == 0)
+ return;
+
+ // Add this info in to the svc_list
+ opdetails.service_context ().set_context (IOP::BI_DIR_IIOP,
+ cdr);
+
+ return;
+}
+
+
+int
+TAO_SSLIOP_Transport::get_listen_point (
+ IIOP::ListenPointList &listen_point_list,
+ TAO_Acceptor *acceptor)
+{
+ TAO_SSLIOP_Acceptor *iiop_acceptor =
+ ACE_dynamic_cast (TAO_SSLIOP_Acceptor *,
+ acceptor );
+
+ // Get the array of endpoints serviced by <iiop_acceptor>
+ const ACE_INET_Addr *endpoint_addr =
+ iiop_acceptor->endpoints ();
+
+ // Get the count
+ size_t count =
+ iiop_acceptor->endpoint_count ();
+
+ // Get the local address of the connection
+ ACE_INET_Addr local_addr;
+
+ if (this->connection_handler_->peer ().get_local_addr (local_addr)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Could not resolve local host")
+ ACE_TEXT (" address in set_bidir_context_info () \n")),
+ -1);
+ }
+
+
+
+ for (size_t index = 0;
+ index <= count;
+ index++)
+ {
+ // Get the listen point on that acceptor if it has the same
+ // interface on which this connection is established
+
+ // Note: Looks like there is no point in sending the list of
+ // endpoints on interfaces on which this connection has not
+ // been established. If this is wrong, please correct me.
+ char local_interface[MAXHOSTNAMELEN];
+ char acceptor_interface[MAXHOSTNAMELEN];
+
+ if (endpoint_addr[index].get_host_name (acceptor_interface,
+ MAXHOSTNAMELEN) ==
+ -1)
+ continue;
+
+ if (local_addr.get_host_name (local_interface,
+ MAXHOSTNAMELEN) == -1)
+ continue;
+
+ // @@ This is very bad for performance, but it is a one time
+ // affair
+ if (ACE_OS::strcmp (local_interface,
+ acceptor_interface) == 0)
+ {
+ // We have the connection and the acceptor endpoint on the
+ // same interface
+ IIOP::ListenPoint point;
+ point.host = CORBA::string_dup (local_interface);
+ point.port = endpoint_addr[index].get_port_number ();
+
+ // Get the count of the number of elements
+ CORBA::ULong len = listen_point_list.length ();
+
+ // Increase the length by 1
+ listen_point_list.length (len + 1);
+ // Add the new length to the list
+ listen_point_list[len] = point;
+ }
+ }
+
+ return 1;
+}
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h
index bda09d40414..59a3fa9785c 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h
@@ -37,7 +37,7 @@
#include "tao/operation_details.h"
#include "tao/GIOP_Message_State.h"
#include "tao/Pluggable_Messaging_Utils.h"
-
+#include "tao/IIOPC.h"
// Forward decls.
class TAO_SSLIOP_Handler_Base;
@@ -140,11 +140,26 @@ public:
virtual int messaging_init (CORBA::Octet major,
CORBA::Octet minor);
+ /// Set the bidirectional flag
+ virtual void bidirectional_flag (int flag);
+
+ /// Open teh service context list and process it.
+ virtual int tear_listen_point_list (TAO_InputCDR &cdr);
+
private:
/// Process the message that we have read
int process_message (void);
+ /// Set the Bidirectional context info in the service context list
+ void set_bidir_context_info (TAO_Operation_Details &opdetails);
+
+ /// Add the listen points in <acceptor> to the <listen_point_list>
+ /// if this connection is in the same interface as that of the
+ /// endpoints in the <acceptor>
+ int get_listen_point (IIOP::ListenPointList &listen_point_list,
+ TAO_Acceptor *acceptor);
+
private:
/// The connection service handler used for accessing lower layer
@@ -153,6 +168,20 @@ private:
/// Our messaging object.
TAO_Pluggable_Messaging *messaging_object_;
+
+ /// Have we sent any info on bidirectional information or have we
+ /// received any info regarding making the connection
+ /// served by this transport bidirectional. This is essentially for
+ /// this -- we dont want to send the bidirectional context info more
+ /// than once on the connection. Why? Waste of marshalling and
+ /// demarshalling time on the client. On the server side, we need
+ /// this flag for this -- once a client that has established the
+ /// connection asks the server to use the connection both ways, we
+ /// *dont* want the server to go pack service info to the
+ /// client. That would be *bad*.. The value of this flag will be 0
+ /// if the client sends info and 1 if the server receives the info.
+ int bidirectional_flag_;
+
};