CmdClient.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef CmdClient_h
00034 #define CmdClient_h 1
00035
00036 #include <iostream>
00037 #include <string>
00038 #include <fstream>
00039
00040 using std::ostream ;
00041 using std::ifstream ;
00042 using std::string ;
00043
00044 #include "BESObj.h"
00045
00046 class PPTClient ;
00047
00075 class CmdClient : public BESObj
00076 {
00077 private:
00078 PPTClient * _client ;
00079 ostream * _strm ;
00080 bool _strmCreated ;
00081 bool _isInteractive ;
00082
00083 size_t readLine( string &str ) ;
00084 void displayHelp() ;
00085 void executeCommand( const string &cmd,
00086 int repeat ) ;
00087 public:
00088 CmdClient( )
00089 : _client( 0 ),
00090 _strm( 0 ),
00091 _strmCreated( false ),
00092 _isInteractive( false ) {}
00093 ~CmdClient() ;
00094
00095 void startClient( const string &host,
00096 int portVal,
00097 int timeout ) ;
00098 void startClient( const string &unixSocket,
00099 int timeout ) ;
00100 void shutdownClient() ;
00101 void setOutput( ostream *strm, bool created ) ;
00102 void executeClientCommand( const string &cmd ) ;
00103 void executeCommands( const string &cmd,
00104 int repeat ) ;
00105 void executeCommands( ifstream &inputFile,
00106 int repeat ) ;
00107 void interact() ;
00108 bool isConnected() ;
00109 void brokenPipe() ;
00110
00111 virtual void dump( ostream &strm ) const ;
00112 } ;
00113
00114 #endif // CmdClient_h
00115