summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:11 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:11 +0000
commit6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch)
treeda50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows
parent0e555b9150d38e3b3473ba325b56db2642e6352b (diff)
downloadATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows')
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/AVS_Bidirectional_Flows.mpc19
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/Makefile.am86
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/README45
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/receiver.cpp359
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/receiver.h146
-rwxr-xr-xTAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/run_test.pl71
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/sender.cpp518
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/sender.h150
8 files changed, 0 insertions, 1394 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/AVS_Bidirectional_Flows.mpc b/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/AVS_Bidirectional_Flows.mpc
deleted file mode 100644
index ff55e80a109..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/AVS_Bidirectional_Flows.mpc
+++ /dev/null
@@ -1,19 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-project(*send): avstreamsexe {
- exename = sender
-
- Source_Files {
- sender.cpp
- }
-}
-
-project(*recv): avstreamsexe {
- exename = receiver
-
- Source_Files {
- receiver.cpp
- }
-}
-
diff --git a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/Makefile.am b/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/Makefile.am
deleted file mode 100644
index 7bf11f4dad7..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/Makefile.am
+++ /dev/null
@@ -1,86 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
-
-ACE_BUILDDIR = $(top_builddir)/..
-ACE_ROOT = $(top_srcdir)/..
-TAO_BUILDDIR = $(top_builddir)
-TAO_ROOT = $(top_srcdir)
-
-noinst_PROGRAMS =
-
-## Makefile.AVS_Bidirectional_Flows_Recv.am
-
-if !BUILD_ACE_FOR_TAO
-
-noinst_PROGRAMS += receiver
-
-receiver_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(TAO_ROOT) \
- -I$(TAO_BUILDDIR) \
- -I$(TAO_ROOT)/orbsvcs \
- -I$(TAO_BUILDDIR)/orbsvcs
-
-receiver_SOURCES = \
- receiver.cpp \
- receiver.h
-
-receiver_LDADD = \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_AV.la \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosProperty_Serv.la \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosProperty_Skel.la \
- $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosProperty.la \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
- $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
- $(TAO_BUILDDIR)/tao/libTAO.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_ACE_FOR_TAO
-
-## Makefile.AVS_Bidirectional_Flows_Send.am
-
-if !BUILD_ACE_FOR_TAO
-
-noinst_PROGRAMS += sender
-
-sender_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(TAO_ROOT) \
- -I$(TAO_BUILDDIR) \
- -I$(TAO_ROOT)/orbsvcs \
- -I$(TAO_BUILDDIR)/orbsvcs
-
-sender_SOURCES = \
- sender.cpp \
- sender.h
-
-sender_LDADD = \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_AV.la \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosProperty_Serv.la \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosProperty_Skel.la \
- $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosProperty.la \
- $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
- $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
- $(TAO_BUILDDIR)/tao/libTAO.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_ACE_FOR_TAO
-
-## Clean up template repositories, etc.
-clean-local:
- -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
- -rm -f gcctemp.c gcctemp so_locations *.ics
- -rm -rf cxx_repository ptrepository ti_files
- -rm -rf templateregistry ir.out
- -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/README b/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/README
deleted file mode 100644
index c637b2c3b25..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/README
+++ /dev/null
@@ -1,45 +0,0 @@
-// $Id$
-
-Description
------------
-
-This directory contains a simple test in the form of a sender and a
-receiver. The test has the following features:
-
-1. It tests the AVStreams Pluggable Protocol Framework
-2. Shows a mechanism to pace data.
-3. Shows how to set up bidirectional data.
-
-Running the test
-----------------
-
-receiver
---------
-
-receiver -f <input_filename>
-
--f <input_filename> -> The name of the file from which data is sent to the receiver
-
-sender
-------
-
-sender [-f <filename>] [-p <protocol>] [-r <frame rate>] [-d]
-
-
--f filename --> The file to be streamed to the receiver (defaults to
- "input").
-
--p protocol --> The protocol string could be UDP or TCP (defaults to
- UDP). But with the multicast address it should be UDP.
-
--r framerate--> The rate at which tha data frames need to be sent
- (defaults to 30 frames per second).
-
--d --> Increament the TAO_debug_level for debug messages.
-
-
-The test must be run with the naming service. Check the run_test.pl
-to see how to configure the test case.
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/receiver.cpp b/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/receiver.cpp
deleted file mode 100644
index 3683e3e7ba2..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/receiver.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-// $Id$
-
-#include "receiver.h"
-#include "ace/Get_Opt.h"
-#include "ace/High_Res_Timer.h"
-
-static FILE *output_file = 0;
-// File handle of the file into which received data is written.
-
-static const char *output_file_name = "output";
-// File name of the file into which received data is written.
-
-typedef ACE_Unmanaged_Singleton<Receiver,ACE_Null_Mutex> RECEIVER;
-//Create a singleton instance of the receiver.
-
-int
-Receiver_StreamEndPoint::get_callback (const char *,
- TAO_AV_Callback *&callback)
-{
- // Return the receiver application callback to the AVStreams for
- // future upcalls.
- callback = &this->callback_;
- return 0;
-}
-
-
-int
-Receiver_StreamEndPoint::set_protocol_object (const char * flowname,
- TAO_AV_Protocol_Object *object)
-{
- // Set the sender protocol object corresponding to the transport
- // protocol selected.
- if (ACE_OS::strcmp (flowname, "Data_Receiver1") == 0)
- RECEIVER::instance ()->protocol_object (object);
- return 0;
-}
-
-Receiver_Callback::Receiver_Callback (void)
- : frame_count_ (1),
- mb_ (BUFSIZ)
-{
-}
-
-int
-Receiver_Callback::receive_frame (ACE_Message_Block *frame,
- TAO_AV_frame_info *,
- const ACE_Addr &)
-{
- //
- // Upcall from the AVStreams when there is data to be received from
- // the sender.
- //
- ACE_DEBUG ((LM_DEBUG,
- "Receiver_Callback::receive_frame for frame %d\n",
- this->frame_count_++));
-
- while (frame != 0)
- {
- // Write the received data to the file.
- size_t result =
- ACE_OS::fwrite (frame->rd_ptr (),
- frame->length (),
- 1,
- output_file);
-
- if (result == frame->length ())
- ACE_ERROR_RETURN ((LM_ERROR,
- "Receiver_Callback::fwrite failed\n"),
- -1);
-
- frame = frame->cont ();
- }
-
- // Read from the file into a message block.
- int n = ACE_OS::fread (this->mb_.wr_ptr (),
- 1,
- this->mb_.size (),
- RECEIVER::instance ()->input_file ());
-
- if (n < 0)
- ACE_DEBUG ((LM_DEBUG,
- "Receiver::receive_frame fread failed\n"));
-
- if (n == 0)
- {
- // At end of file break the loop and end the sender.
- ACE_DEBUG ((LM_DEBUG,"End of file\n"));
- }
- else
- {
- this->mb_.wr_ptr (n);
-
- // Send frame.
- int result =
- RECEIVER::instance ()->protocol_object ()->send_frame (&this->mb_);
-
- if (result < 0)
- ACE_DEBUG ((LM_DEBUG,
- "Send Frame Failed\n"));
-
- // Reset the message block.
- this->mb_.reset ();
- }
- return 0;
-}
-
-int
-Receiver_Callback::handle_destroy (void)
-{
- // Called when the distributer requests the stream to be shutdown.
- ACE_DEBUG ((LM_DEBUG,
- "Receiver_Callback::handle_destroy\n"));
-
- static int count = 0;
- ++count;
-
- if (count < 2)
- {
- ACE_TRY_NEW_ENV
- {
- TAO_AV_CORE::instance ()->orb ()->shutdown (0
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Receiver_Callback::handle_destroy Failed\n");
- return -1;
-
- }
-
- ACE_ENDTRY;
- }
-
- return 0;
-}
-
-Receiver::Receiver (void)
- : mmdevice_ (0),
- frame_rate_ (30),
- input_file_ (0),
- frame_count_ (0),
- filename_ ("input"),
- mb_ (BUFSIZ)
-{
-}
-
-Receiver::~Receiver (void)
-{
-}
-
-void
-Receiver::protocol_object (TAO_AV_Protocol_Object *object)
-{
- // Set the sender protocol object corresponding to the transport
- // protocol selected.
- this->protocol_object_ = object;
-}
-
-int
-Receiver::parse_args (int argc,
- char **argv)
-{
- // Parse command line arguments
- ACE_Get_Opt opts (argc, argv, "f:r:d");
-
- int c;
- while ((c= opts ()) != -1)
- {
- switch (c)
- {
- case 'f':
- this->filename_ = opts.opt_arg ();
- break;
- case 'r':
- this->frame_rate_ = ACE_OS::atoi (opts.opt_arg ());
- break;
- case 'd':
- TAO_debug_level++;
- break;
- default:
- ACE_DEBUG ((LM_DEBUG, "Unknown Option\n"));
- return -1;
- }
- }
- return 0;
-}
-
-int
-Receiver::init (int argc,
- char ** argv
- ACE_ENV_ARG_DECL)
-{
- // Initialize the endpoint strategy with the orb and poa.
- int result =
- this->reactive_strategy_.init (TAO_AV_CORE::instance ()->orb (),
- TAO_AV_CORE::instance ()->poa ());
- if (result != 0)
- return result;
-
- // Parse the command line arguments
- result =
- this->parse_args (argc,
- argv);
- if (result != 0)
- return result;
-
- // Open file to read.
- this->input_file_ =
- ACE_OS::fopen (this->filename_.c_str (),
- "r");
-
- if (this->input_file_ == 0)
- ACE_ERROR_RETURN ((LM_DEBUG,
- "Cannot open input file %s\n",
- this->filename_.c_str ()),
- -1);
- else
- ACE_DEBUG ((LM_DEBUG,
- "Input File opened successfully\n"));
-
- // Register the receiver mmdevice object with the ORB
- ACE_NEW_RETURN (this->mmdevice_,
- TAO_MMDevice (&this->reactive_strategy_),
- -1);
-
- // Servant Reference Counting to manage lifetime
- PortableServer::ServantBase_var safe_mmdevice =
- this->mmdevice_;
-
- CORBA::Object_var mmdevice =
- this->mmdevice_->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- // Register the mmdevice with the naming service.
- CosNaming::Name name (1);
- name.length (1);
- name [0].id =
- CORBA::string_dup ("Receiver");
-
- // Initialize the naming services
- if (this->naming_client_.init (TAO_AV_CORE::instance ()->orb ()) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to initialize "
- "the TAO_Naming_Client\n"),
- -1);
-
- // Register the receiver object with the naming server.
- this->naming_client_->rebind (name,
- mmdevice.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- return 0;
-}
-
-TAO_AV_Protocol_Object*
-Receiver::protocol_object (void)
-{
- return this->protocol_object_;
-}
-
-FILE *
-Receiver::input_file (void)
-{
- return this->input_file_;
-}
-
-int
-main (int argc,
- char **argv)
-{
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- // Initialize the ORB first.
- CORBA::ORB_var orb =
- CORBA::ORB_init (argc,
- argv,
- 0
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- CORBA::Object_var obj
- = orb->resolve_initial_references ("RootPOA"
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Get the POA_var object from Object_var.
- PortableServer::POA_var root_poa =
- PortableServer::POA::_narrow (obj.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- PortableServer::POAManager_var mgr
- = root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Initialize the AVStreams components.
- TAO_AV_CORE::instance ()->init (orb.in (), root_poa.in () ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Make sure we have a valid <output_file>
- output_file = ACE_OS::fopen (output_file_name,
- "w");
- if (output_file == 0)
- ACE_ERROR_RETURN ((LM_DEBUG,
- "Cannot open output file %s\n",
- output_file_name),
- -1);
-
- else
- ACE_DEBUG ((LM_DEBUG,
- "Output File Opened Successfully\n"));
-
- int result =
- RECEIVER::instance ()->init (argc,
- argv
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // // Start sending data.
- // result = SENDER::instance ()->pace_data (ACE_ENV_SINGLE_ARG_PARAMETER);
- // ACE_TRY_CHECK;
-
- if (result != 0)
- return result;
-
- orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Hack for now....
- ACE_OS::sleep (1);
-
- //orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"receiver::init");
- return -1;
- }
- ACE_ENDTRY;
- ACE_CHECK_RETURN (-1);
-
- ACE_OS::fclose (output_file);
-
- RECEIVER::close (); // Explicitly finalize the Unmanaged_Singleton.
-
- return 0;
-}
-
-#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
-template ACE_Unmanaged_Singleton<Receiver, ACE_Null_Mutex> *ACE_Unmanaged_Singleton<Receiver, ACE_Null_Mutex>::singleton_;
-#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/receiver.h b/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/receiver.h
deleted file mode 100644
index 539f43b8b43..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/receiver.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/orbsvcs/tests/AVStreams/Simple
-//
-// = FILENAME
-// receiver.h
-//
-// = DESCRIPTION
-// This application receives data from a AV sender and writes it to
-// a file.
-//
-// = AUTHOR
-// Yamuna Krishnamurthy <yamuna@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "orbsvcs/Naming/Naming_Client.h"
-#include "orbsvcs/AV/AVStreams_i.h"
-#include "orbsvcs/AV/Endpoint_Strategy.h"
-#include "orbsvcs/AV/Policy.h"
-#include "orbsvcs/AV/Protocol_Factory.h"
-
-class Receiver_Callback : public TAO_AV_Callback
-{
- // = TITLE
- // Application defined callback object.
- //
- // = DESCRIPTION
- // AVStreams calls this class when data shows up from a sender.
-public:
-
- Receiver_Callback (void);
- // Constructor.
-
- // Method that is called when there is data to be received from a
- // sender.
- int receive_frame (ACE_Message_Block *frame,
- TAO_AV_frame_info *frame_info,
- const ACE_Addr &peer_address);
-
- // Called when the sender is done sending data and wants to close
- // down the connection.
- int handle_destroy (void);
-
-private:
- int frame_count_;
- // Keeping a count of the incoming frames.
-
- ACE_Message_Block mb_;
- // Message block into which data is read from a file and then sent.
-};
-
-class Receiver_StreamEndPoint : public TAO_Server_StreamEndPoint
-{
- // = TITLE
- // Application defined stream endpoint object.
- //
- // = DESCRIPTION
- // AVStreams calls this class during connection setup.
-public:
- // Create a receiver application callback.
- int get_callback (const char *flowname,
- TAO_AV_Callback *&callback);
-
- int set_protocol_object (const char *flowname,
- TAO_AV_Protocol_Object *object);
- // Set protocol object corresponding to the transport protocol
- // chosen.
-
-
-private:
- Receiver_Callback callback_;
- // Receiver application callback.
-};
-
-class Receiver
-{
- // = TITLE
- // Receiver application class.
- //
- // = DESCRIPTION
- // This class receives data from a AV sender and writes it to
- // a file.
-public:
- Receiver (void);
- // Constructor
-
- ~Receiver (void);
- // Destructor.
-
- int init (int argc,
- char **argv
- ACE_ENV_ARG_DECL_NOT_USED);
- // Initialize data components.
-
- void protocol_object (TAO_AV_Protocol_Object *protocol_object);
- // Set the protocol object corresponding to the transport protocol chosen.
-
- TAO_AV_Protocol_Object * protocol_object (void);
- // Set the protocol object corresponding to the transport protocol chosen.
-
- FILE * input_file (void);
-
-protected:
- TAO_Naming_Client naming_client_;
- // The Naming Service Client.
-
- TAO_AV_Endpoint_Reactive_Strategy_B
- <Receiver_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl> reactive_strategy_;
- // The endpoint reactive strategy.
-
- TAO_MMDevice *mmdevice_;
- // Receiver MMDevice.
-
- int frame_rate_;
- // Rate at which the data will be sent.
-
- TAO_AV_Protocol_Object *protocol_object_;
- // Protocol object corresponding to the transport protocol selected.
-
- FILE *input_file_;
- // File handle of the file read from.
-
- int frame_count_;
- // Number of frames sent.
-
- ACE_CString filename_;
- // File from which data is read.
-
- int parse_args (int argc, char **argv);
- // Method to parse the command line arguments.
-
- ACE_Message_Block mb_;
- // Message block into which data is read from a file and then sent.
-
-};
-
-
-
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/run_test.pl b/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/run_test.pl
deleted file mode 100755
index efe05403c37..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/run_test.pl
+++ /dev/null
@@ -1,71 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
-
-# $Id$
-# -*- perl -*-
-
-use lib $ENV{"ACE_ROOT"}.'/bin';
-use PerlACE::Run_Test;
-use File::stat;
-
-# amount of delay between running the servers
-
-$sleeptime = 2;
-$status = 0;
-
-$nsior = PerlACE::LocalFile ("ns.ior");
-$outfile = PerlACE::LocalFile ("output");
-
-# generate test stream data
-$input = PerlACE::generate_test_file("test_input", 102400);
-
-unlink $nsior;
-
-$NS = new PerlACE::Process ($ENV{"TAO_ROOT"}."/orbsvcs/Naming_Service/Naming_Service", "-o $nsior");
-$SV = new PerlACE::Process ("receiver", "-ORBInitRef NameService=file://$nsior -f output");
-$CL = new PerlACE::Process ("sender", "-ORBInitRef NameService=file://$nsior -f $input -r 2");
-
-print STDERR "Starting Naming Service\n";
-
-$NS->Spawn ();
-
-if (PerlACE::waitforfile_timed ($nsior, 5) == -1) {
- print STDERR "ERROR: cannot find naming service IOR file\n";
- $NS->Kill ();
- exit 1;
-}
-
-print STDERR "Starting Receiver\n";
-
-$SV->Spawn ();
-
-sleep $sleeptime;
-
-print STDERR "Starting Sender\n";
-
-$sender = $CL->SpawnWaitKill (200);
-
-if ($sender != 0) {
- print STDERR "ERROR: sender returned $sender\n";
- $status = 1;
-}
-
-$receiver = $SV->TerminateWaitKill (5);
-
-if ($receiver != 0) {
- print STDERR "ERROR: receiver returned $receiver\n";
- $status = 1;
-}
-
-$nserver = $NS->TerminateWaitKill (5);
-
-if ($nserver != 0) {
- print STDERR "ERROR: Naming Service returned $nserver\n";
- $status = 1;
-}
-
-unlink $nsior;
-unlink $output, $input;
-
-exit $status;
diff --git a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/sender.cpp b/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/sender.cpp
deleted file mode 100644
index 2e806a208a2..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/sender.cpp
+++ /dev/null
@@ -1,518 +0,0 @@
-// $Id$
-
-#include "sender.h"
-#include "tao/debug.h"
-#include "ace/Get_Opt.h"
-#include "ace/High_Res_Timer.h"
-
-typedef ACE_Unmanaged_Singleton<Sender, ACE_Null_Mutex> SENDER;
-// Create a singleton instance of the Sender.
-
-static FILE *output_file = 0;
-// File handle of the file into which received data is written.
-
-static const char *output_file_name = "output";
-// File name of the file into which received data is written.
-
-
-int
-Sender_StreamEndPoint::get_callback (const char *,
- TAO_AV_Callback *&callback)
-{
- // Create and return the sender application callback to AVStreams
- // for further upcalls.
- callback = &this->callback_;
- return 0;
-}
-
-int
-Sender_StreamEndPoint::set_protocol_object (const char *,
- TAO_AV_Protocol_Object *object)
-{
- // Set the sender protocol object corresponding to the transport
- // protocol selected.
- SENDER::instance ()->protocol_object (object);
- return 0;
-}
-
-Sender_Callback::Sender_Callback (void)
- : frame_count_ (1)
-{
-}
-
-int
-Sender_Callback::receive_frame (ACE_Message_Block *frame,
- TAO_AV_frame_info *,
- const ACE_Addr &)
-{
- //
- // Upcall from the AVStreams when there is data to be received from
- // the sender.
- //
- ACE_DEBUG ((LM_DEBUG,
- "Sender_Callback::receive_frame for frame %d\n",
- this->frame_count_++));
-
- while (frame != 0)
- {
- // Write the received data to the file.
- size_t result =
- ACE_OS::fwrite (frame->rd_ptr (),
- frame->length (),
- 1,
- output_file);
-
- if (result == frame->length ())
- ACE_ERROR_RETURN ((LM_ERROR,
- "Sender_Callback::fwrite failed\n"),
- -1);
-
- frame = frame->cont ();
- }
-
- if (SENDER::instance ()->eof () == 1)
- SENDER::instance ()->shutdown ();
- return 0;
-}
-
-Sender::Sender (void)
- : sender_mmdevice_ (0),
- streamctrl_ (0),
- frame_count_ (0),
- filename_ ("input"),
- input_file_ (0),
- protocol_ ("UDP"),
- frame_rate_ (30),
- mb_ (BUFSIZ),
- eof_ (0)
-{
-}
-
-void
-Sender::protocol_object (TAO_AV_Protocol_Object *object)
-{
- // Set the sender protocol object corresponding to the transport
- // protocol selected.
- this->protocol_object_ = object;
-}
-
-int
-Sender::eof (void)
-{
- return this->eof_;
-}
-
-void
-Sender::shutdown (void)
-{
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- // File reading is complete, destroy the stream.
- AVStreams::flowSpec stop_spec;
- this->streamctrl_->destroy (stop_spec
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Shut the orb down.
- TAO_AV_CORE::instance ()->orb ()->shutdown (0
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "shutdown\n");
- }
- ACE_ENDTRY;
-}
-
-int
-Sender::parse_args (int argc,
- char **argv)
-{
- // Parse command line arguments
- ACE_Get_Opt opts (argc, argv, "f:p:r:d");
-
- int c;
- while ((c= opts ()) != -1)
- {
- switch (c)
- {
- case 'f':
- this->filename_ = opts.opt_arg ();
- break;
- case 'p':
- this->protocol_ = opts.opt_arg ();
- break;
- case 'r':
- this->frame_rate_ = ACE_OS::atoi (opts.opt_arg ());
- break;
- case 'd':
- TAO_debug_level++;
- break;
- default:
- ACE_DEBUG ((LM_DEBUG, "Unknown Option\n"));
- return -1;
- }
- }
- return 0;
-}
-
-// Method to get the object reference of the receiver
-int
-Sender::bind_to_receiver (ACE_ENV_SINGLE_ARG_DECL)
-{
- CosNaming::Name name (1);
- name.length (1);
- name [0].id =
- CORBA::string_dup ("Receiver");
-
- // Resolve the receiver object reference from the Naming Service
- CORBA::Object_var receiver_mmdevice_obj =
- this->naming_client_->resolve (name
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- this->receiver_mmdevice_ =
- AVStreams::MMDevice::_narrow (receiver_mmdevice_obj.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (CORBA::is_nil (this->receiver_mmdevice_.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- "Could not resolve Receiver_MMdevice in Naming service <%s>\n"),
- -1);
-
- return 0;
-}
-
-int
-Sender::init (int argc,
- char **argv
- ACE_ENV_ARG_DECL)
-{
- // Initialize the endpoint strategy with the orb and poa.
- int result =
- this->endpoint_strategy_.init (TAO_AV_CORE::instance ()->orb (),
- TAO_AV_CORE::instance ()->poa ());
- if (result != 0)
- return result;
-
- // Initialize the naming services
- result =
- this->naming_client_.init (TAO_AV_CORE::instance ()->orb ());
- if (result != 0)
- return result;
-
- // Parse the command line arguments
- result =
- this->parse_args (argc,
- argv);
- if (result != 0)
- return result;
-
- // Open file to read.
- this->input_file_ =
- ACE_OS::fopen (this->filename_.c_str (),
- "r");
-
- if (this->input_file_ == 0)
- ACE_ERROR_RETURN ((LM_DEBUG,
- "Cannot open input file %s\n",
- this->filename_.c_str ()),
- -1);
- else
- ACE_DEBUG ((LM_DEBUG,
- "File opened successfully\n"));
-
- // Resolve the object reference of the receiver from the Naming Service.
- result = this->bind_to_receiver (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (result != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) Error binding to the naming service\n"),
- -1);
-
-
- // Initialize the QoS
- AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS);
-
- // Create the forward flow specification to describe the flow.
- TAO_Forward_FlowSpec_Entry entry ("Data_Receiver",
- "IN",
- "USER_DEFINED",
- "",
- this->protocol_.c_str (),
- 0);
-
- AVStreams::flowSpec flow_spec (1);
- flow_spec.length (2);
- flow_spec [0] = CORBA::string_dup (entry.entry_to_string ());
-
- // Create the forward flow specification to describe the flow.
- TAO_Forward_FlowSpec_Entry entry1 ("Data_Receiver1",
- "OUT",
- "USER_DEFINED",
- "",
- this->protocol_.c_str (),
- 0);
-
- flow_spec [1] = CORBA::string_dup (entry1.entry_to_string ());
-
- // Register the sender mmdevice object with the ORB
- ACE_NEW_RETURN (this->sender_mmdevice_,
- TAO_MMDevice (&this->endpoint_strategy_),
- -1);
-
- // Servant Reference Counting to manage lifetime
- PortableServer::ServantBase_var safe_mmdevice =
- this->sender_mmdevice_;
-
- AVStreams::MMDevice_var mmdevice =
- this->sender_mmdevice_->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- ACE_NEW_RETURN (this->streamctrl_,
- TAO_StreamCtrl,
- -1);
-
- PortableServer::ServantBase_var safe_streamctrl =
- this->streamctrl_;
-
- // Bind/Connect the sender and receiver MMDevices.
- CORBA::Boolean bind_result =
- this->streamctrl_->bind_devs (mmdevice.in (),
- this->receiver_mmdevice_.in (),
- the_qos.inout (),
- flow_spec
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (bind_result == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "streamctrl::bind_devs failed\n"),
- -1);
-
- return 0;
-}
-
-// Method to send data at the specified rate
-int
-Sender::pace_data (ACE_ENV_SINGLE_ARG_DECL)
-{
- // The time that should lapse between two consecutive frames sent.
- ACE_Time_Value inter_frame_time;
-
- // The time between two consecutive frames.
- inter_frame_time.set (1 / (double) this->frame_rate_);
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "Frame Rate = %d / second\n"
- "Inter Frame Time = %d (msec)\n",
- this->frame_rate_,
- inter_frame_time.msec ()));
-
- ACE_TRY
- {
- // The time taken for sending a frame and preparing for the next frame
- ACE_High_Res_Timer elapsed_timer;
-
- // Continue to send data till the file is read to the end.
- while (1)
- {
- // Read from the file into a message block.
- int n = ACE_OS::fread (this->mb_.wr_ptr (),
- 1,
- this->mb_.size (),
- this->input_file_);
-
- if (n < 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Sender::pace_data fread failed\n"),
- -1);
-
- if (n == 0)
- {
- // At end of file break the loop and end the sender.
- ACE_DEBUG ((LM_DEBUG,"Handle_Start:End of file\n"));
- this->eof_ = 1;
- break;
- }
-
- this->mb_.wr_ptr (n);
-
- if (this->frame_count_ > 1)
- {
- //
- // Second frame and beyond
- //
-
- // Stop the timer that was started just before the previous frame was sent.
- elapsed_timer.stop ();
-
- // Get the time elapsed after sending the previous frame.
- ACE_Time_Value elapsed_time;
- elapsed_timer.elapsed_time (elapsed_time);
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "Elapsed Time = %d\n",
- elapsed_time.msec ()));
-
- // Check to see if the inter frame time has elapsed.
- if (elapsed_time < inter_frame_time)
- {
- // Inter frame time has not elapsed.
-
- // Calculate the time to wait before the next frame needs to be sent.
- ACE_Time_Value wait_time (inter_frame_time - elapsed_time);
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "Wait Time = %d\n",
- wait_time.msec ()));
-
- // Run the orb for the wait time so the sender can
- // continue other orb requests.
- TAO_AV_CORE::instance ()->orb ()->run (wait_time
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- }
-
- // Start timer before sending the frame.
- elapsed_timer.start ();
-
- // Send frame.
- int result =
- this->protocol_object_->send_frame (&this->mb_);
-
- if (result < 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "send failed:%p",
- "Sender::pace_data send\n"),
- -1);
-
- ACE_DEBUG ((LM_DEBUG,
- "Sender::pace_data frame %d was sent succesfully\n",
- ++this->frame_count_));
-
- // Reset the message block.
- this->mb_.reset ();
-
- } // end while
-
- // File reading is complete, destroy the stream.
- AVStreams::flowSpec stop_spec;
- this->streamctrl_->destroy (stop_spec
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Shut the orb down.
- //TAO_AV_CORE::instance ()->orb ()->shutdown (1,
- // ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- //ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- // "Sender::pace_data Failed\n");
- return -1;
- }
- ACE_ENDTRY;
- return 0;
-}
-
-int
-main (int argc,
- char **argv)
-{
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- CORBA::ORB_var orb =
- CORBA::ORB_init (argc,
- argv,
- 0
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- CORBA::Object_var obj
- = orb->resolve_initial_references ("RootPOA"
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Get the POA_var object from Object_var
- PortableServer::POA_var root_poa
- = PortableServer::POA::_narrow (obj.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- PortableServer::POAManager_var mgr
- = root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Initialize the AV Stream components.
-/* TAO_AV_CORE::instance ()->init (orb.in (),
- root_poa.in ()
- ACE_ENV_ARG_PARAMETER); */
- ACE_TRY_CHECK;
-
- // Initialize the AVStreams components.
- TAO_AV_CORE::instance ()->init (orb.in (), root_poa.in () ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Initialize the Sender.
- int result = 0;
- result = SENDER::instance ()->init (argc,
- argv
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (result < 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Sender::init failed\n"),
- -1);
-
- // Make sure we have a valid <output_file>
- output_file = ACE_OS::fopen (output_file_name,
- "w");
- if (output_file == 0)
- ACE_ERROR_RETURN ((LM_DEBUG,
- "Cannot open output file %s\n",
- output_file_name),
- -1);
-
- else
- ACE_DEBUG ((LM_DEBUG,
- "File Opened Successfully\n"));
-
- // Start sending data.
- result = SENDER::instance ()->pace_data (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- ACE_Time_Value tv(3,0);
- orb->run (tv);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Sender Failed\n");
- return -1;
- }
- ACE_ENDTRY;
- ACE_CHECK_RETURN (-1);
-
- SENDER::close (); // Explicitly finalize the Unmanaged_Singleton.
-
- return 0;
-}
-
-#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
-template ACE_Unmanaged_Singleton<Sender, ACE_Null_Mutex> *ACE_Unmanaged_Singleton<Sender, ACE_Null_Mutex>::singleton_;
-#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/sender.h b/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/sender.h
deleted file mode 100644
index 16a78c88b96..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/Bidirectional_Flows/sender.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/orbsvcs/tests/AVStreams/Simple
-//
-// = FILENAME
-// sender.h
-//
-// = DESCRIPTION
-// This application reads data from a file and sends it to s
-// receiver.
-//
-// = AUTHOR
-// Yamuna Krishnamurthy <yamuna@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "orbsvcs/Naming/Naming_Client.h"
-#include "orbsvcs/AV/AVStreams_i.h"
-#include "orbsvcs/AV/Endpoint_Strategy.h"
-#include "orbsvcs/AV/Protocol_Factory.h"
-
-class Sender_Callback : public TAO_AV_Callback
-{
- // = TITLE
- // Application defined callback object.
- //
- // = DESCRIPTION
- // AVStreams calls this class when data shows up from a sender.
-public:
-
- Sender_Callback (void);
- // Constructor.
-
- // Method that is called when there is data to be received from a
- // sender.
- int receive_frame (ACE_Message_Block *frame,
- TAO_AV_frame_info *frame_info,
- const ACE_Addr &peer_address);
-
- // Called when the sender is done sending data and wants to close
- // down the connection.
- // int handle_destroy (void);
-
-private:
- int frame_count_;
- // Keeping a count of the incoming frames.
-};
-
-class Sender_StreamEndPoint : public TAO_Client_StreamEndPoint
-{
- // = TITLE
- // Defines a sender stream endpoint.
-public:
- int get_callback (const char *flowname,
- TAO_AV_Callback *&callback);
- // Create the application callback and return its handle to
- // AVStreams for further application callbacks.
-
- int set_protocol_object (const char *flowname,
- TAO_AV_Protocol_Object *object);
- // Set protocol object corresponding to the transport protocol
- // chosen.
-
-protected:
- Sender_Callback callback_;
- // Application callback.
-};
-
-typedef TAO_AV_Endpoint_Reactive_Strategy_A
- <Sender_StreamEndPoint,
- TAO_VDev,
- AV_Null_MediaCtrl>
- SENDER_ENDPOINT_STRATEGY;
-
-class Sender
-{
- // = TITLE
- // Sender Application.
- //
- // = DESCRIPTION
- // Class is responsible for streaming (and pacing) data to a
- // receiver.
-public:
- Sender (void);
- // Constructor
-
- int init (int argc,
- char **argv
- ACE_ENV_ARG_DECL_NOT_USED);
- // Method to initialize the various data components.
-
- int pace_data (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
- // Method to pace and send data from a file.
-
- void protocol_object (TAO_AV_Protocol_Object *protocol_object);
- // Set the protocol object corresponding to the transport protocol chosen.
-
- int eof (void);
-
- void shutdown (void);
-
-private:
- int parse_args (int argc, char **argv);
- // Method to parse the command line arguments.
-
- int bind_to_receiver (ACE_ENV_SINGLE_ARG_DECL);
- // Method that binds the sender to the receiver.
-
- SENDER_ENDPOINT_STRATEGY endpoint_strategy_;
- // The endpoint strategy used by the sender.
-
- AVStreams::MMDevice_var receiver_mmdevice_;
- // The receiver MMDevice that the sender connects to.
-
- TAO_MMDevice *sender_mmdevice_;
- // The sender MMDevice.
-
- TAO_StreamCtrl *streamctrl_;
- // Stream controller
-
- int frame_count_;
- // Number of frames sent.
-
- ACE_CString filename_;
- // File from which data is read.
-
- TAO_Naming_Client naming_client_;
- // The Naming Service client.
-
- FILE *input_file_;
- // File handle of the file read from.
-
- ACE_CString protocol_;
- // Selected protocol - default is UDP
-
- int frame_rate_;
- // Rate at which the data will be sent.
-
- ACE_Message_Block mb_;
- // Message block into which data is read from a file and then sent.
-
- TAO_AV_Protocol_Object *protocol_object_;
- // Protocol object corresponding to the transport protocol selected.
-
- int eof_;
-};