2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
23 $Date: 2010/10/04 20:24:14 $
35 #include "stg/module_settings.h"
36 #include "stg/os_int.h"
41 #define STG_HEADER "SG04"
42 #define OK_HEADER "OKHD"
43 #define ERR_HEADER "ERHD"
44 #define OK_LOGIN "OKLG"
45 #define ERR_LOGIN "ERLG"
46 #define OK_LOGINS "OKLS"
47 #define ERR_LOGINS "ERLS"
58 //-----------------------------------------------------------------------------
61 CONFIGPROTO(PLUGIN_LOGGER & l);
64 void SetPort(uint16_t port);
65 void SetAdmins(ADMINS * a);
66 void SetUsers(USERS * u);
67 void SetTariffs(TARIFFS * t);
68 void SetStore(STORE * s);
69 void SetStgSettings(const SETTINGS * s);
70 uint32_t GetAdminIP() const { return adminIP; }
73 const std::string & GetStrError() const { return errorStr; }
77 CONFIGPROTO(const CONFIGPROTO & rvalue);
78 CONFIGPROTO & operator=(const CONFIGPROTO & rvalue);
80 int RecvHdr(int sock);
81 int RecvLogin(int sock);
82 int SendLoginAnswer(int sock);
83 int SendHdrAnswer(int sock, int err);
84 int RecvLoginS(int sock);
85 int SendLoginSAnswer(int sock, int err);
86 int RecvData(int sock);
87 int SendDataAnswer(int sock, const std::string & answer);
88 int SendError(int sock, const std::string & text);
89 void WriteLogAccessFailed(uint32_t ip);
90 const std::string & GetDataAnswer() const { return dataAnswer; }
94 std::list<std::string> requestList;
96 std::string adminLogin;
97 std::string adminPassword;
99 pthread_t thrReciveSendConf;
103 PLUGIN_LOGGER & logger;
104 std::string dataAnswer;
110 BASE_PARSER * currParser;
111 std::vector<BASE_PARSER *> dataParser;
113 XML_Parser xmlParser;
115 std::string errorStr;
117 friend void ParseXMLStart(void *data, const char *el, const char **attr);
118 friend void ParseXMLEnd(void *data, const char *el);
120 //-----------------------------------------------------------------------------
121 #endif //CONFIGPROTO_H