]> git.stg.codes - stg.git/blob - include/stg/admin_conf.h
Minor changes.
[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     explicit 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 PRIV & pr, const std::string & l, const std::string & p)
66         : priv(pr),
67           login(l),
68           password(p)
69     {}
70     PRIV          priv;
71     std::string   login;
72     std::string   password;
73 };
74 //-----------------------------------------------------------------------------
75 struct ADMIN_CONF_RES
76 {
77     ADMIN_CONF_RES()
78     {}
79     RESETABLE<PRIV> priv;
80     RESETABLE<std::string> login;
81     RESETABLE<std::string> password;
82 };
83
84 #include "admin_conf.inc.h"
85
86 #endif
87
88