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