{"set credit expire", "get credit expire", "-E", "<credit_expire_date>"},
{"set password", "get password", "-o", "<new_password>"},
{"set prepaid traffic", "get prepaid traffic", "-e", "<prepaid>"},
- {"set IP-addresses", "get IP-addresses", "-I", "<*|ip_addr[,ip_addr...]>"},
+ {"set IP-addresses", "get IP-addresses", "-I", "<*|ip_addr[,ip_addr...]>"},
{"set name", "get name", "-A", "<name>"},
{"set note", "get note", "-N", "<note>"},
{"set street address", "get street address", "-D", "<address>"},
{"group", req->group, &ud->group},
{"tariff", req->tariff, &ud->tariff},
{"password", req->usrPasswd, &ud->password},
- {"ip", req->ips, &ud->ips} // IP-address of user
+ {"ip", req->ips, &ud->ips} // IP-address of user
};
for (unsigned i = 0; i < sizeof(strReqParams) / sizeof(StringReqParams); i++)
{
SRCS = netunit.cpp \
parser.cpp \
parser_auth_by.cpp \
+ parser_server_info.cpp \
+ parser_check_user.cpp \
servconf.cpp
INCS = servconf.h \
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ */
+
#ifndef __STG_STGLIBS_SRVCONF_PARSER_AUTH_BY_H__
#define __STG_STGLIBS_SRVCONF_PARSER_AUTH_BY_H__
--- /dev/null
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ */
+
+#ifndef __STG_STGLIBS_SRVCONF_PARSER_CHECK_USER_H__
+#define __STG_STGLIBS_SRVCONF_PARSER_CHECK_USER_H__
+
+#include "stg/parser.h"
+
+class PARSER_CHECK_USER: public PARSER
+{
+public:
+ typedef int (* CALLBACK)(const char * answer, void * data);
+
+ PARSER_CHECK_USER();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void SetCallback(CALLBACK f, void * data);
+private:
+ CALLBACK callback;
+ void * data;
+ int depth;
+
+ void ParseAnswer(const char *el, const char **attr);
+};
+
+#endif
--- /dev/null
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ */
+
+#ifndef __STG_STGLIBS_SRVCONF_PARSER_SERVER_INFO_H__
+#define __STG_STGLIBS_SRVCONF_PARSER_SERVER_INFO_H__
+
+#include "stg/parser.h"
+
+#include "stg/const.h"
+
+#include <string>
+
+class PARSER_SERVER_INFO: public PARSER
+{
+public:
+ struct INFO
+ {
+ std::string version;
+ int tariffNum;
+ int tariffType;
+ int usersNum;
+ std::string uname;
+ int dirNum;
+ std::string dirName[DIR_NUM];
+ };
+ typedef void (* CALLBACK)(const INFO & info, void * data);
+
+ PARSER_SERVER_INFO();
+ int ParseStart(const char *el, const char **attr);
+ void ParseEnd(const char *el);
+ void SetCallback(CALLBACK f, void * data);
+private:
+ void ParseDirName(const char **attr, int d);
+
+ CALLBACK callback;
+ void * data;
+ int depth;
+ INFO info;
+};
+
+#endif
#include "netunit.h"
#include "stg/parser_auth_by.h"
+#include "stg/parser_server_info.h"
+#include "stg/parser_check_user.h"
+
#include "stg/os_int.h"
#include "stg/const.h"
#define MAX_ERR_STR_LEN (64)
#define IP_STRING_LEN (255)
-#define UNAME_LEN (256)
-#define SERV_VER_LEN (64)
-#define DIRNAME_LEN (16)
//-----------------------------------------------------------------------------
struct STAT
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;
};
//-----------------------------------------------------------------------------
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);
//-----------------------------------------------------------------------------
struct ADMINDATA
bool error;
};
//-----------------------------------------------------------------------------
-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;
- bool error;
-};
-//-----------------------------------------------------------------------------
class PARSER_GET_USERS: public PARSER
{
public:
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:
void SetUserDataRecvCb(RecvUserDataCb_t, void * data);
void SetAuthByCallback(PARSER_AUTH_BY::CALLBACK f, void * data);
- void SetServerInfoRecvCb(RecvServerInfoDataCb_t, void * data);
+ void SetServerInfoCallback(PARSER_SERVER_INFO::CALLBACK f, void * data);
void SetChgUserCb(RecvChgUserCb_t, void * data);
- void SetCheckUserCb(RecvCheckUserCb_t, void * data);
+ void SetCheckUserCallback(PARSER_CHECK_USER::CALLBACK f, void * data);
void SetGetUserDataRecvCb(RecvUserDataCb_t, void * data);
void SetSendMessageCb(RecvSendMessageCb_t, void * data);
// TODO: Remove this shit!
int MsgUser(const char * request);
int SendMessage(const char * login, const char * message, int prio);
- int GetServerInfo();
+ int ServerInfo();
int CheckUser(const char * login, const char * password);
const std::string & GetStrError() const;
PARSER_GET_USERS parserGetUsers;
PARSER_GET_USER parserGetUser;
PARSER_AUTH_BY parserAuthBy;
- PARSER_GET_SERVER_INFO parserServerInfo;
+ PARSER_SERVER_INFO parserServerInfo;
PARSER_CHG_USER parserChgUser;
PARSER_CHECK_USER parserCheckUser;
PARSER_SEND_MESSAGE parserSendMessage;
RecvUserDataCb_t RecvUserDataCb;
RecvUserDataCb_t RecvGetUserDataCb;
PARSER_AUTH_BY::CALLBACK authByCallback;
- RecvServerInfoDataCb_t RecvServerInfoDataCb;
+ PARSER_SERVER_INFO::CALLBACK serverInfoCallback;
RecvChgUserCb_t RecvChgUserCb;
- RecvCheckUserCb_t RecvCheckUserCb;
+ PARSER_CHECK_USER::CALLBACK checkUserCallback;
RecvSendMessageCb_t RecvSendMessageCb;
void * getUserDataDataCb;
void * authByData;
void * getUsersDataDataCb;
- void * getServerInfoDataCb;
+ void * serverInfoData;
void * chgUserDataCb;
- void * checkUserDataCb;
+ void * checkUserData;
void * sendMessageDataCb;
friend int AnsRecv(void * data, std::list<std::string> * list);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-PARSER_GET_SERVER_INFO::PARSER_GET_SERVER_INFO()
- : RecvServerInfoDataCb(NULL),
- serverInfoDataCb(NULL),
- depth(0),
- error(false),
- serverInfo()
-{
-}
-//-----------------------------------------------------------------------------
-int PARSER_GET_SERVER_INFO::ParseStart(const char *el, const char **attr)
-{
-depth++;
-if (depth == 1)
- {
- if (strcasecmp(el, "ServerInfo") != 0)
- {
- //printf("%s\n", el);
- }
- }
-else
- {
- if (depth == 2)
- {
- if (strcasecmp(el, "uname") == 0)
- {
- ParseUname(attr);
- return 0;
- }
- if (strcasecmp(el, "version") == 0)
- {
- ParseServerVersion(attr);
- return 0;
- }
- if (strcasecmp(el, "tariff") == 0)
- {
- ParseTariffType(attr);
- return 0;
- }
- if (strcasecmp(el, "dir_num") == 0)
- {
- ParseDirNum(attr);
- return 0;
- }
- if (strcasecmp(el, "users_num") == 0)
- {
- ParseUsersNum(attr);
- return 0;
- }
- if (strcasecmp(el, "tariff_num") == 0)
- {
- ParseTariffsNum(attr);
- return 0;
- }
-
- for (int j = 0; j < DIR_NUM; j++)
- {
- char str[16];
- sprintf(str, "dir_name_%d", j);
- if (strcasecmp(el, str) == 0)
- {
- ParseDirName(attr, j);
- }
- }
-
- }
- }
-return 0;
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::ParseEnd(const char *)
-{
-depth--;
-if (depth == 0)
- {
- RecvServerInfoDataCb(&serverInfo, serverInfoDataCb);
- }
-}
-//-----------------------------------------------------------------------------
-/*void PARSER_GET_SERVER_INFO::ParseServerInfo(const char * el, const char ** attr)
- {
- }*/
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::SetServerInfoRecvCb(RecvServerInfoDataCb_t f, void * data)
-{
-RecvServerInfoDataCb = f;
-serverInfoDataCb = data;
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::ParseUname(const char ** attr)
-{
-if (strcmp(*attr, "value") == 0)
- serverInfo.uname = attr[1];
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::ParseServerVersion(const char ** attr)
-{
-if (strcmp(*attr, "value") == 0)
- serverInfo.version = attr[1];
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::ParseUsersNum(const char ** attr)
-{
-if (strcmp(*attr, "value") == 0)
- {
- if (str2x(attr[1], serverInfo.usersNum) < 0)
- {
- serverInfo.usersNum = -1;
- return;
- }
- }
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::ParseTariffsNum(const char ** attr)
-{
-if (strcmp(*attr, "value") == 0)
- {
- if (str2x(attr[1], serverInfo.tariffNum) < 0)
- {
- serverInfo.tariffNum = -1;
- return;
- }
- }
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::ParseTariffType(const char ** attr)
-{
-if (strcmp(*attr, "value") == 0)
- {
- if (str2x(attr[1], serverInfo.tariffType) < 0)
- {
- serverInfo.tariffType = -1;
- return;
- }
- }
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::ParseDirNum(const char **attr)
-{
-if (strcasecmp(*attr, "value") == 0)
- {
- if (str2x(attr[1], serverInfo.dirNum) < 0)
- {
- serverInfo.dirNum = -1;
- return;
- }
- }
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::ParseDirName(const char **attr, int d)
-{
-if (strcmp(attr[0], "value") == 0)
- {
- char str[2*DIRNAME_LEN + 1];
- Decode21(str, attr[1]);
- serverInfo.dirName[d] = str;
- }
-}
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
PARSER_CHG_USER::PARSER_CHG_USER()
: RecvChgUserCb(NULL),
chgUserCbData(NULL),
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-PARSER_CHECK_USER::PARSER_CHECK_USER()
- : RecvCheckUserCb(NULL),
- checkUserCbData(NULL),
- depth(0),
- error(false)
-{
-}
-//-----------------------------------------------------------------------------
-int PARSER_CHECK_USER::ParseStart(const char *el, const char **attr)
-{
-depth++;
-if (depth == 1)
- {
- if (strcasecmp(el, "CheckUser") == 0)
- {
- //printf("el=%s attr[0]=%s attr[1]=%s\n", el, attr[0], attr[1]);
- ParseAnswer(el, attr);
- }
- }
-return 0;
-}
-//-----------------------------------------------------------------------------
-void PARSER_CHECK_USER::ParseEnd(const char *)
-{
-depth--;
-}
-//-----------------------------------------------------------------------------
-void PARSER_CHECK_USER::ParseAnswer(const char *, const char **attr)
-{
-if (RecvCheckUserCb)
- {
- RecvCheckUserCb(attr[1], checkUserCbData);
- }
-}
-//-----------------------------------------------------------------------------
-void PARSER_CHECK_USER::SetCheckUserRecvCb(RecvCheckUserCb_t f, void * data)
-{
-RecvCheckUserCb = f;
-checkUserCbData = data;
-}
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
PARSER_SEND_MESSAGE::PARSER_SEND_MESSAGE()
: RecvSendMessageCb(NULL),
sendMessageCbData(NULL),
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ */
+
#include "stg/parser_auth_by.h"
#include <strings.h> // strcasecmp
void PARSER_AUTH_BY::ParseEnd(const char * /*el*/)
{
depth--;
-if (depth == 0)
+if (depth == 0 && callback)
callback(info, data);
}
//-----------------------------------------------------------------------------
-void PARSER_AUTH_BY::SetCallback(CALLBACK f, void * data)
+void PARSER_AUTH_BY::SetCallback(CALLBACK f, void * d)
{
callback = f;
-data = data;
+data = d;
}
--- /dev/null
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ */
+
+#include "stg/parser_check_user.h"
+
+#include <strings.h>
+
+PARSER_CHECK_USER::PARSER_CHECK_USER()
+ : callback(NULL),
+ data(NULL),
+ depth(0)
+{
+}
+//-----------------------------------------------------------------------------
+int PARSER_CHECK_USER::ParseStart(const char *el, const char **attr)
+{
+depth++;
+if (depth == 1)
+ if (strcasecmp(el, "CheckUser") == 0)
+ ParseAnswer(el, attr);
+return 0;
+}
+//-----------------------------------------------------------------------------
+void PARSER_CHECK_USER::ParseEnd(const char *)
+{
+depth--;
+}
+//-----------------------------------------------------------------------------
+void PARSER_CHECK_USER::ParseAnswer(const char *, const char **attr)
+{
+if (attr && attr[0] && attr[1] && strcasecmp(attr[0], "value") == 0)
+ if (callback)
+ callback(attr[1], data);
+}
+//-----------------------------------------------------------------------------
+void PARSER_CHECK_USER::SetCallback(CALLBACK f, void * d)
+{
+callback = f;
+data = d;
+}
--- /dev/null
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ */
+
+#include "stg/parser_server_info.h"
+
+#include "stg/common.h"
+
+#include <cstdio> // sprintf
+
+#include <strings.h>
+
+namespace
+{
+
+const size_t UNAME_LEN = 256;
+const size_t SERV_VER_LEN = 64;
+const size_t DIRNAME_LEN = 16;
+
+bool checkValue(const char ** attr)
+{
+return attr && attr[0] && attr[1] && strcasecmp(attr[0], "value") == 0;
+}
+
+int getIntValue(const char ** attr)
+{
+int value = -1;
+if (checkValue(attr))
+ if (str2x(attr[1], value) < 0)
+ return -1;
+return value;
+}
+
+std::string getStringValue(const char ** attr)
+{
+if (checkValue(attr))
+ return attr[1];
+return "";
+}
+
+}
+
+PARSER_SERVER_INFO::PARSER_SERVER_INFO()
+ : callback(NULL),
+ data(NULL),
+ depth(0)
+{
+}
+//-----------------------------------------------------------------------------
+int PARSER_SERVER_INFO::ParseStart(const char *el, const char **attr)
+{
+depth++;
+if (depth == 1)
+ {
+ if (strcasecmp(el, "ServerInfo") != 0)
+ {
+ //printf("%s\n", el);
+ }
+ }
+else
+ {
+ if (depth == 2)
+ {
+ if (strcasecmp(el, "uname") == 0)
+ {
+ info.uname = getStringValue(attr);
+ return 0;
+ }
+ if (strcasecmp(el, "version") == 0)
+ {
+ info.version = getStringValue(attr);
+ return 0;
+ }
+ if (strcasecmp(el, "tariff") == 0)
+ {
+ info.tariffType = getIntValue(attr);
+ return 0;
+ }
+ if (strcasecmp(el, "dir_num") == 0)
+ {
+ info.dirNum = getIntValue(attr);
+ return 0;
+ }
+ if (strcasecmp(el, "users_num") == 0)
+ {
+ info.usersNum = getIntValue(attr);
+ return 0;
+ }
+ if (strcasecmp(el, "tariff_num") == 0)
+ {
+ info.tariffNum = getIntValue(attr);
+ return 0;
+ }
+
+ for (int j = 0; j < DIR_NUM; j++)
+ {
+ char str[16];
+ sprintf(str, "dir_name_%d", j);
+ if (strcasecmp(el, str) == 0)
+ ParseDirName(attr, j);
+ }
+
+ }
+ }
+return 0;
+}
+//-----------------------------------------------------------------------------
+void PARSER_SERVER_INFO::ParseEnd(const char * /*el*/)
+{
+depth--;
+if (depth == 0 && callback)
+ callback(info, data);
+}
+//-----------------------------------------------------------------------------
+void PARSER_SERVER_INFO::SetCallback(CALLBACK f, void * d)
+{
+callback = f;
+data = d;
+}
+//-----------------------------------------------------------------------------
+void PARSER_SERVER_INFO::ParseDirName(const char **attr, int d)
+{
+if (checkValue(attr))
+ {
+ char str[2 * DIRNAME_LEN + 1];
+ Decode21(str, attr[1]);
+ info.dirName[d] = str;
+ }
+}
RecvUserDataCb(NULL),
RecvGetUserDataCb(NULL),
authByCallback(NULL),
- RecvServerInfoDataCb(NULL),
+ serverInfoCallback(NULL),
RecvChgUserCb(NULL),
- RecvCheckUserCb(NULL),
+ checkUserCallback(NULL),
RecvSendMessageCb(NULL),
getUserDataDataCb(NULL),
authByData(NULL),
getUsersDataDataCb(NULL),
- getServerInfoDataCb(NULL),
+ serverInfoData(NULL),
chgUserDataCb(NULL),
- checkUserDataCb(NULL),
+ checkUserData(NULL),
sendMessageDataCb(NULL)
{
parser = XML_ParserCreate(NULL);
return st_ok;
}
//-----------------------------------------------------------------------------
-int SERVCONF::GetServerInfo()
+int SERVCONF::ServerInfo()
{
char request[] = "<GetServerInfo/>";
int ret;
currParser = &parserServerInfo;
-((PARSER_GET_SERVER_INFO*)currParser)->SetServerInfoRecvCb(RecvServerInfoDataCb, getServerInfoDataCb);
+((PARSER_SERVER_INFO*)currParser)->SetCallback(serverInfoCallback, serverInfoData);
nt.Reset();
nt.SetRxCallback(this, AnsRecv);
int ret;
currParser = &parserCheckUser;
-((PARSER_CHECK_USER*)currParser)->SetCheckUserRecvCb(RecvCheckUserCb, checkUserDataCb);
+((PARSER_CHECK_USER*)currParser)->SetCallback(checkUserCallback, checkUserData);
nt.Reset();
nt.SetRxCallback(this, AnsRecv);
authByData = data;
}
//-----------------------------------------------------------------------------
-void SERVCONF::SetServerInfoRecvCb(RecvServerInfoDataCb_t f, void * data)
+void SERVCONF::SetServerInfoCallback(PARSER_SERVER_INFO::CALLBACK f, void * data)
{
-RecvServerInfoDataCb = f;
-getServerInfoDataCb = data;
+serverInfoCallback = f;
+serverInfoData = data;
}
//-----------------------------------------------------------------------------
void SERVCONF::SetChgUserCb(RecvChgUserCb_t f, void * data)
chgUserDataCb = data;
}
//-----------------------------------------------------------------------------
-void SERVCONF::SetCheckUserCb(RecvCheckUserCb_t f, void * data)
+void SERVCONF::SetCheckUserCallback(PARSER_CHECK_USER::CALLBACK f, void * data)
{
-RecvCheckUserCb = f;
-checkUserDataCb = data;
+checkUserCallback = f;
+checkUserData = data;
}
//-----------------------------------------------------------------------------
void SERVCONF::SetSendMessageCb(RecvSendMessageCb_t f, void * data)