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:
parent
f500cfa1e6
commit
b9f463ebee
2 changed files with 12 additions and 0 deletions
|
@ -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[]);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue