Changeset a44cb15 in nscp for include/nscapi/nscapi_core_wrapper.cpp
- Timestamp:
- 09/02/11 07:38:44 (21 months ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2
- Children:
- a14aa07
- Parents:
- 3b11e65
- File:
-
- 1 edited
-
include/nscapi/nscapi_core_wrapper.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
include/nscapi/nscapi_core_wrapper.cpp
rd7e265d ra44cb15 129 129 std::string request; 130 130 nscapi::functions::create_simple_query_response(command, code, message, perf, request); 131 NSCAPI::nagiosReturn ret = NotifyChannel(channel, command, code, request); 132 } 133 134 135 NSCAPI::errorReturn nscapi::core_wrapper::NotifyChannel(std::wstring channel, std::wstring command, NSCAPI::nagiosReturn code, std::string result) { 131 NSCAPI::nagiosReturn ret = submit_message(channel, command, request); 132 } 133 134 NSCAPI::errorReturn nscapi::core_wrapper::submit_message(std::wstring channel, std::wstring command, std::string buffer) { 136 135 if (!fNSAPINotify) 137 136 throw nscapi::nscapi_exception(_T("NSCore has not been initiated...")); 138 return fNSAPINotify(channel.c_str(), command.c_str(), code, result.c_str(), result.size());137 return fNSAPINotify(channel.c_str(), command.c_str(), buffer.c_str(), buffer.size()); 139 138 } 140 139 … … 544 543 return ret; 545 544 } 546 void nscapi::core_wrapper::registerCommand( std::wstring command, std::wstring description) {545 void nscapi::core_wrapper::registerCommand(unsigned int id, std::wstring command, std::wstring description) { 547 546 if (!fNSAPIRegisterCommand) 548 547 throw nscapi::nscapi_exception(_T("NSCore has not been initiated...")); 549 if (fNSAPIRegisterCommand(id_, command.c_str(), description.c_str()) != NSCAPI::isSuccess) { 550 CORE_LOG_ERROR_STD(_T("Failed to register command: ") + command + _T(" in plugin: ") + to_wstring(id_)); 548 if (fNSAPIRegisterCommand(id, command.c_str(), description.c_str()) != NSCAPI::isSuccess) { 549 CORE_LOG_ERROR_STD(_T("Failed to register command: ") + command + _T(" in plugin: ") + to_wstring(id)); 550 } 551 } 552 553 void nscapi::core_wrapper::registerSubmissionListener(unsigned int id, std::wstring channel) { 554 if (!fNSAPIRegisterSubmissionListener) 555 throw nscapi::nscapi_exception(_T("NSCore has not been initiated...")); 556 if (fNSAPIRegisterSubmissionListener(id, channel.c_str()) != NSCAPI::isSuccess) { 557 CORE_LOG_ERROR_STD(_T("Failed to register channel: ") + channel + _T(" in plugin: ") + to_wstring(id)); 558 } 559 } 560 void nscapi::core_wrapper::registerRoutingListener(unsigned int id, std::wstring channel) { 561 if (!fNSAPIRegisterRoutingListener) 562 throw nscapi::nscapi_exception(_T("NSCore has not been initiated...")); 563 if (fNSAPIRegisterRoutingListener(id, channel.c_str()) != NSCAPI::isSuccess) { 564 CORE_LOG_ERROR_STD(_T("Failed to register channel: ") + channel + _T(" in plugin: ") + to_wstring(id)); 551 565 } 552 566 } … … 583 597 * @return NSCAPI::success or NSCAPI::failure 584 598 */ 585 bool nscapi::core_wrapper::load_endpoints(unsigned int id, nscapi::core_api::lpNSAPILoader f) { 586 id_ = id; 599 bool nscapi::core_wrapper::load_endpoints(nscapi::core_api::lpNSAPILoader f) { 587 600 fNSAPIGetApplicationName = (nscapi::core_api::lpNSAPIGetApplicationName)f(_T("NSAPIGetApplicationName")); 588 601 fNSAPIGetApplicationVersionStr = (nscapi::core_api::lpNSAPIGetApplicationVersionStr)f(_T("NSAPIGetApplicationVersionStr")); … … 624 637 fNSAPIExpandPath = (nscapi::core_api::lpNSAPIExpandPath)f(_T("NSAPIExpandPath")); 625 638 639 fNSAPIRegisterSubmissionListener = (nscapi::core_api::lpNSAPIRegisterSubmissionListener)f(_T("NSAPIRegisterSubmissionListener")); 640 fNSAPIRegisterRoutingListener = (nscapi::core_api::lpNSAPIRegisterRoutingListener)f(_T("NSAPIRegisterRoutingListener")); 641 626 642 return true; 627 643 }
Note: See TracChangeset
for help on using the changeset viewer.








