diff options
author | yamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-06 00:52:43 +0000 |
---|---|---|
committer | yamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-06 00:52:43 +0000 |
commit | 1a08b1500ae661322541892eef055f4f409d4e83 (patch) | |
tree | 3c2bfd5a9d9513aa773ef3e2b904d25ae763eea5 | |
parent | bcecd87e5af4d2883d9c73274e45549c1b8708dc (diff) | |
download | ATCD-1a08b1500ae661322541892eef055f4f409d4e83.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/AVStreams/Simple/README | 45 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/AVStreams/Simple/ftp.cpp | 448 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/AVStreams/Simple/ftp.h | 172 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/AVStreams/Simple/run_test.pl | 68 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/AVStreams/Simple/server.h | 94 |
6 files changed, 833 insertions, 6 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index b6d012e916c..cfd2ea20092 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -93,12 +93,12 @@ Mon Mar 5 07:59:00 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de> Mon Mar 5 04:42:52 2001 Yamuna Krishnamurthy <yamuna@cs.wustl.edu> - * orbsvcs/tests/AVStreams/Comp_Test/ftp.h: - * orbsvcs/tests/AVStreams/Comp_Test/ftp.cpp: - * orbsvcs/tests/AVStreams/Comp_Test/server.h: - * orbsvcs/tests/AVStreams/Comp_Test/server.cpp: - * orbsvcs/tests/AVStreams/Comp_Test/README: - * orbsvcs/tests/AVStreams/Comp_Test/run_test.pl: + * orbsvcs/tests/AVStreams/Simple/ftp.h: + * orbsvcs/tests/AVStreams/Simple/ftp.cpp: + * orbsvcs/tests/AVStreams/Simple/server.h: + * orbsvcs/tests/AVStreams/Simple/server.cpp: + * orbsvcs/tests/AVStreams/Simple/README: + * orbsvcs/tests/AVStreams/Simple/run_test.pl: Added a new test to the AVStreams tests in order to demonstrate the use of AVStreams Service to pace data at a specified frame rate. diff --git a/TAO/orbsvcs/tests/AVStreams/Simple/README b/TAO/orbsvcs/tests/AVStreams/Simple/README new file mode 100644 index 00000000000..ff61685cb04 --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/Simple/README @@ -0,0 +1,45 @@ +// $Id$ + +Description +----------- + +This directory contains a simple test in the form of a ftp client and server. +The test has the following features. + +1. It tests the AVStreams Pluggable Protocol Framework +2. Shows a mechanism to pace data. +3. Performs benchmarking. + +Running the test +---------------- + +server +------ + +server -f <output_filename> + +-f <output_filename> -> The name of the file under which the received stream + data has to be stored. + +ftp: +---- + +ftp [-f <filename>] [-a <address>] [-p <protocol>] [-s] [-r <frame rate>] [-d] + + +-f filename --> The file to be streamed to the server. It is currently + streamed at the rate of 0.5kbytes/s. + +-a address --> Multicast address or the host on which the client is running + Default is multicast address + +-p protocol --> The protocol string could be UDP or TCP. But with the + multicast address it should be UDP. + +-s --> flag to use SFP. This option cannot be used with -p + TCP since SFP currently runs only over UDP. + +-r framerate--> The rate at which tha data frames need to be sent. + +-d --> Increament the TAO_debug_level for debug messages. + diff --git a/TAO/orbsvcs/tests/AVStreams/Simple/ftp.cpp b/TAO/orbsvcs/tests/AVStreams/Simple/ftp.cpp new file mode 100644 index 00000000000..ce3b165a4cb --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/Simple/ftp.cpp @@ -0,0 +1,448 @@ +// $Id$ + +#include "ftp.h" +#include "ace/Get_Opt.h" +#include "ace/High_Res_Timer.h" + +ACE_High_Res_Timer last_frame_sent_time; +// The time taken for sending a frmae and preparing for the next frame + +ACE_Time_Value inter_frame_time; +// The time that should lapse between two consecutive frames sent. + +FTP_Client_Callback::FTP_Client_Callback (void) +{ +} + +FTP_Client_StreamEndPoint::FTP_Client_StreamEndPoint (void) +{ +} + +int +FTP_Client_StreamEndPoint::get_callback (const char *, + TAO_AV_Callback *&callback) +{ + // Create and return the clienmt application callback and return to the AVStreams + // for further upcalls. + callback = &this->callback_; + return 0; +} + +int +FTP_Client_StreamEndPoint::set_protocol_object (const char *, + TAO_AV_Protocol_Object *object) +{ + // Set the client protocol object corresponding to the transport protocol selected. + CLIENT::instance ()->set_protocol_object (object); + return 0; +} + +Client::Client (void) + :client_mmdevice_ (&endpoint_strategy_), + count_ (0), + address_ (ACE_OS::strdup ("224.9.9.2:12345")), + fp_ (0), + protocol_ (ACE_OS::strdup ("UDP")), + frame_rate_ (30) +{ + this->mb.size (BUFSIZ); +} + +void +Client::set_protocol_object (TAO_AV_Protocol_Object *object) +{ + // Set the client protocol object corresponding to the transport protocol selected. + this->protocol_object_ = object; +} + +int +Client::parse_args (int argc, + char **argv) +{ + // Parse command line arguments + ACE_Get_Opt opts (argc,argv,"f:a:p:r:sd"); + + this->use_sfp_ = 0; + + int c; + while ((c= opts ()) != -1) + { + switch (c) + { + case 'f': + this->filename_ = ACE_OS::strdup (opts.optarg); + break; + case 'a': + this->address_ = ACE_OS::strdup (opts.optarg); + break; + case 'p': + this->protocol_ = ACE_OS::strdup (opts.optarg); + break; + case 'r': + this->frame_rate_ = ACE_OS::atoi (opts.optarg); + break; + case 's': + this->use_sfp_ = 1; + break; + case 'd': + TAO_debug_level++; + break; + default: + ACE_DEBUG ((LM_DEBUG,"Unknown Option\n")); + return -1; + } + } + return 0; +} + +FILE * +Client::file (void) +{ + return this->fp_; +} + +char* +Client::flowname (void) +{ + return this->flowname_; +} + +TAO_StreamCtrl* +Client::streamctrl (void) +{ + return &this->streamctrl_; +} + + +int +Client::frame_rate (void) +{ + return this->frame_rate_; +} + + +// Method to get the object reference of the server +int +Client::bind_to_server (CORBA::Environment &ACE_TRY_ENV) +{ + // Initialize the naming services + if (my_naming_client_.init (TAO_AV_CORE::instance ()->orb ()) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize " + "the TAO_Naming_Client. \n"), + -1); + + CosNaming::Name server_mmdevice_name (1); + server_mmdevice_name.length (1); + server_mmdevice_name [0].id = CORBA::string_dup ("Server_MMDevice"); + + // Resolve the server object reference from the Naming Service + CORBA::Object_var server_mmdevice_obj = + my_naming_client_->resolve (server_mmdevice_name, + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + this->server_mmdevice_ = + AVStreams::MMDevice::_narrow (server_mmdevice_obj.in (), + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (this->server_mmdevice_.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + "Could not resolve Server_MMdevice in Naming service <%s>\n"), + -1); + + return 0; +} + +int +Client::init (int argc, + char **argv, + CORBA::Environment& ACE_TRY_ENV) +{ + this->argc_ = argc; + this->argv_ = argv; + + CORBA::String_var ior; + + // Initialize the endpoint strategy with the orb and poa. + this->endpoint_strategy_.init(TAO_AV_CORE::instance ()->orb (), + TAO_AV_CORE::instance ()->poa ()); + + // Parse the command line arguments + this->parse_args (argc, + argv); + + + // Open file to read. + this->fp_ = ACE_OS::fopen (this->filename_, + "r"); + if (this->fp_ == 0) + ACE_ERROR_RETURN ((LM_DEBUG, + "Cannot open output file %s\n", + this->filename_), + -1); + + // Resolve the object reference of the server from the Naming Service. + if (this->bind_to_server (ACE_TRY_ENV) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) Error binding to the naming service\n"), + -1); + + // Create the Flow protocol name + char flow_protocol_str [BUFSIZ]; + if (this->use_sfp_) + ACE_OS::strcpy (flow_protocol_str, + "sfp:1.0"); + else + ACE_OS::strcpy (flow_protocol_str, + ""); + + // Initialize the QoS + AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS); + + // Set the address of the ftp client. + ACE_INET_Addr addr (this->address_); + + // Initialize the flowname + ACE_NEW_RETURN (this->flowname_, + char [BUFSIZ], + 0); + + ACE_OS::sprintf (this->flowname_, + "Data_%s", + this->protocol_); + + // Create the forward flow specification to describe the flow. + TAO_Forward_FlowSpec_Entry entry (this->flowname_, + "IN", + "USER_DEFINED", + flow_protocol_str, + this->protocol_, + &addr); + + AVStreams::flowSpec flow_spec (1); + flow_spec [0] = CORBA::string_dup (entry.entry_to_string ()); + flow_spec.length (1); + + // Bind/Connect the client and server MMDevices. + CORBA::Boolean result = + this->streamctrl_.bind_devs (this->client_mmdevice_._this (ACE_TRY_ENV), + this->server_mmdevice_.in (), + the_qos.inout (), + flow_spec, + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + if (result == 0) + ACE_ERROR_RETURN ((LM_ERROR,"streamctrl::bind_devs failed\n"),-1); + + return 0; +} + +// Method to send data at the specified rate +int +Client::pace_data (CORBA::Environment& ACE_TRY_ENV) +{ + + // Time within which a frame should be sent. + double frame_time = 1/ (double) this->frame_rate_; + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "Frame Time ONE = %f\n Frame Rate = %d\n", + frame_time, + this->frame_rate_)); + + // The time between two consecutive frames. + inter_frame_time.set (frame_time); + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "Inter Frame Time = %d\n", + inter_frame_time.msec ())); + + ACE_TRY + { + + // Continue to send data till the file is read to the end. + while (1) + { + // Count the frames sent. + count_++; + + // Read from the file into a message block. + int n = ACE_OS::fread(this->mb.rd_ptr (), + 1, + this->mb.size (), + CLIENT::instance ()->file ()); + + if (n < 0) + ACE_ERROR_RETURN ((LM_ERROR, + "FTP_Client_Flow_Handler::fread end of file\n"), + -1); + + if (n == 0) + { + if (feof (CLIENT::instance ()->file ())) + { + // At end of file break the loop and end the client. + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG,"Handle_Start:End of file\n")); + break; + } + + } + + this->mb.wr_ptr (n); + + if ( this->count_ > 1) + { + // Greater than the first frame. + + // Stop the timer that was started just before the previous frame was sent. + last_frame_sent_time.stop (); + + // Get the time elapsed after sending the previous frame. + ACE_Time_Value tv; + last_frame_sent_time.elapsed_time (tv); + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "Elapsed Time = %d\n", + tv.msec ())); + + // Check to see if the inter frame time has elapsed. + if (tv < inter_frame_time) + { + // Inter frame time has not elapsed. + + // Claculate the time to wait before the next frame needs to be sent. + ACE_Time_Value wait_time (inter_frame_time - tv); + + 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 client can continue other orb requests. + TAO_AV_CORE::instance ()->orb ()->run (wait_time, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + } + + // Start timer before sending the frame. + last_frame_sent_time.start (); + + // Send frame. + int result = this->protocol_object_->send_frame (&this->mb); + if (result < 0) + ACE_ERROR_RETURN ((LM_ERROR, + "send failed:%p","FTP_Client_Flow_Handler::send\n"), + -1); + ACE_DEBUG ((LM_DEBUG,"Client::pace_data buffer sent succesfully\n")); + + // Reset the mb. + this->mb.reset (); + + } // end while + + // Since the file is read stop the stream. + AVStreams::flowSpec stop_spec (1); + CLIENT::instance ()->streamctrl ()->destroy (stop_spec, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Shut the orb down. + TAO_AV_CORE::instance ()->orb ()->shutdown (0); + ACE_TRY_CHECK; + + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Client::pace_data Failed"); + 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_TRY_ENV); + CORBA::Object_var obj + = orb->resolve_initial_references ("RootPOA", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + + //Get the POA_var object from Object_var + PortableServer::POA_var root_poa + = PortableServer::POA::_narrow (obj.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + PortableServer::POAManager_var mgr + = root_poa->the_POAManager (ACE_TRY_ENV); + ACE_TRY_CHECK; + + mgr->activate (ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Initialize the AV STream components. + TAO_AV_CORE::instance ()->init (orb.in (), + root_poa.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // INitialize the Client. + int result = 0; + result = CLIENT::instance ()->init (argc, + argv, + ACE_TRY_ENV); + if (result < 0) + ACE_ERROR_RETURN ((LM_ERROR, + "client::init failed\n"),1); + + // Start sending data. + result = CLIENT::instance ()->pace_data (ACE_TRY_ENV); + ACE_TRY_CHECK; + + orb->destroy (ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + } + ACE_CATCHANY + + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"Client Failed\n"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Singleton <Client,ACE_Null_Mutex>; +template class +TAO_AV_Endpoint_Reactive_Strategy_A<FTP_Client_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl>; +template class +TAO_AV_Endpoint_Reactive_Strategy<FTP_Client_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Singleton <Client,ACE_Null_Mutex> +#pragma instantiate +TAO_AV_Endpoint_Reactive_Strategy_A<FTP_Client_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl> +#pragma instantiate +TAO_AV_Endpoint_Reactive_Strategy<FTP_Client_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/TAO/orbsvcs/tests/AVStreams/Simple/ftp.h b/TAO/orbsvcs/tests/AVStreams/Simple/ftp.h new file mode 100644 index 00000000000..48c43359aa4 --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/Simple/ftp.h @@ -0,0 +1,172 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/orbsvcs/tests/AVStreams/Simple +// +// = FILENAME +// ftp.h +// +// = DESCRIPTION +// Ftp client to send data +// +// = AUTHOR +// Yamuna Krishnamurthy <yamuna@cs.wustl.edu> +// +// ============================================================================ + + +#ifndef TAO_AV_FTP_H +#define TAO_AV_FTP_H + +#include "ace/Get_Opt.h" +#include "orbsvcs/Naming/Naming_Utils.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 FTP_Client_Callback : public TAO_AV_Callback +{ + // = TITLE + // Defines the client applcation callback. + // + // = DESCRIPTION + // This class can override the methods of + // the TAO_AV_Callback to do application + // specific processing. +public: + FTP_Client_Callback (void); + //Constructor +}; + + +class FTP_Client_StreamEndPoint : public TAO_Client_StreamEndPoint +{ + // = TITLE + // Defines the client stream endpoint. + // + // = DESCRIPTION + // This class overrides the methods of TAO_ClientStreamendpoint + // so the application can perform its processing during post and pre + // connection set up. + +public: + FTP_Client_StreamEndPoint (void); + //Contructor + + virtual int get_callback (const char *flowname, + TAO_AV_Callback *&callback); + // Create the application client callback and return its handle to the + // AVSTreams for further application callbacks + + virtual int set_protocol_object (const char *flowname, + TAO_AV_Protocol_Object *object); + // Set protocol object corresponding to the transport protocol chosen. + +protected: + FTP_Client_Callback callback_; + // reference to the cllient application callback. +}; + +typedef TAO_AV_Endpoint_Reactive_Strategy_A <FTP_Client_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl> ENDPOINT_STRATEGY; + + +class Client +{ + // = TITLE + // Defines the Client Application + // + // = DESCRIPTION + // The actual client program that acts as the ftp client that streams data + // to the ftp servers that are waiting for data. +public: + Client (void); + // Constructor + + int init (int argc, + char **argv, + CORBA::Environment&); + // Method to initialize the various data components. + + void set_protocol_object (TAO_AV_Protocol_Object *protocol_object); + // Set the protocol object corresponding to the transport protocol chosen. + + int pace_data (CORBA::Environment&); + // Method to pace and send data from a file. + + FILE *file (void); + // File handle from which data is read to be sent. + + TAO_StreamCtrl* streamctrl (void); + // The stream control interface that manages the stream set up + + char *flowname (void); + // name of the flow set up. + + int frame_rate (void); + // The requested frame rate for sending each frame of data read from the file. + +private: + int parse_args (int argc, char **argv); + // Method to parse the command line arguments. + + int bind_to_server (CORBA::Environment& ACE_TRY_ENV); + // Method that binds the ftp client to the server + + ENDPOINT_STRATEGY endpoint_strategy_; + // The reacfive strategy of the client. + + AVStreams::MMDevice_var server_mmdevice_; + // The server MMDevice that the ftpo client connects to + + TAO_MMDevice client_mmdevice_; + // The ftp client MMDevice. + + TAO_StreamCtrl streamctrl_; + // Video stream controller + + int count_; + // Number of frames sent. + + int argc_; + char **argv_; + + const char *filename_; + // File from which data is read. + + const char *address_; + // Address of the ftp client host machine or a multicast address - Default is + // UDP multicast addess + + TAO_Naming_Client my_naming_client_; + // The Naming Service client. + + FILE *fp_; + // File handle of the file read from. + + char *protocol_; + // Selected protocol - default is UDP + + char *flowname_; + + int use_sfp_; + // If set to 1 then use sfp as the flow carrier protocol. + + int frame_rate_; + + 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. + +}; + +typedef ACE_Singleton<Client,ACE_Null_Mutex> CLIENT; + +#endif /* TAO_AV_FTP_H */ + diff --git a/TAO/orbsvcs/tests/AVStreams/Simple/run_test.pl b/TAO/orbsvcs/tests/AVStreams/Simple/run_test.pl new file mode 100755 index 00000000000..9c507bb244c --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/Simple/run_test.pl @@ -0,0 +1,68 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../../../../bin'; +use PerlACE::Run_Test; + +# amount of delay between running the servers + +$sleeptime = 6; +$status = 0; + +$nsior = PerlACE::LocalFile ("ns.ior"); +$testfile = PerlACE::LocalFile ("test"); +$makefile = PerlACE::LocalFile ("Makefile"); + +unlink $nsior; + +$NS = new PerlACE::Process ("../../../Naming_Service/Naming_Service", "-o $nsior"); +$SV = new PerlACE::Process ("server", "-ORBInitRef NameService=file://$nsior -f $testfile"); +$CL = new PerlACE::Process ("ftp", "-ORBInitRef NameService=file://$nsior -f $makefile"); + +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 Server\n"; + +$SV->Spawn (); + +sleep $sleeptime; + +print STDERR "Starting Client\n"; + +$client = $CL->SpawnWaitKill (60); + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +$server = $SV->TerminateWaitKill (5); + +if ($server != 0) { + print STDERR "ERROR: server returned $server\n"; + $status = 1; +} + +$nserver = $NS->TerminateWaitKill (5); + +if ($nserver != 0) { + print STDERR "ERROR: Naming Service returned $nserver\n"; + $status = 1; +} + +unlink $nsior; +unlink $testfile; + +exit $status; diff --git a/TAO/orbsvcs/tests/AVStreams/Simple/server.h b/TAO/orbsvcs/tests/AVStreams/Simple/server.h new file mode 100644 index 00000000000..8e25fe7437b --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/Simple/server.h @@ -0,0 +1,94 @@ +/* -*- C++ -*- */ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// TAO/orbsvcs/tests/AVStreams/Simple +// +// = FILENAME +// ftp.h +// +// = DESCRIPTION +// Ftp server to receive data +// +// = AUTHOR +// Yamuna Krishnamurthy <yamuna@cs.wustl.edu> +// +// ============================================================================ + +#include "orbsvcs/Naming/Naming_Utils.h" +#include "orbsvcs/AV/AVStreams_i.h" +#include "orbsvcs/AV/Endpoint_Strategy.h" +#include "orbsvcs/AV/Policy.h" + + +class FTP_Server_Callback : public TAO_AV_Callback +{ + // = TITLE + // Defines a class for the server application callback. + // + // = DESCRIPTION + // This class overides the methods of the TAO_AV_Callback so the + // AVStreams can make upcalls to the application. + +public: + + // Method that is called when there is data to be received from the ftp client. + int receive_frame (ACE_Message_Block *frame, + TAO_AV_frame_info *frame_info, + const ACE_Addr &peer_address); + + // Called when the ftp client has finished reading the file and wants + // to close4 down the connection. + int handle_destroy (void); +}; + +class FTP_Server_StreamEndPoint : public TAO_Server_StreamEndPoint +{ + // = TITLE + // Defines the aplication stream endpoint + // + // = DESCRIPTION + // This is the class that overrides the tao_server_enpodint to handle + // pre and post connect processing. +public: + // Create the server application callback. + int get_callback (const char *flowname, + TAO_AV_Callback *&callback); + +private: + FTP_Server_Callback callback_; + // reference to the server application callback. +}; + +class Server +{ + // = TITLE + // Defines the server application class. + // + // = DESCRIPOTION + // The actual server progarm that acts as the ftp server that receives data + // sent by the ftp client. +public: + Server (void); + // Constructor + + ~Server (void); + // Deestructor. + + int init (int argc, + char **argv, + CORBA::Environment &); + // Initialize data components. + +protected: + TAO_Naming_Client my_naming_client_; + // The Naming Service Client. + + TAO_AV_Endpoint_Reactive_Strategy_B + <FTP_Server_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl> reactive_strategy_; + // The endpoint reacxtive strategy. + + TAO_MMDevice *mmdevice_; + // The server MMDevice. +}; |