2014-01-03 08:27:31 +00:00
|
|
|
#ifndef MASTER_DAEMON
|
|
|
|
#define MASTER_DAEMON
|
|
|
|
|
|
|
|
|
|
|
|
/*! \brief masterDaemon
|
|
|
|
* server core.
|
|
|
|
*
|
2014-01-05 22:58:00 +00:00
|
|
|
* Two Process Layers: one to n EPP Servers and one to n EPP Clients.
|
2014-01-03 08:27:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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>,
|
2014-01-05 22:58:00 +00:00
|
|
|
public Listener<mdAPIFrame>,
|
|
|
|
public Listener<mdHostCommand> {
|
2014-01-03 08:27:31 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
bool shuttingDown;
|
|
|
|
|
|
|
|
boost::asio::io_service io_;
|
|
|
|
|
|
|
|
int arCycles,
|
2014-01-05 22:58:00 +00:00
|
|
|
apiClients[MAX_CLIENTS],
|
2014-01-06 19:19:17 +00:00
|
|
|
eppPeers[MAX_PEER],
|
2014-01-05 22:58:00 +00:00
|
|
|
nClievers,
|
|
|
|
received,
|
2014-01-03 08:27:31 +00:00
|
|
|
sentCommands;
|
|
|
|
|
|
|
|
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;
|
2014-01-05 22:58:00 +00:00
|
|
|
memset(apiClients,0,sizeof(apiClients));
|
2014-01-06 19:19:17 +00:00
|
|
|
memset(eppPeers,0,sizeof(eppPeers));
|
2014-01-03 08:27:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int getDeviceHandle(int deviceMajor,std::string &deviceMinor) {};
|
|
|
|
int initBaseAPI(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();
|
2014-01-05 22:58:00 +00:00
|
|
|
void * fetchCommands(std::string subSystem) {};
|
2014-01-03 08:27:31 +00:00
|
|
|
|
|
|
|
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);
|
2014-01-05 22:58:00 +00:00
|
|
|
virtual void processEvent(const mdAPIFrame &ev);
|
|
|
|
virtual void processEvent(const mdHostCommand &ev);
|
2014-01-03 08:27:31 +00:00
|
|
|
|
|
|
|
void run();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|