Exemple #1
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;
}
Exemple #2
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;
}