| [dc65e35] | 1 | /************************************************************************** |
|---|
| 2 | * Copyright (C) 2004-2007 by Michael Medin <michael@medin.name> * |
|---|
| 3 | * * |
|---|
| 4 | * This code is part of NSClient++ - http://trac.nakednuns.org/nscp * |
|---|
| 5 | * * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify * |
|---|
| 7 | * it under the terms of the GNU General Public License as published by * |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
|---|
| 9 | * (at your option) any later version. * |
|---|
| 10 | * * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, * |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|---|
| 14 | * GNU General Public License for more details. * |
|---|
| 15 | * * |
|---|
| 16 | * You should have received a copy of the GNU General Public License * |
|---|
| 17 | * along with this program; if not, write to the * |
|---|
| 18 | * Free Software Foundation, Inc., * |
|---|
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
|---|
| 20 | ***************************************************************************/ |
|---|
| [a0528c4] | 21 | #pragma once |
|---|
| 22 | |
|---|
| 23 | #include <string> |
|---|
| 24 | #include <list> |
|---|
| [2a94f3f] | 25 | #include <iostream> |
|---|
| [d05c3f0] | 26 | |
|---|
| 27 | #include <NSCAPI.h> |
|---|
| [2a94f3f] | 28 | #include <charEx.h> |
|---|
| [c4f6204] | 29 | #include <arrayBuffer.h> |
|---|
| [818b54e] | 30 | #include <types.hpp> |
|---|
| [2018659] | 31 | |
|---|
| 32 | #include <unicode_char.hpp> |
|---|
| 33 | #include <strEx.h> |
|---|
| 34 | |
|---|
| [60375ed] | 35 | #include "../libs/protobuf/plugin.proto.h" |
|---|
| [2018659] | 36 | |
|---|
| [7f9c823] | 37 | #ifdef WIN32 |
|---|
| 38 | //#include <windows.h> |
|---|
| 39 | #endif |
|---|
| [478588b] | 40 | |
|---|
| [a0528c4] | 41 | |
|---|
| 42 | namespace NSCHelper |
|---|
| 43 | { |
|---|
| [81e29d8] | 44 | #ifdef DEBUG |
|---|
| [7f9c823] | 45 | NSCAPI::nagiosReturn wrapReturnString(wchar_t *buffer, unsigned int bufLen, std::wstring str, NSCAPI::nagiosReturn defaultReturnCode); |
|---|
| 46 | NSCAPI::errorReturn wrapReturnString(wchar_t *buffer, unsigned int bufLen, std::wstring str, NSCAPI::errorReturn defaultReturnCode); |
|---|
| [81e29d8] | 47 | #else |
|---|
| [7f9c823] | 48 | int wrapReturnString(wchar_t *buffer, unsigned int bufLen, std::wstring str, int defaultReturnCode); |
|---|
| [81e29d8] | 49 | #endif |
|---|
| [99e4d8f] | 50 | std::wstring translateMessageType(NSCAPI::messageTypes msgType); |
|---|
| 51 | std::wstring translateReturn(NSCAPI::nagiosReturn returnCode); |
|---|
| [739db5a] | 52 | NSCAPI::nagiosReturn translateReturn(std::wstring str); |
|---|
| [1a5449e] | 53 | NSCAPI::nagiosReturn maxState(NSCAPI::nagiosReturn a, NSCAPI::nagiosReturn b); |
|---|
| [36c340d] | 54 | |
|---|
| [cea178b] | 55 | inline bool isNagiosReturnCode(NSCAPI::nagiosReturn code) { |
|---|
| 56 | if ( (code == NSCAPI::returnOK) || (code == NSCAPI::returnWARN) || (code == NSCAPI::returnCRIT) || (code == NSCAPI::returnUNKNOWN) ) |
|---|
| 57 | return true; |
|---|
| 58 | return false; |
|---|
| 59 | } |
|---|
| [b0ae738] | 60 | inline bool isMyNagiosReturn(NSCAPI::nagiosReturn code) { |
|---|
| 61 | return code == NSCAPI::returnCRIT || code == NSCAPI::returnOK || code == NSCAPI::returnWARN || code == NSCAPI::returnUNKNOWN |
|---|
| 62 | || code == NSCAPI::returnInvalidBufferLen || code == NSCAPI::returnIgnored; |
|---|
| 63 | } |
|---|
| [cea178b] | 64 | |
|---|
| [1a5449e] | 65 | #ifdef DEBUG |
|---|
| 66 | inline NSCAPI::nagiosReturn int2nagios(int code) { |
|---|
| 67 | if (code == 0) |
|---|
| 68 | return NSCAPI::returnOK; |
|---|
| 69 | if (code == 1) |
|---|
| 70 | return NSCAPI::returnWARN; |
|---|
| 71 | if (code == 2) |
|---|
| 72 | return NSCAPI::returnCRIT; |
|---|
| 73 | if (code == 4) |
|---|
| 74 | return NSCAPI::returnUNKNOWN; |
|---|
| 75 | throw "@fixme bad code"; |
|---|
| [36c340d] | 76 | } |
|---|
| [1a5449e] | 77 | inline int nagios2int(NSCAPI::nagiosReturn code) { |
|---|
| 78 | if (code == NSCAPI::returnOK) |
|---|
| 79 | return 0; |
|---|
| 80 | if (code == NSCAPI::returnWARN) |
|---|
| 81 | return 1; |
|---|
| 82 | if (code == NSCAPI::returnCRIT) |
|---|
| 83 | return 2; |
|---|
| 84 | if (code == NSCAPI::returnUNKNOWN) |
|---|
| 85 | return 4; |
|---|
| 86 | throw "@fixme bad code"; |
|---|
| 87 | } |
|---|
| 88 | #else |
|---|
| 89 | inline NSCAPI::nagiosReturn int2nagios(int code) { |
|---|
| 90 | return code; |
|---|
| 91 | } |
|---|
| 92 | inline int nagios2int(NSCAPI::nagiosReturn code) { |
|---|
| 93 | return code; |
|---|
| 94 | } |
|---|
| 95 | #endif |
|---|
| [1eef1ee] | 96 | inline void escalteReturnCodeToCRIT(NSCAPI::nagiosReturn ¤tReturnCode) { |
|---|
| [36c340d] | 97 | currentReturnCode = NSCAPI::returnCRIT; |
|---|
| 98 | } |
|---|
| [1eef1ee] | 99 | inline void escalteReturnCodeToWARN(NSCAPI::nagiosReturn ¤tReturnCode) { |
|---|
| [36c340d] | 100 | if (currentReturnCode != NSCAPI::returnCRIT) |
|---|
| 101 | currentReturnCode = NSCAPI::returnWARN; |
|---|
| 102 | } |
|---|
| [1bfe6f0] | 103 | |
|---|
| 104 | namespace report { |
|---|
| 105 | unsigned int parse(std::wstring str); |
|---|
| 106 | bool matches(unsigned int report, NSCAPI::nagiosReturn code); |
|---|
| 107 | std::wstring to_string(unsigned int report); |
|---|
| 108 | } |
|---|
| [c0d7e82] | 109 | namespace logging { |
|---|
| 110 | unsigned int parse(std::wstring str); |
|---|
| 111 | bool matches(unsigned int report, NSCAPI::nagiosReturn code); |
|---|
| 112 | std::wstring to_string(unsigned int report); |
|---|
| 113 | } |
|---|
| [a0528c4] | 114 | }; |
|---|
| 115 | |
|---|
| 116 | namespace NSCModuleHelper |
|---|
| 117 | { |
|---|
| [8223547] | 118 | class NSCMHExcpetion { |
|---|
| 119 | public: |
|---|
| [99e4d8f] | 120 | std::wstring msg_; |
|---|
| 121 | NSCMHExcpetion(std::wstring msg) : msg_(msg) {} |
|---|
| [8223547] | 122 | }; |
|---|
| [9567d4b] | 123 | struct plugin_info_type { |
|---|
| 124 | std::wstring dll; |
|---|
| 125 | std::wstring name; |
|---|
| 126 | std::wstring version; |
|---|
| 127 | std::wstring description; |
|---|
| 128 | }; |
|---|
| 129 | typedef std::list<plugin_info_type> plugin_info_list; |
|---|
| [a0528c4] | 130 | // Types for the Callbacks into the main program |
|---|
| [7f9c823] | 131 | |
|---|
| 132 | typedef NSCAPI::errorReturn (*lpNSAPIGetBasePath)(wchar_t*,unsigned int); |
|---|
| 133 | typedef NSCAPI::errorReturn (*lpNSAPIGetApplicationName)(wchar_t*,unsigned int); |
|---|
| 134 | typedef NSCAPI::errorReturn (*lpNSAPIGetApplicationVersionStr)(wchar_t*,unsigned int); |
|---|
| 135 | typedef NSCAPI::errorReturn (*lpNSAPIGetSettingsString)(const wchar_t*,const wchar_t*,const wchar_t*,wchar_t*,unsigned int); |
|---|
| 136 | typedef NSCAPI::errorReturn (*lpNSAPIGetSettingsInt)(const wchar_t*, const wchar_t*, int); |
|---|
| 137 | typedef NSCAPI::errorReturn (*lpNSAPIGetSettingsSection)(const wchar_t*, arrayBuffer::arrayBuffer*, unsigned int *); |
|---|
| [2603350] | 138 | typedef NSCAPI::errorReturn (*lpNSAPIReleaseSettingsSectionBuffer)(arrayBuffer::arrayBuffer*, unsigned int *); |
|---|
| [7f9c823] | 139 | typedef void (*lpNSAPIMessage)(int, const wchar_t*, const int, const wchar_t*); |
|---|
| [1eef1ee] | 140 | typedef NSCAPI::errorReturn (*lpNSAPIStopServer)(void); |
|---|
| [739db5a] | 141 | typedef NSCAPI::errorReturn (*lpNSAPIExit)(void); |
|---|
| [40970de] | 142 | typedef NSCAPI::nagiosReturn (*lpNSAPIInject)(const wchar_t*, const char *, const unsigned int, char **, unsigned int *); |
|---|
| [2018659] | 143 | typedef void (*lpNSAPIDestroyBuffer)(char**); |
|---|
| [1bfe6f0] | 144 | |
|---|
| [40970de] | 145 | typedef NSCAPI::errorReturn (*lpNSAPINotify)(const wchar_t*, const wchar_t*, NSCAPI::nagiosReturn, const char*, unsigned int); |
|---|
| [1bfe6f0] | 146 | |
|---|
| [1d9338a] | 147 | typedef NSCAPI::boolReturn (*lpNSAPICheckLogMessages)(int); |
|---|
| [7f9c823] | 148 | typedef NSCAPI::errorReturn (*lpNSAPIEncrypt)(unsigned int, const wchar_t*, unsigned int, wchar_t*, unsigned int *); |
|---|
| 149 | typedef NSCAPI::errorReturn (*lpNSAPIDecrypt)(unsigned int, const wchar_t*, unsigned int, wchar_t*, unsigned int *); |
|---|
| 150 | typedef NSCAPI::errorReturn (*lpNSAPISetSettingsString)(const wchar_t*, const wchar_t*, const wchar_t*); |
|---|
| 151 | typedef NSCAPI::errorReturn (*lpNSAPISetSettingsInt)(const wchar_t*, const wchar_t*, int); |
|---|
| [76aafc4] | 152 | typedef NSCAPI::errorReturn (*lpNSAPIWriteSettings)(int); |
|---|
| 153 | typedef NSCAPI::errorReturn (*lpNSAPIReadSettings)(int); |
|---|
| 154 | typedef NSCAPI::errorReturn (*lpNSAPIRehash)(int); |
|---|
| [7f9c823] | 155 | typedef NSCAPI::errorReturn (*lpNSAPIDescribeCommand)(const wchar_t*,wchar_t*,unsigned int); |
|---|
| [6b690bf] | 156 | typedef NSCAPI::errorReturn (*lpNSAPIGetAllCommandNames)(arrayBuffer::arrayBuffer*, unsigned int *); |
|---|
| 157 | typedef NSCAPI::errorReturn (*lpNSAPIReleaseAllCommandNamessBuffer)(arrayBuffer::arrayBuffer*, unsigned int *); |
|---|
| [01a278b] | 158 | typedef NSCAPI::errorReturn (*lpNSAPIRegisterCommand)(unsigned int, const wchar_t*,const wchar_t*); |
|---|
| [7f9c823] | 159 | typedef NSCAPI::errorReturn (*lpNSAPISettingsRegKey)(const wchar_t*, const wchar_t*, int, const wchar_t*, const wchar_t*, const wchar_t*, int); |
|---|
| 160 | typedef NSCAPI::errorReturn (*lpNSAPISettingsRegPath)(const wchar_t*, const wchar_t*, const wchar_t*, int); |
|---|
| [9567d4b] | 161 | typedef NSCAPI::errorReturn (*lpNSAPIGetPluginList)(int *len, NSCAPI::plugin_info *list[]); |
|---|
| 162 | typedef NSCAPI::errorReturn (*lpNSAPIReleasePluginList)(int len, NSCAPI::plugin_info *list[]); |
|---|
| 163 | typedef NSCAPI::errorReturn (*lpNSAPISettingsSave)(void); |
|---|
| 164 | |
|---|
| [a0528c4] | 165 | |
|---|
| 166 | // Helper functions for calling into the core |
|---|
| [99e4d8f] | 167 | std::wstring getApplicationName(void); |
|---|
| 168 | std::wstring getApplicationVersionString(void); |
|---|
| 169 | std::list<std::wstring> getSettingsSection(std::wstring section); |
|---|
| 170 | std::wstring getSettingsString(std::wstring section, std::wstring key, std::wstring defaultValue); |
|---|
| 171 | int getSettingsInt(std::wstring section, std::wstring key, int defaultValue); |
|---|
| [9567d4b] | 172 | void settings_register_key(std::wstring path, std::wstring key, NSCAPI::settings_type type, std::wstring title, std::wstring description, std::wstring defaultValue, bool advanced); |
|---|
| 173 | void settings_register_path(std::wstring path, std::wstring title, std::wstring description, bool advanced); |
|---|
| 174 | void settings_save(); |
|---|
| 175 | |
|---|
| [99e4d8f] | 176 | void Message(int msgType, std::wstring file, int line, std::wstring message); |
|---|
| [2018659] | 177 | NSCAPI::nagiosReturn InjectCommandRAW(const wchar_t* command, const char *request, const unsigned int request_len, char **response, unsigned int *response_len); |
|---|
| 178 | void DestroyBuffer(char**buffer); |
|---|
| [40970de] | 179 | NSCAPI::nagiosReturn InjectCommand(const std::wstring command, const std::list<std::wstring> argument, std::string & result); |
|---|
| [2018659] | 180 | NSCAPI::nagiosReturn InjectSimpleCommand(const std::wstring command, const std::list<std::wstring> argument, std::wstring & message, std::wstring & perf); |
|---|
| [40970de] | 181 | NSCAPI::errorReturn NotifyChannel(std::wstring channel, std::wstring command, NSCAPI::nagiosReturn code, std::string result); |
|---|
| [7f9c823] | 182 | NSCAPI::nagiosReturn InjectSplitAndCommand(const wchar_t* command, wchar_t* buffer, wchar_t splitChar, std::wstring & message, std::wstring & perf); |
|---|
| 183 | NSCAPI::nagiosReturn InjectSplitAndCommand(const std::wstring command, const std::wstring buffer, wchar_t splitChar, std::wstring & message, std::wstring & perf, bool escape = false); |
|---|
| [a0528c4] | 184 | void StopService(void); |
|---|
| [739db5a] | 185 | void Exit(void); |
|---|
| [99e4d8f] | 186 | std::wstring getBasePath(); |
|---|
| [1d9338a] | 187 | bool logDebug(); |
|---|
| 188 | bool checkLogMessages(int type); |
|---|
| [7f9c823] | 189 | std::wstring Encrypt(std::wstring str, unsigned int algorithm = NSCAPI::encryption_xor); |
|---|
| 190 | std::wstring Decrypt(std::wstring str, unsigned int algorithm = NSCAPI::encryption_xor); |
|---|
| [99e4d8f] | 191 | NSCAPI::errorReturn SetSettingsString(std::wstring section, std::wstring key, std::wstring value); |
|---|
| 192 | NSCAPI::errorReturn SetSettingsInt(std::wstring section, std::wstring key, int value); |
|---|
| [76aafc4] | 193 | NSCAPI::errorReturn WriteSettings(int type); |
|---|
| 194 | NSCAPI::errorReturn ReadSettings(int type); |
|---|
| 195 | NSCAPI::errorReturn Rehash(int flag); |
|---|
| [9567d4b] | 196 | plugin_info_list getPluginList(); |
|---|
| 197 | |
|---|
| [6b690bf] | 198 | std::list<std::wstring> getAllCommandNames(); |
|---|
| 199 | std::wstring describeCommand(std::wstring command); |
|---|
| 200 | void registerCommand(std::wstring command, std::wstring description); |
|---|
| [7a156f4] | 201 | unsigned int getBufferLength(); |
|---|
| [2018659] | 202 | |
|---|
| 203 | |
|---|
| [40970de] | 204 | class SimpleNotificationHandler { |
|---|
| 205 | public: |
|---|
| 206 | NSCAPI::nagiosReturn handleRAWNotification(const wchar_t* channel, const wchar_t* command, NSCAPI::nagiosReturn code, std::string result) { |
|---|
| 207 | try { |
|---|
| 208 | PluginCommand::ResponseMessage message; |
|---|
| 209 | message.ParseFromString(result); |
|---|
| 210 | if (message.payload_size() != 1) { |
|---|
| 211 | //NSC_LOG_ERROR_STD(_T("Unsupported payload size: ") + to_wstring(request_message.payload_size())); |
|---|
| 212 | return NSCAPI::returnIgnored; |
|---|
| 213 | } |
|---|
| 214 | |
|---|
| 215 | ::PluginCommand::Response payload = message.payload().Get(0); |
|---|
| 216 | std::list<std::wstring> args; |
|---|
| 217 | for (int i=0;i<payload.arguments_size();i++) { |
|---|
| 218 | args.push_back(to_wstring(payload.arguments(i))); |
|---|
| 219 | } |
|---|
| 220 | std::wstring msg = to_wstring(payload.message()), perf; |
|---|
| 221 | NSCAPI::nagiosReturn ret = handleSimpleNotification(channel, command, code, msg, perf); |
|---|
| 222 | } catch (std::exception &e) { |
|---|
| 223 | std::cout << "Failed to parse data from: " << strEx::strip_hex(result) << e.what() << std::endl;; |
|---|
| 224 | } catch (...) { |
|---|
| 225 | std::cout << "Failed to parse data from: " << strEx::strip_hex(result) << std::endl;; |
|---|
| 226 | } |
|---|
| 227 | |
|---|
| 228 | return -1; |
|---|
| 229 | } |
|---|
| 230 | virtual NSCAPI::nagiosReturn handleSimpleNotification(const std::wstring channel, const std::wstring command, NSCAPI::nagiosReturn code, std::wstring msg, std::wstring perf) = 0; |
|---|
| 231 | |
|---|
| 232 | }; |
|---|
| 233 | |
|---|
| [2018659] | 234 | class SimpleCommand { |
|---|
| 235 | |
|---|
| 236 | public: |
|---|
| 237 | NSCAPI::nagiosReturn handleRAWCommand(const wchar_t* char_command, const std::string &request, std::string &response) { |
|---|
| 238 | |
|---|
| 239 | std::wstring command = char_command; |
|---|
| 240 | PluginCommand::RequestMessage request_message; |
|---|
| 241 | request_message.ParseFromString(request); |
|---|
| 242 | |
|---|
| 243 | if (request_message.payload_size() != 1) { |
|---|
| 244 | //NSC_LOG_ERROR_STD(_T("Unsupported payload size: ") + to_wstring(request_message.payload_size())); |
|---|
| 245 | return NSCAPI::returnIgnored; |
|---|
| 246 | } |
|---|
| 247 | ::PluginCommand::Request payload = request_message.payload().Get(0); |
|---|
| 248 | std::list<std::wstring> args; |
|---|
| 249 | for (int i=0;i<payload.arguments_size();i++) { |
|---|
| 250 | args.push_back(to_wstring(payload.arguments(i))); |
|---|
| 251 | } |
|---|
| 252 | std::wstring msg, perf; |
|---|
| 253 | NSCAPI::nagiosReturn ret = handleCommand(command, args, msg, perf); |
|---|
| 254 | |
|---|
| 255 | PluginCommand::ResponseMessage response_message; |
|---|
| 256 | ::PluginCommand::Header* hdr = response_message.mutable_header(); |
|---|
| 257 | |
|---|
| 258 | hdr->set_type(PluginCommand::Header_Type_RESPONSE); |
|---|
| 259 | hdr->set_version(PluginCommand::Header_Version_VERSION_1); |
|---|
| 260 | |
|---|
| 261 | PluginCommand::Response *resp = response_message.add_payload(); |
|---|
| 262 | resp->set_command(to_string(command)); |
|---|
| 263 | resp->set_message(to_string(msg)); |
|---|
| 264 | resp->set_version(PluginCommand::Response_Version_VERSION_1); |
|---|
| 265 | if (ret == NSCAPI::returnOK) |
|---|
| 266 | resp->set_result(PluginCommand::Response_Code_OK); |
|---|
| 267 | else if (ret == NSCAPI::returnWARN) |
|---|
| 268 | resp->set_result(PluginCommand::Response_Code_WARNING); |
|---|
| 269 | else if (ret == NSCAPI::returnCRIT) |
|---|
| 270 | resp->set_result(PluginCommand::Response_Code_CRITCAL); |
|---|
| 271 | else |
|---|
| 272 | resp->set_result(PluginCommand::Response_Code_UNKNOWN); |
|---|
| 273 | |
|---|
| 274 | response_message.SerializeToString(&response); |
|---|
| 275 | return ret; |
|---|
| 276 | } |
|---|
| 277 | |
|---|
| 278 | virtual NSCAPI::nagiosReturn handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &msg, std::wstring &perf) = 0; |
|---|
| 279 | //(const strEx::blindstr command, const unsigned int argLen, TCHAR **char_args, std::wstring &msg, std::wstring &perf) = 0; |
|---|
| 280 | //(const std::wstring command, const std::list<std::wstring> arguments) = 0; |
|---|
| 281 | |
|---|
| 282 | }; |
|---|
| [a0528c4] | 283 | }; |
|---|
| 284 | |
|---|
| [e26cfe0] | 285 | |
|---|
| [9567d4b] | 286 | #define SETTINGS_MAKE_NAME(key) \ |
|---|
| [d5356c1] | 287 | std::wstring(setting_keys::key ## _PATH + _T(".") + setting_keys::key) |
|---|
| [9567d4b] | 288 | |
|---|
| 289 | #define SETTINGS_GET_STRING(key) \ |
|---|
| [d5356c1] | 290 | NSCModuleHelper::getSettingsString(setting_keys::key ## _PATH, setting_keys::key, setting_keys::key ## _DEFAULT) |
|---|
| [9567d4b] | 291 | #define SETTINGS_GET_INT(key) \ |
|---|
| [d5356c1] | 292 | NSCModuleHelper::getSettingsInt(setting_keys::key ## _PATH, setting_keys::key, setting_keys::key ## _DEFAULT) |
|---|
| [9567d4b] | 293 | #define SETTINGS_GET_BOOL(key) \ |
|---|
| [d5356c1] | 294 | NSCModuleHelper::getSettingsInt(setting_keys::key ## _PATH, setting_keys::key, setting_keys::key ## _DEFAULT) |
|---|
| [9567d4b] | 295 | |
|---|
| 296 | #define SETTINGS_GET_STRING_FALLBACK(key, fallback) \ |
|---|
| [d5356c1] | 297 | NSCModuleHelper::getSettingsString(setting_keys::key ## _PATH, setting_keys::key, NSCModuleHelper::getSettingsString(setting_keys::fallback ## _PATH, setting_keys::fallback, setting_keys::fallback ## _DEFAULT)) |
|---|
| [9567d4b] | 298 | #define SETTINGS_GET_INT_FALLBACK(key, fallback) \ |
|---|
| [d5356c1] | 299 | NSCModuleHelper::getSettingsInt(setting_keys::key ## _PATH, setting_keys::key, NSCModuleHelper::getSettingsInt(setting_keys::fallback ## _PATH, setting_keys::fallback, setting_keys::fallback ## _DEFAULT)) |
|---|
| [9567d4b] | 300 | #define SETTINGS_GET_BOOL_FALLBACK(key, fallback) \ |
|---|
| [d5356c1] | 301 | NSCModuleHelper::getSettingsInt(setting_keys::key ## _PATH, setting_keys::key, NSCModuleHelper::getSettingsInt(setting_keys::fallback ## _PATH, setting_keys::fallback, setting_keys::fallback ## _DEFAULT)) |
|---|
| [9567d4b] | 302 | |
|---|
| 303 | #define SETTINGS_REG_KEY_S(key) \ |
|---|
| [d5356c1] | 304 | NSCModuleHelper::settings_register_key(setting_keys::key ## _PATH, setting_keys::key, NSCAPI::key_string, setting_keys::key ## _TITLE, setting_keys::key ## _DESC, setting_keys::key ## _DEFAULT, setting_keys::key ## _ADVANCED); |
|---|
| [9567d4b] | 305 | #define SETTINGS_REG_KEY_I(key) \ |
|---|
| [7f9c823] | 306 | NSCModuleHelper::settings_register_key(setting_keys::key ## _PATH, setting_keys::key, NSCAPI::key_integer, setting_keys::key ## _TITLE, setting_keys::key ## _DESC, boost::lexical_cast<std::wstring>(setting_keys::key ## _DEFAULT), setting_keys::key ## _ADVANCED); |
|---|
| [9567d4b] | 307 | #define SETTINGS_REG_KEY_B(key) \ |
|---|
| [d5356c1] | 308 | NSCModuleHelper::settings_register_key(setting_keys::key ## _PATH, setting_keys::key, NSCAPI::key_integer, setting_keys::key ## _TITLE, setting_keys::key ## _DESC, setting_keys::key ## _DEFAULT==1?_T("1"):_T("0"), setting_keys::key ## _ADVANCED); |
|---|
| [9567d4b] | 309 | #define SETTINGS_REG_PATH(key) \ |
|---|
| [d5356c1] | 310 | NSCModuleHelper::settings_register_path(setting_keys::key ## _PATH, setting_keys::key ## _TITLE, setting_keys::key ## _DESC, setting_keys::key ## _ADVANCED); |
|---|