]> git.stg.codes - stg.git/blob - include/stg/admin_conf.h
Fix radius plugin compilation errors
[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     {};
28     PRIV(uint16_t p)
29         : userStat((p & 0x0003) >> 0x00),
30           userConf((p & 0x000C) >> 0x02),
31           userCash((p & 0x0030) >> 0x04),
32           userPasswd((p & 0x00C0) >> 0x06),
33           userAddDel((p & 0x0300) >> 0x08),
34           adminChg((p & 0x0C00) >> 0x0A),
35           tariffChg((p & 0x3000) >> 0x0C)
36     {}
37
38     uint16_t ToInt() const;
39     void FromInt(uint16_t p);
40
41     uint16_t userStat;
42     uint16_t userConf;
43     uint16_t userCash;
44     uint16_t userPasswd;
45     uint16_t userAddDel;
46     uint16_t adminChg;
47     uint16_t tariffChg;
48 };
49 //-----------------------------------------------------------------------------
50 struct ADMIN_CONF
51 {
52     ADMIN_CONF()
53         : priv(),
54           login(),
55           password("* NO PASSWORD *")
56     {}
57     ADMIN_CONF(const ADMIN_CONF & rvalue)
58         : priv(rvalue.priv),
59           login(rvalue.login),
60           password(rvalue.password)
61     {}
62     ADMIN_CONF(const PRIV & pr, const std::string & l, const std::string & p)
63         : priv(pr),
64           login(l),
65           password(p)
66     {}
67     PRIV          priv;
68     std::string   login;
69     std::string   password;
70 };
71 //-----------------------------------------------------------------------------
72
73 #include "admin_conf.inc.h"
74
75 #endif
76
77