summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-10 05:35:47 +0000
committeryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-10 05:35:47 +0000
commit598e653dd09e76b74ac29dea8fe421ed05d2d85b (patch)
tree92a245a737a19e76726f4de1c787b6e2d31f320d
parentc42126c408c9becd51b42914614b3c8253ae11b6 (diff)
downloadATCD-598e653dd09e76b74ac29dea8fe421ed05d2d85b.tar.gz
*** empty log message ***
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/Fill_ACE_QoS.cpp114
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/Fill_ACE_QoS.h75
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/FlowSpec_Dbase.h52
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/Makefile355
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/QoS_Signal_Handler.cpp34
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/QoS_Signal_Handler.h45
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/QoS_Util.cpp121
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/QoS_Util.h75
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/README127
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/Receiver_QoS_Event_Handler.h61
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/Sender_QoS_Event_Handler.h61
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/receiver.cpp325
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/receiver.dsp138
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/sender.cpp333
-rw-r--r--examples/QOS/Change_Receiver_FlowSpec/sender.dsp138
-rw-r--r--examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.cpp114
-rw-r--r--examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.h75
-rw-r--r--examples/QOS/Change_Sender_TSpec/FlowSpec_Dbase.h52
-rw-r--r--examples/QOS/Change_Sender_TSpec/Makefile355
-rw-r--r--examples/QOS/Change_Sender_TSpec/QoS_Signal_Handler.cpp34
-rw-r--r--examples/QOS/Change_Sender_TSpec/QoS_Signal_Handler.h45
-rw-r--r--examples/QOS/Change_Sender_TSpec/QoS_Util.cpp121
-rw-r--r--examples/QOS/Change_Sender_TSpec/QoS_Util.h75
-rw-r--r--examples/QOS/Change_Sender_TSpec/README126
-rw-r--r--examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.cpp145
-rw-r--r--examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.h61
-rw-r--r--examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.cpp222
-rw-r--r--examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.h61
-rw-r--r--examples/QOS/Change_Sender_TSpec/receiver.cpp325
-rw-r--r--examples/QOS/Change_Sender_TSpec/receiver.dsp138
-rw-r--r--examples/QOS/Change_Sender_TSpec/sender.cpp333
-rw-r--r--examples/QOS/Change_Sender_TSpec/sender.dsp138
-rw-r--r--examples/QOS/Makefile43
-rw-r--r--examples/QOS/QOS.dsw76
-rw-r--r--examples/QOS/Simple/Fill_ACE_QoS.cpp114
-rw-r--r--examples/QOS/Simple/Fill_ACE_QoS.h75
-rw-r--r--examples/QOS/Simple/FlowSpec_Dbase.h52
-rw-r--r--examples/QOS/Simple/Makefile355
-rw-r--r--examples/QOS/Simple/QoS_Signal_Handler.cpp40
-rw-r--r--examples/QOS/Simple/QoS_Signal_Handler.h45
-rw-r--r--examples/QOS/Simple/QoS_Util.cpp121
-rw-r--r--examples/QOS/Simple/QoS_Util.h75
-rw-r--r--examples/QOS/Simple/README142
-rw-r--r--examples/QOS/Simple/Receiver_QoS_Event_Handler.cpp136
-rw-r--r--examples/QOS/Simple/Receiver_QoS_Event_Handler.h61
-rw-r--r--examples/QOS/Simple/Sender_QoS_Event_Handler.cpp143
-rw-r--r--examples/QOS/Simple/Sender_QoS_Event_Handler.h61
-rw-r--r--examples/QOS/Simple/receiver.cpp325
-rw-r--r--examples/QOS/Simple/receiver.dsp138
-rw-r--r--examples/QOS/Simple/sender.cpp333
-rw-r--r--examples/QOS/Simple/sender.dsp138
51 files changed, 6910 insertions, 37 deletions
diff --git a/examples/QOS/Change_Receiver_FlowSpec/Fill_ACE_QoS.cpp b/examples/QOS/Change_Receiver_FlowSpec/Fill_ACE_QoS.cpp
new file mode 100644
index 00000000000..655e48cc742
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/Fill_ACE_QoS.cpp
@@ -0,0 +1,114 @@
+// 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_;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Hash_Map_Manager<ACE_CString,ACE_Flow_Spec *,ACE_Null_Mutex>;
+template class ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Entry<ACE_CString, ACE_Flow_Spec *>;
+template class ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Hash_Map_Manager<ACE_CString,ACE_Flow_Spec *,ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, ACE_Flow_Spec *>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/QOS/Change_Receiver_FlowSpec/Fill_ACE_QoS.h b/examples/QOS/Change_Receiver_FlowSpec/Fill_ACE_QoS.h
new file mode 100644
index 00000000000..9c48633d47f
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/Fill_ACE_QoS.h
@@ -0,0 +1,75 @@
+/* -*- 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/Synch.h"
+#include "ace/ACE.h"
+#include "ace/OS.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/examples/QOS/Change_Receiver_FlowSpec/FlowSpec_Dbase.h b/examples/QOS/Change_Receiver_FlowSpec/FlowSpec_Dbase.h
new file mode 100644
index 00000000000..fc382048c13
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/FlowSpec_Dbase.h
@@ -0,0 +1,52 @@
+/* -*- 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/examples/QOS/Change_Receiver_FlowSpec/Makefile b/examples/QOS/Change_Receiver_FlowSpec/Makefile
new file mode 100644
index 00000000000..a942852fd0e
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/Makefile
@@ -0,0 +1,355 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+LDLIBS += -lACE_QoS
+
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+PSRC = $(addsuffix .cpp,$(BIN))
+
+CLT_OBJS = \
+ QoS_Signal_Handler.o \
+ QoS_Util.o \
+ Fill_ACE_QoS.o \
+ sender.o \
+ Sender_QoS_Event_Handler.o
+
+SVR_OBJS = \
+ QoS_Signal_Handler.o \
+ QoS_Util.o \
+ Fill_ACE_QoS.o \
+ receiver.o \
+ Receiver_QoS_Event_Handler.o
+
+BIN2 = receiver \
+ sender
+
+BIN = $(BIN2)
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+receiver: $(addprefix $(VDIR),$(SVR_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+sender: $(addprefix $(VDIR),$(CLT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+
+.obj/receiver.o .obj/receiver.so .shobj/receiver.o .shobj/receiver.so: receiver.cpp \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/pre.h \
+ $(ACE_ROOT)/ace/post.h \
+ $(ACE_ROOT)/ace/ACE_export.h \
+ $(ACE_ROOT)/ace/svc_export.h \
+ $(ACE_ROOT)/ace/ace_wchar.h \
+ $(ACE_ROOT)/ace/ace_wchar.inl \
+ $(ACE_ROOT)/ace/OS_Errno.h \
+ $(ACE_ROOT)/ace/OS_Export.h \
+ $(ACE_ROOT)/ace/OS_Errno.inl \
+ $(ACE_ROOT)/ace/OS_Dirent.h \
+ $(ACE_ROOT)/ace/OS_Dirent.inl \
+ $(ACE_ROOT)/ace/OS_String.h \
+ $(ACE_ROOT)/ace/OS_String.inl \
+ $(ACE_ROOT)/ace/OS_Memory.h \
+ $(ACE_ROOT)/ace/OS_Memory.inl \
+ $(ACE_ROOT)/ace/OS_TLI.h \
+ $(ACE_ROOT)/ace/OS_TLI.inl \
+ $(ACE_ROOT)/ace/Min_Max.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session.h \
+ $(ACE_ROOT)/ace/QoS/ACE_QoS_Export.h \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Flag_Manip.h \
+ $(ACE_ROOT)/ace/Flag_Manip.i \
+ $(ACE_ROOT)/ace/Handle_Ops.h \
+ $(ACE_ROOT)/ace/Handle_Ops.i \
+ $(ACE_ROOT)/ace/Lib_Find.h \
+ $(ACE_ROOT)/ace/Lib_Find.i \
+ $(ACE_ROOT)/ace/Init_ACE.h \
+ $(ACE_ROOT)/ace/Init_ACE.i \
+ $(ACE_ROOT)/ace/Sock_Connect.h \
+ $(ACE_ROOT)/ace/Sock_Connect.i \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Factory.h \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Node.h \
+ $(ACE_ROOT)/ace/Node.cpp \
+ $(ACE_ROOT)/ace/Array_Base.h \
+ $(ACE_ROOT)/ace/Array_Base.inl \
+ $(ACE_ROOT)/ace/Array_Base.cpp \
+ $(ACE_ROOT)/ace/Unbounded_Set.h \
+ $(ACE_ROOT)/ace/Unbounded_Set.inl \
+ $(ACE_ROOT)/ace/Unbounded_Set.cpp \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.h \
+ $(ACE_ROOT)/ace/Unbounded_Queue.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.cpp \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/QoS/QoS_Decorator.h \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Test_and_Set.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Test_and_Set.i \
+ $(ACE_ROOT)/ace/Test_and_Set.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Manager.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.i \
+ QoS_Util.h Fill_ACE_QoS.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Functor.h \
+ $(ACE_ROOT)/ace/Functor.i \
+ $(ACE_ROOT)/ace/Functor_T.h \
+ $(ACE_ROOT)/ace/Functor_T.i \
+ $(ACE_ROOT)/ace/Functor_T.cpp \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ QoS_Signal_Handler.h Receiver_QoS_Event_Handler.h
+
+.obj/sender.o .obj/sender.so .shobj/sender.o .shobj/sender.so: sender.cpp \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/pre.h \
+ $(ACE_ROOT)/ace/post.h \
+ $(ACE_ROOT)/ace/ACE_export.h \
+ $(ACE_ROOT)/ace/svc_export.h \
+ $(ACE_ROOT)/ace/ace_wchar.h \
+ $(ACE_ROOT)/ace/ace_wchar.inl \
+ $(ACE_ROOT)/ace/OS_Errno.h \
+ $(ACE_ROOT)/ace/OS_Export.h \
+ $(ACE_ROOT)/ace/OS_Errno.inl \
+ $(ACE_ROOT)/ace/OS_Dirent.h \
+ $(ACE_ROOT)/ace/OS_Dirent.inl \
+ $(ACE_ROOT)/ace/OS_String.h \
+ $(ACE_ROOT)/ace/OS_String.inl \
+ $(ACE_ROOT)/ace/OS_Memory.h \
+ $(ACE_ROOT)/ace/OS_Memory.inl \
+ $(ACE_ROOT)/ace/OS_TLI.h \
+ $(ACE_ROOT)/ace/OS_TLI.inl \
+ $(ACE_ROOT)/ace/Min_Max.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session.h \
+ $(ACE_ROOT)/ace/QoS/ACE_QoS_Export.h \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Flag_Manip.h \
+ $(ACE_ROOT)/ace/Flag_Manip.i \
+ $(ACE_ROOT)/ace/Handle_Ops.h \
+ $(ACE_ROOT)/ace/Handle_Ops.i \
+ $(ACE_ROOT)/ace/Lib_Find.h \
+ $(ACE_ROOT)/ace/Lib_Find.i \
+ $(ACE_ROOT)/ace/Init_ACE.h \
+ $(ACE_ROOT)/ace/Init_ACE.i \
+ $(ACE_ROOT)/ace/Sock_Connect.h \
+ $(ACE_ROOT)/ace/Sock_Connect.i \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Factory.h \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Node.h \
+ $(ACE_ROOT)/ace/Node.cpp \
+ $(ACE_ROOT)/ace/Array_Base.h \
+ $(ACE_ROOT)/ace/Array_Base.inl \
+ $(ACE_ROOT)/ace/Array_Base.cpp \
+ $(ACE_ROOT)/ace/Unbounded_Set.h \
+ $(ACE_ROOT)/ace/Unbounded_Set.inl \
+ $(ACE_ROOT)/ace/Unbounded_Set.cpp \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.h \
+ $(ACE_ROOT)/ace/Unbounded_Queue.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.cpp \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Impl.h \
+ \
+ \
+ \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Impl.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Decorator.h \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Test_and_Set.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Test_and_Set.i \
+ $(ACE_ROOT)/ace/Test_and_Set.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Manager.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.i \
+ QoS_Util.h Fill_ACE_QoS.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Functor.h \
+ $(ACE_ROOT)/ace/Functor.i \
+ $(ACE_ROOT)/ace/Functor_T.h \
+ $(ACE_ROOT)/ace/Functor_T.i \
+ $(ACE_ROOT)/ace/Functor_T.cpp \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ QoS_Signal_Handler.h Sender_QoS_Event_Handler.h
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/examples/QOS/Change_Receiver_FlowSpec/QoS_Signal_Handler.cpp b/examples/QOS/Change_Receiver_FlowSpec/QoS_Signal_Handler.cpp
new file mode 100644
index 00000000000..9f07ad5b378
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/QoS_Signal_Handler.cpp
@@ -0,0 +1,34 @@
+// 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*)
+{
+ if (signum == SIGINT)
+ {
+ 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/examples/QOS/Change_Receiver_FlowSpec/QoS_Signal_Handler.h b/examples/QOS/Change_Receiver_FlowSpec/QoS_Signal_Handler.h
new file mode 100644
index 00000000000..35b9f3a19e7
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/QoS_Signal_Handler.h
@@ -0,0 +1,45 @@
+/* -*- 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/examples/QOS/Change_Receiver_FlowSpec/QoS_Util.cpp b/examples/QOS/Change_Receiver_FlowSpec/QoS_Util.cpp
new file mode 100644
index 00000000000..d75e9343ba6
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/QoS_Util.cpp
@@ -0,0 +1,121 @@
+// QoS_Session_Impl.cpp
+// $Id$
+
+#define SENDER_PORT 10001
+
+#include "ace/Log_Msg.h"
+#include "ace/Get_Opt.h"
+#include "QoS_Util.h"
+
+ACE_RCSID(QOS, QoS_Util,"$Id$")
+
+// constructor.
+QoS_Util::QoS_Util (int argc,
+ char *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_, "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.optarg);
+ break;
+ case 'n': // to be used by Senders only to specify the destination.
+ this->dest_addr_->set (get_opts.optarg);
+ break;
+ case 'p': // protocol.
+ if (ACE_OS::strcasecmp (get_opts.optarg, "tcp") == 0)
+ this->protocol_ = IPPROTO_TCP;
+ else
+ if (ACE_OS::strcasecmp (get_opts.optarg, "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.optarg);
+ 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/examples/QOS/Change_Receiver_FlowSpec/QoS_Util.h b/examples/QOS/Change_Receiver_FlowSpec/QoS_Util.h
new file mode 100644
index 00000000000..6de6e2d24d3
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/QoS_Util.h
@@ -0,0 +1,75 @@
+/* -*- 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, char *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_;
+ char **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/examples/QOS/Change_Receiver_FlowSpec/README b/examples/QOS/Change_Receiver_FlowSpec/README
new file mode 100644
index 00000000000..58320ef8def
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/README
@@ -0,0 +1,127 @@
+$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.
+
+In addition it dynamically changes the receiver flow spec which in
+turn changes the RESV messages sent.
+
+
+------------------------------------------------------------------------
+WIN2K :
+
+Build Requirements :
+--------------------
+1. Two Win2K machines.
+2. June98 Platform SDK or later.
+3. Link with ws2_32.lib
+
+The test consists of a server (which is the receiver) and a client
+ (which is the sender).
+
+ The receiver is started first (though it is not mandatory) as :
+
+ server -m merengue.cs.wustl.edu:9091
+
+ -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 :
+
+ client -m merengue.cs.wustl.edu:9091 -P 10004
+
+ -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 be the
+following :
+
+include /project/doc/vishal/ACE_wrappers/include/makeinclude/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 static_libs_only=1
+
+ Static library option is used because the RAPI library that we have
+ does not compile as a shared object.
+
+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 :
+
+ sender merengue/5000 [ t 2000000 100000 2000000 512 1024 ]
+ reserve wf [ cl 4000000 200000 4000000 256 2024 ]
+
+
+
+ From ACE:
+ dest udp macarena/5000
+ sender ace/5000 [ t 2000000 100000 2000000 512 1024 ]
+ sender macarena/5022 [ t 2000000 100000 2000000 512 1024 ]
+ sender beguine/6000 [ t 2000000 100000 2000000 512 1024 ]
+
+ From Macarena:
+ wait until done with ACE
+ dest udp macarena/5000 <session name>
+ 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.
+
+-------------------------------------------------------------------------------
+
+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/examples/QOS/Change_Receiver_FlowSpec/Receiver_QoS_Event_Handler.h b/examples/QOS/Change_Receiver_FlowSpec/Receiver_QoS_Event_Handler.h
new file mode 100644
index 00000000000..874d628e3c1
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/Receiver_QoS_Event_Handler.h
@@ -0,0 +1,61 @@
+/* -*- 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::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/examples/QOS/Change_Receiver_FlowSpec/Sender_QoS_Event_Handler.h b/examples/QOS/Change_Receiver_FlowSpec/Sender_QoS_Event_Handler.h
new file mode 100644
index 00000000000..b691bbd0615
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/Sender_QoS_Event_Handler.h
@@ -0,0 +1,61 @@
+/* -*- 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::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/examples/QOS/Change_Receiver_FlowSpec/receiver.cpp b/examples/QOS/Change_Receiver_FlowSpec/receiver.cpp
new file mode 100644
index 00000000000..254fe51b4a7
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/receiver.cpp
@@ -0,0 +1,325 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ACE_wrappers/examples/QOS
+//
+// = FILENAME
+// server.cpp
+//
+// = AUTHOR
+// Vishal Kachroo <vishal@cs.wustl.edu>
+//
+// ============================================================================
+
+#define QOSEVENT_MAIN
+
+#include "ace/OS.h"
+#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
+main (int argc, char * 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 (ACE_QoS_Session_Factory::ACE_RAPI_SESSION);
+ // XX Shouldn't have to specify GQOS or RAPI?!? XX it is not
+ // clear that we need to pass in a key indicating the type XX of
+ // object to create. Since we use RAPI flag at compile time can
+ // XX we assume rapi here also? Or could we have RAPI and GQoS?
+
+ // 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);
+
+// // Register the RAPI Event Handler with the Reactor. This
+// // handles the QoS events.
+// if (ACE_Reactor::instance ()->register_handler
+// (&rapi_event_handler,
+// ACE_Event_Handler::QOS_MASK | ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering the RAPI Event Handler\n"),
+// -1);
+
+// // The following event handler handles the data.
+// ACE_QoS_Event_Handler data_event_handler (dgram_mcast_qos,
+// qos_session);
+
+// // Register the Data Event Handler with the Reactor.
+// if (ACE_Reactor::instance ()->register_handler
+// (&data_event_handler,ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering Data Event Handler\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/examples/QOS/Change_Receiver_FlowSpec/receiver.dsp b/examples/QOS/Change_Receiver_FlowSpec/receiver.dsp
new file mode 100644
index 00000000000..217e7daa619
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/receiver.dsp
@@ -0,0 +1,138 @@
+# Microsoft Developer Studio Project File - Name="002" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=002 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "receiver.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "receiver.mak" CFG="002 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "002 - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "002 - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "002 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ACE_QoS.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ELSEIF "$(CFG)" == "002 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Od /I "..\..\\" /D "WIN32" /D "_DEBUG" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACE_QoSd.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "002 - Win32 Release"
+# Name "002 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Receiver_QoS_Event_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\receiver.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FlowSpec_Dbase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Receiver_QOS_Event_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/examples/QOS/Change_Receiver_FlowSpec/sender.cpp b/examples/QOS/Change_Receiver_FlowSpec/sender.cpp
new file mode 100644
index 00000000000..576479b4889
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/sender.cpp
@@ -0,0 +1,333 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ACE_wrappers/examples/QOS
+//
+// = FILENAME
+// client.cpp
+//
+// = AUTHOR
+// Vishal Kachroo <vishal@cs.wustl.edu>
+//
+// ============================================================================
+
+
+#include "ace/OS.h"
+#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
+main (int argc, char * 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. 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_RAPI_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);
+
+
+
+// // 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,
+// qos_session);
+
+// ACE_RAPI_Event_Handler rapi_event_handler (qos_session);
+
+// // Register the RAPI Event Handler with the Reactor. This
+// // handles the QoS events.
+// if (ACE_Reactor::instance ()->register_handler
+// (&rapi_event_handler,
+// ACE_Event_Handler::QOS_MASK | ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering the RAPI Event Handler\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/examples/QOS/Change_Receiver_FlowSpec/sender.dsp b/examples/QOS/Change_Receiver_FlowSpec/sender.dsp
new file mode 100644
index 00000000000..475922b7fd7
--- /dev/null
+++ b/examples/QOS/Change_Receiver_FlowSpec/sender.dsp
@@ -0,0 +1,138 @@
+# Microsoft Developer Studio Project File - Name="003" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=003 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "sender.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "sender.mak" CFG="003 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "003 - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "003 - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "003 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ws2_32.lib ACE_QoS.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ELSEIF "$(CFG)" == "003 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Od /I "..\..\\" /D "WIN32" /D "_DEBUG" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACE_QoSd.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "003 - Win32 Release"
+# Name "003 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\sender.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Sender_QoS_Event_Handler.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FlowSpec_Dbase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Sender_QOS_Event_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.cpp b/examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.cpp
new file mode 100644
index 00000000000..655e48cc742
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.cpp
@@ -0,0 +1,114 @@
+// 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_;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Hash_Map_Manager<ACE_CString,ACE_Flow_Spec *,ACE_Null_Mutex>;
+template class ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Entry<ACE_CString, ACE_Flow_Spec *>;
+template class ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Hash_Map_Manager<ACE_CString,ACE_Flow_Spec *,ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, ACE_Flow_Spec *>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.h b/examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.h
new file mode 100644
index 00000000000..9c48633d47f
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/Fill_ACE_QoS.h
@@ -0,0 +1,75 @@
+/* -*- 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/Synch.h"
+#include "ace/ACE.h"
+#include "ace/OS.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/examples/QOS/Change_Sender_TSpec/FlowSpec_Dbase.h b/examples/QOS/Change_Sender_TSpec/FlowSpec_Dbase.h
new file mode 100644
index 00000000000..fc382048c13
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/FlowSpec_Dbase.h
@@ -0,0 +1,52 @@
+/* -*- 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/examples/QOS/Change_Sender_TSpec/Makefile b/examples/QOS/Change_Sender_TSpec/Makefile
new file mode 100644
index 00000000000..a942852fd0e
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/Makefile
@@ -0,0 +1,355 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+LDLIBS += -lACE_QoS
+
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+PSRC = $(addsuffix .cpp,$(BIN))
+
+CLT_OBJS = \
+ QoS_Signal_Handler.o \
+ QoS_Util.o \
+ Fill_ACE_QoS.o \
+ sender.o \
+ Sender_QoS_Event_Handler.o
+
+SVR_OBJS = \
+ QoS_Signal_Handler.o \
+ QoS_Util.o \
+ Fill_ACE_QoS.o \
+ receiver.o \
+ Receiver_QoS_Event_Handler.o
+
+BIN2 = receiver \
+ sender
+
+BIN = $(BIN2)
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+receiver: $(addprefix $(VDIR),$(SVR_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+sender: $(addprefix $(VDIR),$(CLT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+
+.obj/receiver.o .obj/receiver.so .shobj/receiver.o .shobj/receiver.so: receiver.cpp \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/pre.h \
+ $(ACE_ROOT)/ace/post.h \
+ $(ACE_ROOT)/ace/ACE_export.h \
+ $(ACE_ROOT)/ace/svc_export.h \
+ $(ACE_ROOT)/ace/ace_wchar.h \
+ $(ACE_ROOT)/ace/ace_wchar.inl \
+ $(ACE_ROOT)/ace/OS_Errno.h \
+ $(ACE_ROOT)/ace/OS_Export.h \
+ $(ACE_ROOT)/ace/OS_Errno.inl \
+ $(ACE_ROOT)/ace/OS_Dirent.h \
+ $(ACE_ROOT)/ace/OS_Dirent.inl \
+ $(ACE_ROOT)/ace/OS_String.h \
+ $(ACE_ROOT)/ace/OS_String.inl \
+ $(ACE_ROOT)/ace/OS_Memory.h \
+ $(ACE_ROOT)/ace/OS_Memory.inl \
+ $(ACE_ROOT)/ace/OS_TLI.h \
+ $(ACE_ROOT)/ace/OS_TLI.inl \
+ $(ACE_ROOT)/ace/Min_Max.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session.h \
+ $(ACE_ROOT)/ace/QoS/ACE_QoS_Export.h \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Flag_Manip.h \
+ $(ACE_ROOT)/ace/Flag_Manip.i \
+ $(ACE_ROOT)/ace/Handle_Ops.h \
+ $(ACE_ROOT)/ace/Handle_Ops.i \
+ $(ACE_ROOT)/ace/Lib_Find.h \
+ $(ACE_ROOT)/ace/Lib_Find.i \
+ $(ACE_ROOT)/ace/Init_ACE.h \
+ $(ACE_ROOT)/ace/Init_ACE.i \
+ $(ACE_ROOT)/ace/Sock_Connect.h \
+ $(ACE_ROOT)/ace/Sock_Connect.i \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Factory.h \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Node.h \
+ $(ACE_ROOT)/ace/Node.cpp \
+ $(ACE_ROOT)/ace/Array_Base.h \
+ $(ACE_ROOT)/ace/Array_Base.inl \
+ $(ACE_ROOT)/ace/Array_Base.cpp \
+ $(ACE_ROOT)/ace/Unbounded_Set.h \
+ $(ACE_ROOT)/ace/Unbounded_Set.inl \
+ $(ACE_ROOT)/ace/Unbounded_Set.cpp \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.h \
+ $(ACE_ROOT)/ace/Unbounded_Queue.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.cpp \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/QoS/QoS_Decorator.h \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Test_and_Set.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Test_and_Set.i \
+ $(ACE_ROOT)/ace/Test_and_Set.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Manager.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.i \
+ QoS_Util.h Fill_ACE_QoS.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Functor.h \
+ $(ACE_ROOT)/ace/Functor.i \
+ $(ACE_ROOT)/ace/Functor_T.h \
+ $(ACE_ROOT)/ace/Functor_T.i \
+ $(ACE_ROOT)/ace/Functor_T.cpp \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ QoS_Signal_Handler.h Receiver_QoS_Event_Handler.h
+
+.obj/sender.o .obj/sender.so .shobj/sender.o .shobj/sender.so: sender.cpp \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/pre.h \
+ $(ACE_ROOT)/ace/post.h \
+ $(ACE_ROOT)/ace/ACE_export.h \
+ $(ACE_ROOT)/ace/svc_export.h \
+ $(ACE_ROOT)/ace/ace_wchar.h \
+ $(ACE_ROOT)/ace/ace_wchar.inl \
+ $(ACE_ROOT)/ace/OS_Errno.h \
+ $(ACE_ROOT)/ace/OS_Export.h \
+ $(ACE_ROOT)/ace/OS_Errno.inl \
+ $(ACE_ROOT)/ace/OS_Dirent.h \
+ $(ACE_ROOT)/ace/OS_Dirent.inl \
+ $(ACE_ROOT)/ace/OS_String.h \
+ $(ACE_ROOT)/ace/OS_String.inl \
+ $(ACE_ROOT)/ace/OS_Memory.h \
+ $(ACE_ROOT)/ace/OS_Memory.inl \
+ $(ACE_ROOT)/ace/OS_TLI.h \
+ $(ACE_ROOT)/ace/OS_TLI.inl \
+ $(ACE_ROOT)/ace/Min_Max.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session.h \
+ $(ACE_ROOT)/ace/QoS/ACE_QoS_Export.h \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Flag_Manip.h \
+ $(ACE_ROOT)/ace/Flag_Manip.i \
+ $(ACE_ROOT)/ace/Handle_Ops.h \
+ $(ACE_ROOT)/ace/Handle_Ops.i \
+ $(ACE_ROOT)/ace/Lib_Find.h \
+ $(ACE_ROOT)/ace/Lib_Find.i \
+ $(ACE_ROOT)/ace/Init_ACE.h \
+ $(ACE_ROOT)/ace/Init_ACE.i \
+ $(ACE_ROOT)/ace/Sock_Connect.h \
+ $(ACE_ROOT)/ace/Sock_Connect.i \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Factory.h \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Node.h \
+ $(ACE_ROOT)/ace/Node.cpp \
+ $(ACE_ROOT)/ace/Array_Base.h \
+ $(ACE_ROOT)/ace/Array_Base.inl \
+ $(ACE_ROOT)/ace/Array_Base.cpp \
+ $(ACE_ROOT)/ace/Unbounded_Set.h \
+ $(ACE_ROOT)/ace/Unbounded_Set.inl \
+ $(ACE_ROOT)/ace/Unbounded_Set.cpp \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.h \
+ $(ACE_ROOT)/ace/Unbounded_Queue.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.cpp \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Impl.h \
+ \
+ \
+ \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Impl.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Decorator.h \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Test_and_Set.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Test_and_Set.i \
+ $(ACE_ROOT)/ace/Test_and_Set.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Manager.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.i \
+ QoS_Util.h Fill_ACE_QoS.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Functor.h \
+ $(ACE_ROOT)/ace/Functor.i \
+ $(ACE_ROOT)/ace/Functor_T.h \
+ $(ACE_ROOT)/ace/Functor_T.i \
+ $(ACE_ROOT)/ace/Functor_T.cpp \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ QoS_Signal_Handler.h Sender_QoS_Event_Handler.h
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/examples/QOS/Change_Sender_TSpec/QoS_Signal_Handler.cpp b/examples/QOS/Change_Sender_TSpec/QoS_Signal_Handler.cpp
new file mode 100644
index 00000000000..9f07ad5b378
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/QoS_Signal_Handler.cpp
@@ -0,0 +1,34 @@
+// 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*)
+{
+ if (signum == SIGINT)
+ {
+ 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/examples/QOS/Change_Sender_TSpec/QoS_Signal_Handler.h b/examples/QOS/Change_Sender_TSpec/QoS_Signal_Handler.h
new file mode 100644
index 00000000000..35b9f3a19e7
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/QoS_Signal_Handler.h
@@ -0,0 +1,45 @@
+/* -*- 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/examples/QOS/Change_Sender_TSpec/QoS_Util.cpp b/examples/QOS/Change_Sender_TSpec/QoS_Util.cpp
new file mode 100644
index 00000000000..d75e9343ba6
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/QoS_Util.cpp
@@ -0,0 +1,121 @@
+// QoS_Session_Impl.cpp
+// $Id$
+
+#define SENDER_PORT 10001
+
+#include "ace/Log_Msg.h"
+#include "ace/Get_Opt.h"
+#include "QoS_Util.h"
+
+ACE_RCSID(QOS, QoS_Util,"$Id$")
+
+// constructor.
+QoS_Util::QoS_Util (int argc,
+ char *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_, "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.optarg);
+ break;
+ case 'n': // to be used by Senders only to specify the destination.
+ this->dest_addr_->set (get_opts.optarg);
+ break;
+ case 'p': // protocol.
+ if (ACE_OS::strcasecmp (get_opts.optarg, "tcp") == 0)
+ this->protocol_ = IPPROTO_TCP;
+ else
+ if (ACE_OS::strcasecmp (get_opts.optarg, "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.optarg);
+ 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/examples/QOS/Change_Sender_TSpec/QoS_Util.h b/examples/QOS/Change_Sender_TSpec/QoS_Util.h
new file mode 100644
index 00000000000..6de6e2d24d3
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/QoS_Util.h
@@ -0,0 +1,75 @@
+/* -*- 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, char *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_;
+ char **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/examples/QOS/Change_Sender_TSpec/README b/examples/QOS/Change_Sender_TSpec/README
new file mode 100644
index 00000000000..a8423774320
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/README
@@ -0,0 +1,126 @@
+$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.
+
+In addition it dynamically changes the sender TSpec which in turn
+changes the PATH messages.
+
+------------------------------------------------------------------------
+WIN2K :
+
+Build Requirements :
+--------------------
+1. Two Win2K machines.
+2. June98 Platform SDK or later.
+3. Link with ws2_32.lib
+
+The test consists of a server (which is the receiver) and a client
+ (which is the sender).
+
+ The receiver is started first (though it is not mandatory) as :
+
+ server -m merengue.cs.wustl.edu:9091
+
+ -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 :
+
+ client -m merengue.cs.wustl.edu:9091 -P 10004
+
+ -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 be the
+following :
+
+include /project/doc/vishal/ACE_wrappers/include/makeinclude/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 static_libs_only=1
+
+ Static library option is used because the RAPI library that we have
+ does not compile as a shared object.
+
+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 :
+
+ sender merengue/5000 [ t 2000000 100000 2000000 512 1024 ]
+ reserve wf [ cl 4000000 200000 4000000 256 2024 ]
+
+
+
+ From ACE:
+ dest udp macarena/5000
+ sender ace/5000 [ t 2000000 100000 2000000 512 1024 ]
+ sender macarena/5022 [ t 2000000 100000 2000000 512 1024 ]
+ sender beguine/6000 [ t 2000000 100000 2000000 512 1024 ]
+
+ From Macarena:
+ wait until done with ACE
+ dest udp macarena/5000 <session name>
+ 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.
+
+-------------------------------------------------------------------------------
+
+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/examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.cpp b/examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.cpp
new file mode 100644
index 00000000000..f2466b175d6
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.cpp
@@ -0,0 +1,145 @@
+/* -*- 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/SString.h"
+#include "Fill_ACE_QoS.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/examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.h b/examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.h
new file mode 100644
index 00000000000..874d628e3c1
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.h
@@ -0,0 +1,61 @@
+/* -*- 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::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/examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.cpp b/examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.cpp
new file mode 100644
index 00000000000..f294f250b05
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.cpp
@@ -0,0 +1,222 @@
+/* -*- 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.h"
+#include "Fill_ACE_QoS.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_String::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));
+
+ //
+ // create a dynamic flow spec on each callback to test QoS retransmits
+ //
+ ACE_CString flow_id ("flow_id");
+
+ Fill_ACE_QoS flow_spec_list;
+ ACE_DEBUG ((LM_DEBUG,
+ "\nA new flow spec! in QoS handler."));
+
+ static int token_rate = 9400;
+ ++token_rate;
+ static int peak_bw = 18500;
+ ++peak_bw;
+ switch (flow_spec_list.map ().bind (flow_id,
+ new ACE_Flow_Spec (token_rate,
+ 708,
+ peak_bw,
+ 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;
+ }
+
+ //
+ // set up the new qos
+ //
+ ACE_QoS another_qos_sender;
+ if (flow_spec_list.fill_simplex_sender_qos (another_qos_sender,
+ flow_id) !=0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to fill handler-simplex sender qos\n"),
+ -1);
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ "Successfully built a new flowspec in handle_qos!\n"));
+
+ //
+ // change the qos for the current session
+ //
+ ACE_QoS_Manager qos_manager = this->dgram_mcast_qos_.qos_manager ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "QoS Manager was built in handle_qos!\n"));
+
+ // Set the QoS for the session. Replaces the ioctl () call that
+ // was being made previously.
+ if (this->qos_session_->qos (&this->dgram_mcast_qos_,
+ &qos_manager,
+ another_qos_sender) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to set QoS\n"),
+ -1);
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ "Setting QOS succeeds.\n"));
+
+
+ // ACE_SOCK_Dgram_Mcast_QoS dgram_mcast_qos_;
+ // ACE_QoS_Session *qos_session_;
+
+ return 0;
+}
diff --git a/examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.h b/examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.h
new file mode 100644
index 00000000000..b691bbd0615
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.h
@@ -0,0 +1,61 @@
+/* -*- 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::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/examples/QOS/Change_Sender_TSpec/receiver.cpp b/examples/QOS/Change_Sender_TSpec/receiver.cpp
new file mode 100644
index 00000000000..254fe51b4a7
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/receiver.cpp
@@ -0,0 +1,325 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ACE_wrappers/examples/QOS
+//
+// = FILENAME
+// server.cpp
+//
+// = AUTHOR
+// Vishal Kachroo <vishal@cs.wustl.edu>
+//
+// ============================================================================
+
+#define QOSEVENT_MAIN
+
+#include "ace/OS.h"
+#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
+main (int argc, char * 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 (ACE_QoS_Session_Factory::ACE_RAPI_SESSION);
+ // XX Shouldn't have to specify GQOS or RAPI?!? XX it is not
+ // clear that we need to pass in a key indicating the type XX of
+ // object to create. Since we use RAPI flag at compile time can
+ // XX we assume rapi here also? Or could we have RAPI and GQoS?
+
+ // 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);
+
+// // Register the RAPI Event Handler with the Reactor. This
+// // handles the QoS events.
+// if (ACE_Reactor::instance ()->register_handler
+// (&rapi_event_handler,
+// ACE_Event_Handler::QOS_MASK | ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering the RAPI Event Handler\n"),
+// -1);
+
+// // The following event handler handles the data.
+// ACE_QoS_Event_Handler data_event_handler (dgram_mcast_qos,
+// qos_session);
+
+// // Register the Data Event Handler with the Reactor.
+// if (ACE_Reactor::instance ()->register_handler
+// (&data_event_handler,ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering Data Event Handler\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/examples/QOS/Change_Sender_TSpec/receiver.dsp b/examples/QOS/Change_Sender_TSpec/receiver.dsp
new file mode 100644
index 00000000000..217e7daa619
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/receiver.dsp
@@ -0,0 +1,138 @@
+# Microsoft Developer Studio Project File - Name="002" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=002 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "receiver.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "receiver.mak" CFG="002 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "002 - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "002 - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "002 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ACE_QoS.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ELSEIF "$(CFG)" == "002 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Od /I "..\..\\" /D "WIN32" /D "_DEBUG" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACE_QoSd.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "002 - Win32 Release"
+# Name "002 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Receiver_QoS_Event_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\receiver.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FlowSpec_Dbase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Receiver_QOS_Event_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/examples/QOS/Change_Sender_TSpec/sender.cpp b/examples/QOS/Change_Sender_TSpec/sender.cpp
new file mode 100644
index 00000000000..576479b4889
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/sender.cpp
@@ -0,0 +1,333 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ACE_wrappers/examples/QOS
+//
+// = FILENAME
+// client.cpp
+//
+// = AUTHOR
+// Vishal Kachroo <vishal@cs.wustl.edu>
+//
+// ============================================================================
+
+
+#include "ace/OS.h"
+#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
+main (int argc, char * 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. 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_RAPI_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);
+
+
+
+// // 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,
+// qos_session);
+
+// ACE_RAPI_Event_Handler rapi_event_handler (qos_session);
+
+// // Register the RAPI Event Handler with the Reactor. This
+// // handles the QoS events.
+// if (ACE_Reactor::instance ()->register_handler
+// (&rapi_event_handler,
+// ACE_Event_Handler::QOS_MASK | ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering the RAPI Event Handler\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/examples/QOS/Change_Sender_TSpec/sender.dsp b/examples/QOS/Change_Sender_TSpec/sender.dsp
new file mode 100644
index 00000000000..475922b7fd7
--- /dev/null
+++ b/examples/QOS/Change_Sender_TSpec/sender.dsp
@@ -0,0 +1,138 @@
+# Microsoft Developer Studio Project File - Name="003" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=003 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "sender.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "sender.mak" CFG="003 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "003 - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "003 - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "003 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ws2_32.lib ACE_QoS.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ELSEIF "$(CFG)" == "003 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Od /I "..\..\\" /D "WIN32" /D "_DEBUG" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACE_QoSd.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "003 - Win32 Release"
+# Name "003 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\sender.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Sender_QoS_Event_Handler.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FlowSpec_Dbase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Sender_QOS_Event_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/examples/QOS/Makefile b/examples/QOS/Makefile
index 63607c5285e..05f3be650d0 100644
--- a/examples/QOS/Makefile
+++ b/examples/QOS/Makefile
@@ -2,30 +2,10 @@
#
# $Id$
#
-LDLIBS += -lACE_QoS
-VLDLIBS = $(LDLIBS:%=%$(VAR))
-
-PSRC = $(addsuffix .cpp,$(BIN))
-
-CLT_OBJS = \
- QoS_Signal_Handler.o \
- QoS_Util.o \
- Fill_ACE_QoS.o \
- client.o \
- Sender_QoS_Event_Handler.o
-
-SVR_OBJS = \
- QoS_Signal_Handler.o \
- QoS_Util.o \
- Fill_ACE_QoS.o \
- server.o \
- Receiver_QoS_Event_Handler.o
-
-BIN2 = server \
- client
-
-BIN = $(BIN2)
+DIRS = Simple \
+ Change_Sender_TSpec \
+ Change_Receiver_FlowSpec
#----------------------------------------------------------------------------
# Include macros and targets
@@ -34,19 +14,12 @@ BIN = $(BIN2)
include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
include $(ACE_ROOT)/include/makeinclude/macros.GNU
include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
-
-#----------------------------------------------------------------------------
-# Local targets
-#----------------------------------------------------------------------------
-
-server: $(addprefix $(VDIR),$(SVR_OBJS))
- $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+#include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU
+#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+#include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU
-client: $(addprefix $(VDIR),$(CLT_OBJS))
- $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
#----------------------------------------------------------------------------
# Dependencies
#----------------------------------------------------------------------------
diff --git a/examples/QOS/QOS.dsw b/examples/QOS/QOS.dsw
index e69d39928c5..102067f2315 100644
--- a/examples/QOS/QOS.dsw
+++ b/examples/QOS/QOS.dsw
@@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
-Project: "002"=.\server.dsp - Package Owner=<4>
+Project: "002"=.\Simple\receiver.dsp - Package Owner=<4>
Package=<5>
{{{
@@ -15,7 +15,79 @@ Package=<4>
###############################################################################
-Project: "003"=.\client.dsp - Package Owner=<4>
+Project: "003"=.\Simple\sender.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
+Project: "002"=.\Change_Sender_TSpec\receiver.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "003"=.\Change_Sender_TSpec\sender.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
+Project: "002"=.\Change_Receiver_FlowSpec\receiver.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "003"=.\Change_Receiver_FlowSpec\sender.dsp - Package Owner=<4>
Package=<5>
{{{
diff --git a/examples/QOS/Simple/Fill_ACE_QoS.cpp b/examples/QOS/Simple/Fill_ACE_QoS.cpp
new file mode 100644
index 00000000000..655e48cc742
--- /dev/null
+++ b/examples/QOS/Simple/Fill_ACE_QoS.cpp
@@ -0,0 +1,114 @@
+// 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_;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Hash_Map_Manager<ACE_CString,ACE_Flow_Spec *,ACE_Null_Mutex>;
+template class ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Entry<ACE_CString, ACE_Flow_Spec *>;
+template class ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Hash_Map_Manager<ACE_CString,ACE_Flow_Spec *,ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, ACE_Flow_Spec *>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Flow_Spec *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Thread_Mutex>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/QOS/Simple/Fill_ACE_QoS.h b/examples/QOS/Simple/Fill_ACE_QoS.h
new file mode 100644
index 00000000000..9c48633d47f
--- /dev/null
+++ b/examples/QOS/Simple/Fill_ACE_QoS.h
@@ -0,0 +1,75 @@
+/* -*- 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/Synch.h"
+#include "ace/ACE.h"
+#include "ace/OS.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/examples/QOS/Simple/FlowSpec_Dbase.h b/examples/QOS/Simple/FlowSpec_Dbase.h
new file mode 100644
index 00000000000..fc382048c13
--- /dev/null
+++ b/examples/QOS/Simple/FlowSpec_Dbase.h
@@ -0,0 +1,52 @@
+/* -*- 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/examples/QOS/Simple/Makefile b/examples/QOS/Simple/Makefile
new file mode 100644
index 00000000000..45728741da0
--- /dev/null
+++ b/examples/QOS/Simple/Makefile
@@ -0,0 +1,355 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+LDLIBS += -lACE_QoS
+
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+PSRC = $(addsuffix .cpp,$(BIN))
+
+CLT_OBJS = \
+ QoS_Signal_Handler.o \
+ QoS_Util.o \
+ Fill_ACE_QoS.o \
+ sender.o \
+ Sender_QoS_Event_Handler.o
+
+SVR_OBJS = \
+ QoS_Signal_Handler.o \
+ QoS_Util.o \
+ Fill_ACE_QoS.o \
+ receiver.o \
+ Receiver_QoS_Event_Handler.o
+
+BIN2 = receiver \
+ sender
+
+BIN = $(BIN2)
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+receiver: $(addprefix $(VDIR),$(SVR_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+sender: $(addprefix $(VDIR),$(CLT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+
+.obj/receiver.o .obj/receiver.so .shobj/receiver.o .shobj/receiver.so: receiver.cpp \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/pre.h \
+ $(ACE_ROOT)/ace/post.h \
+ $(ACE_ROOT)/ace/ACE_export.h \
+ $(ACE_ROOT)/ace/svc_export.h \
+ $(ACE_ROOT)/ace/ace_wchar.h \
+ $(ACE_ROOT)/ace/ace_wchar.inl \
+ $(ACE_ROOT)/ace/OS_Errno.h \
+ $(ACE_ROOT)/ace/OS_Export.h \
+ $(ACE_ROOT)/ace/OS_Errno.inl \
+ $(ACE_ROOT)/ace/OS_Dirent.h \
+ $(ACE_ROOT)/ace/OS_Dirent.inl \
+ $(ACE_ROOT)/ace/OS_String.h \
+ $(ACE_ROOT)/ace/OS_String.inl \
+ $(ACE_ROOT)/ace/OS_Memory.h \
+ $(ACE_ROOT)/ace/OS_Memory.inl \
+ $(ACE_ROOT)/ace/OS_TLI.h \
+ $(ACE_ROOT)/ace/OS_TLI.inl \
+ $(ACE_ROOT)/ace/Min_Max.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session.h \
+ $(ACE_ROOT)/ace/QoS/ACE_QoS_Export.h \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Flag_Manip.h \
+ $(ACE_ROOT)/ace/Flag_Manip.i \
+ $(ACE_ROOT)/ace/Handle_Ops.h \
+ $(ACE_ROOT)/ace/Handle_Ops.i \
+ $(ACE_ROOT)/ace/Lib_Find.h \
+ $(ACE_ROOT)/ace/Lib_Find.i \
+ $(ACE_ROOT)/ace/Init_ACE.h \
+ $(ACE_ROOT)/ace/Init_ACE.i \
+ $(ACE_ROOT)/ace/Sock_Connect.h \
+ $(ACE_ROOT)/ace/Sock_Connect.i \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Factory.h \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Node.h \
+ $(ACE_ROOT)/ace/Node.cpp \
+ $(ACE_ROOT)/ace/Array_Base.h \
+ $(ACE_ROOT)/ace/Array_Base.inl \
+ $(ACE_ROOT)/ace/Array_Base.cpp \
+ $(ACE_ROOT)/ace/Unbounded_Set.h \
+ $(ACE_ROOT)/ace/Unbounded_Set.inl \
+ $(ACE_ROOT)/ace/Unbounded_Set.cpp \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.h \
+ $(ACE_ROOT)/ace/Unbounded_Queue.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.cpp \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/QoS/QoS_Decorator.h \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Test_and_Set.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Test_and_Set.i \
+ $(ACE_ROOT)/ace/Test_and_Set.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Manager.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.i \
+ QoS_Util.h Fill_ACE_QoS.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Functor.h \
+ $(ACE_ROOT)/ace/Functor.i \
+ $(ACE_ROOT)/ace/Functor_T.h \
+ $(ACE_ROOT)/ace/Functor_T.i \
+ $(ACE_ROOT)/ace/Functor_T.cpp \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ QoS_Signal_Handler.h Receiver_QoS_Event_Handler.h
+
+.obj/sender.o .obj/sender.so .shobj/sender.o .shobj/sender.so: sender.cpp \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/pre.h \
+ $(ACE_ROOT)/ace/post.h \
+ $(ACE_ROOT)/ace/ACE_export.h \
+ $(ACE_ROOT)/ace/svc_export.h \
+ $(ACE_ROOT)/ace/ace_wchar.h \
+ $(ACE_ROOT)/ace/ace_wchar.inl \
+ $(ACE_ROOT)/ace/OS_Errno.h \
+ $(ACE_ROOT)/ace/OS_Export.h \
+ $(ACE_ROOT)/ace/OS_Errno.inl \
+ $(ACE_ROOT)/ace/OS_Dirent.h \
+ $(ACE_ROOT)/ace/OS_Dirent.inl \
+ $(ACE_ROOT)/ace/OS_String.h \
+ $(ACE_ROOT)/ace/OS_String.inl \
+ $(ACE_ROOT)/ace/OS_Memory.h \
+ $(ACE_ROOT)/ace/OS_Memory.inl \
+ $(ACE_ROOT)/ace/OS_TLI.h \
+ $(ACE_ROOT)/ace/OS_TLI.inl \
+ $(ACE_ROOT)/ace/Min_Max.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session.h \
+ $(ACE_ROOT)/ace/QoS/ACE_QoS_Export.h \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Flag_Manip.h \
+ $(ACE_ROOT)/ace/Flag_Manip.i \
+ $(ACE_ROOT)/ace/Handle_Ops.h \
+ $(ACE_ROOT)/ace/Handle_Ops.i \
+ $(ACE_ROOT)/ace/Lib_Find.h \
+ $(ACE_ROOT)/ace/Lib_Find.i \
+ $(ACE_ROOT)/ace/Init_ACE.h \
+ $(ACE_ROOT)/ace/Init_ACE.i \
+ $(ACE_ROOT)/ace/Sock_Connect.h \
+ $(ACE_ROOT)/ace/Sock_Connect.i \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Factory.h \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Node.h \
+ $(ACE_ROOT)/ace/Node.cpp \
+ $(ACE_ROOT)/ace/Array_Base.h \
+ $(ACE_ROOT)/ace/Array_Base.inl \
+ $(ACE_ROOT)/ace/Array_Base.cpp \
+ $(ACE_ROOT)/ace/Unbounded_Set.h \
+ $(ACE_ROOT)/ace/Unbounded_Set.inl \
+ $(ACE_ROOT)/ace/Unbounded_Set.cpp \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \
+ $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.h \
+ $(ACE_ROOT)/ace/Unbounded_Queue.inl \
+ $(ACE_ROOT)/ace/Unbounded_Queue.cpp \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Impl.h \
+ \
+ \
+ \
+ $(ACE_ROOT)/ace/QoS/QoS_Session_Impl.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Decorator.h \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.h \
+ $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread_Adapter.inl \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Test_and_Set.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Test_and_Set.i \
+ $(ACE_ROOT)/ace/Test_and_Set.cpp \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \
+ $(ACE_ROOT)/ace/SOCK_Dgram.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram.i \
+ $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \
+ $(ACE_ROOT)/ace/QoS/QoS_Manager.h \
+ $(ACE_ROOT)/ace/QoS/SOCK_Dgram_Mcast_QoS.i \
+ QoS_Util.h Fill_ACE_QoS.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Functor.h \
+ $(ACE_ROOT)/ace/Functor.i \
+ $(ACE_ROOT)/ace/Functor_T.h \
+ $(ACE_ROOT)/ace/Functor_T.i \
+ $(ACE_ROOT)/ace/Functor_T.cpp \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.h \
+ $(ACE_ROOT)/ace/Malloc_Allocator.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ QoS_Signal_Handler.h Sender_QoS_Event_Handler.h
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/examples/QOS/Simple/QoS_Signal_Handler.cpp b/examples/QOS/Simple/QoS_Signal_Handler.cpp
new file mode 100644
index 00000000000..a0533bacdbc
--- /dev/null
+++ b/examples/QOS/Simple/QoS_Signal_Handler.cpp
@@ -0,0 +1,40 @@
+// 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/examples/QOS/Simple/QoS_Signal_Handler.h b/examples/QOS/Simple/QoS_Signal_Handler.h
new file mode 100644
index 00000000000..35b9f3a19e7
--- /dev/null
+++ b/examples/QOS/Simple/QoS_Signal_Handler.h
@@ -0,0 +1,45 @@
+/* -*- 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/examples/QOS/Simple/QoS_Util.cpp b/examples/QOS/Simple/QoS_Util.cpp
new file mode 100644
index 00000000000..d75e9343ba6
--- /dev/null
+++ b/examples/QOS/Simple/QoS_Util.cpp
@@ -0,0 +1,121 @@
+// QoS_Session_Impl.cpp
+// $Id$
+
+#define SENDER_PORT 10001
+
+#include "ace/Log_Msg.h"
+#include "ace/Get_Opt.h"
+#include "QoS_Util.h"
+
+ACE_RCSID(QOS, QoS_Util,"$Id$")
+
+// constructor.
+QoS_Util::QoS_Util (int argc,
+ char *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_, "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.optarg);
+ break;
+ case 'n': // to be used by Senders only to specify the destination.
+ this->dest_addr_->set (get_opts.optarg);
+ break;
+ case 'p': // protocol.
+ if (ACE_OS::strcasecmp (get_opts.optarg, "tcp") == 0)
+ this->protocol_ = IPPROTO_TCP;
+ else
+ if (ACE_OS::strcasecmp (get_opts.optarg, "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.optarg);
+ 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/examples/QOS/Simple/QoS_Util.h b/examples/QOS/Simple/QoS_Util.h
new file mode 100644
index 00000000000..6de6e2d24d3
--- /dev/null
+++ b/examples/QOS/Simple/QoS_Util.h
@@ -0,0 +1,75 @@
+/* -*- 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, char *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_;
+ char **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/examples/QOS/Simple/README b/examples/QOS/Simple/README
new file mode 100644
index 00000000000..13255842932
--- /dev/null
+++ b/examples/QOS/Simple/README
@@ -0,0 +1,142 @@
+//$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/examples/QOS/Simple/Receiver_QoS_Event_Handler.cpp b/examples/QOS/Simple/Receiver_QoS_Event_Handler.cpp
new file mode 100644
index 00000000000..5646e7670df
--- /dev/null
+++ b/examples/QOS/Simple/Receiver_QoS_Event_Handler.cpp
@@ -0,0 +1,136 @@
+/* -*- 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"
+
+// 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/examples/QOS/Simple/Receiver_QoS_Event_Handler.h b/examples/QOS/Simple/Receiver_QoS_Event_Handler.h
new file mode 100644
index 00000000000..874d628e3c1
--- /dev/null
+++ b/examples/QOS/Simple/Receiver_QoS_Event_Handler.h
@@ -0,0 +1,61 @@
+/* -*- 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::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/examples/QOS/Simple/Sender_QoS_Event_Handler.cpp b/examples/QOS/Simple/Sender_QoS_Event_Handler.cpp
new file mode 100644
index 00000000000..75eb6930942
--- /dev/null
+++ b/examples/QOS/Simple/Sender_QoS_Event_Handler.cpp
@@ -0,0 +1,143 @@
+/* -*- 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"
+
+// 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_String::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/examples/QOS/Simple/Sender_QoS_Event_Handler.h b/examples/QOS/Simple/Sender_QoS_Event_Handler.h
new file mode 100644
index 00000000000..b691bbd0615
--- /dev/null
+++ b/examples/QOS/Simple/Sender_QoS_Event_Handler.h
@@ -0,0 +1,61 @@
+/* -*- 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::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/examples/QOS/Simple/receiver.cpp b/examples/QOS/Simple/receiver.cpp
new file mode 100644
index 00000000000..254fe51b4a7
--- /dev/null
+++ b/examples/QOS/Simple/receiver.cpp
@@ -0,0 +1,325 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ACE_wrappers/examples/QOS
+//
+// = FILENAME
+// server.cpp
+//
+// = AUTHOR
+// Vishal Kachroo <vishal@cs.wustl.edu>
+//
+// ============================================================================
+
+#define QOSEVENT_MAIN
+
+#include "ace/OS.h"
+#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
+main (int argc, char * 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 (ACE_QoS_Session_Factory::ACE_RAPI_SESSION);
+ // XX Shouldn't have to specify GQOS or RAPI?!? XX it is not
+ // clear that we need to pass in a key indicating the type XX of
+ // object to create. Since we use RAPI flag at compile time can
+ // XX we assume rapi here also? Or could we have RAPI and GQoS?
+
+ // 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);
+
+// // Register the RAPI Event Handler with the Reactor. This
+// // handles the QoS events.
+// if (ACE_Reactor::instance ()->register_handler
+// (&rapi_event_handler,
+// ACE_Event_Handler::QOS_MASK | ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering the RAPI Event Handler\n"),
+// -1);
+
+// // The following event handler handles the data.
+// ACE_QoS_Event_Handler data_event_handler (dgram_mcast_qos,
+// qos_session);
+
+// // Register the Data Event Handler with the Reactor.
+// if (ACE_Reactor::instance ()->register_handler
+// (&data_event_handler,ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering Data Event Handler\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/examples/QOS/Simple/receiver.dsp b/examples/QOS/Simple/receiver.dsp
new file mode 100644
index 00000000000..217e7daa619
--- /dev/null
+++ b/examples/QOS/Simple/receiver.dsp
@@ -0,0 +1,138 @@
+# Microsoft Developer Studio Project File - Name="002" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=002 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "receiver.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "receiver.mak" CFG="002 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "002 - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "002 - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "002 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ACE_QoS.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ELSEIF "$(CFG)" == "002 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Od /I "..\..\\" /D "WIN32" /D "_DEBUG" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACE_QoSd.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "002 - Win32 Release"
+# Name "002 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Receiver_QoS_Event_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\receiver.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FlowSpec_Dbase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Receiver_QOS_Event_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/examples/QOS/Simple/sender.cpp b/examples/QOS/Simple/sender.cpp
new file mode 100644
index 00000000000..576479b4889
--- /dev/null
+++ b/examples/QOS/Simple/sender.cpp
@@ -0,0 +1,333 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ACE_wrappers/examples/QOS
+//
+// = FILENAME
+// client.cpp
+//
+// = AUTHOR
+// Vishal Kachroo <vishal@cs.wustl.edu>
+//
+// ============================================================================
+
+
+#include "ace/OS.h"
+#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
+main (int argc, char * 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. 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_RAPI_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);
+
+
+
+// // 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,
+// qos_session);
+
+// ACE_RAPI_Event_Handler rapi_event_handler (qos_session);
+
+// // Register the RAPI Event Handler with the Reactor. This
+// // handles the QoS events.
+// if (ACE_Reactor::instance ()->register_handler
+// (&rapi_event_handler,
+// ACE_Event_Handler::QOS_MASK | ACE_Event_Handler::READ_MASK) == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "Error in registering the RAPI Event Handler\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/examples/QOS/Simple/sender.dsp b/examples/QOS/Simple/sender.dsp
new file mode 100644
index 00000000000..475922b7fd7
--- /dev/null
+++ b/examples/QOS/Simple/sender.dsp
@@ -0,0 +1,138 @@
+# Microsoft Developer Studio Project File - Name="003" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=003 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "sender.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "sender.mak" CFG="003 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "003 - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "003 - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "003 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ws2_32.lib ACE_QoS.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ELSEIF "$(CFG)" == "003 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Od /I "..\..\\" /D "WIN32" /D "_DEBUG" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACE_QoSd.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace" /libpath:"..\..\ace\QoS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "003 - Win32 Release"
+# Name "003 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\sender.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Sender_QoS_Event_Handler.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Fill_ACE_QoS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FlowSpec_Dbase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Signal_Handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\QoS_Util.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Sender_QOS_Event_Handler.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project