New state plugin callback for pagination.

* You need to change all statedata plugin callback for the new pagination feature
  * If you dont use pagination you can ignore the values of the new parameters
  * See [User manual pagination](https://clixon-docs.readthedocs.io/en/latest/misc.html#pagination)
  * The updated callback signature is as follows:
  ```
  int statedata(clicon_handle     h,
                cvec             *nsc,
	        char             *xpath,
	        pagination_mode_t pagmode,   // NEW
	        uint32_t          offset,    // NEW
	        uint32_t          limit,     // NEW
	        uint32_t         *remaining, // NEW
	        cxobj            *xstate)
  ```
This commit is contained in:
Olof hagsand 2021-09-21 15:02:46 +02:00
parent 384ce70d7c
commit a7a699a8b5
7 changed files with 32 additions and 39 deletions

View file

@ -1119,7 +1119,7 @@ static clixon_plugin_api api = {
.ca_extension=example_extension, /* yang extensions */
.ca_daemon=example_daemon, /* daemon */
.ca_reset=example_reset, /* reset */
.ca_statedata2=example_statedata, /* statedata2 : Note fn is switched if -sS <file> */
.ca_statedata=example_statedata, /* statedata : Note fn is switched if -sS <file> */
.ca_lockdb=example_lockdb, /* Database lock changed state */
.ca_trans_begin=main_begin, /* trans begin */
.ca_trans_validate=main_validate, /* trans validate */
@ -1164,7 +1164,7 @@ clixon_plugin_init(clicon_handle h)
break;
case 'S': /* state file (requires -s) */
_state_file = optarg;
api.ca_statedata2 = example_statefile; /* Switch state data callback */
api.ca_statedata = example_statefile; /* Switch state data callback */
break;
case 'i': /* read state file on init not by request (requires -sS <file> */
_state_file_cached = 1;

View file

@ -180,6 +180,10 @@ int
nacm_statedata(clicon_handle h,
cvec *nsc,
char *xpath,
pagination_mode_t pagmode,
uint32_t offset,
uint32_t limit,
uint32_t *remaining,
cxobj *xstate)
{
int retval = -1;