#ifndef CLIENTSTATEANDDATA_H #define CLIENTSTATEANDDATA_H #define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0])) #define MaxData 1024*16 #define PREFIX ":" #define CMD_OK "." #define CMD_FAIL "!" #define END_LINE "\r\n" int parseArgsInCommandLine(const char *cmd, char *buffer, int bufferSize, char **argv_p, int maxArgs); class Hcb; class ClientStateAndData { public: enum { ID_STATE=0, COMMAND_STATE=1, CONNECTED_STATE=2, DISCONNECTED_STATE=3 }; ClientStateAndData(Hcb *hca, int perm); ~ClientStateAndData(); void sendInt(int i); void sendBuffer(const char* bufPtr, const int bufLen); void processInOut(); // called when there is data to read for the client // returns <0 if it is done. int process(); int getState() const {return state;}; void close(); static const char *identifier; private: void help(); // returns -1 if exit disconnected int parseCmd(const char *cmdLine); void dev_list(const char *filter); void reg_list(); void reg_list_name(); void serverInfo(); void sendStr(const char *str); int state; Hcb *hcaBuffer; Hcb *hcaBuffer2; int permanent; }; #endif