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"
43 class GET_USERS: public BASE_PARSER
46 GET_USERS(const ADMIN & admin, USERS & users)
47 : BASE_PARSER(admin, "GetUsers"), m_users(users),
48 m_lastUserUpdateTime(0) {}
49 int Start(void * data, const char * el, const char ** attr);
53 time_t m_lastUserUpdateTime;
58 class GET_USER: public BASE_PARSER
61 GET_USER(const ADMIN & admin, const USERS & users)
62 : BASE_PARSER(admin, "GetUser"), m_users(users) {}
63 int Start(void * data, const char * el, const char ** attr);
66 const USERS & m_users;
72 class ADD_USER: public BASE_PARSER
75 ADD_USER(const ADMIN & admin, USERS & users)
76 : BASE_PARSER(admin, "AddUser"), m_users(users) {}
77 int Start(void * data, const char * el, const char ** attr);
78 int End(void * data, const char * el);
87 class CHG_USER: public BASE_PARSER
90 CHG_USER(const ADMIN & admin, USERS & users, const TARIFFS & tariffs)
91 : BASE_PARSER(admin, "SetUser"),
94 m_cashMustBeAdded(false),
97 int Start(void * data, const char * el, const char ** attr);
98 int End(void * data, const char * el);
102 const TARIFFS & m_tariffs;
105 RESETABLE<uint64_t> m_upr[DIR_NUM];
106 RESETABLE<uint64_t> m_downr[DIR_NUM];
107 std::string m_cashMsg;
109 bool m_cashMustBeAdded;
116 class DEL_USER: public BASE_PARSER
119 DEL_USER(const ADMIN & admin, USERS & users)
120 : BASE_PARSER(admin, "DelUser"), m_users(users), res(0), u(NULL) {}
121 int Start(void * data, const char * el, const char ** attr);
122 int End(void * data, const char * el);
132 class CHECK_USER: public BASE_PARSER
135 CHECK_USER(const ADMIN & admin, const USERS & users)
136 : BASE_PARSER(admin, "CheckUser"), m_users(users) {}
137 int Start(void * data, const char * el, const char ** attr);
138 int End(void * data, const char * el);
141 const USERS & m_users;
143 void CreateAnswer(const char * error);