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"
20 #define RPC_CONFIG_VERSION "Stargazer RPC v. 0.2"
22 extern "C" PLUGIN * GetPlugin();
29 class RPC_CONFIG_SETTINGS
32 RPC_CONFIG_SETTINGS();
33 virtual ~RPC_CONFIG_SETTINGS() {};
34 const std::string & GetStrError() const { return errorStr; };
35 int ParseSettings(const MODULE_SETTINGS & s);
36 uint16_t GetPort() const { return port; };
37 double GetCookieTimeout() const { return cookieTimeout; };
51 class RPC_CONFIG :public PLUGIN
55 virtual ~RPC_CONFIG();
57 void SetUsers(USERS * u) { users = u; }
58 void SetTariffs(TARIFFS * t) { tariffs = t; }
59 void SetAdmins(ADMINS * a) { admins = a; }
60 void SetStore(STORE * s) { store = s; }
61 void SetStgSettings(const SETTINGS * s);
62 void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
67 int Reload() { return 0; }
68 bool IsRunning() { return running && !stopped; }
70 const std::string & GetStrError() const { return errorStr; }
71 const std::string GetVersion() const { return RPC_CONFIG_VERSION; }
72 uint16_t GetStartPosition() const { return 220; }
73 uint16_t GetStopPosition() const { return 220; }
75 bool GetAdminInfo(const std::string & cookie,
77 bool CheckAdmin(const std::string & login,
78 const std::string & password,
79 std::string * cookie);
80 bool LogoutAdmin(const std::string & cookie);
83 static void * Run(void *);
84 std::string GetCookie() const;
85 void InitiateRegistry();
87 mutable std::string errorStr;
88 RPC_CONFIG_SETTINGS rpcConfigSettings;
93 MODULE_SETTINGS settings;
94 xmlrpc_c::registry rpcRegistry;
95 xmlrpc_c::serverAbyss * rpcServer;
102 std::vector<std::string> dirNames;