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: 2009/10/15 14:46:17 $
33 #include <sys/types.h>
34 #include <sys/socket.h>
46 #define STG_HEADER "SG04"
47 #define OK_HEADER "OKHD"
48 #define ERR_HEADER "ERHD"
49 #define OK_LOGIN "OKLG"
50 #define ERR_LOGIN "ERLG"
51 #define OK_LOGINS "OKLS"
52 #define ERR_LOGINS "ERLS"
54 //-----------------------------------------------------------------------------
61 void SetPort(uint16_t port);
62 //void SetHostAllow(HOSTALLOW * ha);
63 void SetAdmins(ADMINS * a);
64 void SetUsers(USERS * u);
65 void SetTariffs(TARIFFS * t);
66 void SetStore(STORE * s);
67 void SetStgSettings(const SETTINGS * s);
68 const string & GetAdminLogin();
69 uint32_t GetAdminIP();
72 const string & GetStrError();
73 static void * Run(void * a);
76 int RecvHdr(int sock);
77 int RecvLogin(int sock);
78 int SendLoginAnswer(int sock, int err);
79 int SendHdrAnswer(int sock, int err);
80 int RecvLoginS(int sock);
81 int SendLoginSAnswer(int sock, int err);
82 int RecvData(int sock);
83 int SendDataAnswer(int sock);
84 void SendError(const char * text);
85 void WriteLogAccessFailed(uint32_t ip);
89 list<string> answerList;
90 list<string> requestList;
94 pthread_t thrReciveSendConf;
97 //HOSTALLOW * hostAllow;
98 const ADMIN * currAdmin;
99 STG_LOGGER & WriteServLog;
103 struct sockaddr_in outerAddr;
104 socklen_t outerAddrLen;
106 PARSER_GET_SERVER_INFO parserGetServInfo;
108 PARSER_GET_USERS parserGetUsers;
109 PARSER_GET_USER parserGetUser;
110 PARSER_CHG_USER parserChgUser;
111 PARSER_ADD_USER parserAddUser;
112 PARSER_DEL_USER parserDelUser;
113 PARSER_CHECK_USER parserCheckUser;
114 PARSER_SEND_MESSAGE parserSendMessage;
116 PARSER_GET_ADMINS parserGetAdmins;
117 PARSER_ADD_ADMIN parserAddAdmin;
118 PARSER_DEL_ADMIN parserDelAdmin;
119 PARSER_CHG_ADMIN parserChgAdmin;
121 PARSER_GET_TARIFFS parserGetTariffs;
122 PARSER_ADD_TARIFF parserAddTariff;
123 PARSER_DEL_TARIFF parserDelTariff;
124 PARSER_CHG_TARIFF parserChgTariff;
130 const SETTINGS * settings;
132 BASE_PARSER * currParser;
133 vector<BASE_PARSER*> dataParser;
135 XML_Parser xmlParser;
139 friend void ParseXMLStart(void *data, const char *el, const char **attr);
140 friend void ParseXMLEnd(void *data, const char *el);
142 //-----------------------------------------------------------------------------
143 #endif //CONFIGPROTO_H