2018-09-19 22:19:51 +02:00
|
|
|
#ifndef LIGHTNING_LIGHTNINGD_PLUGIN_H
|
|
|
|
#define LIGHTNING_LIGHTNINGD_PLUGIN_H
|
|
|
|
#include "config.h"
|
|
|
|
#include <ccan/take/take.h>
|
|
|
|
#include <ccan/tal/tal.h>
|
2018-09-20 20:43:55 +02:00
|
|
|
#include <lightningd/jsonrpc.h>
|
2018-11-01 18:53:49 +01:00
|
|
|
#include <lightningd/log.h>
|
2018-09-19 22:19:51 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A collection of plugins, and some associated information.
|
|
|
|
*
|
|
|
|
* Mainly used as root context for calls in the plugin subsystem.
|
|
|
|
*/
|
|
|
|
struct plugins;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new plugins context.
|
|
|
|
*/
|
2018-11-11 10:09:02 +01:00
|
|
|
struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book);
|
2018-09-19 22:19:51 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the registered plugins.
|
|
|
|
*
|
|
|
|
* Initialization includes spinning up the plugins, reading their
|
|
|
|
* manifest, and registering the JSON-RPC passthrough and command line
|
|
|
|
* arguments. In order to read the getmanifest reply from the plugins
|
|
|
|
* we spin up our own io_loop that exits once all plugins have
|
|
|
|
* responded.
|
|
|
|
*/
|
|
|
|
void plugins_init(struct plugins *plugins);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a plugin for initialization and execution.
|
|
|
|
*
|
|
|
|
* @param plugins: Plugin context
|
|
|
|
* @param path: The path of the executable for this plugin
|
|
|
|
*/
|
|
|
|
void plugin_register(struct plugins *plugins, const char* path TAKES);
|
|
|
|
|
2018-11-02 20:04:32 +01:00
|
|
|
/**
|
|
|
|
* Send the configure message to all plugins.
|
|
|
|
*
|
|
|
|
* Once we've collected all the command line arguments we can go ahead
|
|
|
|
* and send them over to the plugin. This finalizes the initialization
|
|
|
|
* of the plugins and signals that lightningd is now ready to process
|
|
|
|
* incoming JSON-RPC calls and messages.
|
|
|
|
*/
|
|
|
|
void plugins_config(struct plugins *plugins);
|
2018-09-20 20:43:55 +02:00
|
|
|
/**
|
|
|
|
* Add the plugin option and their respective options to listconfigs.
|
|
|
|
*
|
|
|
|
* This adds a dict that maps the plugin name to a dict of configuration options
|
|
|
|
* for the corresponding plugins.
|
|
|
|
*/
|
|
|
|
void json_add_opt_plugins(struct json_stream *response,
|
|
|
|
const struct plugins *plugins);
|
|
|
|
|
2018-09-19 22:19:51 +02:00
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_PLUGIN_H */
|