+++ /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 "parser.h"
-
-#include "property_parsers.h"
-#include "stg/const.h"
-
-#include <string>
-
-namespace STG
-{
-
-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)(bool result, const std::string & reason, 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:
- PROPERTY_PARSERS propertyParsers;
- CALLBACK callback;
- void * data;
- int depth;
- bool parsingAnswer;
- INFO info;
- std::string error;
-};
-
-}
-
-#endif
#ifndef __STG_STGLIBS_SERVCONF_H__
#define __STG_STGLIBS_SERVCONF_H__
-#include "stg/parser_server_info.h"
#include "stg/parser_check_user.h"
#include "stg/parser_get_user.h"
#include "stg/parser_get_users.h"
int ChgUser(const std::string & request, PARSER_CHG_USER::CALLBACK f, void * data);
int AuthBy(const std::string & login, AUTH_BY::CALLBACK f, void * data);
int SendMessage(const std::string & request, PARSER_SEND_MESSAGE::CALLBACK f, void * data);
- int ServerInfo(PARSER_SERVER_INFO::CALLBACK f, void * data);
+ int ServerInfo(SERVER_INFO::CALLBACK f, void * data);
int CheckUser(const std::string & login, const std::string & password, PARSER_CHECK_USER::CALLBACK f, void * data);
const std::string & GetStrError() const;
#ifndef __STG_STGLIBS_SRVCONF_TYPES_H__
#define __STG_STGLIBS_SRVCONF_TYPES_H__
+#include "stg/const.h" // DIR_NUM
+
#include <string>
#include <vector>
typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
} // namespace AUTH_BY
+
+namespace SERVER_INFO
+{
+
+struct INFO
+{
+ std::string version;
+ int tariffNum;
+ int tariffType;
+ int usersNum;
+ std::string uname;
+ int dirNum;
+ std::string dirName[DIR_NUM];
+};
+typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
+
+} // namespace SERVER_INFO
} // namespace STG
#endif
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
-#include "stg/parser_server_info.h"
+#include "parser_server_info.h"
#include "stg/common.h"
}
-PARSER_SERVER_INFO::PARSER_SERVER_INFO()
+SERVER_INFO::PARSER::PARSER()
: callback(NULL),
data(NULL),
depth(0),
AddParser(propertyParsers, "dir_name_" + x2str(i), info.dirName[i], GetEncodedValue);
}
//-----------------------------------------------------------------------------
-int PARSER_SERVER_INFO::ParseStart(const char *el, const char **attr)
+int SERVER_INFO::PARSER::ParseStart(const char *el, const char **attr)
{
depth++;
if (depth == 1)
return 0;
}
//-----------------------------------------------------------------------------
-void PARSER_SERVER_INFO::ParseEnd(const char * /*el*/)
+void SERVER_INFO::PARSER::ParseEnd(const char * /*el*/)
{
depth--;
if (depth == 0 && parsingAnswer)
}
}
//-----------------------------------------------------------------------------
-void PARSER_SERVER_INFO::SetCallback(CALLBACK f, void * d)
+void SERVER_INFO::PARSER::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>
+ */
+
+#ifndef __STG_STGLIBS_SRVCONF_PARSER_SERVER_INFO_H__
+#define __STG_STGLIBS_SRVCONF_PARSER_SERVER_INFO_H__
+
+#include "stg/parser.h"
+
+#include "stg/property_parsers.h"
+#include "stg/servconf_types.h"
+
+#include <string>
+
+namespace STG
+{
+namespace SERVER_INFO
+{
+
+class PARSER: public STG::PARSER
+{
+public:
+
+ PARSER();
+ int ParseStart(const char * el, const char ** attr);
+ void ParseEnd(const char * el);
+ void SetCallback(CALLBACK f, void * data);
+private:
+ PROPERTY_PARSERS propertyParsers;
+ CALLBACK callback;
+ void * data;
+ int depth;
+ bool parsingAnswer;
+ INFO info;
+ std::string error;
+};
+
+} // namespace SERVER_INFO
+} // namespace STG
+
+#endif
#include "netunit.h"
#include "parser_auth_by.h"
+#include "parser_server_info.h"
#include "stg/common.h"
int ChgUser(const std::string & request, PARSER_CHG_USER::CALLBACK f, void * data);
int AuthBy(const std::string & login, AUTH_BY::CALLBACK f, void * data);
int SendMessage(const std::string & request, PARSER_SEND_MESSAGE::CALLBACK f, void * data);
- int ServerInfo(PARSER_SERVER_INFO::CALLBACK f, void * data);
+ int ServerInfo(SERVER_INFO::CALLBACK f, void * data);
int CheckUser(const std::string & login, const std::string & password, PARSER_CHECK_USER::CALLBACK f, void * data);
const std::string & GetStrError() const;
PARSER_GET_USERS parserGetUsers;
PARSER_GET_USER parserGetUser;
AUTH_BY::PARSER parserAuthBy;
- PARSER_SERVER_INFO parserServerInfo;
+ SERVER_INFO::PARSER parserServerInfo;
PARSER_CHG_USER parserChgUser;
PARSER_CHECK_USER parserCheckUser;
PARSER_SEND_MESSAGE parserSendMessage;
return pImpl->SendMessage(request, f, data);
}
-int SERVCONF::ServerInfo(PARSER_SERVER_INFO::CALLBACK f, void * data)
+int SERVCONF::ServerInfo(SERVER_INFO::CALLBACK f, void * data)
{
return pImpl->ServerInfo(f, data);
}
return Exec("<GetUsers/>", parserGetUsers);
}
//-----------------------------------------------------------------------------
-int SERVCONF::IMPL::ServerInfo(PARSER_SERVER_INFO::CALLBACK f, void * data)
+int SERVCONF::IMPL::ServerInfo(SERVER_INFO::CALLBACK f, void * data)
{
parserServerInfo.SetCallback(f, data);
return Exec("<GetServerInfo/>", parserServerInfo);