]> git.stg.codes - stg.git/blob - libs/srvconf/include/stg/servconf_types.h
Port to CMake, get rid of os_int.h.
[stg.git] / libs / srvconf / include / stg / servconf_types.h
1 /*
2  *    This program is free software; you can redistribute it and/or modify
3  *    it under the terms of the GNU General Public License as published by
4  *    the Free Software Foundation; either version 2 of the License, or
5  *    (at your option) any later version.
6  *
7  *    This program is distributed in the hope that it will be useful,
8  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *    GNU General Public License for more details.
11  *
12  *    You should have received a copy of the GNU General Public License
13  *    along with this program; if not, write to the Free Software
14  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15  */
16
17 /*
18  *    Author : Maxim Mamontov <faust@stargazer.dp.ua>
19  */
20
21 #ifndef __STG_STGLIBS_SRVCONF_TYPES_H__
22 #define __STG_STGLIBS_SRVCONF_TYPES_H__
23
24 #include "stg/array.h"
25 #include "stg/const.h" // DIR_NUM
26
27 #include <string>
28 #include <vector>
29 #include <ctime>
30 #include <cstdint>
31
32 struct ADMIN_CONF;
33 struct TARIFF_DATA;
34 struct SERVICE_CONF;
35 struct CORP_CONF;
36
37 namespace STG
38 {
39
40 enum status
41 {
42 st_ok = 0,
43 st_conn_fail,
44 st_send_fail,
45 st_recv_fail,
46 st_header_err,
47 st_login_err,
48 st_logins_err,
49 st_data_err,
50 st_unknown_err,
51 st_dns_err,
52 st_xml_parse_error,
53 st_data_error
54 };
55
56 namespace SIMPLE
57 {
58
59 typedef void (* CALLBACK)(bool result, const std::string & reason, void * data);
60
61 } // namespace SIMPLE
62
63 namespace GET_CONTAINER
64 {
65
66 template <typename INFO>
67 struct CALLBACK
68 {
69 typedef void (* TYPE)(bool result, const std::string & reason, const std::vector<INFO> & info, void * data);
70 };
71
72 } // namespace GET_CONTAINER
73
74 namespace AUTH_BY
75 {
76
77 typedef std::vector<std::string> INFO;
78 typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
79
80 } // namespace AUTH_BY
81
82 namespace SERVER_INFO
83 {
84
85 struct INFO
86 {
87     std::string version;
88     int         tariffNum;
89     int         tariffType;
90     int         usersNum;
91     std::string uname;
92     int         dirNum;
93     ARRAY<std::string, DIR_NUM> dirName;
94 };
95 typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
96
97 } // namespace SERVER_INFO
98
99 namespace RAW_XML
100 {
101
102 typedef void (* CALLBACK)(bool result, const std::string & reason, const std::string & response, void * data);
103
104 } // namespace RAW_XML
105
106 namespace GET_USER
107 {
108
109 struct STAT
110 {
111     ARRAY<long long, DIR_NUM> su;
112     ARRAY<long long, DIR_NUM> sd;
113     ARRAY<long long, DIR_NUM> mu;
114     ARRAY<long long, DIR_NUM> md;
115 };
116
117 struct INFO
118 {
119     std::string login;
120     std::string password;
121     double      cash;
122     double      credit;
123     time_t      creditExpire;
124     double      lastCashAdd;
125     double      lastCashAddTime;
126     time_t      lastTimeCash;
127     double      prepaidTraff;
128     int         disabled;
129     int         passive;
130     int         disableDetailStat;
131     int         connected;
132     int         alwaysOnline;
133     uint32_t    ip;
134     std::string ips;
135     std::string tariff;
136     std::string group;
137     std::string note;
138     std::string email;
139     std::string name;
140     std::string address;
141     std::string phone;
142     std::string corp;
143     STAT        stat;
144     time_t      pingTime;
145     time_t      lastActivityTime;
146     ARRAY<std::string, USERDATA_NUM> userData;
147     std::vector<std::string> services;
148     std::vector<std::string> authBy;
149 };
150
151 typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
152
153 } // namespace GET_USER
154
155 namespace GET_ADMIN
156 {
157
158 typedef ADMIN_CONF INFO;
159 typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
160
161 } // namespace GET_ADMIN
162
163 namespace GET_TARIFF
164 {
165
166 typedef TARIFF_DATA INFO;
167 typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
168
169 } // namespace GET_TARIFF
170
171 namespace GET_SERVICE
172 {
173
174 typedef SERVICE_CONF INFO;
175 typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
176
177 } // namespace GET_SERVICE
178
179 namespace GET_CORP
180 {
181
182 typedef CORP_CONF INFO;
183 typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
184
185 } // namespace GET_CORP
186
187 } // namespace STG
188
189 #endif