From 96d8edf2c79b39481cdf92c6150009c991a2310c Mon Sep 17 00:00:00 2001 From: bala Date: Thu, 14 Dec 2000 16:51:51 +0000 Subject: *** empty log message *** --- TAO/tao/IIOP_Acceptor.h | 3 ++ TAO/tao/IIOP_Acceptor.i | 8 +++ TAO/tao/IIOP_Transport.cpp | 128 +++++++++++++++++++++++++++++++++++++++++++-- TAO/tao/IIOP_Transport.h | 9 +++- TAO/tao/TAO.dsp | 27 ++++++++++ TAO/tao/TAO_Static.dsp | 12 +++++ 6 files changed, 182 insertions(+), 5 deletions(-) diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h index b5c0a01a530..9c86303d6a3 100644 --- a/TAO/tao/IIOP_Acceptor.h +++ b/TAO/tao/IIOP_Acceptor.h @@ -57,6 +57,9 @@ public: // @@ Helper method for the implementation repository, should go // away + const ACE_INET_Addr *endpoints (void); + // Returns the array of endpoints in this acceptor + typedef ACE_Strategy_Acceptor TAO_IIOP_BASE_ACCEPTOR; typedef TAO_Creation_Strategy TAO_IIOP_CREATION_STRATEGY; typedef TAO_Concurrency_Strategy TAO_IIOP_CONCURRENCY_STRATEGY; diff --git a/TAO/tao/IIOP_Acceptor.i b/TAO/tao/IIOP_Acceptor.i index f7c171d6e5e..3b55c132b62 100644 --- a/TAO/tao/IIOP_Acceptor.i +++ b/TAO/tao/IIOP_Acceptor.i @@ -13,3 +13,11 @@ TAO_IIOP_Acceptor::address (void) const // -Ossama return this->addrs_[0]; } + +ACE_INLINE const ACE_INET_Addr * +TAO_IIOP_Acceptor::endpoints (void) +{ + ACE_ASSERT (this->addrs_ != 0); + + return this->addrs_; +} diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 24b09cf8b06..28cc9432e36 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -4,7 +4,10 @@ #include "tao/IIOP_Transport.h" #include "tao/IIOP_Connection_Handler.h" +#include "tao/IIOP_Acceptor.h" #include "tao/IIOP_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" @@ -17,6 +20,7 @@ #include "tao/GIOP_Message_Lite.h" + #if !defined (__ACE_INLINE__) # include "tao/IIOP_Transport.i" #endif /* ! __ACE_INLINE__ */ @@ -300,12 +304,15 @@ TAO_IIOP_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 + // 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_bidirectional_context_info (opdetails); + this->set_bidir_context_info (opdetails); } // We are going to pass on this request to the underlying messaging @@ -441,7 +448,120 @@ TAO_IIOP_Transport::process_message (void) void -TAO_IIOP_Transport::set_bidirectional_context_info (TAO_Operation_Details &opdetails) +TAO_IIOP_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_IIOP_Transport::get_listen_point ( + IIOP::ListenPointList &listen_point_list, + TAO_Acceptor *acceptor) +{ + TAO_IIOP_Acceptor *iiop_acceptor = + ACE_dynamic_cast (TAO_IIOP_Acceptor *, + acceptor ); + + // Get the array of endpoints serviced by + 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/tao/IIOP_Transport.h b/TAO/tao/IIOP_Transport.h index af9752d1dbe..3947c7ed060 100644 --- a/TAO/tao/IIOP_Transport.h +++ b/TAO/tao/IIOP_Transport.h @@ -25,6 +25,7 @@ #include "ace/SOCK_Stream.h" #include "ace/Synch.h" #include "ace/Svc_Handler.h" +#include "tao/IIOPC.h" // Forward decls. @@ -33,6 +34,7 @@ class TAO_ORB_Core; class TAO_Operation_Details; class TAO_Pluggable_Messaging; + // Service Handler for this transport typedef ACE_Svc_Handler TAO_IIOP_SVC_HANDLER; @@ -147,8 +149,13 @@ private: int process_message (void); /// Set the Bidirectional context info in the service context list - void set_bidirectional_context_info (TAO_Operation_Details &opdetails); + void set_bidir_context_info (TAO_Operation_Details &opdetails); + /// Add the listen points in to the + /// if this connection is in the same interface as that of the + /// endpoints in the + int get_listen_point (IIOP::ListenPointList &listen_point_list, + TAO_Acceptor *acceptor); private: /// The connection service handler used for accessing lower layer diff --git a/TAO/tao/TAO.dsp b/TAO/tao/TAO.dsp index 8f22472a5bf..6c1c016bc0c 100644 --- a/TAO/tao/TAO.dsp +++ b/TAO/tao/TAO.dsp @@ -1563,6 +1563,25 @@ SOURCE=.\IIOP_Transport.cpp # End Source File # Begin Source File +SOURCE=.\IIOPC.cpp + +!IF "$(CFG)" == "TAO DLL - Win32 Alpha Release" + +!ELSEIF "$(CFG)" == "TAO DLL - Win32 Alpha Debug" + +!ELSEIF "$(CFG)" == "TAO DLL - Win32 MFC Release" + +!ELSEIF "$(CFG)" == "TAO DLL - Win32 MFC Debug" + +!ELSEIF "$(CFG)" == "TAO DLL - Win32 Release" + +!ELSEIF "$(CFG)" == "TAO DLL - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=.\Interceptor_List.cpp !IF "$(CFG)" == "TAO DLL - Win32 Alpha Release" @@ -3752,6 +3771,10 @@ SOURCE=.\IIOP_Transport.h # End Source File # Begin Source File +SOURCE=.\IIOPC.h +# End Source File +# Begin Source File + SOURCE=.\Interceptor_List.h # End Source File # Begin Source File @@ -4440,6 +4463,10 @@ SOURCE=.\IIOP_Transport.i # End Source File # Begin Source File +SOURCE=.\IIOPC.i +# End Source File +# Begin Source File + SOURCE=.\Interceptor_List.inl # End Source File # Begin Source File diff --git a/TAO/tao/TAO_Static.dsp b/TAO/tao/TAO_Static.dsp index 83b3d8eff27..f98b91c293b 100644 --- a/TAO/tao/TAO_Static.dsp +++ b/TAO/tao/TAO_Static.dsp @@ -379,6 +379,10 @@ SOURCE=.\IIOP_Transport.h # End Source File # Begin Source File +SOURCE=.\IIOPC.h +# End Source File +# Begin Source File + SOURCE=.\Interceptor_List.h # End Source File # Begin Source File @@ -1071,6 +1075,10 @@ SOURCE=.\IIOP_Transport.i # End Source File # Begin Source File +SOURCE=.\IIOPC.i +# End Source File +# Begin Source File + SOURCE=.\Interceptor_List.inl # End Source File # Begin Source File @@ -1695,6 +1703,10 @@ SOURCE=.\IIOP_Transport.cpp # End Source File # Begin Source File +SOURCE=.\IIOPC.cpp +# End Source File +# Begin Source File + SOURCE=.\Interceptor_List.cpp # End Source File # Begin Source File -- cgit v1.2.1