1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

node: extend struct node_type with a new function pointer for checking node configuration

This commit is contained in:
Steffen Vogel 2018-07-02 10:59:45 +02:00
parent f500cfa1e6
commit b9f463ebee
2 changed files with 12 additions and 0 deletions

View file

@ -88,6 +88,14 @@ struct node_type {
*/
int (*parse)(struct node *n, json_t *cfg);
/** Check the current node configuration for plausability and errors.
*
* @param n A pointer to the node object.
* @retval 0 Success. Node configuration is good.
* @retval <0 Error. The node configuration is bogus.
*/
int (*check)(struct node *n);
/** Parse node from command line arguments. */
int (*parse_cli)(struct node *n, int argc, char *argv[]);

View file

@ -308,6 +308,10 @@ int node_check(struct node *n)
if (ret)
return ret;
ret = n->_vt->check ? n->_vt->check(n) : 0;
if (ret)
return ret;
n->state = STATE_CHECKED;
return 0;