plugin: Plugins need a list of methods they registered

This will be used in the next commit to dispatch calls to the correct
plugin.

Signed-off-by: Christian Decker <@cdecker>
This commit is contained in:
Christian Decker 2018-11-22 23:52:47 +01:00 committed by Rusty Russell
parent a71208b2a0
commit bf89d86ba8

View file

@ -33,6 +33,8 @@ struct plugin {
struct list_head plugin_opts;
struct list_node list;
const char **methods;
};
struct plugin_request {
@ -106,6 +108,7 @@ void plugin_register(struct plugins *plugins, const char* path TAKES)
plugin_count++;
p->log = new_log(p, plugins->log_book, "plugin-%zu", plugin_count);
p->log = plugins->log;
p->methods = tal_arr(p, const char *, 0);
list_head_init(&p->plugin_opts);
}
@ -460,6 +463,7 @@ static bool plugin_rpcmethod_add(struct plugin *plugin, const char *buffer,
cmd->name);
return false;
}
*tal_arr_expand(&plugin->methods) = cmd->name;
return true;
}