1 #ifndef __RPC_CONFIG_H__
2 #define __RPC_CONFIG_H__
11 #include <xmlrpc-c/base.hpp>
12 #include <xmlrpc-c/registry.hpp>
13 #include <xmlrpc-c/server_abyss.hpp>
15 #include "stg/os_int.h"
16 #include "stg/plugin.h"
17 #include "stg/admin_conf.h"
18 #include "stg/module_settings.h"
19 #include "stg/logger.h"
21 #define RPC_CONFIG_VERSION "Stargazer RPC v. 0.2"
23 extern "C" PLUGIN * GetPlugin();
30 class RPC_CONFIG_SETTINGS
33 RPC_CONFIG_SETTINGS();
34 virtual ~RPC_CONFIG_SETTINGS() {}
35 const std::string & GetStrError() const { return errorStr; }
36 int ParseSettings(const MODULE_SETTINGS & s);
37 uint16_t GetPort() const { return port; }
38 double GetCookieTimeout() const { return cookieTimeout; }
59 class RPC_CONFIG : public PLUGIN
63 virtual ~RPC_CONFIG();
65 void SetUsers(USERS * u) { users = u; }
66 void SetTariffs(TARIFFS * t) { tariffs = t; }
67 void SetAdmins(ADMINS * a) { admins = a; }
68 void SetStore(STORE * s) { store = s; }
69 void SetStgSettings(const SETTINGS * s);
70 void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
75 int Reload() { return 0; }
76 bool IsRunning() { return running && !stopped; }
78 const std::string & GetStrError() const { return errorStr; }
79 const std::string GetVersion() const { return RPC_CONFIG_VERSION; }
80 uint16_t GetStartPosition() const { return 20; }
81 uint16_t GetStopPosition() const { return 20; }
83 bool GetAdminInfo(const std::string & cookie,
85 bool CheckAdmin(const std::string & login,
86 const std::string & password,
87 std::string * cookie);
88 bool LogoutAdmin(const std::string & cookie);
91 RPC_CONFIG(const RPC_CONFIG & rvalue);
92 RPC_CONFIG & operator=(const RPC_CONFIG & rvalue);
94 static void * Run(void *);
95 std::string GetCookie() const;
96 void InitiateRegistry();
98 mutable std::string errorStr;
99 RPC_CONFIG_SETTINGS rpcConfigSettings;
104 MODULE_SETTINGS settings;
106 xmlrpc_c::registry rpcRegistry;
107 xmlrpc_c::serverAbyss * rpcServer;
111 std::map<std::string,
114 std::vector<std::string> dirNames;
115 PLUGIN_LOGGER logger;