diff options
author | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-02-02 17:53:36 +0000 |
---|---|---|
committer | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-02-02 17:53:36 +0000 |
commit | 1d1192b2afd7f88c81db101296d7ee9ce29f8a95 (patch) | |
tree | f0a02919bc67efe2b3cf9df991103cd9513583e7 | |
parent | c4dde6e92dd0faa73c27fe5feb2be97652db1e83 (diff) | |
download | ATCD-1d1192b2afd7f88c81db101296d7ee9ce29f8a95.tar.gz |
adding DS library
-rw-r--r-- | modules/TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.cpp | 63 | ||||
-rw-r--r-- | modules/TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.h | 49 |
2 files changed, 112 insertions, 0 deletions
diff --git a/modules/TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.cpp b/modules/TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.cpp new file mode 100644 index 00000000000..70ca6025e24 --- /dev/null +++ b/modules/TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.cpp @@ -0,0 +1,63 @@ +// @(#) $Id$ + +#include "tao/DiffServPolicy/DiffServ_Network_Priority_Hook.h" +#include "tao/PortableServer/Root_POA.h" +#include "tao/PortableServer/POA_Policy_Set.h" +#include "tao/DiffServPolicy/Server_Network_Priority_Policy.h" +#include "tao/DiffServPolicy/DiffServPolicyC.h" + +ACE_RCSID(DiffServPolicy, + DiffServ_Network_Priority_Hook, + "$Id$") + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +TAO_DiffServ_Network_Priority_Hook::~TAO_DiffServ_Network_Priority_Hook(void) +{ +} + +void +TAO_DiffServ_Network_Priority_Hook::update_network_priority ( + TAO_Root_POA &poa, TAO_POA_Policy_Set &policy_set) +{ + for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++) + { + CORBA::Policy_var policy = policy_set.get_policy_by_index (i); + ::TAO::NetworkPriorityPolicy_var npp + = ::TAO::NetworkPriorityPolicy::_narrow (policy); + + if (!CORBA::is_nil (npp.in ())) + { + TAO::NetworkPriorityModel network_priority_model = + npp->network_priority_model (); + + poa.cached_policies ().network_priority_model ( + TAO::Portable_Server::Cached_Policies::NetworkPriorityModel ( + network_priority_model)); + + TAO::DiffservCodepoint request_diffserv_codepoint = + npp->request_diffserv_codepoint (); + + TAO::DiffservCodepoint reply_diffserv_codepoint = + npp->reply_diffserv_codepoint (); + + poa.cached_policies ().request_diffserv_codepoint ( + request_diffserv_codepoint); + poa.cached_policies ().reply_diffserv_codepoint ( + reply_diffserv_codepoint); + } + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_FACTORY_DEFINE (TAO_DiffServPolicy, TAO_DiffServ_Network_Priority_Hook) +ACE_STATIC_SVC_DEFINE (TAO_DiffServ_Network_Priority_Hook, + ACE_TEXT ("TAO_Network_Priority_Hook"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_DiffServ_Network_Priority_Hook), + ACE_Service_Type::DELETE_THIS + | ACE_Service_Type::DELETE_OBJ, + 0) diff --git a/modules/TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.h b/modules/TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.h new file mode 100644 index 00000000000..b449af9d7df --- /dev/null +++ b/modules/TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.h @@ -0,0 +1,49 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Diffserv_Network_Priority_Hook.h + * + * $Id$ + * + * @author Jaiganesh Balasubramanian <jai@dre.vanderbilt.edu> + * Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + +#ifndef TAO_DIFFSERV_NETWORK_PRIORITY_HOOK_H +#define TAO_DIFFSERV_NETWORK_PRIORITY_HOOK_H + +#include /**/ "ace/pre.h" +#include "ace/Service_Config.h" + +#include "tao/DiffServPolicy/DiffServPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Network_Priority_Hook.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_DiffServPolicy_Export TAO_DiffServ_Network_Priority_Hook + : public TAO_Network_Priority_Hook +{ +public: + virtual ~TAO_DiffServ_Network_Priority_Hook(void); + + void update_network_priority (TAO_Root_POA &poa, + TAO_POA_Policy_Set &poa_policy_set); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DECLARE_EXPORT (TAO_DiffServPolicy, + TAO_DiffServ_Network_Priority_Hook) +ACE_FACTORY_DECLARE (TAO_DiffServPolicy, TAO_DiffServ_Network_Priority_Hook) + + +#include /**/ "ace/post.h" + +#endif /* TAO_DIFFSERV_NETWORK_PRIORITY_HOOK_H */ |