+class PARSER
+{
+public:
+ PARSER() {}
+ virtual ~PARSER() {}
+ virtual int ParseStart(const char *el, const char **attr) = 0;
+ virtual void ParseEnd(const char *el) = 0;
+};
+//-----------------------------------------------------------------------------
+class PARSER_CHG_USER: public PARSER
+{
+public:
+ PARSER_CHG_USER();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void ParseAnswer(const char *el, const char **attr);
+ void SetChgUserRecvCb(RecvChgUserCb_t, void * data);
+private:
+ RecvChgUserCb_t RecvChgUserCb;
+ void * chgUserCbData;
+ int depth;
+};
+//-----------------------------------------------------------------------------
+class PARSER_CHECK_USER: public PARSER
+{
+public:
+ PARSER_CHECK_USER();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void ParseAnswer(const char *el, const char **attr);
+ void SetCheckUserRecvCb(RecvCheckUserCb_t, void * data);
+private:
+ RecvCheckUserCb_t RecvCheckUserCb;
+ void * checkUserCbData;
+ int depth;
+};
+//-----------------------------------------------------------------------------
+class PARSER_GET_USERS: public PARSER
+{
+public:
+ PARSER_GET_USERS();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void ParseUsers(const char *el, const char **attr);
+ void ParseUser(const char *el, const char **attr);
+ void ParseUserParams(const char *el, const char **attr);
+ void ParseUserLoadStat(const char * el, const char ** attr);
+ void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
+private:
+ RecvUserDataCb_t RecvUserDataCb;
+ void * userDataCb;
+ USERDATA user;
+ int depth;
+};
+//-----------------------------------------------------------------------------
+class PARSER_GET_USER: public PARSER
+{
+public:
+ PARSER_GET_USER();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void ParseUsers(const char *el, const char **attr);
+ void ParseUser(const char *el, const char **attr);
+ void ParseUserParams(const char *el, const char **attr);
+ void ParseUserLoadStat(const char * el, const char ** attr);
+ void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
+private:
+ RecvUserDataCb_t RecvUserDataCb;
+ void * userDataCb;
+ USERDATA user;
+ int depth;
+ bool error;
+};
+//-----------------------------------------------------------------------------
+class PARSER_GET_SERVER_INFO: public PARSER
+{
+public:
+ PARSER_GET_SERVER_INFO();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void ParseServerInfo(const char *el, const char **attr);
+ bool GetError();
+ void SetServerInfoRecvCb(RecvServerInfoDataCb_t, void * data);
+private:
+ void ParseUname(const char ** attr);
+ void ParseServerVersion(const char ** attr);
+ void ParseUsersNum(const char ** attr);
+ void ParseTariffsNum(const char ** attr);
+ void ParseTariffType(const char ** attr);
+ void ParseDirNum(const char **attr);
+ void ParseDirName(const char **attr, int d);
+
+ RecvServerInfoDataCb_t RecvServerInfoDataCb;
+ void * serverInfoDataCb;
+ int depth;
+ bool error;
+ SERVERINFO serverInfo;
+};
+//-----------------------------------------------------------------------------
+class PARSER_SEND_MESSAGE: public PARSER
+{
+public:
+ PARSER_SEND_MESSAGE();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void ParseAnswer(const char *el, const char **attr);
+ void SetSendMessageRecvCb(RecvSendMessageCb_t, void * data);
+private:
+ RecvSendMessageCb_t RecvSendMessageCb;
+ void * sendMessageCbData;
+ int depth;
+};
+//-----------------------------------------------------------------------------
+class PARSER_AUTH_BY: public PARSER
+{
+public:
+ PARSER_AUTH_BY();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void ParseServerInfo(const char *el, const char **attr);
+ bool GetError();
+ void SetRecvCb(RecvAuthByDataCb_t, void * data);
+private:
+ RecvAuthByDataCb_t RecvAuthByDataCb;
+ void * authByDataCb;
+ int depth;
+ bool error;
+ std::vector<std::string> list;
+};
+//-----------------------------------------------------------------------------