Replacing remaining badrequest() with proper restconf error msg.

This commit is contained in:
Olof hagsand 2018-04-22 20:13:54 +02:00
parent 3ed1c98556
commit 1913407e52
14 changed files with 153 additions and 75 deletions

View file

@ -93,27 +93,22 @@ Routing notification
The example includes a restonf, netconf, CLI and two backend plugins.
Each plugin is initiated with an API struct followed by a plugin init function.
The content of the API struct is different depending on what kind of plugin it is. Some fields are
meaningful only for some plugins.
The plugin init function may also include registering RPC functions.
The content of the API struct is different depending on what kind of plugin it is.
The plugin init function may also include registering RPC functions, see below is for a backend.
```
static clixon_plugin_api api = {
"example", /* name */
clixon_plugin_init,
plugin_start,
plugin_exit,
NULL, /* cli prompt N/A for backend */
NULL, /* cli suspend N/A for backend */
NULL, /* cli interrupt N/A for backend */
NULL, /* auth N/A for backend */
plugin_reset,
plugin_statedata,
transaction_begin,
transaction_validate,
transaction_complete,
transaction_commit,
transaction_end,
transaction_abort
.ca_reset=plugin_reset,/* reset */
.ca_statedata=plugin_statedata, /* statedata */
.ca_trans_begin=NULL, /* trans begin */
.ca_trans_validate=transaction_validate,/* trans validate */
.ca_trans_complete=NULL, /* trans complete */
.ca_trans_commit=transaction_commit, /* trans commit */
.ca_trans_end=NULL, /* trans end */
.ca_trans_abort=NULL /* trans abort */
};
clixon_plugin_api *

View file

@ -260,13 +260,13 @@ plugin_start(clicon_handle h,
clixon_plugin_api *clixon_plugin_init(clicon_handle h);
static clixon_plugin_api api = {
"example", /* name */ /*--- Common fields. ---*/
clixon_plugin_init, /* init */
plugin_start, /* start */
NULL, /* exit */
.ca_reset=plugin_reset,/* reset */ /*--- Backend plugin only ---*/
.ca_statedata=plugin_statedata, /* statedata */
.ca_trans_begin=NULL, /* trans begin */
"example", /* name */
clixon_plugin_init, /* init */
plugin_start, /* start */
NULL, /* exit */
.ca_reset=plugin_reset, /* reset */
.ca_statedata=plugin_statedata, /* statedata */
.ca_trans_begin=NULL, /* trans begin */
.ca_trans_validate=transaction_validate,/* trans validate */
.ca_trans_complete=NULL, /* trans complete */
.ca_trans_commit=transaction_commit, /* trans commit */