00001 // $Id: BiDir_Service_Context_Handler.cpp 84880 2009-03-17 19:34:49Z johnnyw $ 00002 00003 #include "tao/BiDir_GIOP/BiDir_Service_Context_Handler.h" 00004 00005 ACE_RCSID (BiDir_GIOP, 00006 BiDir_Service_Context_Handler, 00007 "$Id: BiDir_Service_Context_Handler.cpp 84880 2009-03-17 19:34:49Z johnnyw $") 00008 00009 #include "tao/CDR.h" 00010 #include "tao/TAO_Server_Request.h" 00011 #include "tao/Transport.h" 00012 #include "tao/ORB_Core.h" 00013 #include "tao/GIOP_Message_Base.h" 00014 #include "tao/operation_details.h" 00015 #include "tao/Transport_Mux_Strategy.h" 00016 00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00018 00019 int 00020 TAO_BiDIR_Service_Context_Handler::process_service_context ( 00021 TAO_Transport& transport, 00022 const IOP::ServiceContext& context) 00023 { 00024 TAO_InputCDR cdr (reinterpret_cast<const char*> ( 00025 context.context_data.get_buffer ()), 00026 context.context_data.length ()); 00027 return transport.tear_listen_point_list (cdr); 00028 } 00029 00030 int 00031 TAO_BiDIR_Service_Context_Handler::generate_service_context ( 00032 TAO_Stub *, 00033 TAO_Transport& transport, 00034 TAO_Operation_Details &opdetails, 00035 TAO_Target_Specification &, 00036 TAO_OutputCDR &msg) 00037 { 00038 if (transport.orb_core ()->bidir_giop_policy () && 00039 transport.messaging_object ()->is_ready_for_bidirectional (msg) && 00040 transport.bidirectional_flag () < 0) 00041 { 00042 transport.set_bidir_context_info (opdetails); 00043 00044 // Set the flag to 1 (i.e., originating side) 00045 transport.bidirectional_flag (1); 00046 00047 // At the moment we enable BiDIR giop we have to get a new 00048 // request id to make sure that we follow the even/odd rule 00049 // for request id's. We only need to do this when enabled 00050 // it, after that the Transport Mux Strategy will make sure 00051 // that the rule is followed 00052 opdetails.request_id (transport.tms ()->request_id ()); 00053 } 00054 00055 return 0; 00056 } 00057 00058 TAO_END_VERSIONED_NAMESPACE_DECL