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/resetable.h"
41 class GET_USERS: public BASE_PARSER
44 GET_USERS(const ADMIN & admin, USERS & users)
45 : BASE_PARSER(admin, "GetUsers"), m_users(users),
46 lastUserUpdateTime(0), lastUpdateFound(false) {}
47 int Start(void * data, const char * el, const char ** attr);
51 time_t lastUserUpdateTime;
57 class GET_USER: public BASE_PARSER
60 GET_USER(const ADMIN & admin, const USERS & users)
61 : BASE_PARSER(admin, "GetUser"), m_users(users) {}
62 int Start(void * data, const char * el, const char ** attr);
65 const USERS & m_users;
71 class ADD_USER: public BASE_PARSER
74 ADD_USER(const ADMIN & admin, USERS & users)
75 : BASE_PARSER(admin, "AddUser"), m_users(users) {}
76 int Start(void * data, const char * el, const char ** attr);
77 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);
92 int Start(void * data, const char * el, const char ** attr);
93 int End(void * data, const char * el);
97 const TARIFFS & m_tariffs;
100 RESETABLE<uint64_t> * upr;
101 RESETABLE<uint64_t> * downr;
104 bool cashMustBeAdded;
111 class DEL_USER: public BASE_PARSER
114 DEL_USER(const ADMIN & admin, USERS & users)
115 : BASE_PARSER(admin, "DelUser"), m_users(users), res(0), u(NULL) {}
116 int Start(void * data, const char * el, const char ** attr);
117 int End(void * data, const char * el);
127 class CHECK_USER: public BASE_PARSER
130 CHECK_USER(const ADMIN & admin, const USERS & users)
131 : BASE_PARSER(admin, "CheckUser"), m_users(users) {}
132 int Start(void * data, const char * el, const char ** attr);
133 int End(void * data, const char * el);
136 const USERS & m_users;
138 void CreateAnswer(const char * error);