Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Pluggable / ftp.h
blobf7d997fb99c4d3c2f17f008959356429c0272683
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file ftp.h
7 * Ftp client to send data
9 * @author Yamuna Krishnamurthy <yamuna@cs.wustl.edu>
11 //=============================================================================
14 #ifndef TAO_AV_FTP_H
15 #define TAO_AV_FTP_H
17 #include "ace/Get_Opt.h"
18 #include "orbsvcs/Naming/Naming_Client.h"
19 #include "orbsvcs/AV/AVStreams_i.h"
20 #include "orbsvcs/AV/Endpoint_Strategy.h"
21 #include "orbsvcs/AV/Policy.h"
22 #include "orbsvcs/AV/Protocol_Factory.h"
25 /**
26 * @class FTP_Client_Callback
28 * @brief Defines the client applcation callback.
30 * This class can override the methods of
31 * the TAO_AV_Callback to do application
32 * specific processing.
34 class FTP_Client_Callback : public TAO_AV_Callback
36 public:
37 ///Constructor
38 FTP_Client_Callback ();
42 /**
43 * @class FTP_Client_StreamEndPoint
45 * @brief Defines the client stream endpoint.
47 * This class overrides the methods of TAO_ClientStreamendpoint
48 * so the application can perform its processing during post and pre
49 * connection set up.
51 class FTP_Client_StreamEndPoint : public TAO_Client_StreamEndPoint
53 public:
54 /// Constructor
55 FTP_Client_StreamEndPoint ();
57 /// Create the application client callback and return its handle to the
58 /// AVStreams for further application callbacks
59 virtual int get_callback (const char *flowname,
60 TAO_AV_Callback *&callback);
62 /// Set protocol object corresponding to the transport protocol chosen.
63 virtual int set_protocol_object (const char *flowname,
64 TAO_AV_Protocol_Object *object);
66 protected:
67 /// reference to the cllient application callback.
68 FTP_Client_Callback callback_;
71 typedef TAO_AV_Endpoint_Reactive_Strategy_A <FTP_Client_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl> ENDPOINT_STRATEGY;
74 /**
75 * @class Client
77 * @brief Defines the Client Application
79 * The actual client program that acts as the ftp client that streams data
80 * to the ftp servers that are waiting for data.
82 class Client
84 public:
85 /// Constructor
86 Client ();
88 /// Method to initialize the various data components.
89 int init (int argc,
90 ACE_TCHAR *argv[]);
92 /// Set the protocol object corresponding to the transport protocol chosen.
93 void set_protocol_object (TAO_AV_Protocol_Object *protocol_object);
95 /// Method to pace and send data from a file.
96 int pace_data ();
98 /// File handle from which data is read to be sent.
99 FILE *file ();
101 /// The stream control interface that manages the stream set up
102 TAO_StreamCtrl* streamctrl ();
104 /// name of the flow set up.
105 char *flowname ();
107 /// The requested frame rate for sending each frame of data read from the file.
108 int frame_rate ();
110 private:
111 /// Method to parse the command line arguments.
112 int parse_args (int argc, ACE_TCHAR *argv[]);
114 /// Method that binds the ftp client to the server
115 int bind_to_server ();
117 /// The reacfive strategy of the client.
118 ENDPOINT_STRATEGY endpoint_strategy_;
120 /// The server MMDevice that the ftpo client connects to
121 AVStreams::MMDevice_var server_mmdevice_;
123 /// The ftp client MMDevice.
124 TAO_MMDevice client_mmdevice_;
126 /// Video stream controller
127 TAO_StreamCtrl streamctrl_;
129 /// Number of frames sent.
130 int count_;
132 int argc_;
133 ACE_TCHAR **argv_;
135 /// File from which data is read.
136 const char *filename_;
138 /// Address of the ftp client host machine or a multicast address - Default is
139 /// UDP multicast addess
140 const char *address_;
141 const char *peer_addr_str_;
143 /// The Naming Service client.
144 TAO_Naming_Client my_naming_client_;
146 /// File handle of the file read from.
147 FILE *fp_;
149 /// Selected protocol - default is UDP
150 char *protocol_;
152 char *flowname_;
154 /// If set to 1 then use sfp as the flow carrier protocol.
155 int use_sfp_;
157 int frame_rate_;
159 /// Message block into which data is read from a file and then sent.
160 ACE_Message_Block mb;
162 /// Protocol object corresponding to the transport protocol selected.
163 TAO_AV_Protocol_Object* protocol_object_;
166 typedef ACE_Unmanaged_Singleton<Client,ACE_Null_Mutex> CLIENT;
168 #endif /* TAO_AV_FTP_H */