00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4SERVERTASK_H
00015 #define TGO4SERVERTASK_H
00016
00017 #include "TGo4Task.h"
00018
00019 class TGo4TaskManager;
00020 class TGo4TaskHandler;
00021 class TGo4BufferQueue;
00022 class TGo4ObjectQueue;
00023 class TGo4Command;
00024 class TGo4Socket;
00025 class TGo4Status;
00026 class TGo4TaskConnectorTimer;
00027
00028 class TGo4ServerTask : public TGo4Task {
00029 public:
00030
00031 TGo4ServerTask(const char* name,
00032 UInt_t negotiationport=0,
00033 Bool_t blockingmode=kFALSE,
00034 Bool_t standalone=kFALSE,
00035 Bool_t autostart=kTRUE,
00036 Bool_t autocreate=kTRUE,
00037 Bool_t ismaster=kTRUE);
00038
00039 virtual ~TGo4ServerTask();
00040
00045 virtual void Quit();
00046
00051 void Shutdown();
00052
00055 virtual void LockAll();
00056
00059 virtual void UnLockAll();
00060
00061 TGo4TaskManager* GetTaskManager();
00062
00064 TGo4TaskHandler* GetCurrentTaskHandler();
00065
00067 TGo4TaskHandler* GetTaskHandler();
00068
00070 TGo4TaskHandler* GetTaskHandler(const char* name);
00071
00072 TGo4BufferQueue* GetCommandQueue(const char* task=0);
00073
00074 TGo4BufferQueue* GetStatusQueue(const char* task=0);
00075
00076 TGo4BufferQueue* GetDataQueue(const char* task=0);
00077
00082 virtual TGo4Command* NextCommand();
00083
00084
00088 virtual void SendStatus(TGo4Status * stat, const char* receiver=0);
00089
00091 virtual void SendStatusBuffer();
00092
00098 virtual Bool_t StartConnectorThread();
00099
00110 virtual Bool_t StopConnectorThread();
00111
00116 Bool_t ConnectorThreadIsStopped();
00117
00121 void SetCurrentTask(const char* name);
00122
00123 void SetConnect(TGo4Socket * trans, const char* host, UInt_t port, Bool_t keepserv=kFALSE);
00124
00125 void SetDisConnect(TGo4Socket * trans);
00126
00127 TGo4Socket* GetConnectTransport();
00128
00129 const char* GetConnectorName() const { return fxConnectorName.Data();}
00130
00131 const char* GetConnectHost() const { return fxConnectHost.Data();}
00132
00138 virtual Int_t TimerConnect();
00139
00144 virtual Int_t RemoveAllClients(Bool_t force=false);
00145
00151 virtual Bool_t RemoveClient(const char* name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE);
00152
00156 Bool_t RemoveCurrentClient();
00157
00158 Int_t WaitForOpen();
00159
00160
00161
00162
00163
00164
00165
00166 Int_t WaitForClose();
00167
00168 Int_t WaitForConnection();
00169
00170 static const char* Get_fgcLAUNCHPREFSFILE();
00171
00172 protected:
00174
00176 static const Int_t fgiOPENWAITCYCLES;
00177
00179 static const UInt_t fguOPENWAITCYCLETIME;
00180
00182 static const Int_t fgiCLOSEWAITCYCLES;
00183
00185 static const UInt_t fguCLOSEWAITCYCLETIME;
00186
00188 static const Int_t fgiCONNECTWAITCYCLES;
00189
00191 static const UInt_t fguCONNECTWAITCYCLETIME;
00192
00194 static const UInt_t fguCONNECTTIMERPERIOD;
00195
00197 static const char* fgcLAUNCHPREFSFILE;
00198
00199 private:
00200
00204 TString fxConnectorName;
00205
00208 TGo4TaskManager * fxTaskManager;
00209
00211 TGo4TaskHandler * fxCurrentTaskHandler;
00212
00217 TGo4Socket * fxConnectTransport;
00218
00223 TGo4Socket * fxDisConnectTransport;
00224
00228 TString fxConnectHost;
00229
00233 UInt_t fuConnectPort;
00234
00235
00239 Bool_t fbKeepServerSocket;
00240
00244 Bool_t fbConnectRequest;
00245
00249 Bool_t fbDisConnectRequest;
00250
00251
00255 Bool_t fbConnectIsOpen;
00256
00261 Bool_t fbConnectIsDone;
00262
00267 Bool_t fbConnectIsClose;
00269
00274 TGo4TaskConnectorTimer * fxConnectorTimer;
00275 public:
00276
00277 enum ELaunchmodes{
00278 kSecureShell = BIT(0),
00279 kGuiEmbed = BIT(1)
00280 };
00281
00282
00283 ClassDef(TGo4ServerTask,1)
00284 };
00285
00286 #endif //TGO4SERVERTASK_H