]> git.stg.codes - stg.git/blob - libs/srvconf/include/stg/servconf.h
Public interfaces: part 1
[stg.git] / libs / srvconf / include / stg / servconf.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 : Boris Mikhailenko <stg34@stargazer.dp.ua>
19  *    Author : Maxim Mamontov <faust@stargazer.dp.ua>
20  */
21
22 #pragma once
23
24 #include "stg/servconf_types.h"
25
26 #include <string>
27 #include <cstdint>
28
29 namespace STG
30 {
31
32 struct AdminConfOpt;
33 struct UserConfOpt;
34 struct UserStatOpt;
35 struct TariffDataOpt;
36 struct ServiceConfOpt;
37 struct CorpConfOpt;
38
39 class ServConf
40 {
41     public:
42         ServConf(const std::string& server, uint16_t port,
43                  const std::string& login, const std::string& password);
44         ServConf(const std::string& server, uint16_t port,
45                  const std::string& localAddress, uint16_t localPort,
46                  const std::string& login, const std::string& password);
47         ~ServConf();
48
49         int ServerInfo(ServerInfo::Callback f, void* data);
50
51         int RawXML(const std::string& request, RawXML::Callback f, void* data);
52
53         int GetAdmins(GetContainer::Callback<GetAdmin::Info>::Type f, void* data);
54         int GetAdmin(const std::string& login, GetAdmin::Callback f, void* data);
55         int ChgAdmin(const AdminConfOpt& conf, Simple::Callback f, void* data);
56         int AddAdmin(const std::string& login,
57                      const AdminConfOpt& conf,
58                      Simple::Callback f, void* data);
59         int DelAdmin(const std::string& login, Simple::Callback f, void* data);
60
61         int GetTariffs(GetContainer::Callback<GetTariff::Info>::Type f, void* data);
62         int GetTariff(const std::string& name, GetTariff::Callback f, void* data);
63         int ChgTariff(const TariffDataOpt& conf, Simple::Callback f, void* data);
64         int AddTariff(const std::string& name,
65                       const TariffDataOpt& conf,
66                       Simple::Callback f, void* data);
67         int DelTariff(const std::string& name, Simple::Callback f, void* data);
68
69         int GetUsers(GetContainer::Callback<GetUser::Info>::Type f, void* data);
70         int GetUser(const std::string& login, GetUser::Callback f, void* data);
71         int ChgUser(const std::string& login,
72                     const UserConfOpt& conf,
73                     const UserStatOpt& stat,
74                     Simple::Callback f, void* data);
75         int DelUser(const std::string& login, Simple::Callback f, void* data);
76         int AddUser(const std::string& login,
77                     const UserConfOpt& conf,
78                     const UserStatOpt& stat,
79                     Simple::Callback f, void* data);
80         int AuthBy(const std::string& login, AuthBy::Callback f, void* data);
81         int SendMessage(const std::string& login, const std::string& text, Simple::Callback f, void* data);
82         int CheckUser(const std::string& login, const std::string& password, Simple::Callback f, void* data);
83
84         int GetServices(GetContainer::Callback<GetService::Info>::Type f, void* data);
85         int GetService(const std::string& name, GetService::Callback f, void* data);
86         int ChgService(const ServiceConfOpt& conf, Simple::Callback f, void* data);
87         int AddService(const std::string& name,
88                        const ServiceConfOpt& conf,
89                        Simple::Callback f, void* data);
90         int DelService(const std::string& name, Simple::Callback f, void* data);
91
92         int GetCorporations(GetContainer::Callback<GetCorp::Info>::Type f, void* data);
93         int GetCorp(const std::string& name, GetCorp::Callback f, void* data);
94         int ChgCorp(const CorpConfOpt& conf, Simple::Callback f, void* data);
95         int AddCorp(const std::string& name,
96                     const CorpConfOpt& conf,
97                     Simple::Callback f, void* data);
98         int DelCorp(const std::string & name, Simple::Callback f, void* data);
99
100         const std::string& GetStrError() const;
101
102     private:
103         class Impl;
104         Impl* pImpl;
105 };
106
107 } // namespace STG