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; }
 
  58 class RPC_CONFIG :public PLUGIN
 
  62     virtual ~RPC_CONFIG();
 
  64     void                SetUsers(USERS * u) { users = u; }
 
  65     void                SetTariffs(TARIFFS * t) { tariffs = t; }
 
  66     void                SetAdmins(ADMINS * a) { admins = a; }
 
  67     void                SetStore(STORE * s) { store = s; }
 
  68     void                SetStgSettings(const SETTINGS * s);
 
  69     void                SetSettings(const MODULE_SETTINGS & s) { settings = s; }
 
  74     int                 Reload() { return 0; }
 
  75     bool                IsRunning() { return running && !stopped; }
 
  77     const std::string & GetStrError() const { return errorStr; }
 
  78     const std::string   GetVersion() const { return RPC_CONFIG_VERSION; }
 
  79     uint16_t            GetStartPosition() const { return 220; }
 
  80     uint16_t            GetStopPosition() const { return 220; }
 
  82     bool                GetAdminInfo(const std::string & cookie,
 
  84     bool                CheckAdmin(const std::string & login,
 
  85                                    const std::string & password,
 
  86                                    std::string * cookie);
 
  87     bool                LogoutAdmin(const std::string & cookie);
 
  90     RPC_CONFIG(const RPC_CONFIG & rvalue);
 
  91     RPC_CONFIG & operator=(const RPC_CONFIG & rvalue);
 
  93     static void *           Run(void *);
 
  94     std::string             GetCookie() const;
 
  95     void                    InitiateRegistry();
 
  97     mutable std::string     errorStr;
 
  98     RPC_CONFIG_SETTINGS     rpcConfigSettings;
 
 103     MODULE_SETTINGS         settings;
 
 105     xmlrpc_c::registry      rpcRegistry;
 
 106     xmlrpc_c::serverAbyss * rpcServer;
 
 110     std::map<std::string,
 
 113     std::vector<std::string> dirNames;