summaryrefslogtreecommitdiff
path: root/ace/QoS_Decorator.cpp
diff options
context:
space:
mode:
authorvishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-07-17 00:35:38 +0000
committervishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-07-17 00:35:38 +0000
commit592abaa88b89c53427cf877f9bb284525f443ca8 (patch)
treea44681245d96aee8bb80c82ae19fd40b48ffcf8b /ace/QoS_Decorator.cpp
parentd36cb40f0cb683f6f821009f2f5239499aacbe42 (diff)
downloadATCD-592abaa88b89c53427cf877f9bb284525f443ca8.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/QoS_Decorator.cpp')
-rw-r--r--ace/QoS_Decorator.cpp167
1 files changed, 167 insertions, 0 deletions
diff --git a/ace/QoS_Decorator.cpp b/ace/QoS_Decorator.cpp
new file mode 100644
index 00000000000..7291cd38ef8
--- /dev/null
+++ b/ace/QoS_Decorator.cpp
@@ -0,0 +1,167 @@
+// QoS_Decorator.cpp
+// $Id$
+
+#include "ace/QoS_Decorator.h"
+
+ACE_RCSID(ace, QoS_Decorator, "$Id $")
+
+ACE_ALLOC_HOOK_DEFINE(ACE_QOS_DECORATOR)
+
+// Constructor.
+ACE_QoS_Decorator_Base::ACE_QoS_Decorator_Base (void)
+{}
+
+// Constructor.
+ACE_QoS_Decorator_Base::ACE_QoS_Decorator_Base (ACE_Event_Handler
+ *event_handler)
+ : event_handler_ (event_handler)
+{
+}
+
+// Destructor.
+ACE_QoS_Decorator_Base::~ACE_QoS_Decorator_Base (void)
+{
+}
+
+// Forward the call to ACE_Event_Handler component.
+ACE_HANDLE
+ACE_QoS_Decorator_Base::get_handle (void) const
+{
+ return this->event_handler_->get_handle ();
+}
+
+// Forward the call to ACE_Event_Handler component.
+int
+ACE_QoS_Decorator_Base::handle_input (ACE_HANDLE fd)
+{
+ return this->event_handler_->handle_input (fd);
+}
+
+// Forward the call to ACE_Event_Handler component.
+int
+ACE_QoS_Decorator_Base::handle_qos (ACE_HANDLE fd)
+{
+ return this->event_handler_->handle_qos (fd);
+}
+
+// Constructor.
+ACE_QoS_Decorator::ACE_QoS_Decorator (void)
+{}
+
+// Constructor.
+ACE_QoS_Decorator::ACE_QoS_Decorator (ACE_Event_Handler *event_handler,
+ ACE_QoS_Session *qos_session,
+ ACE_Reactor *reactor)
+ : qos_session_ (qos_session),
+ reactor_ (reactor)
+{
+ ACE_NEW (this->decorator_base_,
+ ACE_QoS_Decorator_Base (event_handler));
+
+ ACE_NEW (this->qos_event_handler_,
+ ACE_QoS_Event_Handler (this->decorator_base_));
+}
+
+// Destructor.
+ACE_QoS_Decorator::~ACE_QoS_Decorator (void)
+{
+ delete this->decorator_base_;
+ delete this->qos_event_handler_;
+}
+
+// Implements the undecorated functionality. This is sufficient for
+// GQoS. RAPI needs additional QoS decoration. This is done by the
+// ACE_QoS_Event_Handler class.
+ACE_HANDLE
+ACE_QoS_Decorator::get_handle (void) const
+{
+ return this->decorator_base_->get_handle ();
+}
+
+// Implements the undecorated functionality. This is sufficient for
+// GQoS. RAPI needs additional QoS decoration. This is done by the
+// ACE_QoS_Event_Handler class.
+int
+ACE_QoS_Decorator::handle_input (ACE_HANDLE fd)
+{
+ return this->decorator_base_->handle_input (fd);
+}
+
+// Implements the undecorated functionality. This is sufficient for
+// GQoS. RAPI needs additional QoS decoration. This is done by the
+// ACE_QoS_Event_Handler class.
+int
+ACE_QoS_Decorator::handle_qos (ACE_HANDLE fd)
+{
+ return this->decorator_base_->handle_qos (fd);
+}
+
+// This method registers the RAPI QoS event handler with the reactor
+// if the application is using RAPI. Note that it is a no-op for GQoS
+// because an extra socket for handling QoS events is not required.
+int
+ACE_QoS_Decorator::init (void)
+{
+#if defined (ACE_HAS_RAPI)
+
+ // Pass the QoS session to QoS Event Handler.
+ this->qos_event_handler_->qos_session (this->qos_session_);
+
+ // Register the QoS Event Handler with the Reactor.
+ return this->reactor_->register_handler (this->qos_event_handler_,
+ ACE_Event_Handler::READ_MASK);
+#endif
+ return 0;
+
+}
+
+// Constructor.
+ACE_QoS_Event_Handler::ACE_QoS_Event_Handler (void)
+{
+}
+
+// Constructor.
+ACE_QoS_Event_Handler::ACE_QoS_Event_Handler (ACE_QoS_Decorator_Base
+ *decorator_base)
+ : decorator_base_ (decorator_base)
+{
+};
+
+// Destructor.
+ACE_QoS_Event_Handler::~ACE_QoS_Event_Handler (void)
+{
+}
+
+// Set the QoS session.
+void
+ACE_QoS_Event_Handler::qos_session (ACE_QoS_Session *qos_session)
+{
+ this->qos_session_ = qos_session;
+}
+
+// Returns the RAPI file descriptor for listening to RAPI evnets.
+ACE_HANDLE
+ACE_QoS_Event_Handler::get_handle (void) const
+{
+ return this->qos_session_->rsvp_events_handle ();
+}
+
+// Note, here the handle_input () calls the handle_qos () of the
+// Decorator Base which then calls handle_qos () of the
+// ACE_Event_Handler component within it. This helps to translate the
+// normal read events into qos events in case of RAPI so the
+// application using the API is oblivious to the fact that in RAPI,
+// QoS events are received on a different socket. This helps to
+// maintain a uniform design for the application irrespective of
+// whether it is using RAPI or GQoS.
+int
+ACE_QoS_Event_Handler::handle_input (ACE_HANDLE fd)
+{
+ return this->decorator_base_->handle_qos (fd);
+}
+
+
+
+
+
+