1 #ifndef __RPC_CONFIG_H__
2 #define __RPC_CONFIG_H__
10 #include <xmlrpc-c/base.hpp>
11 #include <xmlrpc-c/registry.hpp>
12 #include <xmlrpc-c/server_abyss.hpp>
16 #include "admin_conf.h"
17 #include "module_settings.h"
19 #define RPC_CONFIG_VERSION "Stargazer RPC v. 0.2"
21 extern "C" PLUGIN * GetPlugin();
28 class RPC_CONFIG_SETTINGS
31 RPC_CONFIG_SETTINGS();
32 virtual ~RPC_CONFIG_SETTINGS() {};
33 const std::string & GetStrError() const { return errorStr; };
34 int ParseSettings(const MODULE_SETTINGS & s);
35 uint16_t GetPort() const { return port; };
36 double GetCookieTimeout() const { return cookieTimeout; };
38 int ParseIntInRange(const std::string & str,
54 class RPC_CONFIG :public PLUGIN
58 virtual ~RPC_CONFIG();
60 void SetUsers(USERS * u) { users = u; }
61 void SetTariffs(TARIFFS * t) { tariffs = t; }
62 void SetAdmins(ADMINS * a) { admins = a; }
63 void SetStore(STORE * s) { store = s; }
64 void SetTraffcounter(TRAFFCOUNTER *) {}
65 void SetStgSettings(const SETTINGS * s) { stgSettings = s; }
66 void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
71 int Reload() { return 0; }
72 bool IsRunning() { return running && !stopped; }
74 const std::string & GetStrError() const { return errorStr; }
75 const std::string GetVersion() const { return RPC_CONFIG_VERSION; }
76 uint16_t GetStartPosition() const { return 220; }
77 uint16_t GetStopPosition() const { return 220; }
79 bool GetAdminInfo(const std::string & cookie,
81 bool CheckAdmin(const std::string & login,
82 const std::string & password,
83 std::string * cookie);
84 bool LogoutAdmin(const std::string & cookie);
87 static void * Run(void *);
88 std::string GetCookie() const;
89 void InitiateRegistry();
91 mutable std::string errorStr;
92 RPC_CONFIG_SETTINGS rpcConfigSettings;
97 MODULE_SETTINGS settings;
98 const SETTINGS * stgSettings;
99 xmlrpc_c::registry rpcRegistry;
100 xmlrpc_c::serverAbyss * rpcServer;
104 std::map<std::string,