From 78abb0b0452283d7a7e3700e9c9ffe52912f0d5e Mon Sep 17 00:00:00 2001 From: jai Date: Wed, 31 Jan 2007 22:32:28 +0000 Subject: adding DS library --- .../DiffServPolicy/DiffServ_Protocols_Hooks.cpp | 34 +++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/modules/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp b/modules/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp index 26c4cb1778f..02c4fa81aaf 100644 --- a/modules/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp +++ b/modules/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp @@ -1,5 +1,6 @@ #include "tao/DiffServPolicy/DiffServ_Protocols_Hooks.h" #include "tao/Stub.h" +#include "tao/Profile.h" #include "tao/ORB_Core.h" #include "tao/Service_Context.h" #include "tao/CDR.h" @@ -87,26 +88,36 @@ const CORBA::Long TAO_DS_Network_Priority_Protocols_Hooks::get_dscp_codepoint ( TAO_Stub *stub, CORBA::Object *object) { + CORBA::Long dscp = 0; + TAO::DiffservCodepoint diffserv_codepoint; + CORBA::Policy_var client_nw_priority_policy = stub->get_cached_policy ( TAO_CACHED_POLICY_CLIENT_NETWORK_PRIORITY ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - CORBA::Policy_var server_nw_priority_policy = - object->_get_cached_policy ( - TAO_CACHED_POLICY_NETWORK_PRIORITY - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Long dscp = 0; - TAO::DiffservCodepoint diffserv_codepoint; - if (CORBA::is_nil (client_nw_priority_policy.in ())) { + TAO_Stub *server_stub = object->_stubobj (); + TAO_MProfile server_profiles = server_stub->base_profiles (); + CORBA::PolicyList_var policy_list = + server_profiles.policy_list (); + + CORBA::ULong length = policy_list->length (); + + for (CORBA::ULong i = 0; i < length; ++i) + { + if (policy_list[i]->policy_type () == TAO::NETWORK_PRIORITY_TYPE) + { + CORBA::Policy_var server_nw_priority_policy = + CORBA::Policy::_duplicate (policy_list[i]); + } + } + if (CORBA::is_nil (server_nw_priority_policy.in ())) { - // cannot happen + return dscp; } else { @@ -130,6 +141,7 @@ TAO_DS_Network_Priority_Protocols_Hooks::get_dscp_codepoint ( ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; dscp = diffserv_codepoint; + return dscp; } } } @@ -146,8 +158,10 @@ TAO_DS_Network_Priority_Protocols_Hooks::get_dscp_codepoint ( diffserv_codepoint = client_nw_priority->request_diffserv_codepoint (); dscp = diffserv_codepoint; + return dscp; } } + return dscp; } -- cgit v1.2.1