diff options
Diffstat (limited to 'ACE/examples/QOS/Simple')
-rw-r--r-- | ACE/examples/QOS/Simple/Fill_ACE_QoS.cpp | 99 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/Fill_ACE_QoS.h | 75 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/FlowSpec_Dbase.h | 52 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/Makefile.am | 78 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/QOS_Simple.mpc | 25 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/QoS_Signal_Handler.cpp | 40 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/QoS_Signal_Handler.h | 45 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/QoS_Util.cpp | 122 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/QoS_Util.h | 75 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/README | 142 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/Receiver_QoS_Event_Handler.cpp | 137 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/Receiver_QoS_Event_Handler.h | 61 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/Sender_QoS_Event_Handler.cpp | 144 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/Sender_QoS_Event_Handler.h | 59 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/receiver.cpp | 301 | ||||
-rw-r--r-- | ACE/examples/QOS/Simple/sender.cpp | 315 |
16 files changed, 0 insertions, 1770 deletions
diff --git a/ACE/examples/QOS/Simple/Fill_ACE_QoS.cpp b/ACE/examples/QOS/Simple/Fill_ACE_QoS.cpp deleted file mode 100644 index 20c03f40fa6..00000000000 --- a/ACE/examples/QOS/Simple/Fill_ACE_QoS.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Fill_ACE_QoS.cpp -// $Id$ - -#include "Fill_ACE_QoS.h" - -ACE_RCSID(QOS, Fill_ACE_QoS,"$Id$") - -const iovec Fill_ACE_QoS::iov_ = {0,0}; - -Fill_ACE_QoS::Fill_ACE_QoS (void) -{ - ACE_NEW (this->default_traffic_, - ACE_Flow_Spec (ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - ACE_SERVICETYPE_NOTRAFFIC, - ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - 25, - 1)); -} - -// destructor. -Fill_ACE_QoS::~Fill_ACE_QoS (void) -{} - -int -Fill_ACE_QoS::fill_simplex_receiver_qos (ACE_QoS &ace_qos, - const ACE_CString &recv_flow_name) -{ - ACE_Flow_Spec *recv_flow_spec = 0; - - if (this->map ().find (recv_flow_name, recv_flow_spec) != 0) - ACE_ERROR_RETURN ((LM_DEBUG, - "Unable to find a FlowSpec with name %s", - recv_flow_name.c_str ()), - -1); - ace_qos.receiving_flowspec (recv_flow_spec); - ace_qos.sending_flowspec ((this->default_traffic_)); - ace_qos.provider_specific (Fill_ACE_QoS::iov_); - - return 0; -} - - -int -Fill_ACE_QoS::fill_simplex_sender_qos (ACE_QoS &ace_qos, - const ACE_CString &send_flow_name) -{ - ACE_Flow_Spec *send_flow_spec = 0; - - if (this->map ().find (send_flow_name, send_flow_spec) != 0) - ACE_ERROR_RETURN ((LM_DEBUG, - "Unable to find a FlowSpec with name %s", - send_flow_name.c_str ()), - -1); - - ace_qos.receiving_flowspec ((this->default_traffic_)); - ace_qos.sending_flowspec (send_flow_spec); - ace_qos.provider_specific (Fill_ACE_QoS::iov_); - - return 0; -} - -int -Fill_ACE_QoS::fill_duplex_qos (ACE_QoS &ace_qos, - const ACE_CString &recv_flow_name, - const ACE_CString &send_flow_name) -{ - ACE_Flow_Spec *send_flow_spec = 0; - ACE_Flow_Spec *recv_flow_spec = 0; - - if (this->map ().find (recv_flow_name, recv_flow_spec) != 0) - ACE_ERROR_RETURN ((LM_DEBUG, - "Unable to find a FlowSpec with name %s", - recv_flow_name.c_str ()), - -1); - - if (this->map ().find (send_flow_name, send_flow_spec) != 0) - ACE_ERROR_RETURN ((LM_DEBUG, - "Unable to find a FlowSpec with name %s", - send_flow_name.c_str ()), - -1); - - ace_qos.receiving_flowspec (recv_flow_spec); - ace_qos.sending_flowspec (send_flow_spec); - ace_qos.provider_specific (Fill_ACE_QoS::iov_); - - return 0; -} - -Fill_ACE_QoS::FLOW_SPEC_HASH_MAP& -Fill_ACE_QoS::map (void) -{ - return this->flow_spec_map_; -} - diff --git a/ACE/examples/QOS/Simple/Fill_ACE_QoS.h b/ACE/examples/QOS/Simple/Fill_ACE_QoS.h deleted file mode 100644 index 281b9beb876..00000000000 --- a/ACE/examples/QOS/Simple/Fill_ACE_QoS.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// Fill_ACE_QoS.h -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ============================================================================ - -#ifndef FILL_ACE_QOS_H -#define FILL_ACE_QOS_H - -#include "ace/SString.h" -#include "ace/Hash_Map_Manager.h" -#include "ace/ACE.h" -#include "ace/Null_Mutex.h" -#include "ace/OS_QoS.h" - -class Fill_ACE_QoS -{ - // TITLE - // This class helps users to add new flow specs and provides - // utility functions for filling up the flow specs for simplex/duplex - // sessions. - -public: - typedef ACE_Hash_Map_Manager <ACE_CString, ACE_Flow_Spec *, ACE_Null_Mutex> FLOW_SPEC_HASH_MAP; - - //Initialization and termination methods. - Fill_ACE_QoS (void); - // constructor. - - ~Fill_ACE_QoS (void); - // destructor. - - int fill_simplex_receiver_qos (ACE_QoS &ace_qos, - const ACE_CString &recv_flow_name); - // To be used by receivers. Fills the receiver qos and sets the - // sender qos to NO_TRAFFIC. - - int fill_simplex_sender_qos (ACE_QoS &ace_qos, - const ACE_CString &send_flow_name); - // To be used by senders. Fills the sender qos and sets the receiver - // qos to NO_TRAFFIC. - - int fill_duplex_qos (ACE_QoS &ace_qos, - const ACE_CString &recv_flow_name, - const ACE_CString &send_flow_name); - // To be used by applications that wish to be both receivers and - // senders. - - FLOW_SPEC_HASH_MAP& map (void); - // Returns the hash map of flowspecs indexed by flowspec name. - -private: - - // The Service Provider is currently set to NULL for all ACE_QoS. - static const iovec iov_; - - // A NO_TRAFFIC flow spec. Senders set the receiving qos to this - // while the receivers set the sending qos to this. - ACE_Flow_Spec *default_traffic_; - - // A list of flowspecs indexed by the flowspec name. - FLOW_SPEC_HASH_MAP flow_spec_map_; -}; - -#endif /* FILL_ACE_QOS_H */ diff --git a/ACE/examples/QOS/Simple/FlowSpec_Dbase.h b/ACE/examples/QOS/Simple/FlowSpec_Dbase.h deleted file mode 100644 index fc382048c13..00000000000 --- a/ACE/examples/QOS/Simple/FlowSpec_Dbase.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- C++ -*- */ -//$Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// FlowSpec_Dbase.h -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ============================================================================ - -#ifndef FLOWSPEC_DBASE_H -#define FLOWSPEC_DBASE_H - -// This file contains the different FlowSpecs that the QoS enabled -// application uses. Its a good idea to list them all here so the -// application code is clean. - -ACE_Flow_Spec notraffic (ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - ACE_SERVICETYPE_NOTRAFFIC, - ACE_QOS_NOT_SPECIFIED, - ACE_QOS_NOT_SPECIFIED, - 25, - 1); - -ACE_Flow_Spec g711 (9200, - 708, - 18400, - 0, - 0, - ACE_SERVICETYPE_CONTROLLEDLOAD, - 368, - 368, - 25, - 1); - -// The default session address is macarena.cs.wustl.edu. I am using macarena -// as my receiver for testing. -#define DEFAULT_QOS_SESSION_MACHINE "128.252.165.127" -#define DEFAULT_QOS_SESSION_PORT 8001 - -#endif /* FLOWSPEC_DBASE_H */ - diff --git a/ACE/examples/QOS/Simple/Makefile.am b/ACE/examples/QOS/Simple/Makefile.am deleted file mode 100644 index 1c00ebf8545..00000000000 --- a/ACE/examples/QOS/Simple/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id$ -## -## This file was generated by MPC. Any changes made directly to -## this file will be lost the next time it is generated. -## -## MPC Command: -## bin/mwc.pl -type automake -noreldefs -features ssl=1,qos=1 ACE.mwc - -ACE_BUILDDIR = $(top_builddir) -ACE_ROOT = $(top_srcdir) - -noinst_PROGRAMS = - -## Makefile.QOS_Simple_Receiver.am - -if BUILD_QOS - -noinst_PROGRAMS += receiver - -receiver_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -DACE_HAS_QOS - -receiver_SOURCES = \ - Fill_ACE_QoS.cpp \ - QoS_Signal_Handler.cpp \ - QoS_Util.cpp \ - Receiver_QoS_Event_Handler.cpp \ - receiver.cpp \ - Fill_ACE_QoS.h \ - QoS_Signal_Handler.h \ - QoS_Util.h \ - Receiver_QoS_Event_Handler.h - -receiver_LDADD = \ - $(ACE_BUILDDIR)/ace/QoS/libACE_QoS.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -endif BUILD_QOS - -## Makefile.QOS_Simple_Sender.am - -if BUILD_QOS - -noinst_PROGRAMS += sender - -sender_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -DACE_HAS_QOS - -sender_SOURCES = \ - Fill_ACE_QoS.cpp \ - QoS_Signal_Handler.cpp \ - QoS_Util.cpp \ - Sender_QoS_Event_Handler.cpp \ - sender.cpp \ - Fill_ACE_QoS.h \ - QoS_Signal_Handler.h \ - QoS_Util.h \ - Sender_QoS_Event_Handler.h - -sender_LDADD = \ - $(ACE_BUILDDIR)/ace/QoS/libACE_QoS.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -endif BUILD_QOS - -## Clean up template repositories, etc. -clean-local: - -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* - -rm -f gcctemp.c gcctemp so_locations *.ics - -rm -rf cxx_repository ptrepository ti_files - -rm -rf templateregistry ir.out - -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/ACE/examples/QOS/Simple/QOS_Simple.mpc b/ACE/examples/QOS/Simple/QOS_Simple.mpc deleted file mode 100644 index 9767bd6fdb9..00000000000 --- a/ACE/examples/QOS/Simple/QOS_Simple.mpc +++ /dev/null @@ -1,25 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*receiver) : aceexe, qos { - exename = receiver - requires += qos - Source_Files { - Fill_ACE_QoS.cpp - QoS_Signal_Handler.cpp - QoS_Util.cpp - receiver.cpp - Receiver_QoS_Event_Handler.cpp - } -} -project(*sender) : aceexe, qos { - exename = sender - requires += qos - Source_Files { - Fill_ACE_QoS.cpp - QoS_Signal_Handler.cpp - QoS_Util.cpp - sender.cpp - Sender_QoS_Event_Handler.cpp - } -} diff --git a/ACE/examples/QOS/Simple/QoS_Signal_Handler.cpp b/ACE/examples/QOS/Simple/QoS_Signal_Handler.cpp deleted file mode 100644 index a0533bacdbc..00000000000 --- a/ACE/examples/QOS/Simple/QoS_Signal_Handler.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// QoS_Signal_Handler.cpp -// $Id$ - -#include "ace/Log_Msg.h" -#include "QoS_Signal_Handler.h" - -ACE_RCSID(QOS, QoS_Signal_Handler,"$Id$") - -// constructor. -QoS_Signal_Handler::QoS_Signal_Handler (ACE_QoS_Session *qos_session) - : qos_session_ (qos_session) -{ -} - -// Releases the QoS sessions gracefully. -int -QoS_Signal_Handler::handle_signal (int signum, siginfo_t *, ucontext_t*) -{ - - ACE_DEBUG ((LM_DEBUG, - "QoS_Signal_Handler::handle_signal\n")); - - if (signum == SIGINT) - { - ACE_DEBUG ((LM_DEBUG, - "QoS_Signal_Handler::handle_signal SIGINT called\n")); - if (this->qos_session_->close () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to close the QoS session.\n"), - -1); - else - ACE_DEBUG ((LM_DEBUG, - "QoS Session with id %d closed successfully.\n", - this->qos_session_->session_id ())); - } - else - ACE_DEBUG ((LM_DEBUG, - "A signal other than SIGINT received.\nIgnoring.\n")); - return 0; -} diff --git a/ACE/examples/QOS/Simple/QoS_Signal_Handler.h b/ACE/examples/QOS/Simple/QoS_Signal_Handler.h deleted file mode 100644 index 35b9f3a19e7..00000000000 --- a/ACE/examples/QOS/Simple/QoS_Signal_Handler.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ===================================================================== -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// QoS_Signal_Handler.h -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ===================================================================== - -#ifndef QOS_SIGNAL_HANDLER_H -#define QOS_SIGNAL_HANDLER_H - -#include "ace/Event_Handler.h" -#include "ace/QoS/QoS_Session.h" - -class QoS_Signal_Handler : public ACE_Event_Handler -{ - // TITLE - // This class Handles the SIGINT signal through the Reactor. - // Useful to gracefully release QoS sessions. - -public: - - QoS_Signal_Handler (ACE_QoS_Session *qos_session); - // constructor. - - int handle_signal(int signum, siginfo_t*,ucontext_t*); - // Override this method to implement graceful shutdown. - -private: - - ACE_QoS_Session *qos_session_; - // Session to be gracefully shutdown. - -}; - -#endif /* QOS_SIGNAL_HANDLER_H */ - diff --git a/ACE/examples/QOS/Simple/QoS_Util.cpp b/ACE/examples/QOS/Simple/QoS_Util.cpp deleted file mode 100644 index 0ef3b353248..00000000000 --- a/ACE/examples/QOS/Simple/QoS_Util.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// QoS_Session_Impl.cpp -// $Id$ - -#define SENDER_PORT 10001 - -#include "ace/Log_Msg.h" -#include "ace/Get_Opt.h" -#include "QoS_Util.h" -#include "ace/OS_NS_strings.h" - -ACE_RCSID(QOS, QoS_Util,"$Id$") - -// constructor. -QoS_Util::QoS_Util (int argc, - ACE_TCHAR *argv[]) - : argc_ (argc), - argv_ (argv), - source_port_ (SENDER_PORT), - protocol_ (IPPROTO_UDP), - multicast_flag_ (0) -{ - ACE_NEW (this->mult_session_addr_, - ACE_INET_Addr (ACE_DEFAULT_MULTICAST_PORT)); - - ACE_NEW (this->dest_addr_, - ACE_INET_Addr (ACE_DEFAULT_SERVER_PORT)); -} - -// destructor. -QoS_Util::~QoS_Util (void) -{ - delete this->mult_session_addr_; - delete this->dest_addr_; -} - -int -QoS_Util::parse_args (void) -{ - ACE_Get_Opt get_opts (this->argc_, this->argv_, ACE_TEXT("m:n:p:P:c")); - int c = 0; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'm': // multicast session address. - this->multicast_flag_ = 1; - this->mult_session_addr_->set (get_opts.opt_arg ()); - break; - case 'n': // to be used by Senders only to specify the destination. - this->dest_addr_->set (get_opts.opt_arg ()); - break; - case 'p': // protocol. - if (ACE_OS::strcasecmp (get_opts.opt_arg (), ACE_TEXT("tcp")) == 0) - this->protocol_ = IPPROTO_TCP; - else - if (ACE_OS::strcasecmp (get_opts.opt_arg (), ACE_TEXT("udp")) == 0) - this->protocol_ = IPPROTO_UDP; - else - ACE_DEBUG ((LM_DEBUG, - "Unknown protocol specified\n" - "UDP assumed\n")); - break; - case 'P': // sender source port. - this->source_port_ = ACE_OS::atoi (get_opts.opt_arg ()); - break; - case 'h': // display help for different options. - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s" - " [-m host:port] QoS multicast session address" - " Overides the receiver address specified in the -n option" - " [-n host:port] Use for a unicast sender. " - " Follow by receiver addr" - " [-p tcp|udp] specify protocol to be used" - " [-P port] source sender port" - " [-h] <help>" - "\n", - argv_ [0]), - -1); - } - - // If multicast address is specified then ignore the unicast sender - // destination address and force the protocol to be UDP. - if (this->multicast_flag_ == 1) - { - this->dest_addr_ = this->mult_session_addr_; - this->protocol_ = IPPROTO_UDP; - } - - // Indicates successful parsing of command line. - return 0; -} - -ACE_INET_Addr * -QoS_Util::mult_session_addr (void) const -{ - return this->mult_session_addr_; -} - -ACE_INET_Addr * -QoS_Util::dest_addr (void) const -{ - return this->dest_addr_; -} - -u_short -QoS_Util::source_port (void) const -{ - return this->source_port_; -} - -ACE_Protocol_ID -QoS_Util::protocol (void) const -{ - return this->protocol_; -} - -int -QoS_Util::multicast_flag (void) const -{ - return this->multicast_flag_; -} diff --git a/ACE/examples/QOS/Simple/QoS_Util.h b/ACE/examples/QOS/Simple/QoS_Util.h deleted file mode 100644 index ae347de68f6..00000000000 --- a/ACE/examples/QOS/Simple/QoS_Util.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ===================================================================== -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// QoS_Util.h -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ===================================================================== - -#ifndef QOS_UTIL_H -#define QOS_UTIL_H - -#include "ace/INET_Addr.h" -#include "ace/QoS/QoS_Session.h" - -class QoS_Util -{ - // = TITLE - // This class provides the utility functions like parse_args () - // required by a QoS enabled application. - -public: - - // constructor. - QoS_Util (int argc, ACE_TCHAR *argv[]); - - // destructor. - ~QoS_Util (void); - - // Parse command-line arguments. - int parse_args (void); - - // GET methods. - ACE_INET_Addr *mult_session_addr (void) const; - - ACE_INET_Addr *dest_addr (void) const; - - u_short source_port (void) const; - - ACE_Protocol_ID protocol (void) const; - - int multicast_flag (void) const; - -private: - - // Command line arguments. - int argc_; - ACE_TCHAR **argv_; - - // Multicast session address. - ACE_INET_Addr *mult_session_addr_; - - // Unicast destination address of the receiver. - ACE_INET_Addr *dest_addr_; - - // Source port for the sender. - u_short source_port_; - - // Protocol. - ACE_Protocol_ID protocol_; - - // Multicast Flag. - int multicast_flag_; - -}; - -#endif /* QOS_UTIL_H */ - diff --git a/ACE/examples/QOS/Simple/README b/ACE/examples/QOS/Simple/README deleted file mode 100644 index 13255842932..00000000000 --- a/ACE/examples/QOS/Simple/README +++ /dev/null @@ -1,142 +0,0 @@ -//$Id$ - -A Regression test for ACE QoS features. ---------------------------------------- - -This test implements a simple Receiver-Sender program that ensures -Quality of Service (QoS) guarantees on the underlying network before -transmitting data. The program tests the ACE QoS APIs/features. The -test works for Winsock2 APIs on Win2K as well as RAPI on Solaris. - - ------------------------------------------------------------------------- -WIN2K : - -Build Requirements : --------------------- -1. Two Win2K machines. -2. June98 Platform SDK or later. -3. Link with ws2_32.lib - -The test consists of a receiver and a sender. - - The sender is started first (though it is not mandatory) as : - - sender -m merengue.cs.wustl.edu:9091 -P 10004 - - -m: specifies the multicast session address that both client and - server subscribe to for QoS events. - - -p: Protocol to be used. Could be udp or tcp. Default is udp. - - -P: Sender source port. If not specified, DEFAULT_SOURCE_SENDER_PORT - (10001) will be used. - - -h: Displays the help on various options. - -The sample Sender is started next as : - - receiver -m merengue.cs.wustl.edu:9091 - - -m: specifies the multicast session address that both client and - server subscribe to for QoS events. - - -n: Option to be used by senders only to specify the destination - address. This option is overriden if a multicast address is also - specified through the -m option. - - -p: Protocol to be used. Could be udp or tcp. Default is udp. - - -P: Sender source port. If not specified, DEFAULT_SOURCE_SENDER_PORT - (10001) will be used. - - -h: Displays the help on various options. - -On Win2K the user must have administrative access to the machine to -run this program. It seems to be a pre-requisite to opening QoS -sockets. - -The sender and receiver should be run on different Win2K machines. - -The test demonstrates how to GQOS enable an application using the ACE QoS APIs. -It concentrates on the use of various ACE QoS APIs and their correctness. - -------------------------------------------------------------------------------- - -RAPI : - -0. The $ACE_ROOT/include/makeinclude/platform_macros.GNU should include the -following : - -include /project/doc/vishal/ACE_wrappers/include/makeinclude/<appropriate platform macros file eg.platform_sunos5_sunc++.GNU> -PLATFORM_RAPI_CPPFLAGS += -I/project/doc/vishal/rapi/rel4.2a4/rsvpd/ -PLATFORM_RAPI_LIBS += -lrsvp -PLATFORM_RAPI_LDFLAGS += -L/project/doc/vishal/rapi/rel4.2a4/rsvpd/ - -assuming that RAPI library is installed in /project/doc/vishal/rapi/rel4.2a4/ - -1. Compile ACE with - - make rapi=1 - -2. Run the RSVP Daemon on two machines: (merengue.cs and macarena.cs) - - /project/doc/vishal/rapi/rel4.2a4/rsvpd/rsvpd -D - - The current version of the daemon comes with an inbuilt rtap - application to test the various reservation commands and RAPI APIs. - - Typical values for rtap would be : - - dest udp macarena/5000 - sender merengue/5000 [ t 2000000 100000 2000000 512 1024 ] - - dest udp macarena/5000 - reserve wf [ cl 2000000 100000 2000000 512 1024 ] - -3. If RTAP runs fine and the daemons show the debug messages about - RESV, PATH and other RSVP messages, run the QoS example, making sure - that rtap session is released on both machines. - -The test consists of a receiver and a sender. - - The sender is started first (though it is not mandatory) as : - - sender -m macarena.cs.wustl.edu:9091 -P 10004 - - -m: specifies the multicast session address that both client and - server subscribe to for QoS events. - - -p: Protocol to be used. Could be udp or tcp. Default is udp. - - -P: Sender source port. If not specified, DEFAULT_SOURCE_SENDER_PORT - (10001) will be used. - - -h: Displays the help on various options. - -The sample Sender is started next as : - - receiver -m macarena.cs.wustl.edu:9091 - - -m: specifies the multicast session address that both client and - server subscribe to for QoS events. - - -n: Option to be used by senders only to specify the destination - address. This option is overriden if a multicast address is also - specified through the -m option. - - -p: Protocol to be used. Could be udp or tcp. Default is udp. - - -P: Sender source port. If not specified, DEFAULT_SOURCE_SENDER_PORT - (10001) will be used. - - -h: Displays the help on various options. - -------------------------------------------------------------------------------- - -If you run into any problems with this test please contact Vishal -Kachroo <vishal@cs.wustl.edu>. - -This README last updated on 20th July, 2000. - -------------------------------------------------------------------------------- diff --git a/ACE/examples/QOS/Simple/Receiver_QoS_Event_Handler.cpp b/ACE/examples/QOS/Simple/Receiver_QoS_Event_Handler.cpp deleted file mode 100644 index 69258313420..00000000000 --- a/ACE/examples/QOS/Simple/Receiver_QoS_Event_Handler.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// Receiver_QoS_Event_Handler.cpp -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ============================================================================ - -#include "Receiver_QoS_Event_Handler.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" - -// Constructor. -Receiver_QoS_Event_Handler::Receiver_QoS_Event_Handler (void) -{ -} - -Receiver_QoS_Event_Handler::Receiver_QoS_Event_Handler (const ACE_SOCK_Dgram_Mcast_QoS - &dgram_mcast_qos, - ACE_QoS_Session *qos_session) - : dgram_mcast_qos_ (dgram_mcast_qos), - qos_session_ (qos_session) -{ -} - -// Destructor. -Receiver_QoS_Event_Handler::~Receiver_QoS_Event_Handler (void) -{ -} - -// Return the handle of the Dgram_Mcast. This method is called -// internally by the reactor. -ACE_HANDLE -Receiver_QoS_Event_Handler::get_handle (void) const -{ - return this->dgram_mcast_qos_.get_handle (); -} - -// Called when there is a READ activity on the dgram_mcast_qos handle. -int -Receiver_QoS_Event_Handler::handle_input (ACE_HANDLE) -{ - char buf[BUFSIZ]; - - iovec iov; - iov.iov_base = buf; - iov.iov_len = BUFSIZ; - - ACE_OS::memset (iov.iov_base, - 0, - BUFSIZ); - - ACE_DEBUG ((LM_DEBUG, - "Inside handle_input () of Receiver_QoS_Event_Handler ()\n")); - - // Receive message from multicast group. - ssize_t result = - this->dgram_mcast_qos_.recv (&iov, - 1, - this->remote_addr_); - - if (result != -1) - { - ACE_DEBUG ((LM_DEBUG, - "Message Received : %s", - iov.iov_base)); - return 0; - } - else - return -1; -} - -// Called when there is a QoS Event. -int -Receiver_QoS_Event_Handler::handle_qos (ACE_HANDLE fd) -{ - ACE_UNUSED_ARG (fd); - - ACE_DEBUG ((LM_DEBUG, - "\nReceived a QOS event. Inside handle_qos ()\n")); - - // 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, - " 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" - "\tToken Rate = %d\t\t\tToken Rate = %d\n" - "\tToken Bucket Size = %d\t\t\tToken Bucket Size = %d\n" - "\tPeak Bandwidth = %d\t\t\tPeak Bandwidth = %d\n" - "\tLatency = %d\t\t\t\tLatency = %d\n" - "\tDelay Variation = %d\t\t\tDelay Variation = %d\n" - "\tService Type = %d\t\t\tService Type = %d\n" - "\tMax SDU Size = %d\t\t\tMax SDU Size = %d\n" - "\tMinimum Policed Size = %d\t\tMinimum Policed Size = %d\n\n", - ace_get_qos.receiving_flowspec ()->token_rate (), - ace_get_qos.sending_flowspec ()->token_rate (), - ace_get_qos.receiving_flowspec ()->token_bucket_size (), - ace_get_qos.sending_flowspec ()->token_bucket_size (), - ace_get_qos.receiving_flowspec ()->peak_bandwidth (), - ace_get_qos.sending_flowspec ()->peak_bandwidth (), - ace_get_qos.receiving_flowspec ()->latency (), - ace_get_qos.sending_flowspec ()->latency (), - ace_get_qos.receiving_flowspec ()->delay_variation (), - ace_get_qos.sending_flowspec ()->delay_variation (), - ace_get_qos.receiving_flowspec ()->service_type (), - ace_get_qos.sending_flowspec ()->service_type (), - ace_get_qos.receiving_flowspec ()->max_sdu_size (), - ace_get_qos.sending_flowspec ()->max_sdu_size (), - ace_get_qos.receiving_flowspec ()->minimum_policed_size (), - ace_get_qos.sending_flowspec ()->minimum_policed_size ())); - - return 0; - -} diff --git a/ACE/examples/QOS/Simple/Receiver_QoS_Event_Handler.h b/ACE/examples/QOS/Simple/Receiver_QoS_Event_Handler.h deleted file mode 100644 index bb8e26decf8..00000000000 --- a/ACE/examples/QOS/Simple/Receiver_QoS_Event_Handler.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// Receiver_QoS_Event_Handler.h -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ============================================================================ - -#ifndef RECEIVER_QOS_EVENT_HANDLER_H -#define RECEIVER_QOS_EVENT_HANDLER_H - -#include "ace/Reactor.h" -#include "ace/INET_Addr.h" -#include "ace/Event_Handler.h" -#include "ace/QoS/QoS_Session.h" -#include "ace/QoS/SOCK_Dgram_Mcast_QoS.h" - -ACE_RCSID(Receiver_QoS_Event_Handler, Receiver_QoS_Event_Handler, "$Id$") - - class Receiver_QoS_Event_Handler : public ACE_Event_Handler - { - public: - // = Initialization and Termination methods. - Receiver_QoS_Event_Handler (void); - // Constructor. - - Receiver_QoS_Event_Handler (const ACE_SOCK_Dgram_Mcast_QoS &dgram_mcast_qos, - ACE_QoS_Session *qos_session); - // Constructor. - - ~Receiver_QoS_Event_Handler (void); - // Destructor. - - virtual ACE_HANDLE get_handle (void) const; - // Override this to return the handle of the Dgram_Mcast - // that we are using. - - virtual int handle_input (ACE_HANDLE fd); - // Handles a READ event. - - virtual int handle_qos (ACE_HANDLE fd); - // Handles a QoS event. - - private: - ACE_SOCK_Dgram_Mcast_QoS dgram_mcast_qos_; - ACE_QoS_Session *qos_session_; - ACE_INET_Addr remote_addr_; - }; - -#endif /* RECEIVER_QOS_EVENT_HANDLER_H */ - - - diff --git a/ACE/examples/QOS/Simple/Sender_QoS_Event_Handler.cpp b/ACE/examples/QOS/Simple/Sender_QoS_Event_Handler.cpp deleted file mode 100644 index 5ee4ccf0f8e..00000000000 --- a/ACE/examples/QOS/Simple/Sender_QoS_Event_Handler.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// Sender_QoS_Event_Handler.cpp -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ============================================================================ - -#include "Sender_QoS_Event_Handler.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" - -// Constructor. -Sender_QoS_Event_Handler::Sender_QoS_Event_Handler (void) -{ -} - -// Constructor. -Sender_QoS_Event_Handler::Sender_QoS_Event_Handler (const ACE_SOCK_Dgram_Mcast_QoS - &dgram_mcast_qos, - ACE_QoS_Session *qos_session) - : dgram_mcast_qos_ (dgram_mcast_qos), - qos_session_ (qos_session) -{ -} - -// Destructor. -Sender_QoS_Event_Handler::~Sender_QoS_Event_Handler (void) -{ -} - -// Return the handle of the Dgram_Mcast. This method is called -// internally by the reactor. - -ACE_HANDLE -Sender_QoS_Event_Handler::get_handle (void) const -{ - return this->dgram_mcast_qos_.get_handle (); -} - -// Handle the QoS Event. In this case send data to the receiver -// using WSASendTo() that uses overlapped I/O. - -int -Sender_QoS_Event_Handler::handle_qos (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, - "\nReceived a QOS event. Inside handle_qos ()\n")); - - // 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, - " 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" - "\tToken Rate = %d\t\t\tToken Rate = %d\n" - "\tToken Bucket Size = %d\t\t\tToken Bucket Size = %d\n" - "\tPeak Bandwidth = %d\t\t\tPeak Bandwidth = %d\n" - "\tLatency = %d\t\t\t\tLatency = %d\n" - "\tDelay Variation = %d\t\t\tDelay Variation = %d\n" - "\tService Type = %d\t\t\tService Type = %d\n" - "\tMax SDU Size = %d\t\t\tMax SDU Size = %d\n" - "\tMinimum Policed Size = %d\t\tMinimum Policed Size = %d\n\n", - ace_get_qos.receiving_flowspec ()->token_rate (), - ace_get_qos.sending_flowspec ()->token_rate (), - ace_get_qos.receiving_flowspec ()->token_bucket_size (), - ace_get_qos.sending_flowspec ()->token_bucket_size (), - ace_get_qos.receiving_flowspec ()->peak_bandwidth (), - ace_get_qos.sending_flowspec ()->peak_bandwidth (), - ace_get_qos.receiving_flowspec ()->latency (), - ace_get_qos.sending_flowspec ()->latency (), - ace_get_qos.receiving_flowspec ()->delay_variation (), - ace_get_qos.sending_flowspec ()->delay_variation (), - ace_get_qos.receiving_flowspec ()->service_type (), - ace_get_qos.sending_flowspec ()->service_type (), - ace_get_qos.receiving_flowspec ()->max_sdu_size (), - ace_get_qos.sending_flowspec ()->max_sdu_size (), - ace_get_qos.receiving_flowspec ()->minimum_policed_size (), - ace_get_qos.sending_flowspec ()->minimum_policed_size ())); - - // This is SPECIFIC TO WIN2K and should be done in the qos_update function. - -// ACE_QoS ace_get_qos; -// u_long dwBytes; - -// if (ACE_OS::ioctl (this->dgram_mcast_qos_.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)); -// else -// ACE_DEBUG ((LM_DEBUG, -// "Getting QOS using ACE_OS::ioctl () succeeds.\n")); - - char* msg = "Hello sent on a QoS enabled session !!\n"; - iovec iov[1]; - iov[0].iov_base = msg; - iov[0].iov_len = ACE_OS::strlen(msg); - - size_t bytes_sent = 0; - - // Send "Hello" to the QoS session address to which the receiver has - // subscribed. - if (this->dgram_mcast_qos_.send (iov, - 1, - bytes_sent, - 0, - this->qos_session_->dest_addr (), - 0, - 0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in dgram_mcast.send ()\n"), - -1); - else - ACE_DEBUG ((LM_DEBUG, - "Using ACE_OS::sendto () : Bytes sent : %d", - bytes_sent)); - return 0; -} diff --git a/ACE/examples/QOS/Simple/Sender_QoS_Event_Handler.h b/ACE/examples/QOS/Simple/Sender_QoS_Event_Handler.h deleted file mode 100644 index e90884320eb..00000000000 --- a/ACE/examples/QOS/Simple/Sender_QoS_Event_Handler.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// Sender_QoS_Event_Handler.h -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ============================================================================ - -#ifndef SENDER_QOS_EVENT_HANDLER_H -#define SENDER_QOS_EVENT_HANDLER_H - -#include "ace/Event_Handler.h" -#include "ace/Reactor.h" -#include "ace/INET_Addr.h" -#include "ace/QoS/SOCK_Dgram_Mcast_QoS.h" -#include "ace/QoS/QoS_Session.h" - -//#define MY_DEFPORT 5001 -//#define DEFAULT_MULTICASTGROUP "234.5.6.7" - -ACE_RCSID(Sender_QoS_Event_Handler, Sender_QoS_Event_Handler, "$Id$") - -class Sender_QoS_Event_Handler : public ACE_Event_Handler -{ -public: - // = Initialization and Termination methods. - Sender_QoS_Event_Handler (void); - // Constructor. - - Sender_QoS_Event_Handler (const ACE_SOCK_Dgram_Mcast_QoS &dgram_mcast_qos, - ACE_QoS_Session *qos_session); - // Constructor. - - ~Sender_QoS_Event_Handler (void); - // Destructor. - - virtual ACE_HANDLE get_handle (void) const; - // Override this to return the handle of the Dgram_Mcast - // that we are using. - - virtual int handle_qos (ACE_HANDLE fd); - // Handles a QoS event. Right now, just - // prints a message. - -private: - - ACE_SOCK_Dgram_Mcast_QoS dgram_mcast_qos_; - ACE_QoS_Session *qos_session_; -}; - -#endif /* SENDER_QOS_EVENT_HANDLER_H */ diff --git a/ACE/examples/QOS/Simple/receiver.cpp b/ACE/examples/QOS/Simple/receiver.cpp deleted file mode 100644 index 72381d64f69..00000000000 --- a/ACE/examples/QOS/Simple/receiver.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// server.cpp -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ============================================================================ - -#define QOSEVENT_MAIN - -#include "ace/QoS/QoS_Session.h" -#include "ace/QoS/QoS_Session_Factory.h" -#include "ace/QoS/QoS_Decorator.h" -#include "ace/QoS/SOCK_Dgram_Mcast_QoS.h" - -#include "QoS_Util.h" -#include "Fill_ACE_QoS.h" -#include "QoS_Signal_Handler.h" -#include "Receiver_QoS_Event_Handler.h" - -// To open QOS sockets administrative access is required on the -// machine. Fill in default values for QoS structure. The default -// values were simply choosen from existing QOS templates available -// via WSAGetQosByName. Notice that ProviderSpecific settings are -// being allowed when picking the "default" template but not for -// "well-known" QOS templates. Also notice that since data is only -// flowing from sender to receiver, different flowspecs are filled in -// depending upon whether this application is acting as a sender or -// receiver. - - -// This function fills up the ACE_QoS_Params with the supplied iovec -// and ACE_QoS. - -int -FillQoSParams (ACE_QoS_Params &qos_params, - iovec* iov, - ACE_QoS* qos) -{ - qos_params.callee_data (iov); - qos_params.caller_data (0); - qos_params.socket_qos (qos); - qos_params.group_socket_qos (0); - qos_params.flags (ACE_JL_BOTH); - - return 0; -} - -int -ACE_TMAIN (int argc, ACE_TCHAR * argv[]) -{ - - QoS_Util qos_util(argc, argv); - - if (qos_util.parse_args () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in parsing args\n"), - -1); - - // This is a multicast application. - if (qos_util.multicast_flag ()) - { - Fill_ACE_QoS fill_ace_qos; - - // The application adds the flow specs that it wants into the - // Fill_ACE_QoS. The Fill_ACE_QoS indexes the flow specs by the - // flow spec names. Here the new flowspec being added is g_711. - ACE_CString g_711 ("g_711"); - - switch (fill_ace_qos.map ().bind (g_711, - new ACE_Flow_Spec (9200, - 708, - 18400, - 0, - 0, - ACE_SERVICETYPE_CONTROLLEDLOAD, - 368, - 368, - 25, - 1))) - { - case 1 : - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to bind the new flow spec\n" - "The Flow Spec name already exists\n"), - -1); - break; - case -1 : - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to bind the new flow spec\n"), - -1); - break; - } - - ACE_DEBUG ((LM_DEBUG, - "g_711 Flow Spec bound successfully\n")); - - // This is a receiver. So we fill in the receiving QoS parameters. - ACE_QoS ace_qos_receiver; - if (fill_ace_qos.fill_simplex_receiver_qos (ace_qos_receiver, - g_711) !=0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to fill simplex receiver qos\n"), - -1); - else - ACE_DEBUG ((LM_DEBUG, - "Filled up the Receiver QoS parameters\n")); - - // Opening a new Multicast Datagram. - ACE_SOCK_Dgram_Mcast_QoS dgram_mcast_qos; - - // Multicast Session Address specified by user at command line. - // If this address is not specified, - // <localhost:ACE_DEFAULT_MULTICAST_PORT> is assumed. - ACE_INET_Addr mult_addr (*(qos_util.mult_session_addr ())); - - // Fill the ACE_QoS_Params to be passed to the <ACE_OS::join_leaf> - // through subscribe. - - ACE_QoS_Params qos_params; - FillQoSParams (qos_params, 0, &ace_qos_receiver); - - // 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 (); - - // 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); - else - ACE_DEBUG ((LM_DEBUG, - "QoS session opened successfully\n")); - - // The following call opens the Dgram_Mcast and calls the - // <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_qos.subscribe (mult_addr, - qos_params, - 1, - 0, - AF_INET, - // ACE_FROM_PROTOCOL_INFO, - 0, - 0, // ACE_Protocol_Info, - 0, - ACE_OVERLAPPED_SOCKET_FLAG - | ACE_FLAG_MULTIPOINT_C_LEAF - | ACE_FLAG_MULTIPOINT_D_LEAF, - qos_session) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in subscribe\n"), - -1); - else - ACE_DEBUG ((LM_DEBUG, - "Dgram_Mcast subscribe succeeds \n")); - - int nIP_TTL = 25; - 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_qos.get_handle (), // Socket. - ACE_SIO_MULTICAST_SCOPE, // IO control code. - &nIP_TTL, // In buffer. - sizeof (nIP_TTL), // Length of in buffer. - achInBuf, // Out buffer. - BUFSIZ, // Length of Out buffer. - &dwBytes, // bytes returned. - 0, // Overlapped. - 0) == -1) // Func. - ACE_ERROR ((LM_ERROR, - "Error in Multicast scope ACE_OS::ioctl() \n")); - else - ACE_DEBUG ((LM_DEBUG, - "Setting TTL with Multicast scope ACE_OS::ioctl call succeeds \n")); - - int bFlag = 0; - - // Should this be abstracted into QoS objects ?? Doesnt seem to have - // to do anything directly with QoS. - if (ACE_OS::ioctl (dgram_mcast_qos.get_handle (), // Socket. - ACE_SIO_MULTIPOINT_LOOPBACK, // IO control code. - &bFlag, // In buffer. - sizeof (bFlag), // Length of in buffer. - achInBuf, // Out buffer. - BUFSIZ, // Length of Out buffer. - &dwBytes, // bytes returned. - 0, // Overlapped. - 0) == -1) // Func. - ACE_ERROR ((LM_ERROR, - "Error in Loopback ACE_OS::ioctl() \n")); - else - ACE_DEBUG ((LM_DEBUG, - "Disable Loopback with ACE_OS::ioctl call succeeds \n")); - - // This is a receiver. - qos_session->flags (ACE_QoS_Session::ACE_QOS_RECEIVER); - - ACE_QoS_Manager qos_manager = dgram_mcast_qos.qos_manager (); - - // Set the QoS for the session. Replaces the ioctl () call that - // was being made previously. - if (qos_session->qos (&dgram_mcast_qos, - &qos_manager, - ace_qos_receiver) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to set QoS\n"), - -1); - else - ACE_DEBUG ((LM_DEBUG, - "Setting QOS succeeds.\n")); - - // Register a signal handler that helps to gracefully close the - // open QoS sessions. - QoS_Signal_Handler qos_signal_handler (qos_session); - - // Register the usual SIGINT signal handler with the Reactor for - // the application to gracefully release the QoS session and - // shutdown. - if (ACE_Reactor::instance ()->register_handler - (SIGINT, &qos_signal_handler) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in registering the Signal Handler.\n"), - -1); - - // Handler to process QoS and Data events for the reciever. - Receiver_QoS_Event_Handler qos_event_handler (dgram_mcast_qos, - qos_session); - - // Decorate the above handler with QoS functionality. - ACE_QoS_Decorator qos_decorator (&qos_event_handler, - qos_session); - - // Initialize the Decorator. - if (qos_decorator.init () != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "QoS Decorator init () failed.\n"), - -1); - - // Register the decorated Event Handler with the Reactor. - if (ACE_Reactor::instance ()->register_handler (&qos_decorator, - ACE_Event_Handler::QOS_MASK | - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in registering the Decorator with the Reactor\n"), - -1); - - - // Start the event loop. - ACE_DEBUG ((LM_DEBUG, - "Running the Event Loop ... \n")); - - ACE_Reactor::instance ()->run_event_loop (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) shutting down server logging daemon\n")); - } - else - ACE_DEBUG ((LM_DEBUG, - "Specify a -m option for multicast application\n")); - return 0; -} - - - diff --git a/ACE/examples/QOS/Simple/sender.cpp b/ACE/examples/QOS/Simple/sender.cpp deleted file mode 100644 index 97e6aafa407..00000000000 --- a/ACE/examples/QOS/Simple/sender.cpp +++ /dev/null @@ -1,315 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE_wrappers/examples/QOS -// -// = FILENAME -// client.cpp -// -// = AUTHOR -// Vishal Kachroo <vishal@cs.wustl.edu> -// -// ============================================================================ - - -#include "ace/QoS/QoS_Session.h" -#include "ace/QoS/QoS_Session_Factory.h" -#include "ace/QoS/QoS_Session_Impl.h" -#include "ace/QoS/QoS_Decorator.h" -#include "ace/QoS/SOCK_Dgram_Mcast_QoS.h" - -#include "QoS_Util.h" -#include "Fill_ACE_QoS.h" -#include "QoS_Signal_Handler.h" -#include "Sender_QoS_Event_Handler.h" - -// To open QOS sockets administrative access is required on the -// machine. Fill in default values for QoS structure. The default -// values were simply choosen from existing QOS templates available -// via WSAGetQosByName. Notice that ProviderSpecific settings are -// being allowed when picking the "default" template but not for -// "well-known" QOS templates. Also notice that since data is only -// flowing from sender to receiver, different flowspecs are filled in -// depending upon whether this application is acting as a sender or -// receiver. - -// This function fills up the ACE_QoS_Params with the supplied iovec and ACE_QoS. - -int -FillQoSParams (ACE_QoS_Params &qos_params, - iovec* iov, - ACE_QoS* qos) -{ - qos_params.callee_data (iov); - qos_params.caller_data (0); - qos_params.socket_qos (qos); - qos_params.group_socket_qos (0); - qos_params.flags (ACE_JL_BOTH); - - return 0; -} - -int -ACE_TMAIN (int argc, ACE_TCHAR * argv[]) -{ - - ACE_DEBUG ((LM_DEBUG, - "Sender\n")); - - QoS_Util qos_util(argc, argv); - - if (qos_util.parse_args () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in parsing args\n"), - -1); - - // This is a multicast application. - if (qos_util.multicast_flag ()) - { - Fill_ACE_QoS fill_ace_qos; - - // The application adds the flow specs that it wants into the - // Fill_ACE_QoS. The Fill_ACE_QoS indexes the flow specs by the flow - // spec names. Here the new flowspec being added is g_711. - ACE_CString g_711 ("g_711"); - - switch (fill_ace_qos.map ().bind (g_711, - new ACE_Flow_Spec (9200, - 708, - 18400, - 0, - 0, - ACE_SERVICETYPE_CONTROLLEDLOAD, - 368, - 368, - 25, - 1))) - { - case 1 : - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to bind the new flow spec\n" - "The Flow Spec name already exists\n"), - -1); - break; - case -1 : - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to bind the new flow spec\n"), - -1); - break; - } - - ACE_DEBUG ((LM_DEBUG, - "g_711 Flow Spec bound successfully\n")); - - // This is a sender. So we fill in the sending QoS parameters. - ACE_QoS ace_qos_sender; - - if (fill_ace_qos.fill_simplex_sender_qos (ace_qos_sender, - g_711) !=0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to fill simplex sender qos\n"), - -1); - else - ACE_DEBUG ((LM_DEBUG, - "Filled up the Sender QoS parameters\n")); - - // Opening a new Multicast Datagram. It is absolutely necessary that - // the sender and the receiver subscribe to the same multicast - // addresses to make sure the "multicast sessions" for the two are - // the same. This is used to match the RESV<->PATH states. - ACE_SOCK_Dgram_Mcast_QoS dgram_mcast_qos; - - // Multicast Session Address specified by user at command line. - // If this address is not specified, - // <localhost:ACE_DEFAULT_MULTICAST_PORT> is assumed. - ACE_INET_Addr mult_addr (*(qos_util.mult_session_addr ())); - - // Fill the ACE_QoS_Params to be passed to the <ACE_OS::join_leaf> - // through subscribe. - - ACE_QoS_Params qos_params; - FillQoSParams (qos_params, 0, &ace_qos_sender); - - // Create a QoS Session Factory. - ACE_QoS_Session_Factory session_factory; - - // Ask the factory to create a QoS session. - ACE_QoS_Session *qos_session = - session_factory.create_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); - else - ACE_DEBUG ((LM_DEBUG, - "QoS session opened successfully\n")); - - // The following call opens the Dgram_Mcast and calls the - // <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_qos.subscribe (mult_addr, - qos_params, - 1, - 0, - AF_INET, - // ACE_FROM_PROTOCOL_INFO, - 0, - 0, // ACE_Protocol_Info, - 0, - ACE_OVERLAPPED_SOCKET_FLAG - | ACE_FLAG_MULTIPOINT_C_LEAF - | ACE_FLAG_MULTIPOINT_D_LEAF, - qos_session) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in subscribe\n"), - -1); - else - ACE_DEBUG ((LM_DEBUG, - "Dgram_Mcast subscribe succeeds \n")); - - int nIP_TTL = 25; - 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_qos.get_handle (), // Socket. - ACE_SIO_MULTICAST_SCOPE, // IO control code. - &nIP_TTL, // In buffer. - sizeof (nIP_TTL), // Length of in buffer. - achInBuf, // Out buffer. - BUFSIZ, // Length of Out buffer. - &dwBytes, // bytes returned. - 0, // Overlapped. - 0) == -1) // Func. - ACE_ERROR ((LM_ERROR, - "Error in Multicast scope ACE_OS::ioctl() \n")); - else - ACE_DEBUG ((LM_DEBUG, - "Setting TTL with Multicast scope ACE_OS::ioctl call succeeds \n")); - - int bFlag = 0; - - // Should this be abstracted into QoS objects ?? Doesnt seem to have - // to do anything directly with QoS. - if (ACE_OS::ioctl (dgram_mcast_qos.get_handle (), // Socket. - ACE_SIO_MULTIPOINT_LOOPBACK, // IO control code. - &bFlag, // In buffer. - sizeof (bFlag), // Length of in buffer. - achInBuf, // Out buffer. - BUFSIZ, // Length of Out buffer. - &dwBytes, // bytes returned. - 0, // Overlapped. - 0) == -1) // Func. - ACE_ERROR ((LM_ERROR, - "Error in Loopback ACE_OS::ioctl() \n")); - else - ACE_DEBUG ((LM_DEBUG, - "Disable Loopback with ACE_OS::ioctl call succeeds \n")); - - // This is a sender. - qos_session->flags (ACE_QoS_Session::ACE_QOS_SENDER); - - ACE_QoS_Manager qos_manager = dgram_mcast_qos.qos_manager (); - - // Since we are using RSVP, it is imperative that the client - // application have the option of supplying the source sender - // port for the RSVP messages. A default will be chosen by the - // ACE API if this is not done. - qos_session->source_port (qos_util.source_port ()); - - // Set the QoS for the session. Replaces the ioctl () call that - // was being made previously. - if (qos_session->qos (&dgram_mcast_qos, - &qos_manager, - ace_qos_sender) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to set QoS\n"), - -1); - else - ACE_DEBUG ((LM_DEBUG, - "Setting QOS succeeds.\n")); - - // Register a signal handler that helps to gracefully close the open - // QoS sessions. - QoS_Signal_Handler qos_signal_handler (qos_session); - - // Register the usual SIGINT signal handler with the Reactor for - // the application to gracefully release the QoS session and - // shutdown. - if (ACE_Reactor::instance ()->register_handler - (SIGINT, &qos_signal_handler) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in registering the Signal Handler.\n"), - -1); - - // Handler to process QoS and Data events for the reciever. - Sender_QoS_Event_Handler qos_event_handler (dgram_mcast_qos, - qos_session); - - // Decorate the above handler with QoS functionality. - ACE_QoS_Decorator qos_decorator (&qos_event_handler, - qos_session); - - // Initialize the Decorator. - if (qos_decorator.init () != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "QoS Decorator init () failed.\n"), - -1); - - // Register the decorated Event Handler with the Reactor. - if (ACE_Reactor::instance ()->register_handler (&qos_decorator, - ACE_Event_Handler::QOS_MASK | - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error in registering the Decorator with the Reactor\n"), - -1); - - - - // Start the event loop. - ACE_DEBUG ((LM_DEBUG, - "Running the Event Loop ... \n")); - - ACE_Reactor::instance ()->run_event_loop (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) shutting down server logging daemon\n")); - } - else - ACE_DEBUG ((LM_DEBUG, - "Specify a -m option for multicast application\n")); - return 0; -} - - - - - - - |