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 SetTraffcounter(TRAFFCOUNTER *) {}
62 void SetStgSettings(const SETTINGS * s);
63 void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
68 int Reload() { return 0; }
69 bool IsRunning() { return running && !stopped; }
71 const std::string & GetStrError() const { return errorStr; }
72 const std::string GetVersion() const { return RPC_CONFIG_VERSION; }
73 uint16_t GetStartPosition() const { return 220; }
74 uint16_t GetStopPosition() const { return 220; }
76 bool GetAdminInfo(const std::string & cookie,
78 bool CheckAdmin(const std::string & login,
79 const std::string & password,
80 std::string * cookie);
81 bool LogoutAdmin(const std::string & cookie);
84 static void * Run(void *);
85 std::string GetCookie() const;
86 void InitiateRegistry();
88 mutable std::string errorStr;
89 RPC_CONFIG_SETTINGS rpcConfigSettings;
94 MODULE_SETTINGS settings;
95 xmlrpc_c::registry rpcRegistry;
96 xmlrpc_c::serverAbyss * rpcServer;
100 std::map<std::string,
103 std::vector<std::string> dirNames;