diff options
author | vishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-12-29 00:23:27 +0000 |
---|---|---|
committer | vishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-12-29 00:23:27 +0000 |
commit | f8442f755814bd830124e3cf0746dc9c43fc5f20 (patch) | |
tree | 32ecc1965d901396c26a61b75235b1cf1d7d7481 | |
parent | a49ef22647bd95a761f27a3cbd8991997c12f5ad (diff) | |
download | ATCD-f8442f755814bd830124e3cf0746dc9c43fc5f20.tar.gz |
*** empty log message ***
-rw-r--r-- | ace/QoS_Session_Impl.cpp | 1 | ||||
-rw-r--r-- | examples/QOS/Receiver_QOS_Event_Handler.cpp | 33 | ||||
-rw-r--r-- | examples/QOS/Receiver_QOS_Event_Handler.h | 5 | ||||
-rw-r--r-- | examples/QOS/server.cpp | 68 |
4 files changed, 76 insertions, 31 deletions
diff --git a/ace/QoS_Session_Impl.cpp b/ace/QoS_Session_Impl.cpp index 842b6d039c1..69716be1d45 100644 --- a/ace/QoS_Session_Impl.cpp +++ b/ace/QoS_Session_Impl.cpp @@ -502,6 +502,7 @@ ACE_GQoS_Session::qos (ACE_SOCK *socket, int ACE_GQoS_Session::update_qos (void) { + // WSAIoctl (GET_QOS) call goes here... return 0; } diff --git a/examples/QOS/Receiver_QOS_Event_Handler.cpp b/examples/QOS/Receiver_QOS_Event_Handler.cpp index 97205d81791..e0070cd7880 100644 --- a/examples/QOS/Receiver_QOS_Event_Handler.cpp +++ b/examples/QOS/Receiver_QOS_Event_Handler.cpp @@ -21,8 +21,10 @@ ACE_QOS_Event_Handler::ACE_QOS_Event_Handler (void) { } -ACE_QOS_Event_Handler::ACE_QOS_Event_Handler (const ACE_SOCK_Dgram_Mcast &dgram_mcast) - : dgram_mcast_ (dgram_mcast) +ACE_QOS_Event_Handler::ACE_QOS_Event_Handler (const ACE_SOCK_Dgram_Mcast &dgram_mcast, + ACE_QoS_Session *qos_session) + : dgram_mcast_ (dgram_mcast), + qos_session_ (qos_session) { } @@ -47,20 +49,23 @@ ACE_QOS_Event_Handler::handle_qos (ACE_HANDLE) ACE_DEBUG ((LM_DEBUG, "\nReceived a QOS event. Inside handle_qos ()\n")); - ACE_QoS ace_get_qos; - u_long dwBytes; - - if (ACE_OS::ioctl (this->dgram_mcast_.get_handle (), - ACE_SIO_GET_QOS, - ace_get_qos, - &dwBytes) == -1) - ACE_ERROR ((LM_ERROR, - "Error in Qos get ACE_OS::ioctl ()\n" - "Bytes Returned = %d\n", - dwBytes)); + // We have received an RSVP event. The following update_qos () call + // calls rapi_dispatch () in case of RAPI and WSAIoctl (GET_QOS) in + // case of W2K. It then does the QoS parameter translation and updates + // the QoS session object with the latest QoS. This call replaces the + // direct call that was being made to WSAIoctl (GET_QOS) here for the + // Win2K example. + + if (this->qos_session_->update_qos () == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "Error in updating QoS\n"), + -1); else ACE_DEBUG ((LM_DEBUG, - "Getting QOS using ACE_OS::ioctl () succeeds.\n")); + " Updating QOS succeeds.\n")); + + // Now proactively query the QoS object for QoS. + ACE_QoS ace_get_qos = this->qos_session_->qos (); ACE_DEBUG ((LM_DEBUG, "\nReceiving Flowspec :\t\t\tSending Flowspec :\n\n" diff --git a/examples/QOS/Receiver_QOS_Event_Handler.h b/examples/QOS/Receiver_QOS_Event_Handler.h index 98982d22849..ddcfc18cfd2 100644 --- a/examples/QOS/Receiver_QOS_Event_Handler.h +++ b/examples/QOS/Receiver_QOS_Event_Handler.h @@ -21,6 +21,7 @@ #include "ace/Reactor.h" #include "ace/INET_Addr.h" #include "ace/SOCK_Dgram_Mcast.h" +#include "ace/QoS_Session.h" ACE_RCSID(Receiver_QOS_Event_Handler, Receiver_QOS_Event_Handler, "$Id$") @@ -31,7 +32,8 @@ public: ACE_QOS_Event_Handler (void); // Constructor. - ACE_QOS_Event_Handler::ACE_QOS_Event_Handler (const ACE_SOCK_Dgram_Mcast &dgram_mcast); + ACE_QOS_Event_Handler::ACE_QOS_Event_Handler (const ACE_SOCK_Dgram_Mcast &dgram_mcast, + ACE_QoS_Session *qos_session); // Constructor. ~ACE_QOS_Event_Handler (void); @@ -51,6 +53,7 @@ public: private: ACE_SOCK_Dgram_Mcast dgram_mcast_; ACE_INET_Addr remote_addr_; + ACE_QoS_Session *qos_session_; }; #endif /* RECEIVER_QOS_EVENT_HANDLER_H */ diff --git a/examples/QOS/server.cpp b/examples/QOS/server.cpp index d89383af3ad..164482798aa 100644 --- a/examples/QOS/server.cpp +++ b/examples/QOS/server.cpp @@ -18,6 +18,8 @@ #include "ace/SOCK_Dgram_Mcast.h" #include "ace/OS.h" +#include "ace/QoS_Session_Factory.h" +#include "ace/QoS_Session.h" #include "QosEvent.h" #include "Receiver_QOS_Event_Handler.h" @@ -209,8 +211,39 @@ main (int argc, char * argv[]) ACE_QoS_Params qos_params; FillQoSParams (qos_params, 0, &qos); + // Create a QoS Session Factory. + ACE_QoS_Session_Factory session_factory; + + // Ask the factory to create a QoS session. This could be RAPI or GQoS + // based on the parameter passed. + ACE_QoS_Session *qos_session = + session_factory.create_session (ACE_QoS_Session_Factory::ACE_GQOS_SESSION); + + // Create a destination address for the QoS session. The same address should be used + // for the subscribe call later. A copy is made below only to distinguish the two + // usages of the dest address. + + ACE_INET_Addr dest_addr (mult_addr); + + // A QoS session is defined by the 3-tuple [DestAddr, DestPort, Protocol]. Initialize + // the QoS session. + if (qos_session->open (mult_addr, + IPPROTO_UDP) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "Error in opening the QoS session\n"), + -1); + // The following call opens the Dgram_Mcast and calls the - // <ACE_OS::join_leaf> with the qos_params supplied here. + // <ACE_OS::join_leaf> with the qos_params supplied here. Note the + // QoS session object is passed into this call. This subscribes the + // underlying socket to the passed in QoS session. For joining multiple + // multicast sessions, the following subscribe call should be made with + // different multicast addresses and a new QoS session object should be passed in for + // each such call. The QoS session objects can be created only through the + // session factory. Care should be taken that the mult_addr for the subscribe() + // call matches the dest_addr of the QoS session object. If this is not done, + // the subscribe call will fail. A more abstract version of subscribe will be + // added that constrains the various features of GQoS like different flags etc. if (dgram_mcast.subscribe (mult_addr, qos_params, @@ -222,7 +255,8 @@ main (int argc, char * argv[]) 0, ACE_OVERLAPPED_SOCKET_FLAG | ACE_FLAG_MULTIPOINT_C_LEAF - | ACE_FLAG_MULTIPOINT_D_LEAF) == -1) + | ACE_FLAG_MULTIPOINT_D_LEAF, + qos_session) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error in subscribe\n"), -1); @@ -234,6 +268,8 @@ main (int argc, char * argv[]) char achInBuf [BUFSIZ]; u_long dwBytes; + // Should this be abstracted into QoS objects ?? Doesnt seem to + // have to do anything directly with QoS. if (ACE_OS::ioctl (dgram_mcast.get_handle (), // Socket. ACE_SIO_MULTICAST_SCOPE, // IO control code. &nIP_TTL, // In buffer. @@ -251,6 +287,8 @@ main (int argc, char * argv[]) int bFlag = FALSE; + // Should this be abstracted into QoS objects ?? Doesnt seem to + // have to do anything directly with QoS. if (ACE_OS::ioctl (dgram_mcast.get_handle (), // Socket. ACE_SIO_MULTIPOINT_LOOPBACK, // IO control code. &bFlag, // In buffer. @@ -266,7 +304,6 @@ main (int argc, char * argv[]) ACE_DEBUG ((LM_DEBUG, "Disable Loopback with ACE_OS::ioctl call succeeds \n")); - // Fill up an ACE_QoS and pass it to the overloaded ACE_OS::ioctl () // that uses the I/O control code as SIO_SET_QOS. ACE_QoS ace_qos; @@ -284,22 +321,21 @@ main (int argc, char * argv[]) ace_qos.receiving_flowspec (receiving_flowspec); ace_qos.provider_specific (iov); - // Set the QOS according to the supplied ACE_QoS. The I/O control - // code used under the hood is SIO_SET_QOS. - if (ACE_OS::ioctl (dgram_mcast.get_handle (), // Socket. - ACE_SIO_SET_QOS, - ace_qos, // ACE_QoS. - &dwBytes) == -1) // bytes returned. - ACE_ERROR ((LM_ERROR, - "Error in Qos set ACE_OS::ioctl()\n" - "Bytes Returned = %d\n", - dwBytes)); + // Set the QoS for the session. Replaces the ioctl () call that was being + // made previously. + if (qos_session->qos (&dgram_mcast, + ace_qos) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to set QoS\n"), + -1); else ACE_DEBUG ((LM_DEBUG, - "Setting QOS with ACE_OS::ioctl succeeds.\n")); + "Setting QOS succeeds.\n")); - // Instantiate a QOS Event Handler and pass the Dgram_Mcast into it. - ACE_QOS_Event_Handler qos_event_handler (dgram_mcast); + // Instantiate a QOS Event Handler and pass the Dgram_Mcast and + // QoS session object into it. + ACE_QOS_Event_Handler qos_event_handler (dgram_mcast, + qos_session); // Register the QOS Handler with the Reactor. if (ACE_Reactor::instance ()->register_handler |