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"
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; }
57 class RPC_CONFIG : public PLUGIN
61 virtual ~RPC_CONFIG();
63 void SetUsers(USERS * u) { users = u; }
64 void SetTariffs(TARIFFS * t) { tariffs = t; }
65 void SetAdmins(ADMINS * a) { admins = a; }
66 void SetStore(STORE * s) { store = s; }
67 void SetStgSettings(const SETTINGS * s);
68 void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
73 int Reload(const MODULE_SETTINGS & /*ms*/) { return 0; }
74 bool IsRunning() { return running && !stopped; }
76 const std::string & GetStrError() const { return errorStr; }
77 std::string GetVersion() const { return RPC_CONFIG_VERSION; }
78 uint16_t GetStartPosition() const { return 20; }
79 uint16_t GetStopPosition() const { return 20; }
81 bool GetAdminInfo(const std::string & cookie,
83 bool CheckAdmin(const std::string & login,
84 const std::string & password,
85 std::string * cookie);
86 bool LogoutAdmin(const std::string & cookie);
89 RPC_CONFIG(const RPC_CONFIG & rvalue);
90 RPC_CONFIG & operator=(const RPC_CONFIG & rvalue);
92 static void * Run(void *);
93 std::string GetCookie() const;
94 void InitiateRegistry();
96 mutable std::string errorStr;
97 RPC_CONFIG_SETTINGS rpcConfigSettings;
102 MODULE_SETTINGS settings;
104 xmlrpc_c::registry rpcRegistry;
105 xmlrpc_c::serverAbyss * rpcServer;
109 std::map<std::string,
112 std::vector<std::string> dirNames;
113 PLUGIN_LOGGER logger;