MCPcopy Create free account
hub / github.com/DFHack/dfhack / BindMethod

Method BindMethod

library/RemoteTools.cpp:692–715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690}
691
692command_result CoreService::BindMethod(color_ostream &stream,
693 const dfproto::CoreBindRequest *in,
694 dfproto::CoreBindReply *out)
695{
696 ServerFunctionBase *fn = connection()->findFunction(stream, in->plugin(), in->method());
697
698 if (!fn)
699 {
700 stream.printerr("RPC method not found: {}::{}\n",
701 in->plugin(), in->method());
702 return CR_FAILURE;
703 }
704
705 if (fn->p_in_template->GetTypeName() != in->input_msg() ||
706 fn->p_out_template->GetTypeName() != in->output_msg())
707 {
708 stream.printerr("Requested wrong signature for RPC method: {}::{}\n",
709 in->plugin(), in->method());
710 return CR_FAILURE;
711 }
712
713 out->set_assigned_id(fn->getId());
714 return CR_OK;
715}
716
717command_result CoreService::RunCommand(color_ostream &stream,
718 const dfproto::CoreRunCommandRequest *in)

Callers

nothing calls this directly

Calls 4

findFunctionMethod · 0.80
pluginMethod · 0.80
GetTypeNameMethod · 0.80
getIdMethod · 0.45

Tested by

no test coverage detected