GSI Object Oriented Online Offline (Go4) GO4-6.4.5
Loading...
Searching...
No Matches
TGo4ServerTask.h
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#ifndef TGO4SERVERTASK_H
15#define TGO4SERVERTASK_H
16
17#include "TGo4Task.h"
18
19class TGo4TaskManager;
20class TGo4TaskHandler;
21class TGo4BufferQueue;
22class TGo4ObjectQueue;
23class TGo4Command;
24class TGo4Socket;
25class TGo4Status;
27
31class TGo4ServerTask : public TGo4Task {
32 public:
33
34 TGo4ServerTask(const char *name,
35 UInt_t negotiationport = 0,
36 Bool_t blockingmode = kFALSE,
37 Bool_t standalone = kFALSE,
38 Bool_t autostart = kTRUE,
39 Bool_t autocreate = kTRUE,
40 Bool_t ismaster = kTRUE);
41
42 virtual ~TGo4ServerTask();
43
48 void Quit() override;
49
54 void Shutdown();
55
57
60
63
65 TGo4TaskHandler *GetTaskHandler(const char *name);
66
67 TGo4BufferQueue *GetCommandQueue(const char *task = nullptr) override;
68
69 TGo4BufferQueue *GetStatusQueue(const char *task = nullptr) override;
70
71 TGo4BufferQueue *GetDataQueue(const char *task = nullptr) override;
72
78
79
83 void SendStatus(TGo4Status *stat, const char *receiver = nullptr) override;
84
86 void SendStatusBuffer() override;
87
93 virtual Bool_t StartConnectorThread();
94
105 virtual Bool_t StopConnectorThread();
106
112
116 void SetCurrentTask(const char *name);
117
118 void SetConnect(TGo4Socket *trans, const char *host, UInt_t port, Bool_t keepserv = kFALSE);
119
121
123
124 const char *GetConnectorName() const { return fxConnectorName.Data();}
125
126 const char *GetConnectHost() const { return fxConnectHost.Data();}
127
133 virtual Int_t TimerConnect();
134
139 virtual Int_t RemoveAllClients(Bool_t force = false);
140
146 virtual Bool_t RemoveClient(const char *name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE);
147
152
153 Int_t WaitForOpen();
154
156
158
159 static const char *Get_fgcLAUNCHPREFSFILE();
160
161 protected:
163 // public static constants:
165 static const Int_t fgiOPENWAITCYCLES;
166
168 static const UInt_t fguOPENWAITCYCLETIME;
169
171 static const Int_t fgiCLOSEWAITCYCLES;
172
174 static const UInt_t fguCLOSEWAITCYCLETIME;
175
177 static const Int_t fgiCONNECTWAITCYCLES;
178
180 static const UInt_t fguCONNECTWAITCYCLETIME;
181
183 static const UInt_t fguCONNECTTIMERPERIOD;
184
186 static const char *fgcLAUNCHPREFSFILE;
187
188private:
189
193 TString fxConnectorName;
194
198
201
206 TGo4Socket *fxConnectTransport{nullptr};
207
212 TGo4Socket *fxDisConnectTransport{nullptr};
213
217 TString fxConnectHost;
218
222 UInt_t fuConnectPort{0};
223
227 Bool_t fbKeepServerSocket{kFALSE};
228
232 Bool_t fbConnectRequest{kFALSE};
233
237 Bool_t fbDisConnectRequest{kFALSE};
238
242 Bool_t fbConnectIsOpen{kFALSE};
243
248 Bool_t fbConnectIsDone{kFALSE};
249
254 Bool_t fbConnectIsClose{kFALSE};
256
261 TGo4TaskConnectorTimer * fxConnectorTimer{nullptr};
262public:
263
265 kSecureShell = BIT(0), // kTRUE=launch client with ssh, otherwise rsh
266 kGuiEmbed = BIT(1) // kTRUE=client terminial embedded in gui otherwise in Xterm
267 };
268
269
270ClassDefOverride(TGo4ServerTask,1)
271};
272
273#endif //TGO4SERVERTASK_H
Class containing a pointer queue for TBuffers.
This is the Go4 Abstract Command Class; part of the Base command pattern.
Definition TGo4Command.h:35
Class containing a pointer queue for objects.
Server task.
virtual Int_t TimerConnect()
this method is used by the connectortimer Notify to connect or disconnect a transportchannel (TSocket...
Bool_t fbKeepServerSocket
True if open in server mode shall keep the server socket instance.
Bool_t RemoveCurrentClient()
removes the currently active client from server (disconnect)
static const Int_t fgiOPENWAITCYCLES
maximum cycles to wait until transport is open
void SendStatus(TGo4Status *stat, const char *receiver=nullptr) override
Send status object via status channel to the master.
Bool_t ConnectorThreadIsStopped()
Returns the waiting state fbIsWaiting of the Connector Thread;.
TGo4Command * NextCommand() override
Delivers next command.
const char * GetConnectorName() const
Int_t WaitForOpen()
TGo4ServerTask(const char *name, UInt_t negotiationport=0, Bool_t blockingmode=kFALSE, Bool_t standalone=kFALSE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE, Bool_t ismaster=kTRUE)
TGo4TaskHandler * GetCurrentTaskHandler()
Get task handler of the currently activated client connection.
virtual ~TGo4ServerTask()
void SendStatusBuffer() override
Send internal status buffer to the master(s).
static const Int_t fgiCONNECTWAITCYCLES
maximum cycles to wait until transport is connected
TGo4BufferQueue * GetStatusQueue(const char *task=nullptr) override
virtual Int_t RemoveAllClients(Bool_t force=false)
Remove all connected client task from this server.
TGo4TaskHandler * fxCurrentTaskHandler
1
void SetCurrentTask(const char *name)
sets current client task (i.e.
TGo4Socket * GetConnectTransport()
static const UInt_t fguCLOSEWAITCYCLETIME
time for each close wait cycle
static const UInt_t fguCONNECTTIMERPERIOD
period of task connector timer
static const char * fgcLAUNCHPREFSFILE
Name of the Preferences file for the client startup.
UInt_t fuConnectPort
port number for timer connect
TGo4Socket * fxDisConnectTransport
link to the next TaskHandler transport instance that shall be disconnected by the Application Control...
TGo4BufferQueue * GetCommandQueue(const char *task=nullptr) override
Bool_t fbConnectIsClose
True if fxConnectTransport has returned from Close(), i.e.
Bool_t fbConnectIsOpen
True if fxConnectTransport waits in server Open() call.
Int_t WaitForConnection()
Bool_t fbDisConnectRequest
True if fxConnectTransport shall be Close() by AppControlTimer.
void Quit() override
Quit method used by quit command; may be overridden in special application.
Bool_t fbConnectRequest
True if fxConnectTransport shall be Open() by AppControlTimer.
TGo4TaskManager * GetTaskManager()
Bool_t fbConnectIsDone
True if fxConnectTransport has returned from Open(), i.e.
static const UInt_t fguOPENWAITCYCLETIME
time for each open wait cycle
static const char * Get_fgcLAUNCHPREFSFILE()
const char * GetConnectHost() const
static const UInt_t fguCONNECTWAITCYCLETIME
time for each connect wait cycle
virtual Bool_t StopConnectorThread()
stops the thread that listens to the connector port for a client negotiation request; used before lau...
TGo4Socket * fxConnectTransport
link to the next TaskHandler transport instance that shall be connected by the Application Control Ti...
void SetConnect(TGo4Socket *trans, const char *host, UInt_t port, Bool_t keepserv=kFALSE)
static const Int_t fgiCLOSEWAITCYCLES
maximum cycles to wait until transport is closed
TString fxConnectHost
hostname for timer connect
TGo4TaskHandler * GetTaskHandler(const char *name)
Get task handler for client specified by name.
TGo4BufferQueue * GetDataQueue(const char *task=nullptr) override
void Shutdown()
Fast Quit() without waiting for proper disconnection.
TString fxConnectorName
remember name of connector thread
TGo4TaskManager * fxTaskManager
aggregationByValue 1
TGo4TaskConnectorTimer * fxConnectorTimer
timer responsible for the connection/disconnection of clients; independent of application control tim...
virtual Bool_t StartConnectorThread()
starts the thread that listens to the connector port for a client negotiation request; used after lau...
void SetDisConnect(TGo4Socket *trans)
virtual Bool_t RemoveClient(const char *name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE)
Remove the client task specified by name from this server.
TGo4TaskHandler * GetTaskHandler() override
Get task handler for client specified by name.
Int_t WaitForClose()
timer aggregated to the servertask which is responsible to open and handle the negotiation requests o...
This class is responsible for the interconnection of two tasks: provided are three communication chan...
Task manager.
Go4 Task.
Definition TGo4Task.h:39