Rusty Russell
111d6df442
plugins: make log prefix the basename.
It's not perfect if they have multiple with same name, but better than number.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
eb03b33655
plugins: add and install built-in plugin dir, add clear and disable options.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
a4287f99fd
lightningd: add --plugin-dir option to load directory full of plugins.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Christian Decker
d7e94a9386
plugin: Iterate over the options from a plugin using the tok->size
I had this really contorted way of iterating over options that could
cause valgrind to choke. This is the much more intuitive way to
iterate.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
6 years ago
Christian Decker
b8a1445317
plugin: Make plugin_kill a printf-like function
Suggested-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
e625fd7e82
plugin: Map results back to the incoming JSON-RPC request
The final step in the JSON-RPC passthrough: map the result we got from
the plugin back to the original request we got from the client.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
6 years ago
Christian Decker
7c93cf00bb
plugin: Dispatch incoming RPC calls to appropriate plugin
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
a0f6a82a0b
plugin: Make memleak happy
List element structs must have the list_node as their first element.
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
bf89d86ba8
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>
6 years ago
Christian Decker
a71208b2a0
plugin: Remove added JSON-RPC methods if a plugin gets killed
Removes the method from the dispatch table, leaving a NULL entry
currently.
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
7de4c40b77
plugin: Add plugin rpcmethods to the JSON-RPC interface
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
3e1138951b
plugin: Add pointer to jsonrpc so we can add new methods
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
a4ded47d34
plugin: Fix memory leak when requests are done
We weren't cleaning the requests we fulfilled, so this does that :-)
6 years ago
arowser
3ba751797b
add needed include file
6 years ago
Christian Decker
da465f0fdd
plugin: Exit if we fail to start a plugin
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
b02861bfe1
plugin: Give each plugin their own log-prefix
There is no good naming just yet, so we just number them 1 to n.
6 years ago
Christian Decker
74c58e9f25
docs: Add an initial draft of the plugin documentation
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
805a76a97f
plugin: Make the plugins a list
Suggested-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
775e4b784d
plugin: Get rid of redundant stdin and stdout members
Suggested-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
e6ef675ea1
plugin: Send the configure request once we collected all options
This is the final step to get the plugins working. After parsing the
early options (including `--plugin`), then starting and asking the
plugins for options, and finally reading in the options we just
registered, we just need to assemble the options and send them over.
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
3abc32cbbc
plugin: Terminate objects with an empty line to signal end
This is just meant as a hint to the plugin that the message is done,
and it can try to parse the buffer.
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
404352fc7e
plugin: Configure plugins once we've collected all cli options
6 years ago
Christian Decker
55d6d6b0e7
plugin: Register plugin cli options
We also make `--help` a non-early arg so it allows for the plugins to
register their options before printing the help message. The options
themselves are stored in a separate struct inbetween them being
registered and them being forwarded to the plugin. Currently only
supports string options.
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Christian Decker
10338983a6
plugin: Add logs to plugin and add method to kill a plugin
Also includes some sanity checks for the results returned by the
plugin, such as ensuring that the ID is as expected and that we have
either an error or a real result.
6 years ago
Christian Decker
084224f134
plugin: Add request muxing to the plugin subsystem
6 years ago
Christian Decker
d0de6e59c6
plugin: Start each plugin and setup the connection to it
Mostly copied from bitcoind.c
6 years ago
Christian Decker
c71f4f3bd9
plugin: Add listconfigs stub for the --plugin option
6 years ago
Christian Decker
b6a1735929
plugin: Basic scaffolding for the plugin subsystem
6 years ago