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 $
32 #include <sys/types.h>
33 #include <sys/socket.h>
38 #include "../../../users.h"
39 #include "../../../admins.h"
40 #include "../../../tariffs.h"
41 #include "stg_logger.h"
45 #define STG_HEADER "SG04"
46 #define OK_HEADER "OKHD"
47 #define ERR_HEADER "ERHD"
48 #define OK_LOGIN "OKLG"
49 #define ERR_LOGIN "ERLG"
50 #define OK_LOGINS "OKLS"
51 #define ERR_LOGINS "ERLS"
53 //-----------------------------------------------------------------------------
60 void SetPort(uint16_t port);
61 void SetAdmins(ADMINS * a);
62 void SetUsers(USERS * u);
63 void SetTariffs(TARIFFS * t);
64 void SetStore(BASE_STORE * s);
65 void SetStgSettings(const SETTINGS * s);
66 uint32_t GetAdminIP() const;
69 const string & GetStrError() const;
70 static void * Run(void * a);
73 int RecvHdr(int sock);
74 int RecvLogin(int sock);
75 int SendLoginAnswer(int sock, int err);
76 int SendHdrAnswer(int sock, int err);
77 int RecvLoginS(int sock);
78 int SendLoginSAnswer(int sock, int err);
79 int RecvData(int sock);
80 int SendDataAnswer(int sock);
81 void SendError(const char * text);
82 void WriteLogAccessFailed(uint32_t ip);
86 list<string> answerList;
87 list<string> requestList;
91 pthread_t thrReciveSendConf;
95 STG_LOGGER & WriteServLog;
99 PARSER_GET_SERVER_INFO parserGetServInfo;
101 PARSER_GET_USERS parserGetUsers;
102 PARSER_GET_USER parserGetUser;
103 PARSER_CHG_USER parserChgUser;
104 PARSER_ADD_USER parserAddUser;
105 PARSER_DEL_USER parserDelUser;
106 PARSER_CHECK_USER parserCheckUser;
107 PARSER_SEND_MESSAGE parserSendMessage;
109 PARSER_GET_ADMINS parserGetAdmins;
110 PARSER_ADD_ADMIN parserAddAdmin;
111 PARSER_DEL_ADMIN parserDelAdmin;
112 PARSER_CHG_ADMIN parserChgAdmin;
114 PARSER_GET_TARIFFS parserGetTariffs;
115 PARSER_ADD_TARIFF parserAddTariff;
116 PARSER_DEL_TARIFF parserDelTariff;
117 PARSER_CHG_TARIFF parserChgTariff;
121 BASE_PARSER * currParser;
122 vector<BASE_PARSER*> dataParser;
124 XML_Parser xmlParser;
128 friend void ParseXMLStart(void *data, const char *el, const char **attr);
129 friend void ParseXMLEnd(void *data, const char *el);
131 //-----------------------------------------------------------------------------
132 #endif //CONFIGPROTO_H