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>
17 #include "admin_conf.h"
18 #include "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; };
39 int ParseIntInRange(const std::string & str,
55 class RPC_CONFIG :public PLUGIN
59 virtual ~RPC_CONFIG();
61 void SetUsers(USERS * u) { users = u; }
62 void SetTariffs(TARIFFS * t) { tariffs = t; }
63 void SetAdmins(ADMINS * a) { admins = a; }
64 void SetStore(STORE * s) { store = s; }
65 void SetTraffcounter(TRAFFCOUNTER *) {}
66 void SetStgSettings(const SETTINGS * s);
67 void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
72 int Reload() { return 0; }
73 bool IsRunning() { return running && !stopped; }
75 const std::string & GetStrError() const { return errorStr; }
76 const std::string GetVersion() const { return RPC_CONFIG_VERSION; }
77 uint16_t GetStartPosition() const { return 220; }
78 uint16_t GetStopPosition() const { return 220; }
80 bool GetAdminInfo(const std::string & cookie,
82 bool CheckAdmin(const std::string & login,
83 const std::string & password,
84 std::string * cookie);
85 bool LogoutAdmin(const std::string & cookie);
88 static void * Run(void *);
89 std::string GetCookie() const;
90 void InitiateRegistry();
92 mutable std::string errorStr;
93 RPC_CONFIG_SETTINGS rpcConfigSettings;
98 MODULE_SETTINGS settings;
99 xmlrpc_c::registry rpcRegistry;
100 xmlrpc_c::serverAbyss * rpcServer;
104 std::map<std::string,
107 std::vector<std::string> dirNames;