00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4SERVERTASK_H
00017 #define TGO4SERVERTASK_H
00018
00019 #include "Go4ThreadManager/TGo4ThreadManager.h"
00020 #include "Go4CommandsBase/TGo4CommandReceiver.h"
00021 #include "Go4CommandsTaskHandler/Go4CommandsTaskHandler.h"
00022 #include "Go4TaskHandler/TGo4TaskConnectorTimer.h"
00023 #include "TGo4Task.h"
00024 #include "Rtypes.h"
00025 #include <Rtypes.h>
00026
00027 class TGo4TaskManager;
00028 class TGo4TaskHandler;
00029 class TGo4BufferQueue;
00030 class TGo4ObjectQueue;
00031 class TGo4Command;
00032 class TGo4Socket;
00033 class TGo4Status;
00034
00035 class TGo4ServerTask : public TGo4Task {
00036 public:
00037
00038 TGo4ServerTask(const char* name,
00039 UInt_t negotiationport=0,
00040 Bool_t blockingmode=kFALSE,
00041 Bool_t standalone=kFALSE,
00042 Bool_t autostart=kTRUE,
00043 Bool_t autocreate=kTRUE,
00044 Bool_t ismaster=kTRUE);
00045
00046 virtual ~TGo4ServerTask();
00047
00052 virtual void Quit();
00053
00058 void Shutdown();
00059
00074 virtual Int_t LaunchClient(const char* name,
00075 const char* remotehost=0,
00076 const char* remotedir=0,
00077 const char* remotecommand=0,
00078 Int_t mode=0);
00079
00080 TGo4TaskManager* GetTaskManager();
00081
00083 TGo4TaskHandler* GetCurrentTaskHandler();
00084
00086 TGo4TaskHandler* GetTaskHandler();
00087
00089 TGo4TaskHandler* GetTaskHandler(const char* name);
00090
00091 TGo4BufferQueue* GetCommandQueue(const char* task=0);
00092
00093 TGo4BufferQueue* GetStatusQueue(const char* task=0);
00094
00095 TGo4BufferQueue* GetDataQueue(const char* task=0);
00096
00101 virtual TGo4Command* NextCommand();
00102
00103
00107 virtual void SendStatus(TGo4Status * stat, const char* receiver=0);
00108
00110 virtual void SendStatusBuffer();
00111
00117 virtual Bool_t StartConnectorThread();
00118
00129 virtual Bool_t StopConnectorThread();
00130
00135 Bool_t ConnectorThreadIsStopped();
00136
00140 void SetCurrentTask(const char* name);
00141
00142 void SetConnect(TGo4Socket * trans, const char* host, UInt_t port, Bool_t keepserv=kFALSE);
00143
00144 void SetDisConnect(TGo4Socket * trans);
00145
00146 TGo4Socket* GetConnectTransport();
00147
00148 const char* GetConnectorName() const { return fxConnectorName.Data();}
00149
00150 const char* GetConnectHost() const { return fxConnectHost.Data();}
00151
00157 virtual Int_t TimerConnect();
00158
00162 virtual Int_t RemoveAllClients();
00163
00169 virtual Bool_t RemoveClient(const char* name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE);
00170
00174 Bool_t RemoveCurrentClient();
00175
00176 Int_t WaitForOpen();
00177
00178
00179
00180
00181
00182
00183
00184 Int_t WaitForClose();
00185
00186 Int_t WaitForConnection();
00187
00189
00193 static const Int_t fgiOPENWAITCYCLES;
00194
00198 static const UInt_t fguOPENWAITCYCLETIME;
00199
00203 static const Int_t fgiCLOSEWAITCYCLES;
00204
00208 static const UInt_t fguCLOSEWAITCYCLETIME;
00209
00213 static const Int_t fgiCONNECTWAITCYCLES;
00214
00218 static const UInt_t fguCONNECTWAITCYCLETIME;
00219
00223 static const UInt_t fguCONNECTTIMERPERIOD;
00224 private:
00225
00229 TString fxConnectorName;
00230
00233 TGo4TaskManager * fxTaskManager;
00234
00236 TGo4TaskHandler * fxCurrentTaskHandler;
00237
00242 TGo4Socket * fxConnectTransport;
00243
00248 TGo4Socket * fxDisConnectTransport;
00249
00253 TString fxConnectHost;
00254
00258 UInt_t fuConnectPort;
00259
00260
00264 Bool_t fbKeepServerSocket;
00265
00269 Bool_t fbConnectRequest;
00270
00274 Bool_t fbDisConnectRequest;
00275
00276
00280 Bool_t fbConnectIsOpen;
00281
00286 Bool_t fbConnectIsDone;
00287
00292 Bool_t fbConnectIsClose;
00294
00299 TGo4TaskConnectorTimer * fxConnectorTimer;
00300 public:
00301
00302 enum ELaunchmodes{
00303 kSecureShell = BIT(0),
00304 kGuiEmbed = BIT(1)
00305 };
00306
00307
00309 static const Text_t fgcLAUNCHPREFSFILE[];
00310 ClassDef(TGo4ServerTask,1)
00311 };
00312
00313 #endif //TGO4SERVERTASK_H
00314
00315