SRCS = parsers/property.cpp \
parsers/simple.cpp \
parsers/server_info.cpp \
- parsers/get_admins.cpp \
parsers/get_admin.cpp \
parsers/chg_admin.cpp \
- parsers/get_tariffs.cpp \
parsers/get_tariff.cpp \
parsers/chg_tariff.cpp \
parsers/auth_by.cpp \
parsers/get_user.cpp \
- parsers/get_users.cpp \
parsers/chg_user.cpp \
- parsers/get_services.cpp \
parsers/get_service.cpp \
parsers/chg_service.cpp \
- parsers/get_corporations.cpp \
parsers/get_corp.cpp \
parsers/chg_corp.cpp \
netunit.cpp \
class PARSER: public STG::PARSER
{
public:
+ typedef GET_ADMIN::INFO INFO;
+
PARSER(CALLBACK f, void * data);
virtual ~PARSER();
int ParseStart(const char * el, const char ** attr);
+++ /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 : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#include "get_admins.h"
-
-#include <strings.h>
-
-using namespace STG;
-
-GET_ADMINS::PARSER::PARSER(CALLBACK f, void * d)
- : callback(f),
- data(d),
- adminParser(&GET_ADMINS::PARSER::AdminCallback, this),
- depth(0),
- parsingAnswer(false)
-{
-}
-//-----------------------------------------------------------------------------
-int GET_ADMINS::PARSER::ParseStart(const char * el, const char ** attr)
-{
-depth++;
-if (depth == 1 && strcasecmp(el, "admins") == 0)
- parsingAnswer = true;
-
-if (depth > 1 && parsingAnswer)
- adminParser.ParseStart(el, attr);
-
-return 0;
-}
-//-----------------------------------------------------------------------------
-void GET_ADMINS::PARSER::ParseEnd(const char * el)
-{
-depth--;
-if (depth > 0 && parsingAnswer)
- adminParser.ParseEnd(el);
-
-if (depth == 0 && parsingAnswer)
- {
- if (callback)
- callback(error.empty(), error, info, data);
- error.clear();
- info.clear();
- parsingAnswer = false;
- }
-}
-//-----------------------------------------------------------------------------
-void GET_ADMINS::PARSER::AddAdmin(const GET_ADMIN::INFO & adminInfo)
-{
-info.push_back(adminInfo);
-}
-//-----------------------------------------------------------------------------
-void GET_ADMINS::PARSER::AdminCallback(bool result, const std::string & error, const GET_ADMIN::INFO & info, void * data)
-{
- GET_ADMINS::PARSER * parser = static_cast<GET_ADMINS::PARSER *>(data);
- if (!result)
- parser->SetError(error);
- else
- parser->AddAdmin(info);
-}
+++ /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 : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#ifndef __STG_STGLIBS_SRVCONF_PARSER_GET_ADMINS_H__
-#define __STG_STGLIBS_SRVCONF_PARSER_GET_ADMINS_H__
-
-#include "base.h"
-#include "get_admin.h"
-
-#include "stg/servconf_types.h"
-
-#include <string>
-
-namespace STG
-{
-namespace GET_ADMINS
-{
-
-class PARSER: public STG::PARSER
-{
-public:
- PARSER(CALLBACK f, void * data);
- int ParseStart(const char * el, const char ** attr);
- void ParseEnd(const char * el);
-
-private:
- CALLBACK callback;
- void * data;
- GET_ADMIN::PARSER adminParser;
- INFO info;
- int depth;
- bool parsingAnswer;
- std::string error;
-
- void AddAdmin(const GET_ADMIN::INFO & adminInfo);
- void SetError(const std::string & e) { error = e; }
-
- static void AdminCallback(bool result, const std::string& reason, const GET_ADMIN::INFO & info, void * data);
-};
-
-} // namespace GET_ADMINS
-} // namespace STG
-
-#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 : Maxim Mamontov <faust@stargazer.dp.ua>
+ */
+
+#ifndef __STG_STGLIBS_SRVCONF_PARSER_GET_CONTAINER_H__
+#define __STG_STGLIBS_SRVCONF_PARSER_GET_CONTAINER_H__
+
+#include "base.h"
+
+#include <string>
+
+namespace STG
+{
+namespace GET_CONTAINER
+{
+
+template <typename ELEMENT_PARSER>
+class PARSER: public STG::PARSER
+{
+public:
+ typedef std::vector<typename ELEMENT_PARSER::INFO> INFO;
+ typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
+ PARSER(const std::string & t, CALLBACK f, void * d)
+ : tag(t), callback(f), data(d),
+ elementParser(&PARSER<ELEMENT_PARSER>::ElementCallback, this),
+ depth(0), parsingAnswer(false)
+ {}
+ int ParseStart(const char * el, const char ** attr)
+ {
+ depth++;
+ if (depth == 1 && strcasecmp(el, tag.c_str()) == 0)
+ parsingAnswer = true;
+
+ if (depth > 1 && parsingAnswer)
+ elementParser.ParseStart(el, attr);
+
+ return 0;
+ }
+ void ParseEnd(const char * el)
+ {
+ depth--;
+ if (depth > 0 && parsingAnswer)
+ elementParser.ParseEnd(el);
+
+ if (depth == 0 && parsingAnswer)
+ {
+ if (callback)
+ callback(error.empty(), error, info, data);
+ error.clear();
+ info.clear();
+ parsingAnswer = false;
+ }
+ }
+
+private:
+ std::string tag;
+ CALLBACK callback;
+ void * data;
+ ELEMENT_PARSER elementParser;
+ INFO info;
+ int depth;
+ bool parsingAnswer;
+ std::string error;
+
+ void AddElement(const typename ELEMENT_PARSER::INFO & elementInfo)
+ {
+ info.push_back(elementInfo);
+ }
+ void SetError(const std::string & e) { error = e; }
+
+ static void ElementCallback(bool result, const std::string& reason, const typename ELEMENT_PARSER::INFO & info, void * data)
+ {
+ PARSER<ELEMENT_PARSER> * parser = static_cast<PARSER<ELEMENT_PARSER> *>(data);
+ if (!result)
+ parser->SetError(reason);
+ else
+ parser->AddElement(info);
+ }
+};
+
+} // namespace GET_CONTAINER
+} // namespace STG
+
+#endif
class PARSER: public STG::PARSER
{
public:
+ typedef GET_CORP::INFO INFO;
+
PARSER(CALLBACK f, void * data);
virtual ~PARSER();
int ParseStart(const char * el, const char ** attr);
+++ /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 : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#include "get_corporations.h"
-
-#include <strings.h>
-
-using namespace STG;
-
-GET_CORPORATIONS::PARSER::PARSER(CALLBACK f, void * d)
- : callback(f),
- data(d),
- corpParser(&GET_CORPORATIONS::PARSER::CorpCallback, this),
- depth(0),
- parsingAnswer(false)
-{
-}
-//-----------------------------------------------------------------------------
-int GET_CORPORATIONS::PARSER::ParseStart(const char * el, const char ** attr)
-{
-depth++;
-if (depth == 1 && strcasecmp(el, "corporations") == 0)
- parsingAnswer = true;
-
-if (depth > 1 && parsingAnswer)
- corpParser.ParseStart(el, attr);
-
-return 0;
-}
-//-----------------------------------------------------------------------------
-void GET_CORPORATIONS::PARSER::ParseEnd(const char * el)
-{
-depth--;
-if (depth > 0 && parsingAnswer)
- corpParser.ParseEnd(el);
-
-if (depth == 0 && parsingAnswer)
- {
- if (callback)
- callback(error.empty(), error, info, data);
- error.clear();
- info.clear();
- parsingAnswer = false;
- }
-}
-//-----------------------------------------------------------------------------
-void GET_CORPORATIONS::PARSER::AddCorp(const GET_CORP::INFO & corpInfo)
-{
-info.push_back(corpInfo);
-}
-//-----------------------------------------------------------------------------
-void GET_CORPORATIONS::PARSER::CorpCallback(bool result, const std::string & error, const GET_CORP::INFO & info, void * data)
-{
- GET_CORPORATIONS::PARSER * parser = static_cast<GET_CORPORATIONS::PARSER *>(data);
- if (!result)
- parser->SetError(error);
- else
- parser->AddCorp(info);
-}
+++ /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 : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#ifndef __STG_STGLIBS_SRVCONF_PARSER_GET_CORPORATIONS_H__
-#define __STG_STGLIBS_SRVCONF_PARSER_GET_CORPORATIONS_H__
-
-#include "base.h"
-#include "get_corp.h"
-
-#include "stg/servconf_types.h"
-
-#include <string>
-
-namespace STG
-{
-namespace GET_CORPORATIONS
-{
-
-class PARSER: public STG::PARSER
-{
-public:
- PARSER(CALLBACK f, void * data);
- int ParseStart(const char * el, const char ** attr);
- void ParseEnd(const char * el);
-
-private:
- CALLBACK callback;
- void * data;
- GET_CORP::PARSER corpParser;
- INFO info;
- int depth;
- bool parsingAnswer;
- std::string error;
-
- void AddCorp(const GET_CORP::INFO & corpInfo);
- void SetError(const std::string & e) { error = e; }
-
- static void CorpCallback(bool result, const std::string& reason, const GET_CORP::INFO & info, void * data);
-};
-
-} // namespace GET_CORPORATIONS
-} // namespace STG
-
-#endif
class PARSER: public STG::PARSER
{
public:
+ typedef GET_SERVICE::INFO INFO;
PARSER(CALLBACK f, void * data);
virtual ~PARSER();
int ParseStart(const char * el, const char ** attr);
+++ /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 : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#include "get_services.h"
-
-#include <strings.h>
-
-using namespace STG;
-
-GET_SERVICES::PARSER::PARSER(CALLBACK f, void * d)
- : callback(f),
- data(d),
- serviceParser(&GET_SERVICES::PARSER::ServiceCallback, this),
- depth(0),
- parsingAnswer(false)
-{
-}
-//-----------------------------------------------------------------------------
-int GET_SERVICES::PARSER::ParseStart(const char * el, const char ** attr)
-{
-depth++;
-if (depth == 1 && strcasecmp(el, "services") == 0)
- parsingAnswer = true;
-
-if (depth > 1 && parsingAnswer)
- serviceParser.ParseStart(el, attr);
-
-return 0;
-}
-//-----------------------------------------------------------------------------
-void GET_SERVICES::PARSER::ParseEnd(const char * el)
-{
-depth--;
-if (depth > 0 && parsingAnswer)
- serviceParser.ParseEnd(el);
-
-if (depth == 0 && parsingAnswer)
- {
- if (callback)
- callback(error.empty(), error, info, data);
- error.clear();
- info.clear();
- parsingAnswer = false;
- }
-}
-//-----------------------------------------------------------------------------
-void GET_SERVICES::PARSER::AddService(const GET_SERVICE::INFO & serviceInfo)
-{
-info.push_back(serviceInfo);
-}
-//-----------------------------------------------------------------------------
-void GET_SERVICES::PARSER::ServiceCallback(bool result, const std::string & error, const GET_SERVICE::INFO & info, void * data)
-{
- GET_SERVICES::PARSER * parser = static_cast<GET_SERVICES::PARSER *>(data);
- if (!result)
- parser->SetError(error);
- else
- parser->AddService(info);
-}
+++ /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 : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#ifndef __STG_STGLIBS_SRVCONF_PARSER_GET_SERVICES_H__
-#define __STG_STGLIBS_SRVCONF_PARSER_GET_SERVICES_H__
-
-#include "base.h"
-#include "get_service.h"
-
-#include "stg/servconf_types.h"
-
-#include <string>
-
-namespace STG
-{
-namespace GET_SERVICES
-{
-
-class PARSER: public STG::PARSER
-{
-public:
- PARSER(CALLBACK f, void * data);
- int ParseStart(const char * el, const char ** attr);
- void ParseEnd(const char * el);
-
-private:
- CALLBACK callback;
- void * data;
- GET_SERVICE::PARSER serviceParser;
- INFO info;
- int depth;
- bool parsingAnswer;
- std::string error;
-
- void AddService(const GET_SERVICE::INFO & serviceInfo);
- void SetError(const std::string & e) { error = e; }
-
- static void ServiceCallback(bool result, const std::string& reason, const GET_SERVICE::INFO & info, void * data);
-};
-
-} // namespace GET_SERVICES
-} // namespace STG
-
-#endif
class PARSER: public STG::PARSER
{
public:
+ typedef GET_TARIFF::INFO INFO;
+
PARSER(CALLBACK f, void * data);
virtual ~PARSER();
int ParseStart(const char * el, const char ** attr);
+++ /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 : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#include "get_tariffs.h"
-
-#include <strings.h>
-
-using namespace STG;
-
-GET_TARIFFS::PARSER::PARSER(CALLBACK f, void * d)
- : callback(f),
- data(d),
- tariffParser(&GET_TARIFFS::PARSER::TariffCallback, this),
- depth(0),
- parsingAnswer(false)
-{
-}
-//-----------------------------------------------------------------------------
-int GET_TARIFFS::PARSER::ParseStart(const char * el, const char ** attr)
-{
-depth++;
-if (depth == 1 && strcasecmp(el, "tariffs") == 0)
- parsingAnswer = true;
-
-if (depth > 1 && parsingAnswer)
- tariffParser.ParseStart(el, attr);
-
-return 0;
-}
-//-----------------------------------------------------------------------------
-void GET_TARIFFS::PARSER::ParseEnd(const char * el)
-{
-depth--;
-if (depth > 0 && parsingAnswer)
- tariffParser.ParseEnd(el);
-
-if (depth == 0 && parsingAnswer)
- {
- if (callback)
- callback(error.empty(), error, info, data);
- error.clear();
- info.clear();
- parsingAnswer = false;
- }
-}
-//-----------------------------------------------------------------------------
-void GET_TARIFFS::PARSER::AddTariff(const GET_TARIFF::INFO & tariffInfo)
-{
-info.push_back(tariffInfo);
-}
-//-----------------------------------------------------------------------------
-void GET_TARIFFS::PARSER::TariffCallback(bool result, const std::string & error, const GET_TARIFF::INFO & info, void * data)
-{
- GET_TARIFFS::PARSER * parser = static_cast<GET_TARIFFS::PARSER *>(data);
- if (!result)
- parser->SetError(error);
- else
- parser->AddTariff(info);
-}
+++ /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 : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#ifndef __STG_STGLIBS_SRVCONF_PARSER_GET_TARIFFS_H__
-#define __STG_STGLIBS_SRVCONF_PARSER_GET_TARIFFS_H__
-
-#include "base.h"
-#include "get_tariff.h"
-
-#include "stg/servconf_types.h"
-
-#include <string>
-
-namespace STG
-{
-namespace GET_TARIFFS
-{
-
-class PARSER: public STG::PARSER
-{
-public:
- PARSER(CALLBACK f, void * data);
- int ParseStart(const char * el, const char ** attr);
- void ParseEnd(const char * el);
-
-private:
- CALLBACK callback;
- void * data;
- GET_TARIFF::PARSER tariffParser;
- INFO info;
- int depth;
- bool parsingAnswer;
- std::string error;
-
- void AddTariff(const GET_TARIFF::INFO & tariffInfo);
- void SetError(const std::string & e) { error = e; }
-
- static void TariffCallback(bool result, const std::string& reason, const GET_TARIFF::INFO & info, void * data);
-};
-
-} // namespace GET_TARIFFS
-} // namespace STG
-
-#endif
class PARSER: public STG::PARSER
{
public:
+ typedef GET_USER::INFO INFO;
+
PARSER(CALLBACK f, void * data);
virtual ~PARSER();
int ParseStart(const char * el, const char ** attr);
+++ /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 "get_users.h"
-
-#include <strings.h>
-
-using namespace STG;
-
-GET_USERS::PARSER::PARSER(CALLBACK f, void * d)
- : callback(f),
- data(d),
- userParser(&GET_USERS::PARSER::UserCallback, this),
- depth(0),
- parsingAnswer(false)
-{
-}
-//-----------------------------------------------------------------------------
-int GET_USERS::PARSER::ParseStart(const char * el, const char ** attr)
-{
-depth++;
-if (depth == 1 && strcasecmp(el, "users") == 0)
- parsingAnswer = true;
-
-if (depth > 1 && parsingAnswer)
- userParser.ParseStart(el, attr);
-
-return 0;
-}
-//-----------------------------------------------------------------------------
-void GET_USERS::PARSER::ParseEnd(const char * el)
-{
-depth--;
-if (depth > 0 && parsingAnswer)
- userParser.ParseEnd(el);
-
-if (depth == 0 && parsingAnswer)
- {
- if (callback)
- callback(error.empty(), error, info, data);
- error.clear();
- info.clear();
- parsingAnswer = false;
- }
-}
-//-----------------------------------------------------------------------------
-void GET_USERS::PARSER::AddUser(const GET_USER::INFO & userInfo)
-{
-info.push_back(userInfo);
-}
-//-----------------------------------------------------------------------------
-void GET_USERS::PARSER::UserCallback(bool result, const std::string & error, const GET_USER::INFO & info, void * data)
-{
- GET_USERS::PARSER * parser = static_cast<GET_USERS::PARSER *>(data);
- if (!result)
- parser->SetError(error);
- else
- parser->AddUser(info);
-}
+++ /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_GET_USERS_H__
-#define __STG_STGLIBS_SRVCONF_PARSER_GET_USERS_H__
-
-#include "base.h"
-#include "get_user.h"
-
-#include "stg/servconf_types.h"
-
-#include <string>
-
-namespace STG
-{
-namespace GET_USERS
-{
-
-class PARSER: public STG::PARSER
-{
-public:
- PARSER(CALLBACK f, void * data);
- int ParseStart(const char * el, const char ** attr);
- void ParseEnd(const char * el);
-
-private:
- CALLBACK callback;
- void * data;
- GET_USER::PARSER userParser;
- INFO info;
- int depth;
- bool parsingAnswer;
- std::string error;
-
- void AddUser(const GET_USER::INFO & userInfo);
- void SetError(const std::string & e) { error = e; }
-
- static void UserCallback(bool result, const std::string& reason, const GET_USER::INFO & info, void * data);
-};
-
-} // namespace GET_USERS
-} // namespace STG
-
-#endif
#include "netunit.h"
#include "parsers/simple.h"
+#include "parsers/get_container.h"
#include "parsers/server_info.h"
-#include "parsers/get_admins.h"
#include "parsers/get_admin.h"
#include "parsers/chg_admin.h"
-#include "parsers/get_tariffs.h"
#include "parsers/get_tariff.h"
#include "parsers/chg_tariff.h"
#include "parsers/auth_by.h"
-#include "parsers/get_users.h"
#include "parsers/get_user.h"
#include "parsers/chg_user.h"
-#include "parsers/get_services.h"
#include "parsers/get_service.h"
#include "parsers/chg_service.h"
-#include "parsers/get_corporations.h"
#include "parsers/get_corp.h"
#include "parsers/chg_corp.h"
int SERVCONF::GetAdmins(GET_ADMINS::CALLBACK f, void * data)
{
-return pImpl->Exec<GET_ADMINS::PARSER>("<GetAdmins/>", f, data);
+return pImpl->Exec<GET_CONTAINER::PARSER<GET_ADMIN::PARSER> >("admins", "<GetAdmins/>", f, data);
}
int SERVCONF::GetAdmin(const std::string & login, GET_ADMIN::CALLBACK f, void * data)
int SERVCONF::GetTariffs(GET_TARIFFS::CALLBACK f, void * data)
{
-return pImpl->Exec<GET_TARIFFS::PARSER>("<GetTariffs/>", f, data);
+return pImpl->Exec<GET_CONTAINER::PARSER<GET_TARIFF::PARSER> >("tariffs", "<GetTariffs/>", f, data);
}
int SERVCONF::GetTariff(const std::string & name, GET_TARIFF::CALLBACK f, void * data)
int SERVCONF::GetUsers(GET_USERS::CALLBACK f, void * data)
{
-return pImpl->Exec<GET_USERS::PARSER>("<GetUsers/>", f, data);
+return pImpl->Exec<GET_CONTAINER::PARSER<GET_USER::PARSER> >("users", "<GetUsers/>", f, data);
}
int SERVCONF::GetUser(const std::string & login, GET_USER::CALLBACK f, void * data)
int SERVCONF::GetServices(GET_SERVICES::CALLBACK f, void * data)
{
-return pImpl->Exec<GET_SERVICES::PARSER>("<GetServices/>", f, data);
+return pImpl->Exec<GET_CONTAINER::PARSER<GET_SERVICE::PARSER> >("services", "<GetServices/>", f, data);
}
int SERVCONF::GetService(const std::string & name, GET_SERVICE::CALLBACK f, void * data)
int SERVCONF::GetCorporations(GET_CORPORATIONS::CALLBACK f, void * data)
{
-return pImpl->Exec<GET_CORPORATIONS::PARSER>("<GetCorporations/>", f, data);
+return pImpl->Exec<GET_CONTAINER::PARSER<GET_CORP::PARSER> >("corporations", "<GetCorporations/>", f, data);
}
int SERVCONF::GetCorp(const std::string & name, GET_CORP::CALLBACK f, void * data)