90 lines
2.5 KiB
C++
90 lines
2.5 KiB
C++
#ifndef MASTER_DAEMON
|
|
#define MASTER_DAEMON
|
|
|
|
|
|
/*! \brief masterDaemon
|
|
* server core.
|
|
*
|
|
* Two Process Layers: one to n EPP Servers and one to n EPP Clients.
|
|
*/
|
|
|
|
#ifdef MD_CORE
|
|
|
|
class masterDaemon *thisService;
|
|
|
|
#else
|
|
|
|
extern class masterDaemon *thisService;
|
|
|
|
#endif
|
|
|
|
using boost::asio::ip::udp;
|
|
|
|
|
|
class masterDaemon : public mdProcess,
|
|
public Listener<mdAttention>,
|
|
public Listener<mdCDPulse>,
|
|
public Listener<mdClientBirth>,
|
|
public Listener<mdClientDeath>,
|
|
public Listener<mdIncoming>,
|
|
public Listener<mdResponse>,
|
|
public Listener<mdAPIFrame>,
|
|
public Listener<mdHostCommand> {
|
|
public:
|
|
|
|
bool shuttingDown;
|
|
|
|
boost::asio::io_service io_;
|
|
|
|
int arCycles,
|
|
apiClients[MAX_CLIENTS],
|
|
eppPeers[MAX_PEER],
|
|
nClievers,
|
|
received,
|
|
sentCommands;
|
|
|
|
#if (ARTKENABLED > 0)
|
|
ausRegEPPTK *artk;
|
|
#endif
|
|
masterDaemonConfig *cfg;
|
|
mdDGChannel *bg,*fg;
|
|
|
|
std::string clievers[MAX_CLIEVER];
|
|
|
|
masterDaemon();
|
|
~masterDaemon() {}
|
|
|
|
masterDaemon(masterDaemonConfig *cmdCfg) { int i;
|
|
thisService = this;
|
|
cfg = cmdCfg;
|
|
nClievers = 0;
|
|
shuttingDown = false;
|
|
memset(apiClients,0,sizeof(apiClients));
|
|
memset(eppPeers,0,sizeof(eppPeers));
|
|
}
|
|
|
|
int getDeviceHandle(int deviceMajor,std::string &deviceMinor) {};
|
|
int initAusRegTK(void);
|
|
int initDataLayer(void);
|
|
int releaseDevice(int handle) {return( -1);}
|
|
int validateHandleForCmds(int handle) {return(-1);}
|
|
void dispatch(mdWQitem*);
|
|
void dispatch(const mdIncoming&);
|
|
void listen();
|
|
void * fetchCommands(std::string subSystem) {};
|
|
|
|
virtual void processEvent(const mdAttention &ev);
|
|
virtual void processEvent(const mdCDPulse &ev);
|
|
virtual void processEvent(const mdClientBirth &ev);
|
|
virtual void processEvent(const mdClientDeath &ev);
|
|
virtual void processEvent(const mdIncoming &ev);
|
|
virtual void processEvent(const mdResponse &ev);
|
|
virtual void processEvent(const mdAPIFrame &ev);
|
|
virtual void processEvent(const mdHostCommand &ev);
|
|
|
|
void run();
|
|
|
|
};
|
|
|
|
#endif
|