Plugin: support extra args to "start".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Plugins: `start` command can now take plugin-specific parameters.
This commit is contained in:
Rusty Russell
2020-12-14 15:28:35 +10:30
parent 8a9976c4c1
commit d971e3de98
8 changed files with 117 additions and 18 deletions

View File

@@ -88,6 +88,10 @@ struct plugin {
/* If set, the plugin is so important that if it terminates early,
* C-lightning should terminate as well. */
bool important;
/* Parameters for dynamically-started plugins. */
const char *parambuf;
const jsmntok_t *params;
};
/**
@@ -200,6 +204,8 @@ void plugins_free(struct plugins *plugins);
* @param path: The path of the executable for this plugin
* @param start_cmd: The optional JSON command which caused this.
* @param important: The plugin is important.
* @param parambuf: NULL, or the JSON buffer for extra parameters.
* @param params: NULL, or the tokens for extra parameters.
*
* If @start_cmd, then plugin_cmd_killed or plugin_cmd_succeeded will be called
* on it eventually.
@@ -207,7 +213,10 @@ void plugins_free(struct plugins *plugins);
struct plugin *plugin_register(struct plugins *plugins,
const char* path TAKES,
struct command *start_cmd,
bool important);
bool important,
const char *parambuf STEALS,
const jsmntok_t *params STEALS);
/**
* Returns true if the provided name matches a plugin command