Changeset c015acc in nscp


Ignore:
Timestamp:
10/10/10 14:27:13 (3 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
f7663c9
Parents:
5e12ba6
Message:

Builds again!!!
Streamlined settings and mde the client side API slightly nicer to work with.
Also migrated scheduler to new settings subsystem

Files:
22 edited

Legend:

Unmodified
Added
Removed
  • include/dll/impl_unix.hpp

    r01a278b rc015acc  
    2929        } 
    3030      } 
    31       boost::filesystem::wpath fix_module_name( boost::filesystem::wpath module_ ) { 
    32         boost::filesystem::wpath mod = module_ / get_extension(); 
     31      static boost::filesystem::wpath fix_module_name( boost::filesystem::wpath module ) { 
     32        if (boost::filesystem::is_regular(module)) 
     33          return module; 
     34        boost::filesystem::wpath mod = module / get_extension(); 
    3335        if (boost::filesystem::is_regular(mod)) 
    3436          return mod; 
    35         return module_; 
     37        return module; 
    3638      } 
    3739      static std::wstring get_extension() { 
     
    9698 
    9799      bool is_loaded() const { return handle_!=NULL; } 
    98       std::wstring get_file() const { return module_.string(); } 
     100      boost::filesystem::wpath get_file() const { return module_; } 
     101      std::wstring get_filename() const { return module_.leaf(); } 
     102      std::wstring get_module_name() { 
     103        std::wstring ext = get_extension(); 
     104        int l = ext.length(); 
     105        std::wstring fn = get_filename(); 
     106        if ((fn.length() > l) && (fn.substr(fn.size()-l) == ext)) 
     107          return fn.substr(0, fn.size()-l); 
     108        return fn; 
     109      } 
    99110    }; 
    100111  } 
  • include/dll/impl_w32.hpp

    rd05c3f0 rc015acc  
    1616        } 
    1717      } 
    18       boost::filesystem::wpath fix_module_name( boost::filesystem::wpath module_ ) { 
    19         boost::filesystem::wpath mod = module_ / std::wstring(_T(".dll")); 
     18      static boost::filesystem::wpath fix_module_name( boost::filesystem::wpath module ) { 
     19        if (boost::filesystem::is_regular(module)) 
     20          return module; 
     21        boost::filesystem::wpath mod = module / std::wstring(_T(".dll")); 
    2022        if (boost::filesystem::is_regular(mod)) 
    2123          return mod; 
    22         std::wstring tmp = module_.file_string() + _T(".dll"); 
    23         mod = tmp; 
    24         if (boost::filesystem::is_regular(mod)) 
    25           return mod; 
    26         return module_; 
     24        return module; 
    2725      } 
    2826 
     
    5250      } 
    5351      bool is_loaded() const { return handle_ != NULL; } 
    54       std::wstring get_file() const { return module_.file_string(); } 
     52      boost::filesystem::wpath get_file() const { return module_; } 
     53      std::wstring get_filename() const { return module_.leaf(); } 
     54      std::wstring get_module_name() { 
     55        std::wstring ext = _T(".dll"); 
     56        int l = ext.length(); 
     57        std::wstring fn = get_filename(); 
     58        if ((fn.length() > l) && (fn.substr(fn.size()-l) == ext)) 
     59          return fn.substr(0, fn.size()-l); 
     60        return fn; 
     61      } 
    5562    }; 
    5663  } 
  • include/nscapi/settings.hpp

    r5e12ba6 rc015acc  
    364364    };   
    365365 
     366 
     367    class path_extension { 
     368    public: 
     369      path_extension(settings_registry * owner, std::wstring path) : owner_(owner), path_(path) {} 
     370 
     371      settings_keys_easy_init add_key_to_path(std::wstring path) { 
     372        return settings_keys_easy_init(get_path(path), owner_); 
     373      } 
     374      settings_keys_easy_init add_key() { 
     375        return settings_keys_easy_init(path_, owner_); 
     376      } 
     377      settings_paths_easy_init add_path(std::wstring path = _T("")) { 
     378        return settings_paths_easy_init(get_path(path), owner_); 
     379      } 
     380      inline std::wstring get_path(std::wstring path) { 
     381        if (!path.empty()) 
     382          return path_ + _T("/") + path; 
     383        return path_; 
     384      } 
     385 
     386    private: 
     387      std::wstring path_; 
     388      settings_registry * owner_; 
     389    }; 
     390    class alias_extension { 
     391    public: 
     392      alias_extension(settings_registry * owner, std::wstring alias) : owner_(owner), alias_(alias) {} 
     393 
     394      settings_keys_easy_init add_key_to_path(std::wstring path) { 
     395        return settings_keys_easy_init(get_path(path), owner_); 
     396      } 
     397      settings_paths_easy_init add_path(std::wstring path) { 
     398        return settings_paths_easy_init(get_path(path), owner_); 
     399      } 
     400      inline std::wstring get_path(std::wstring path) { 
     401        if (path.empty()) 
     402          return _T("/") + alias_; 
     403        return path + _T("/") + alias_; 
     404      } 
     405 
     406 
     407      settings_keys_easy_init add_key_to_settings(std::wstring path = _T("")) { 
     408        return settings_keys_easy_init(get_settings_path(path), owner_); 
     409      } 
     410      settings_paths_easy_init add_path_to_settings(std::wstring path = _T("")) { 
     411        return settings_paths_easy_init(get_settings_path(path), owner_); 
     412      } 
     413      inline std::wstring get_settings_path(std::wstring path) { 
     414        if (path.empty()) 
     415          return _T("/settings/") + alias_; 
     416        return _T("/settings/") + alias_ + _T("/") + path; 
     417      } 
     418 
     419      static std::wstring get_alias(std::wstring cur, std::wstring def) { 
     420        if (cur.empty()) 
     421          return def; 
     422        else 
     423          return cur; 
     424      } 
     425      static std::wstring get_alias(std::wstring prefix, std::wstring cur, std::wstring def) { 
     426        if (!prefix.empty()) 
     427          prefix += _T("/"); 
     428        if (cur.empty()) 
     429          return prefix + def; 
     430        else 
     431          return prefix + cur; 
     432      } 
     433      void set_alias(std::wstring cur, std::wstring def) { 
     434        alias_ = get_alias(cur, def); 
     435      } 
     436      void set_alias(std::wstring prefix, std::wstring cur, std::wstring def) { 
     437        alias_ = get_alias(prefix, cur, def); 
     438      } 
     439 
     440    private: 
     441      std::wstring alias_; 
     442      settings_registry * owner_; 
     443    }; 
     444 
    366445    class settings_registry { 
    367446      typedef std::list<boost::shared_ptr<key_info> > key_list; 
     
    386465        return settings_keys_easy_init(path, this); 
    387466      } 
    388       settings_keys_easy_init add_key_to_path_w_alias(std::wstring path) { 
    389         return settings_keys_easy_init(path + _T("/") + alias_, this); 
    390       } 
    391       settings_keys_easy_init add_key_to_settings(std::wstring path = _T("")) { 
    392         if (path.empty()) 
    393           return settings_keys_easy_init(_T("/settings/") + alias_, this); 
    394         return settings_keys_easy_init(_T("/settings/") + alias_ + _T("/") + path, this); 
    395       } 
    396467      settings_paths_easy_init add_path() { 
    397468        return settings_paths_easy_init(this); 
    398469      } 
    399       settings_paths_easy_init add_path_w_alias(std::wstring path) { 
    400         return settings_paths_easy_init(path + _T("/") + alias_, this); 
    401       } 
    402       settings_paths_easy_init add_path_to_settings(std::wstring path = _T("")) { 
    403         if (path.empty()) 
    404           return settings_paths_easy_init(_T("/settings/") + alias_, this); 
    405         return settings_paths_easy_init(_T("/settings/") + alias_ + _T("/") + path, this); 
    406       } 
     470 
    407471      void set_alias(std::wstring cur, std::wstring def) { 
    408         if (cur.empty()) 
    409           alias_ = def; 
    410         else 
    411           alias_ = cur; 
     472        alias_ = alias_extension::get_alias(cur, def); 
    412473      } 
    413474      void set_alias(std::wstring prefix, std::wstring cur, std::wstring def) { 
    414         if (!prefix.empty()) 
    415           prefix += _T("/"); 
    416         if (cur.empty()) 
    417           alias_ = prefix + def; 
    418         else 
    419           alias_ = prefix + cur; 
    420       } 
     475        alias_ = alias_extension::get_alias(prefix, cur, def); 
     476      } 
     477      alias_extension alias() { 
     478        return alias_extension(this, alias_); 
     479      } 
     480      alias_extension alias(std::wstring alias) { 
     481        return alias_extension(this, alias); 
     482      } 
     483      alias_extension alias(std::wstring cur, std::wstring def) { 
     484        return alias_extension(this, alias_extension::get_alias(cur, def)); 
     485      } 
     486      alias_extension alias(std::wstring prefix, std::wstring cur, std::wstring def) { 
     487        return alias_extension(this, alias_extension::get_alias(prefix, cur, def)); 
     488      } 
     489 
     490      path_extension path(std::wstring path) { 
     491        return path_extension(this, path); 
     492      } 
     493       
    421494 
    422495      void register_all() { 
     
    450523      } 
    451524    }; 
     525//    class simple_alias_settings_registry : public settings_registry { 
     526//    private: 
     527//      std::wstring alias_; 
     528//  
     529//    public: 
     530//      simple_alias_settings_registry(nscapi::core_wrapper* core) : settings_registry(core) {} 
     531//  
     532//      settings_keys_easy_init add_key_to_path_w_alias(std::wstring path) { 
     533//        return settings_keys_easy_init(path + _T("/") + alias_, this); 
     534//      } 
     535//      settings_keys_easy_init add_key_to_settings(std::wstring path = _T("")) { 
     536//        return settings_keys_easy_init(get_settings_path(path), this); 
     537//      } 
     538//      settings_paths_easy_init add_path_w_alias(std::wstring path) { 
     539//        return settings_paths_easy_init(path + _T("/") + alias_, this); 
     540//      } 
     541//      settings_paths_easy_init add_path_to_settings(std::wstring path = _T("")) { 
     542//        if (path.empty()) 
     543//          return settings_paths_easy_init(_T("/settings/") + alias_, this); 
     544//        return settings_paths_easy_init(_T("/settings/") + alias_ + _T("/") + path, this); 
     545//      } 
     546//      static std::wstring get_settings_path(std::wstring alias, std::wstring path) { 
     547//        if (path.empty()) 
     548//          return _T("/settings/") + alias; 
     549//        return _T("/settings/") + alias + _T("/") + path; 
     550//      } 
     551//      std::wstring get_settings_path(std::wstring path) { 
     552//        if (path.empty()) 
     553//          return _T("/settings/") + alias_; 
     554//        return _T("/settings/") + alias_ + _T("/") + path; 
     555//      } 
     556//      void set_alias(std::wstring cur, std::wstring def) { 
     557//        if (cur.empty()) 
     558//          alias_ = def; 
     559//        else 
     560//          alias_ = cur; 
     561//      } 
     562//      void set_alias(std::wstring prefix, std::wstring cur, std::wstring def) { 
     563//        if (!prefix.empty()) 
     564//          prefix += _T("/"); 
     565//        if (cur.empty()) 
     566//          alias_ = prefix + def; 
     567//        else 
     568//          alias_ = prefix + cur; 
     569//      } 
     570//  
     571//    }; 
    452572  } 
    453573} 
  • include/pdh/collectors.hpp

    r5e12ba6 rc015acc  
    284284    RoundINTPDHBufferListenerImpl() : buffer(NULL), length(0), current(0), hasValue_(false) {} 
    285285    RoundINTPDHBufferListenerImpl(int length_) : length(length_), current(0), hasValue_(false) { 
    286       PDHCounterMutexHandler mutex(mutex_); 
    287       if (!mutex.hasLock()) 
    288         return; 
    289       buffer = new int[length]; 
     286      PDHCounterMutexHandler mutex(&mutex_); 
     287      if (!mutex.hasLock()) 
     288        return; 
     289      buffer = new TType[length]; 
    290290      for (unsigned int i=0; i<length;i++) 
    291291        buffer[i] = 0; 
  • include/pdh/query.hpp

    r5e12ba6 rc015acc  
    4343    } 
    4444 
    45     counter_ptr addCounter(std::wstring name, listener_ptr) { 
     45    counter_ptr addCounter(std::wstring name, listener_ptr listener) { 
    4646      counter_ptr counter = counter_ptr(new PDHCounter(name, listener)); 
    4747      counters_.push_back(counter); 
  • include/settings/macros.h

    r5e12ba6 rc015acc  
    375375  namespace scheduler { 
    376376    DEFINE_PATH(SECTION, SCHEDULER_SECTION); 
    377     DESCRIBE_SETTING(SECTION, "SCHEDULER SECTION", "Section for the Scheduler module."); 
     377    //DESCRIBE_SETTING(SECTION, "SCHEDULER SECTION", "Section for the Scheduler module."); 
    378378 
    379379    DEFINE_PATH(SCHEDULES_SECTION, SCHEDULER_SECTION_SCH); 
    380     DESCRIBE_SETTING(SCHEDULES_SECTION, "SCHEDULES SECTION", "Section for defining schedules for the Scheduler module."); 
     380    //DESCRIBE_SETTING(SCHEDULES_SECTION, "SCHEDULES SECTION", "Section for defining schedules for the Scheduler module."); 
    381381 
    382382    DEFINE_PATH(DEFAULT_SCHEDULE_SECTION, SCHEDULER_SECTION_DEF); 
    383     DESCRIBE_SETTING(DEFAULT_SCHEDULE_SECTION, "DEFAULT SCHEDULER SECTION", "Default settings for all scheduled commands"); 
     383    //DESCRIBE_SETTING(DEFAULT_SCHEDULE_SECTION, "DEFAULT SCHEDULER SECTION", "Default settings for all scheduled commands"); 
    384384 
    385385    DEFINE_SETTING_I(THREADS, SCHEDULER_SECTION, "debug threads", 1); 
    386     DESCRIBE_SETTING_ADVANCED(THREADS, "THREADS", "Number of threads to use int he thread pool (increase if you have many scheduled items)"); 
     386    //DESCRIBE_SETTING_ADVANCED(THREADS, "THREADS", "Number of threads to use int he thread pool (increase if you have many scheduled items)"); 
    387387 
    388388    DEFINE_SETTING_S(INTERVAL, SCHEDULER_SECTION_FAKE, "interval", "5m"); 
    389     DESCRIBE_SETTING(INTERVAL, "SCHEDULE INTERVAL", "Time in seconds between each check"); 
     389    //DESCRIBE_SETTING(INTERVAL, "SCHEDULE INTERVAL", "Time in seconds between each check"); 
    390390 
    391391    DEFINE_SETTING_S(COMMAND, SCHEDULER_SECTION_FAKE, "command", "check_ok"); 
    392     DESCRIBE_SETTING(COMMAND, "SCHEDULE COMMAND", "Command to run"); 
     392    //DESCRIBE_SETTING(COMMAND, "SCHEDULE COMMAND", "Command to run"); 
    393393 
    394394    DEFINE_SETTING_S(CHANNEL, SCHEDULER_SECTION_FAKE, "channel", "NSCA"); 
    395     DESCRIBE_SETTING(CHANNEL, "SCHEDULE CHANNEL", "Channel to send results on"); 
     395    //DESCRIBE_SETTING(CHANNEL, "SCHEDULE CHANNEL", "Channel to send results on"); 
    396396 
    397397    DEFINE_SETTING_S(REPORT_MODE, SCHEDULER_SECTION_FAKE, "report", "all"); 
    398     DESCRIBE_SETTING(REPORT_MODE, "REPORT MODE", "What to report to the server (any of the following: all, critical, warning, unknown, ok)"); 
     398    //DESCRIBE_SETTING(REPORT_MODE, "REPORT MODE", "What to report to the server (any of the following: all, critical, warning, unknown, ok)"); 
    399399 
    400400    DEFINE_SETTING_S(INTERVAL_D, SCHEDULER_SECTION_DEF, "interval", "5m"); 
    401     DESCRIBE_SETTING(INTERVAL_D, "SCHEDULE INTERVAL", "Time in seconds between each check"); 
     401    //DESCRIBE_SETTING(INTERVAL_D, "SCHEDULE INTERVAL", "Time in seconds between each check"); 
    402402 
    403403    DEFINE_SETTING_S(COMMAND_D, SCHEDULER_SECTION_DEF, "command", "check_ok"); 
    404     DESCRIBE_SETTING(COMMAND_D, "SCHEDULE COMMAND", "Command to run"); 
     404    //DESCRIBE_SETTING(COMMAND_D, "SCHEDULE COMMAND", "Command to run"); 
    405405 
    406406    DEFINE_SETTING_S(CHANNEL_D, SCHEDULER_SECTION_DEF, "channel", "NSCA"); 
    407     DESCRIBE_SETTING(CHANNEL_D, "SCHEDULE CHANNEL", "Channel to send results on"); 
     407    //DESCRIBE_SETTING(CHANNEL_D, "SCHEDULE CHANNEL", "Channel to send results on"); 
    408408 
    409409    DEFINE_SETTING_S(REPORT_MODE_D, SCHEDULER_SECTION_DEF, "report", "all"); 
    410     DESCRIBE_SETTING(REPORT_MODE_D, "REPORT MODE", "What to report to the server (any of the following: all, critical, warning, unknown, ok)"); 
     410    //DESCRIBE_SETTING(REPORT_MODE_D, "REPORT MODE", "What to report to the server (any of the following: all, critical, warning, unknown, ok)"); 
    411411 
    412412  } 
  • modules/CheckEventLog/CheckEventLog.cpp

    r5e12ba6 rc015acc  
    7272    settings.set_alias(_T("CheckEventlog"), alias); 
    7373 
    74     settings.add_path_to_settings() 
     74    settings.alias().add_path_to_settings() 
    7575      (_T("EVENT LOG SECTION"), _T("Section for the EventLog Checker (CHeckEventLog.dll).")) 
    7676      ; 
    7777 
    78     settings.add_key_to_settings() 
     78    settings.alias().add_key_to_settings() 
    7979      (_T("debug"), sh::bool_key(&debug_, false), 
    8080      _T("DEBUG"), _T("Log all \"hits\" and \"misses\" on the eventlog filter chain, useful for debugging eventlog checks but very very very noisy so you don't want to accidentally set this on a real machine.")) 
  • modules/CheckEventLog/CheckEventLog.def

    r291548e rc015acc  
    1313  NSUnloadModule 
    1414  NSGetModuleDescription 
     15  NSDeleteBuffer 
  • modules/CheckExternalScripts/CheckExternalScripts.cpp

    r497b779 rc015acc  
    7676    settings.set_alias(alias, _T("external scripts")); 
    7777 
    78     settings.add_path_to_settings() 
     78    settings.alias().add_path_to_settings() 
    7979      (_T("EXTERNAL SCRIPT SECTION"), _T("Section for external scripts configuration options (CheckExternalScripts).")) 
    8080 
     
    9292      ; 
    9393 
    94     settings.add_key_to_settings() 
     94    settings.alias().add_key_to_settings() 
    9595      (_T("timeout"), sh::uint_key(&timeout, 60), 
    9696      _T("COMMAND TIMEOUT"), _T("The maximum time in seconds that a command can execute. (if more then this execution will be aborted). NOTICE this only affects external commands not internal ones.")) 
  • modules/CheckSystem/CheckSystem.cpp

    r5e12ba6 rc015acc  
    7373    settings.set_alias(_T("check"), alias, _T("system/windows")); 
    7474 
    75     settings.add_path_to_settings() 
     75    settings.alias().add_path_to_settings() 
    7676      (_T("WINDOWS CHECK SYSTEM"), _T("Section for system checks and system settings")) 
    7777 
     
    8686 
    8787 
    88     settings.add_key_to_settings() 
     88    settings.alias().add_key_to_settings() 
    8989      (_T("default"), sh::bool_key(&default_counters), 
    9090      _T("HOSTNAME"), _T("The host name of this host if set to blank (default) the windows name of the computer will be used.")) 
     
    197197            } 
    198198            if (bStatus) { 
    199               PDH::PDHCounter *pCounter = NULL; 
     199               
     200              //typedef boost::shared_ptr<PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> > cnt_type; 
     201              typedef boost::shared_ptr<PDH::PDHCounter> counter_ptr; 
     202              //typedef boost::shared_ptr<PDH::PDHCounterListener> cnt_type; 
     203              counter_ptr pCounter; 
     204              //PDH::PDHCounter *pCounter = NULL; 
    200205              PDH::PDHQuery pdh; 
    201206              try { 
    202                 PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> cDouble; 
    203                 pCounter = pdh.addCounter(counter, &cDouble); 
     207                //pCounter.reset(new PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE>); 
     208                //PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> cDouble; 
     209                pdh.addCounter(counter); 
    204210                pdh.open(); 
    205211 
     
    279285          try { 
    280286            PDH::PDHQuery pdh; 
    281             PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> cDouble; 
    282             pdh.addCounter(counter, &cDouble); 
     287            //PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> cDouble; 
     288            pdh.addCounter(counter); 
    283289            pdh.open(); 
    284290            pdh.gatherData(); 
     
    11271133      } 
    11281134      PDH::PDHQuery pdh; 
    1129       PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> cDouble; 
    1130       pdh.addCounter(counter.data, &cDouble); 
     1135      typedef boost::shared_ptr<PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> > ptr_lsnr_type; 
     1136      ptr_lsnr_type cDouble(new PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE>()); 
     1137      //boost::shared_ptr<PDHCollectors::StaticPDHCounterListener<double, PDH_FMT_DOUBLE> > cDouble; 
     1138      pdh.addCounter(counter.data, cDouble); 
    11311139      pdh.open(); 
    11321140      if (bCheckAverages) { 
     
    11361144      pdh.gatherData(); 
    11371145      pdh.close(); 
    1138       double value = cDouble.getValue(); 
     1146      double value = cDouble->getValue(); 
    11391147      if (bNSClient) { 
    11401148        if (!msg.empty()) 
  • modules/FileLogger/FileLogger.cpp

    r5e12ba6 rc015acc  
    9696    settings.set_alias(_T("log"), alias); 
    9797 
    98     settings.add_path_to_settings() 
     98    settings.alias().add_path_to_settings() 
    9999      (_T("LOG SECTION"), _T("Configure loggning properties.")) 
    100100      ; 
    101101 
    102     settings.add_key_to_settings() 
     102    settings.alias().add_key_to_settings() 
    103103      //(_T("debug"), sh::bool_key(&debug_, false), 
    104104      //_T("DEBUG LOGGING"), _T("Enable debug logging can help track down errors and find problems but will impact overall performance negativly.")) 
  • modules/NRPEServer/NRPEServer.cpp

    r291548e rc015acc  
    6262    settings.set_alias(_T("NRPE"), alias, _T("server")); 
    6363 
    64     settings.add_path_to_settings() 
     64    settings.alias().add_path_to_settings() 
    6565      (_T("NRPE SERVER SECTION"), _T("Section for NRPE (NRPEListener.dll) (check_nrpe) protocol options.")) 
    6666      ; 
    6767 
    68     settings.add_key_to_settings() 
     68    settings.alias().add_key_to_settings() 
    6969      (_T("port"), sh::uint_key(&info_.port, 5666), 
    7070      _T("PORT NUMBER"), _T("Port to use for NRPE.")) 
  • modules/NSCAAgent/NSCAAgent.cpp

    r5e12ba6 rc015acc  
    6262    settings.set_alias(_T("NSCA"), alias, _T("agent")); 
    6363 
    64     settings.add_path_to_settings() 
     64    settings.alias().add_path_to_settings() 
    6565      (_T("NSCA AGENT SECTION"), _T("Section for NSCA passive check module.")) 
    6666      ; 
    6767 
    68     settings.add_key_to_settings() 
     68    settings.alias().add_key_to_settings() 
    6969      (_T("hostname"), sh::string_key(&hostname_), 
    7070      _T("HOSTNAME"), _T("The host name of this host if set to blank (default) the windows name of the computer will be used.")) 
     
    8181      ; 
    8282 
    83     settings.add_path_to_settings(_T("server")) 
     83    settings.alias().add_path_to_settings(_T("server")) 
    8484      (_T("NSCA SERVER"), _T("Configure the NSCA server to report to.")) 
    8585      ; 
    8686 
    87     settings.add_key_to_settings(_T("server")) 
     87    settings.alias().add_key_to_settings(_T("server")) 
    8888      (_T("host"), sh::wstring_key(&nscahost_), 
    8989      _T("NSCA HOST"), _T("The NSCA server to report results to.")) 
  • modules/Scheduler/Scheduler.cpp

    r5e12ba6 rc015acc  
    3333  return false; 
    3434} 
    35 /* 
    3635 
    37 namespace scheduler { 
    38 DEFINE_PATH(SECTION, SCHEDULER_SECTION); 
    39 DESCRIBE_SETTING(SECTION, "SCHEDULER SECTION", "Section for the Scheduler module."); 
    40  
    41 DEFINE_PATH(SCHEDULES_SECTION, SCHEDULER_SECTION_SCH); 
    42 DESCRIBE_SETTING(SCHEDULES_SECTION, "SCHEDULES SECTION", "Section for defining schedules for the Scheduler module."); 
    43  
    44 DEFINE_PATH(DEFAULT_SCHEDULE_SECTION, SCHEDULER_SECTION_DEF); 
    45 DESCRIBE_SETTING(DEFAULT_SCHEDULE_SECTION, "DEFAULT SCHEDULER SECTION", "Default settings for all scheduled commands"); 
    46  
    47 DEFINE_SETTING_I(THREADS, SCHEDULER_SECTION, "debug threads", 1); 
    48 DESCRIBE_SETTING_ADVANCED(THREADS, "THREADS", "Number of threads to use int he thread pool (increase if you have many scheduled items)"); 
    49  
    50 DEFINE_SETTING_S(INTERVAL, SCHEDULER_SECTION_FAKE, "interval", "5m"); 
    51 DESCRIBE_SETTING(INTERVAL, "SCHEDULE INTERVAL", "Time in seconds between each check"); 
    52  
    53 DEFINE_SETTING_S(COMMAND, SCHEDULER_SECTION_FAKE, "command", "check_ok"); 
    54 DESCRIBE_SETTING(COMMAND, "SCHEDULE COMMAND", "Command to run"); 
    55  
    56 DEFINE_SETTING_S(CHANNEL, SCHEDULER_SECTION_FAKE, "channel", "NSCA"); 
    57 DESCRIBE_SETTING(CHANNEL, "SCHEDULE CHANNEL", "Channel to send results on"); 
    58  
    59 DEFINE_SETTING_S(REPORT_MODE, SCHEDULER_SECTION_FAKE, "report", "all"); 
    60 DESCRIBE_SETTING(REPORT_MODE, "REPORT MODE", "What to report to the server (any of the following: all, critical, warning, unknown, ok)"); 
    61  
    62 DEFINE_SETTING_S(INTERVAL_D, SCHEDULER_SECTION_DEF, "interval", "5m"); 
    63 DESCRIBE_SETTING(INTERVAL_D, "SCHEDULE INTERVAL", "Time in seconds between each check"); 
    64  
    65 DEFINE_SETTING_S(COMMAND_D, SCHEDULER_SECTION_DEF, "command", "check_ok"); 
    66 DESCRIBE_SETTING(COMMAND_D, "SCHEDULE COMMAND", "Command to run"); 
    67  
    68 DEFINE_SETTING_S(CHANNEL_D, SCHEDULER_SECTION_DEF, "channel", "NSCA"); 
    69 DESCRIBE_SETTING(CHANNEL_D, "SCHEDULE CHANNEL", "Channel to send results on"); 
    70  
    71 DEFINE_SETTING_S(REPORT_MODE_D, SCHEDULER_SECTION_DEF, "report", "all"); 
    72 DESCRIBE_SETTING(REPORT_MODE_D, "REPORT MODE", "What to report to the server (any of the following: all, critical, warning, unknown, ok)"); 
    73 */ 
    7436bool Scheduler::loadModuleEx(std::wstring alias, NSCAPI::moduleLoadMode mode) { 
    7537 
    7638  try { 
    77     get_core()->registerCommand(_T("CheckEventLog"), _T("Check for errors in the event logger!")); 
    7839 
     40    typedef std::map<std::wstring,std::wstring> schedule_map; 
     41    schedule_map schedules; 
    7942    sh::settings_registry settings(nscapi::plugin_singleton->get_core()); 
    8043    settings.set_alias(_T("scheduler"), alias); 
    8144 
    82     settings.add_path_to_settings() 
     45    settings.alias().add_path_to_settings() 
    8346      (_T("SCHEDULER SECTION"), _T("Section for the Scheduler module.")) 
     47 
    8448      ; 
    8549 
    86 //    settings.add_key_to_settings() 
    87 //      (_T("debug"), sh::bool_key(&debug_, false), 
    88 //      _T("DEBUG"), _T("Log all \"hits\" and \"misses\" on the eventlog filter chain, useful for debugging eventlog checks but very very very noisy so you don't want to accidentally set this on a real machine.")) 
    89 //  
    90 //      (_T("lookup names"), sh::bool_key(&lookup_names_, false), 
    91 //      _T("LOOKUP NAMES"), _T("")) 
    92 //  
    93 //      (_T("syntax"), sh::wstring_key(&syntax_), 
    94 //      _T("SYNTAX"), _T("Set this to use a specific syntax string for all commands (that don't specify one).")) 
    95 //  
    96 //      (_T("buffer size"), sh::int_key(&buffer_length_, 128*1024), 
    97 //      _T("BUFFER_SIZE"), _T("The size of the buffer to use when getting messages this affects the speed and maximum size of messages you can recieve.")) 
    98 //      ; 
     50    settings.alias().add_key_to_settings() 
     51      (_T("threads"), sh::int_fun_key<unsigned int>(boost::bind(&scheduler::simple_scheduler::set_threads, &scheduler_, _1), 1), 
     52      _T("THREAD COUNT"), _T("Number of threads to use.")) 
     53      ; 
     54 
     55    scheduler::target def = read_schedule(settings.alias().get_settings_path(_T("default")), _T("Default schedule")); 
     56 
     57    std::wstring sch_path = settings.alias().get_settings_path(_T("schedules")); 
     58 
     59    settings.alias().add_path_to_settings() 
     60      (_T("schedules"), sh::fun_values_path(boost::bind(&Scheduler::add_schedule, this, sch_path, _1, _2, def)),  
     61      _T("SCHEDULER SECTION"), _T("Section for the Scheduler module.")) 
     62      ; 
    9963 
    10064    settings.register_all(); 
     
    11276  } 
    11377  try { 
    114     SETTINGS_REG_PATH(scheduler::SECTION); 
    115     SETTINGS_REG_PATH(scheduler::DEFAULT_SCHEDULE_SECTION); 
    116     SETTINGS_REG_PATH(scheduler::SCHEDULES_SECTION); 
    117  
    118     SETTINGS_REG_KEY_S(scheduler::INTERVAL_D); 
    119     SETTINGS_REG_KEY_S(scheduler::COMMAND_D); 
    120     SETTINGS_REG_KEY_S(scheduler::CHANNEL_D); 
    121     SETTINGS_REG_KEY_S(scheduler::REPORT_MODE_D); 
    122  
    123     SETTINGS_REG_KEY_I(scheduler::THREADS); 
    124   } catch (nscapi::nscapi_exception &e) { 
    125     NSC_LOG_ERROR_STD(_T("Failed to register command: ") + e.msg_); 
    126   } catch (...) { 
    127     NSC_LOG_ERROR_STD(_T("Failed to register command.")); 
    128   } 
    129  
    130  
    131   try { 
    132  
    133     scheduler_.set_threads(SETTINGS_GET_INT(scheduler::THREADS)); 
    13478    NSC_DEBUG_MSG_STD(_T("Thread count: ") + to_wstring(scheduler_.get_threads())); 
    135  
    13679    if (mode == NSCAPI::normalStart) { 
    13780      scheduler_.set_handler(this); 
    13881      scheduler_.start(); 
    139     } 
    140  
    141     bool found = false; 
    142     scheduler::target def = read_defaut_schedule(setting_keys::scheduler::DEFAULT_SCHEDULE_SECTION_PATH); 
    143     std::list<std::wstring> items = GET_CORE()->getSettingsSection(setting_keys::scheduler::SCHEDULES_SECTION_PATH); 
    144  
    145     for (std::list<std::wstring>::const_iterator cit = items.begin(); cit != items.end(); ++cit) { 
    146       found = true; 
    147       add_schedule(*cit, GET_CORE()->getSettingsString(setting_keys::scheduler::SCHEDULES_SECTION_PATH, *cit, _T("")), def); 
    148     } 
    149  
    150     if (!found) { 
    151       NSC_DEBUG_MSG_STD(_T("No scheduled commands found!")); 
    152       SETTINGS_REG_KEY_S(scheduler::INTERVAL); 
    153       SETTINGS_REG_KEY_S(scheduler::COMMAND); 
    154       SETTINGS_REG_KEY_S(scheduler::CHANNEL); 
    155       SETTINGS_REG_KEY_S(scheduler::REPORT_MODE); 
    156  
    15782    } 
    15883  } catch (nscapi::nscapi_exception &e) { 
     
    16691} 
    16792 
    168 scheduler::target Scheduler::read_defaut_schedule(std::wstring path) { 
     93scheduler::target Scheduler::read_schedule(std::wstring path, std::wstring schedule_name, scheduler::target *def) { 
     94 
    16995  scheduler::target item; 
    170   item.channel = GET_CORE()->getSettingsString(path, setting_keys::scheduler::CHANNEL_D, setting_keys::scheduler::CHANNEL_D_DEFAULT); 
    171   item.command = GET_CORE()->getSettingsString(path, setting_keys::scheduler::COMMAND_D, setting_keys::scheduler::COMMAND_D_DEFAULT); 
    172   std::wstring report = GET_CORE()->getSettingsString(path, setting_keys::scheduler::REPORT_MODE_D, setting_keys::scheduler::REPORT_MODE_D_DEFAULT); 
     96  std::wstring report, duration; 
     97 
     98  sh::settings_registry settings(nscapi::plugin_singleton->get_core()); 
     99 
     100  settings.path(path).add_path() 
     101    (_T("SCHEDULE DEFENITION"), _T("Schedule defenition for: ") + schedule_name) 
     102    ; 
     103 
     104  settings.path(path).add_key() 
     105    (_T("channel"), sh::wstring_key(&item.channel, def==NULL?_T("NSCA"):def->channel), 
     106    _T("SCHEDULE CHANNEL"), _T("Channel to send results on")) 
     107 
     108    (_T("command"), sh::wstring_key(&item.command, def==NULL?_T("check_ok"):def->command), 
     109    _T("SCHEDULE COMMAND"), _T("Command to execute")) 
     110 
     111    (_T("report"), sh::wstring_key(&report, def==NULL?_T("all"):nscapi::report::to_string(def->report)), 
     112    _T("REPORT MODE"), _T("What to report to the server (any of the following: all, critical, warning, unknown, ok)")) 
     113 
     114    // TODO: get the proper default value here! 
     115    (_T("interval"), sh::wstring_key(&duration, _T("5s")), 
     116    _T("SCHEDULE INTERAVAL"), _T("Time in seconds between each check")) 
     117 
     118    ; 
     119 
     120  settings.register_all(); 
     121  settings.notify(); 
     122 
    173123  item.report = nscapi::report::parse(report); 
    174   std::wstring duration = GET_CORE()->getSettingsString(path, setting_keys::scheduler::INTERVAL_D, setting_keys::scheduler::INTERVAL_D_DEFAULT); 
    175124  item.duration = boost::posix_time::seconds(strEx::stoui_as_time_sec(duration, 1)); 
    176125  return item; 
    177126} 
    178 void Scheduler::add_schedule(std::wstring alias, std::wstring command, scheduler::target def) { 
    179   scheduler::target item;  
    180   std::wstring detail_path = setting_keys::scheduler::SCHEDULES_SECTION_PATH + _T("/") + alias; 
    181   item.alias = alias; 
    182   item.command = command; 
    183   item.channel = GET_CORE()->getSettingsString(detail_path, setting_keys::scheduler::CHANNEL, def.channel); 
    184   item.command = GET_CORE()->getSettingsString(detail_path, setting_keys::scheduler::COMMAND, item.command); 
    185  
     127void Scheduler::add_schedule(std::wstring path, std::wstring alias, std::wstring command, scheduler::target def) { 
     128  def.alias = alias; 
     129  def.command = command; 
     130  scheduler::target item = read_schedule(path + _T("/") + alias, alias, &def); 
    186131  strEx::parse_command(item.command, item.command, item.arguments); 
    187  
    188   std::wstring report = GET_CORE()->getSettingsString(detail_path, setting_keys::scheduler::REPORT_MODE, nscapi::report::to_string(def.report)); 
    189   item.report = nscapi::report::parse(report); 
    190   std::wstring duration = GET_CORE()->getSettingsString(detail_path, setting_keys::scheduler::INTERVAL, to_wstring(def.duration.total_seconds()) + _T("s")); 
    191   item.duration = boost::posix_time::seconds(strEx::stoui_as_time_sec(duration, 1)); 
    192132  scheduler_.add_task(item); 
    193133} 
  • modules/Scheduler/Scheduler.h

    r5e12ba6 rc015acc  
    4040 
    4141 
    42   void add_schedule(std::wstring alias, std::wstring command, scheduler::target def); 
    43   scheduler::target read_defaut_schedule(std::wstring path); 
     42  void add_schedule(std::wstring path, std::wstring alias, std::wstring command, scheduler::target def); 
     43  scheduler::target read_schedule(std::wstring path, std::wstring comment, scheduler::target *def = NULL); 
    4444  void handle_schedule(scheduler::target item); 
    4545  void on_error(std::wstring error); 
  • modules/Scheduler/simple_scheduler.hpp

    rc0d7e82 rc015acc  
    122122  }; 
    123123 
    124   class simple_scheduler { 
     124  class simple_scheduler : public boost::noncopyable { 
    125125  private: 
    126126    typedef std::map<int,target> target_list_type; 
  • service/NSCPlugin.cpp

    rc146f89 rc015acc  
    435435} 
    436436 
     437bool NSCPlugin::is_duplicate( boost::filesystem::wpath file, std::wstring alias ) { 
     438  if (alias.empty()) 
     439    return module_.get_file() == dll::dll::fix_module_name(file); 
     440  return module_.get_file() == dll::dll::fix_module_name(file) || alias == alias_; 
     441} 
  • service/NSCPlugin.h

    r7065334 rc015acc  
    6161   */ 
    6262  NSPluginException(dll::dll &module, std::wstring error) : error_(error) { 
    63     file_ = getModule(module.get_file()); 
     63    file_ = module.get_module_name(); 
    6464  } 
    65   std::wstring getModule(std::wstring file) { 
    66     if (file.empty()) 
    67       return _T(""); 
    68     std::wstring ret = file; 
    69     std::wstring::size_type pos = ret.find_last_of(_T("\\")); 
    70     if (pos != std::wstring::npos && ++pos < ret.length()) { 
    71       ret = ret.substr(pos); 
    72     } 
    73     return ret; 
     65  std::wstring what() { 
     66    return error_ + _T(" in file: ") + file_; 
    7467  } 
    7568 
     
    154147  void showTray(); 
    155148  void hideTray(); 
     149  bool is_duplicate( boost::filesystem::wpath file, std::wstring alias ); 
    156150 
    157151  std::wstring getFilename() { 
    158     std::wstring file = module_.get_file(); 
    159     if (file.empty()) 
    160       return _T(""); 
    161     std::wstring::size_type pos = file.find_last_of(_T("\\")); 
    162     if (pos != std::wstring::npos && ++pos < file.length()) { 
    163       return file.substr(pos); 
    164     } 
    165     return file; 
     152    return module_.get_filename(); 
    166153  } 
    167154  std::wstring getModule() { 
    168     std::wstring file = getFilename(); 
    169     std::wstring::size_type pos = file.find_last_of(_T(".")); 
    170     if (pos != std::wstring::npos) { 
    171       file = file.substr(0, pos); 
    172     } 
    173     pos = file.find_last_of(_T("/\\")); 
    174     if (pos != std::wstring::npos) { 
    175       file = file.substr(pos); 
    176     } 
    177155#ifndef WIN32 
     156    std::wstring file = module_.get_module_name(); 
    178157    if (file.substr(0,3) == _T("lib")) 
    179158      file = file.substr(3); 
     159    return file; 
     160#else 
     161    return module_.get_module_name(); 
    180162#endif 
    181     return file; 
    182163  } 
    183164  static std::wstring get_plugin_file(std::wstring key) { 
  • service/NSClient++.cpp

    rb4db89d rc015acc  
    488488} 
    489489 
    490 NSClientT::plugin_info_list NSClientT::get_all_plugins() { 
    491   boost::filesystem::wpath pluginPath = expand_path(_T("${module-path}")); 
    492   plugin_alias_list_type plugins = find_all_plugins(false); 
    493   plugin_info_list ret; 
    494   std::pair<std::wstring,std::wstring> v; 
    495  
    496   BOOST_FOREACH(v, plugins) { 
    497     plugin_info_type info; 
    498     info.dll = v.second; 
    499     try { 
    500       LOG_DEBUG_STD(_T("Attempting to fake load: ") + v.second + _T(" as ") + v.first); 
    501       NSCPlugin plugin(next_plugin_id_++, pluginPath / v.second, v.first); 
    502       plugin.load_dll(); 
    503       plugin.load_plugin(NSCAPI::dontStart); 
    504       info.name = plugin.getName(); 
    505       info.description = plugin.getDescription(); 
    506       plugin.unload(); 
    507     } catch (NSPluginException e) { 
    508       LOG_CRITICAL_STD(_T("Error loading: ") + e.file_ + _T(" root cause: ") + e.error_); 
    509     } catch (...) { 
    510       LOG_CRITICAL_STD(_T("Unknown Error loading: ") + info.dll); 
    511     } 
    512     ret.push_back(info); 
    513   } 
    514   return ret; 
    515 } 
     490// NSClientT::plugin_info_list NSClientT::get_all_plugins() { 
     491// boost::filesystem::wpath pluginPath = expand_path(_T("${module-path}")); 
     492// plugin_alias_list_type plugins = find_all_plugins(false); 
     493// plugin_info_list ret; 
     494// std::pair<std::wstring,std::wstring> v; 
     495//  
     496// BOOST_FOREACH(v, plugins) { 
     497//    plugin_info_type info; 
     498//    info.dll = v.second; 
     499//    try { 
     500//      LOG_DEBUG_STD(_T("Attempting to fake load: ") + v.second + _T(" as ") + v.first); 
     501//      NSCPlugin plugin(next_plugin_id_++, pluginPath / v.second, v.first); 
     502//      plugin.load_dll(); 
     503//      plugin.load_plugin(NSCAPI::dontStart); 
     504//      info.name = plugin.getName(); 
     505//      info.description = plugin.getDescription(); 
     506//      plugin.unload(); 
     507//    } catch (NSPluginException e) { 
     508//      LOG_CRITICAL_STD(_T("Error loading: ") + e.file_ + _T(" root cause: ") + e.error_); 
     509//    } catch (...) { 
     510//      LOG_CRITICAL_STD(_T("Unknown Error loading: ") + info.dll); 
     511//    } 
     512//    ret.push_back(info); 
     513// } 
     514// return ret; 
     515// } 
    516516 
    517517 
     
    528528 
    529529  BOOST_FOREACH(v, plugins) { 
    530     std::wstring desc; 
    531     std::wstring name = v.second; 
    532530    try { 
    533       NSCPlugin plugin(next_plugin_id_++, pluginPath / v.second, v.first); 
    534       name = plugin.getModule(); 
    535       plugin.load_dll(); 
    536       plugin.load_plugin(mode); 
    537       desc = plugin.getName() + _T(" - "); 
    538       desc += plugin.getDescription(); 
    539       plugin.unload(); 
    540     } catch (NSPluginException e) { 
    541       desc += _T("unknown module"); 
    542       LOG_CRITICAL_STD(_T("Error loading: ") + e.file_ + _T(" root cause: ") + e.error_); 
     531      addPlugin(pluginPath / v.second, v.second); 
     532    } catch (NSPluginException &e) { 
     533      LOG_CRITICAL_STD(_T("Failed to register plugin: ") + e.what()); 
    543534    } catch (...) { 
    544       desc += _T("unknown module"); 
    545       LOG_CRITICAL_STD(_T("Unknown Error loading: ") + name); 
    546     } 
    547     try { 
    548       if (v.first.empty() && !settings_manager::get_settings()->has_key(MAIN_MODULES_SECTION, v.second)) 
    549         settings_manager::get_core()->register_key(MAIN_MODULES_SECTION, name, settings::settings_core::key_string, desc, desc, _T("disabled"), false); 
    550     } catch (...) { 
    551       LOG_CRITICAL_STD(_T("Failed to register plugin key: ") + name); 
    552     } 
     535      LOG_CRITICAL_STD(_T("Failed to register plugin key: ") + v.second); 
     536    } 
     537//    std::wstring desc; 
     538//    std::wstring name = v.second; 
     539//    try { 
     540//      NSCPlugin plugin(next_plugin_id_++, pluginPath / v.second, v.first); 
     541//      name = plugin.getModule(); 
     542//      plugin.load_dll(); 
     543//      plugin.load_plugin(mode); 
     544//      desc = plugin.getName() + _T(" - "); 
     545//      desc += plugin.getDescription(); 
     546//      plugin.unload(); 
     547//    } catch (NSPluginException e) { 
     548//      desc += _T("unknown module"); 
     549//      LOG_CRITICAL_STD(_T("Error loading: ") + e.file_ + _T(" root cause: ") + e.error_); 
     550//    } catch (...) { 
     551//      desc += _T("unknown module"); 
     552//      LOG_CRITICAL_STD(_T("Unknown Error loading: ") + name); 
     553//    } 
     554//    try { 
     555//      if (v.first.empty() && !settings_manager::get_settings()->has_key(MAIN_MODULES_SECTION, v.second)) 
     556//        settings_manager::get_core()->register_key(MAIN_MODULES_SECTION, name, settings::settings_core::key_string, desc, desc, _T("disabled"), false); 
     557//    } catch (...) { 
     558//      LOG_CRITICAL_STD(_T("Failed to register plugin key: ") + name); 
     559//    } 
    553560  } 
    554561} 
     
    847854  try { 
    848855    plugin_type plugin = addPlugin(getBasePath() / boost::filesystem::wpath(_T("modules")) / boost::filesystem::wpath(module), _T("")); 
    849     LOG_DEBUG_STD(_T("Loading plugin: ") + plugin->getName() + _T("...")); 
    850     plugin->load_plugin(NSCAPI::dontStart); 
    851     return plugin->commandLineExec(argLen, args); 
     856    if (plugin) { 
     857      LOG_DEBUG_STD(_T("Loading plugin: ") + plugin->getName() + _T("...")); 
     858      plugin->load_plugin(NSCAPI::dontStart); 
     859      return plugin->commandLineExec(argLen, args); 
     860    } else { 
     861      LOG_ERROR_CORE_STD(_T("Failed to load: ") + std::wstring(module) + _T(" available modules are: ") + moduleList); 
     862      return 1; 
     863    } 
    852864  } catch (NSPluginException e) { 
    853865    LOG_MESSAGE_STD(_T("Module (") + e.file_ + _T(") was not found: ") + e.error_); 
     
    974986      return plugin; 
    975987    } 
     988 
     989    BOOST_FOREACH(plugin_type plug, plugins_) { 
     990      if (plug->is_duplicate(file, alias)) { 
     991        plugin.reset(); 
     992        return plug; 
     993      } 
     994    } 
     995 
     996 
    976997    plugins_.insert(plugins_.end(), plugin); 
    977998    commands_.add_plugin(plugin); 
  • service/commands.hpp

    r294b37b rc015acc  
    9292      std::wstring lc = make_key(cmd); 
    9393      if (!have_plugin(plugin_id)) 
    94         throw command_exception("Failed to find plugin: " + ::to_string(plugin_id) + ": " + unsafe_get_all_plugin_ids()); 
     94        throw command_exception("Failed to find plugin: " + ::to_string(plugin_id) + " {" + unsafe_get_all_plugin_ids() + "}"); 
    9595      descriptions_[lc] = desc; 
    9696      commands_[lc] = plugins_[plugin_id]; 
  • service/core_api.cpp

    r291548e rc015acc  
    342342} 
    343343NSCAPI::errorReturn NSAPIGetPluginList(int *len, NSCAPI::plugin_info *list[]) { 
    344   NSClientT::plugin_info_list plugList= mainClient.get_all_plugins(); 
    345   *len = plugList.size(); 
     344//  NSClientT::plugin_info_list plugList= mainClient.get_all_plugins(); 
     345  *len = 0; //plugList.size(); 
    346346 
    347347  *list = new NSCAPI::plugin_info[*len+1]; 
     348  /* 
    348349  int i=0; 
    349350  for(NSClientT::plugin_info_list::const_iterator cit = plugList.begin(); cit != plugList.end(); ++cit,i++) { 
     
    353354    (*list)[i].description = copyString((*cit).description); 
    354355  } 
     356  */ 
    355357  return NSCAPI::isSuccess; 
    356358} 
  • service/settings_client.hpp

    r2a1411e rc015acc  
    112112      } catch (settings::settings_exception e) { 
    113113        error_msg(_T("Failed to initialize settings: ") + e.getError()); 
     114      } catch (NSPluginException &e) { 
     115        error_msg(_T("Failed to load plugins: ") + to_wstring(e.what())); 
    114116      } catch (std::exception &e) { 
    115117        error_msg(_T("Failed to initialize settings: ") + to_wstring(e.what())); 
Note: See TracChangeset for help on using the changeset viewer.