14#ifndef TGO4TASKHANDLER_H
15#define TGO4TASKHANDLER_H
295 static const char *
fgcOK;
Go4CommandMode_t
These values define command execution rights.
Class that knows Command Object; When Client gets the Command it is passed to the Invoker who sets th...
Runnable responsible for command exchange between transport (socket) and buffer (queue) In receiver m...
Runnable responsible for data object exchange between transport (socket) and buffer (queue) In receiv...
Base class for all threadsafe pointer queues.
Runnable responsible for status object exchange between transport (socket) and buffer (queue) In rece...
This class is responsible for the interconnection of two tasks: provided are three communication chan...
static void SetAdminAccount(const char *name, const char *passwd)
Specify login name and password for administrator account.
TGo4CommandInvoker * fxInvoker
Link to external command invoker instance used for direct command in client mode:
static const UInt_t fguTRANSPORTCHECKDELAY
Delay time (ms) to wait between two checks of transport connection.
void SetAborting(Bool_t isaborting=kTRUE)
sets the internal aborting state of this taskhandler instance; will be checked before an exception tr...
TGo4TaskHandler(const char *name, TGo4ThreadManager *threadmanager, Bool_t clientmode=kFALSE, Bool_t mastermode=kTRUE, UInt_t negotiationport=0)
TGo4Queue * fxCommandQueue
Buffers (queues) for the three transport channels:
TGo4Socket * GetStatusTransport() const
Bool_t IsClientMode() const
Check whether this instance is client or server taskhandler.
Int_t fiComPort
Command connection port number.
TGo4CommandInvoker * GetInvoker() const
returns pointer to copy of client invoker which may be used by server to check the valid command clie...
static TNamed fgxADMINISTRATORACCOUNT
This keeps account for admin connection.
static const UInt_t fguDATAQUEUESIZE
Maximum entries allowed for data queue.
static const UInt_t fguCONNECTORPORT
Default port number of negotiation connection (raw transport).
static const char * fgcCONNECT
Initial string for connect request (raw transport).
Bool_t fbMasterMode
True if taskhandler runs in master mode (sends commands, receives data and status).
static const UInt_t fguSTATUSQUEUESIZE
Maximum entries allowed for status queue.
static const char * fgcOK
Ok string for client connect negotiations (raw transport).
virtual TGo4TaskHandlerStatus * CreateStatus()
create a status object with information on the current taskhandler state.
static UInt_t Get_fguPORTWAITTIME()
Bool_t StopTransportThreads(Bool_t wait=kTRUE)
Stop all transport threads of this taskhandler (command, data, status).
UInt_t fuNegPort
Actual port number of negotiation connection (raw transport).
Go4CommandMode_t fiRole
For server connection to client: This indicates role of connected client, if client is master.
TString fxComName
Remember name of command thread.
static const Int_t fgiPORTWAITCYCLES
Cycles to wait for a nonzero portnumber.
static const char * fgcDATATHREAD
Suffix for data thread name.
TGo4Socket * fxStatusTransport
void SetNegotiationPort(UInt_t port)
Set port for the negotiation channel (client mode).
static TNamed fgxCONTROLLERACCOUNT
This keeps account for controller connection.
static const char * fgcMASTER
Task identifier for client connect negotiations (raw transport).
static void SetCtrlAccount(const char *name, const char *passwd)
Specify login name and password for controller account.
void CloseChannels(Option_t *opt="")
Close transport channels and clear queues.
TString fxStatName
Remember name of status thread.
Bool_t IsAborting() const
Check whether this instance is currently being aborted.
Bool_t ConnectClientChannel(const char *name, TGo4Socket *negotiator, TGo4Socket *channel, const char *host)
method defining the connection protocol of one data transport channel (data, status,...
TGo4Queue * fxStatusQueue
Int_t GetStatPort() const
TGo4CommandRunnable * fxCommandRun
link to command runnable which is managed by thread handler 1 1
static const UInt_t fguTHREADSTOPTIME
time for each threadstop wait cycle
Bool_t ConnectServerChannel(const char *name, TGo4Socket *negotiator, TGo4Socket *channel, const char *host)
Method defining the connection protocol of one data transport channel (data, status,...
void SetInvoker(TGo4CommandInvoker *inv)
sets pointer to client invoker which may be used by server to check the valid command clients
Bool_t DisConnect(Bool_t waitforclient=kTRUE)
Closes the connections of all three transport channels.
TGo4Socket * fxDataTransport
TGo4Socket * fxCommandTransport
Transport channels (e.g.
static const char * fgcSLAVE
Task identifier for client connect negotiations (raw transport).
static const UInt_t fguPORTWAITTIME
Time for each waitgetport cycle.
static const char * fgcSTATUSTHREAD
Suffix for status thread name.
TGo4Socket * GetCommandTransport() const
void ClearQueues()
Clear all entries of queues.
static void SetObservAccount(const char *name, const char *passwd)
Specify login name and password for observer account.
Bool_t IsMasterMode() const
Check whether this instance is client or server taskhandler.
TGo4DataRunnable * fxDataRun
link to data runnable which is managed by thread handler 1 1
TGo4StatusRunnable * fxStatusRun
link to status runnable which is managed by thread handler 1 1
Bool_t fbIsAborting
True if taskhandler is being aborted e.g.
TGo4Queue * GetStatusQueue() const
static const char * fgcCOMMANDTHREAD
Suffix for command thread name.
static TNamed fgxOBSERVERACCOUNT
This keeps account for observer connection.
TGo4Queue * GetDataQueue() const
friend class TGo4TaskManager
void SetRole(Go4CommandMode_t role)
static Int_t Get_fgiPORTWAITCYCLES()
static const UInt_t fguCOMMANDQUEUESIZE
Maximum entries allowed for command queue.
static const char * fgcDISCONNECT
Initial string for disconnect request (raw transport).
TGo4ThreadManager * fxThreadManager
Link to threadmanager that owns the task handler, used for runnable ctors.
Bool_t WaitThreadStop(const char *name)
Wait for the thread of name to be stopped.
TGo4Socket * GetDataTransport() const
static const char * Get_fgcOK()
void StartTransportThreads()
Start all transport threads of this taskhandler (command, data, status).
const char * GetHostName() const
Int_t fiDatPort
Data connection port number.
Int_t WaitGetPort(TGo4Socket *sock)
Get actual local port number of specified Go4 socket.
TGo4Socket * ServerRequest(const char *host="localhost")
request to server at host to connect or disconnect us, returns negotiation channel
const char * GetComName() const
Bool_t fbClientMode
True if taskhandler runs in client mode.
TString fxHostName
Remember name of remote task handler.
Go4CommandMode_t GetRole()
static const char * Get_fgcERROR()
const char * GetDatName() const
Bool_t Connect(const char *host="localhost", TGo4Socket *negotiator=nullptr)
establishes the connections of all three transport channels and starts the service threads
virtual ~TGo4TaskHandler()
TGo4ThreadManager * GetThreadManager() const
static const char * fgcERROR
Error string for client connect negotiations (raw transport).
TGo4Queue * GetCommandQueue() const
Bool_t ServerLogin(TGo4Socket *connector, Go4CommandMode_t account)
Negotiate login to requested server channel with account type.
const char * GetStatName() const
TString fxDatName
Remember name of data thread.
TGo4ThreadHandler * fxThreadHandler
link to external threadhandler which is used for the transport service threads (runnables); these run...
Int_t fiStatPort
Status connection port number.
static const Int_t fgiTHREADSTOPCYCLES
cycles to wait for taskhandler thread stop on disconnection