]> git.stg.codes - stg.git/blob - include/stg/admin_conf.h
Do not compile mod_cap_ipq on systems where ip_queue is not available.
[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 <string>
11
12 #include "os_int.h"
13
14 #define ADM_LOGIN_LEN   (32)
15 #define ADM_PASSWD_LEN  (32)
16 //-----------------------------------------------------------------------------
17 struct PRIV
18 {
19     PRIV()
20         : userStat(0),
21           userConf(0),
22           userCash(0),
23           userPasswd(0),
24           userAddDel(0),
25           adminChg(0),
26           tariffChg(0),
27           serviceChg(0),
28           corpChg(0)
29     {}
30     PRIV(uint32_t p)
31         : userStat((p & 0x00000003) >> 0x00),
32           userConf((p & 0x0000000C) >> 0x02),
33           userCash((p & 0x00000030) >> 0x04),
34           userPasswd((p & 0x000000C0) >> 0x06),
35           userAddDel((p & 0x00000300) >> 0x08),
36           adminChg((p & 0x00000C00) >> 0x0A),
37           tariffChg((p & 0x00003000) >> 0x0C),
38           serviceChg((p & 0x0000C000) >> 0x0E),
39           corpChg((p & 0x00030000) >> 0x10)
40     {}
41
42     uint32_t ToInt() const;
43     void FromInt(uint32_t p);
44
45     uint16_t userStat;
46     uint16_t userConf;
47     uint16_t userCash;
48     uint16_t userPasswd;
49     uint16_t userAddDel;
50     uint16_t adminChg;
51     uint16_t tariffChg;
52     uint16_t serviceChg;
53     uint16_t corpChg;
54 };
55 //-----------------------------------------------------------------------------
56 struct ADMIN_CONF
57 {
58     ADMIN_CONF()
59         : priv(),
60           login(),
61           password("* NO PASSWORD *")
62     {}
63     ADMIN_CONF(const ADMIN_CONF & rvalue)
64         : priv(rvalue.priv),
65           login(rvalue.login),
66           password(rvalue.password)
67     {}
68     ADMIN_CONF(const PRIV & pr, const std::string & l, const std::string & p)
69         : priv(pr),
70           login(l),
71           password(p)
72     {}
73     PRIV          priv;
74     std::string   login;
75     std::string   password;
76 };
77 //-----------------------------------------------------------------------------
78
79 #include "admin_conf.inc.h"
80
81 #endif
82
83