plugin: Store a plugin's featurebits in the plugin struct

We'll collect the featurebits on-demand from all currently active plugins when
needed.
This commit is contained in:
Christian Decker
2020-01-29 22:35:20 +01:00
committed by Rusty Russell
parent 966ac95098
commit ea62d97879
2 changed files with 54 additions and 1 deletions

View File

@@ -26,6 +26,22 @@ enum plugin_state {
CONFIGURED
};
/**
* A plugin may register any number of featurebits that should be added to
* various messages as part of their manifest. The following enum enumerates
* the possible locations the featurebits can be added to, and are used as
* indices into the array of featurebits in the plugin struct itself.
*
* If you edit this make sure that there is a matching entry in the
* `plugin_features_type_names[]` array in plugin.c.
*/
enum plugin_features_type {
PLUGIN_FEATURES_NODE,
PLUGIN_FEATURES_INIT,
PLUGIN_FEATURES_INVOICE,
};
#define NUM_PLUGIN_FEATURES_TYPE (PLUGIN_FEATURES_INVOICE+1)
/**
* A plugin, exposed as a stub so we can pass it as an argument.
*/
@@ -66,6 +82,11 @@ struct plugin {
/* An array of subscribed topics */
char **subscriptions;
/* Featurebits for various locations that the plugin
* registered. Indices correspond to the `plugin_features_type`
* enum. */
u8 *featurebits[NUM_PLUGIN_FEATURES_TYPE];
};
/**