]> git.stg.codes - stg.git/blob - include/stg/admin_conf.h
Ticket 37. TariffChangelsAllowed function name changed to
[stg.git] / include / stg / admin_conf.h
1  /*
2  $Revision: 1.9 $
3  $Date: 2010/09/10 05:02:08 $
4  $Author: faust $
5  */
6
7 #ifndef ADMIN_CONF_H
8 #define ADMIN_CONF_H
9
10 #include "stg/resetable.h"
11
12 #include <string>
13
14 #include "os_int.h"
15
16 #define ADM_LOGIN_LEN   (32)
17 #define ADM_PASSWD_LEN  (32)
18 //-----------------------------------------------------------------------------
19 struct PRIV
20 {
21     PRIV()
22         : userStat(0),
23           userConf(0),
24           userCash(0),
25           userPasswd(0),
26           userAddDel(0),
27           adminChg(0),
28           tariffChg(0),
29           serviceChg(0),
30           corpChg(0)
31     {}
32     PRIV(uint32_t p)
33         : userStat((p & 0x00000003) >> 0x00),
34           userConf((p & 0x0000000C) >> 0x02),
35           userCash((p & 0x00000030) >> 0x04),
36           userPasswd((p & 0x000000C0) >> 0x06),
37           userAddDel((p & 0x00000300) >> 0x08),
38           adminChg((p & 0x00000C00) >> 0x0A),
39           tariffChg((p & 0x00003000) >> 0x0C),
40           serviceChg((p & 0x0000C000) >> 0x0E),
41           corpChg((p & 0x00030000) >> 0x10)
42     {}
43
44     uint32_t ToInt() const;
45     void FromInt(uint32_t p);
46
47     uint16_t userStat;
48     uint16_t userConf;
49     uint16_t userCash;
50     uint16_t userPasswd;
51     uint16_t userAddDel;
52     uint16_t adminChg;
53     uint16_t tariffChg;
54     uint16_t serviceChg;
55     uint16_t corpChg;
56 };
57 //-----------------------------------------------------------------------------
58 struct ADMIN_CONF
59 {
60     ADMIN_CONF()
61         : priv(),
62           login(),
63           password("* NO PASSWORD *")
64     {}
65     ADMIN_CONF(const ADMIN_CONF & rvalue)
66         : priv(rvalue.priv),
67           login(rvalue.login),
68           password(rvalue.password)
69     {}
70     ADMIN_CONF(const PRIV & pr, const std::string & l, const std::string & p)
71         : priv(pr),
72           login(l),
73           password(p)
74     {}
75     PRIV          priv;
76     std::string   login;
77     std::string   password;
78 };
79 //-----------------------------------------------------------------------------
80 struct ADMIN_CONF_RES
81 {
82     ADMIN_CONF_RES()
83     {}
84     ADMIN_CONF_RES(const ADMIN_CONF_RES & rhs)
85         : priv(rhs.priv),
86           login(rhs.login),
87           password(rhs.password)
88     {}
89     ADMIN_CONF_RES & operator=(const ADMIN_CONF_RES & rhs)
90     {
91         priv = rhs.priv;
92         login = rhs.login;
93         password = rhs.password;
94         return *this;
95     }
96     RESETABLE<PRIV> priv;
97     RESETABLE<std::string> login;
98     RESETABLE<std::string> password;
99 };
100
101 #include "admin_conf.inc.h"
102
103 #endif
104
105