Ejemplo n.º 1
0
int NRDPClient::clp_handler_impl::exec(client::configuration::data_type data, const Plugin::ExecuteRequestMessage &request_message, Plugin::ExecuteResponseMessage &response_message) {
	const ::Plugin::Common_Header& request_header = request_message.header();
	connection_data con = parse_header(request_header, data);

	nscapi::protobuf::functions::make_return_header(response_message.mutable_header(), request_header);

	nrdp::data nrdp_data;
	for (int i=0;i < request_message.payload_size(); ++i) {
		nscapi::protobuf::functions::decoded_simple_command_data data = nscapi::protobuf::functions::parse_simple_exec_request_payload(request_message.payload(i));
		//nrdp_data.add_command(data.command, data.args);
	}
	boost::tuple<int,std::string> ret = send(con, nrdp_data);
	nscapi::protobuf::functions::append_simple_exec_response_payload(response_message.add_payload(), "TODO", ret.get<0>(), ret.get<1>());
	return NSCAPI::isSuccess;
}
Ejemplo n.º 2
0
int NSCPClient::clp_handler_impl::exec(client::configuration::data_type data, const Plugin::ExecuteRequestMessage &request_message, Plugin::ExecuteResponseMessage &response_message) {
	const ::Plugin::Common_Header& request_header = request_message.header();
	connection_data con = parse_header(request_header, data);

	std::string tmp;
	int ret = send(con, NSCPIPC::Common_MessageTypes_EXEC_REQUEST, request_message.SerializeAsString(), tmp);
	response_message.ParseFromString(tmp);
	return ret;
}
Ejemplo n.º 3
0
bool NSCPClient::commandLineExec(const int target_mode, const Plugin::ExecuteRequestMessage &request, Plugin::ExecuteResponseMessage &response) {
	BOOST_FOREACH(const Plugin::ExecuteRequestMessage::Request &payload, request.payload()) {
		if (payload.arguments_size() == 0 || payload.arguments(0) == "help") {
			Plugin::ExecuteResponseMessage::Response *rp = response.add_payload();
			nscapi::protobuf::functions::set_response_bad(*rp, "Usage: nscp nscp --help");
			return true;
		}
	}
	if (target_mode == NSCAPI::target_module)
		return client_.do_exec(request, response, "check_nscp");
	return false;
}
Ejemplo n.º 4
0
int CheckMKClient::clp_handler_impl::exec(client::configuration::data_type data, const Plugin::ExecuteRequestMessage &, Plugin::ExecuteResponseMessage &response_message) {
	NSC_LOG_ERROR_STD("check_mk does not support submit patterns");
	nscapi::protobuf::functions::set_response_good(*response_message.add_payload(), "check_mk does not support exec pattern");
	return NSCAPI::isSuccess;
}