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>
19 * Author : Maxim Mamontov <faust@stargazer.dp.ua>
22 #ifndef __STG_SGCONFIG_PARSER_USERS_H__
23 #define __STG_SGCONFIG_PARSER_USERS_H__
27 #include "stg/user_conf.h"
28 #include "stg/user_stat.h"
29 #include "stg/resetable.h"
44 class GET_USERS: public BASE_PARSER
47 GET_USERS(const ADMIN & admin, USERS & users)
48 : BASE_PARSER(admin, "GetUsers"), m_users(users),
49 m_lastUserUpdateTime(0) {}
50 int Start(void * data, const char * el, const char ** attr);
54 time_t m_lastUserUpdateTime;
59 class GET_USER: public BASE_PARSER
62 GET_USER(const ADMIN & admin, const USERS & users)
63 : BASE_PARSER(admin, "GetUser"), m_users(users) {}
64 int Start(void * data, const char * el, const char ** attr);
67 const USERS & m_users;
73 class ADD_USER: public BASE_PARSER
76 ADD_USER(const ADMIN & admin, USERS & users)
77 : BASE_PARSER(admin, "AddUser"), m_users(users) {}
78 int Start(void * data, const char * el, const char ** attr);
87 class CHG_USER: public BASE_PARSER
90 CHG_USER(const ADMIN & admin, USERS & users,
91 STORE & store, const TARIFFS & tariffs)
92 : BASE_PARSER(admin, "SetUser"),
96 m_cashMustBeAdded(false),
99 int Start(void * data, const char * el, const char ** attr);
104 const TARIFFS & m_tariffs;
107 RESETABLE<uint64_t> m_upr[DIR_NUM];
108 RESETABLE<uint64_t> m_downr[DIR_NUM];
109 std::string m_cashMsg;
111 bool m_cashMustBeAdded;
118 class DEL_USER: public BASE_PARSER
121 DEL_USER(const ADMIN & admin, USERS & users)
122 : BASE_PARSER(admin, "DelUser"), m_users(users), res(0), u(NULL) {}
123 int Start(void * data, const char * el, const char ** attr);
124 int End(void * data, const char * el);
134 class CHECK_USER: public BASE_PARSER
137 CHECK_USER(const ADMIN & admin, const USERS & users)
138 : BASE_PARSER(admin, "CheckUser"), m_users(users) {}
139 int Start(void * data, const char * el, const char ** attr);
140 int End(void * data, const char * el);
143 const USERS & m_users;
145 void CreateAnswer(const char * error);