plugin: Add hook registration

I might have gone a bit overboard with the type-checking, but
typesafe_cb_cast is quite nice to use, so why not. The macro to
register a new hook encapsulates the entire flow from param
serialization, to dispatch, parsing and callback dispatch in one
bundle. I was tempted to have the callback outside of the
registration, but it's unlikely that we'll have two calls to the same
hook with different callbacks.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2018-12-20 12:00:35 +01:00
committed by Rusty Russell
parent 025fbbc9ea
commit f8f76e3d31
4 changed files with 127 additions and 0 deletions

View File

@@ -13,6 +13,11 @@
*/
struct plugins;
/**
* A plugin, exposed as a stub so we can pass it as an argument.
*/
struct plugin;
/**
* Create a new plugins context.
*/