+//-----------------------------------------------------------------------------
+struct STAT
+{
+ long long su[DIR_NUM];
+ long long sd[DIR_NUM];
+ long long mu[DIR_NUM];
+ long long md[DIR_NUM];
+ double freeMb;
+};
+//-----------------------------------------------------------------------------
+struct SERVERINFO
+{
+ std::string version;
+ int tariffNum;
+ int tariffType;
+ int usersNum;
+ std::string uname;
+ int dirNum;
+ std::string dirName[DIR_NUM];
+};
+//-----------------------------------------------------------------------------
+struct USERDATA
+{
+ std::string login;
+ std::string password;
+ double cash;
+ double credit;
+ time_t creditExpire;
+ double lastCash;
+ double prepaidTraff;
+ int down;
+ int passive;
+ int disableDetailStat;
+ int connected;
+ int alwaysOnline;
+ uint32_t ip;
+ std::string ips;
+ std::string tariff;
+ std::string iface;
+ std::string group;
+ std::string note;
+ std::string email;
+ std::string name;
+ std::string address;
+ std::string phone;
+ STAT stat;
+ std::string userData[USERDATA_NUM];
+
+ struct USERDATA * next;
+};
+//-----------------------------------------------------------------------------
+typedef void(*RecvUserDataCb_t)(USERDATA * ud, void * data);
+typedef void(*RecvServerInfoDataCb_t)(SERVERINFO * si, void * data);
+typedef int(*RecvChgUserCb_t)(const char * asnwer, void * data);
+typedef int(*RecvCheckUserCb_t)(const char * answer, void * data);
+typedef int(*RecvSendMessageCb_t)(const char * answer, void * data);
+typedef void(*RecvAuthByDataCb_t)(const std::vector<std::string> & list, void * data);
+//-----------------------------------------------------------------------------
+struct ADMINDATA
+{
+ char login[ADM_LOGIN_LEN];
+};
+//-----------------------------------------------------------------------------
+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