* Stream replay support

* RFC8040 Restconf replay support: start-time and stop-time query parameter support
    * This only applies to "native" restconf stream support, Nchan mode has different replay functionality
  * RFC5277 Netconf replay support using <startTime> and
  * Replay support is only in-memory and not persistent. External time-series DB could be added.
This commit is contained in:
Olof hagsand 2018-10-27 11:12:01 +02:00
parent 77e56868d4
commit af16760279
13 changed files with 355 additions and 65 deletions

View file

@ -37,17 +37,30 @@
#ifndef _CLIXON_QUEUE_H_
#define _CLIXON_QUEUE_H_
/*
* Circular queue structure for use as first entry in a parent structure.
/*! Circular queue structure for use as first entry in a parent structure.
* Add qelem_t as first element in struct
* @code
* struct a{
* qelem_t a_q; # this must be there
* int a_b; # other elements
* ...
* };
* @endcode
*/
typedef struct _qelem_t {
struct _qelem_t *q_next;
struct _qelem_t *q_prev;
} qelem_t;
/*
* Append element 'elem' to queue.
*/
/*! Append element 'elem' to queue.
* @param[in] elem Element to be added
* @param[in,out] pred Add element after this
* @code
* struct a *list; # existing list
* struct a *new = malloc(...);
* ADDQ(new, list);
* @endcode
*/
#define ADDQ(elem, pred) { \
register qelem_t *Xe = (qelem_t *) (elem); \
register qelem_t *Xp = (qelem_t *) (pred); \
@ -62,8 +75,14 @@ typedef struct _qelem_t {
} \
}
/*
* Insert element 'elem' in queue after 'pred'
/*! Insert element 'elem' in queue after 'pred'
* @param[in] elem Element to be added
* @param[in,out] pred Add element after this
* @code
* struct a *list; # existing list
* struct a *new = malloc(...);
* INSQ(new, list);
* @endcode
*/
#define INSQ(elem, pred) { \
register qelem_t *Xe = (qelem_t *) (elem); \
@ -79,9 +98,16 @@ typedef struct _qelem_t {
pred = elem; \
}
/*
* Remove element 'elem' from queue. 'head' is the pointer to the queue and
/*! Remove element 'elem' from queue. 'head' is the pointer to the queue and
* is of 'type'.
* @param[in] elem
* @param[in] head
* @param[in] type XXX needed?
* @code
* struct a *list; # existing list
* struct a *el; # remove this
* DELQ(el, list, struct a*);
* @endcode
*/
#define DELQ(elem, head, type) { \
register qelem_t *Xe = (qelem_t *) elem; \
@ -92,10 +118,13 @@ typedef struct _qelem_t {
head = (type)Xe->q_next; \
}
/*
* Get next entry in list
/*! Get next entry in list
* @param[in] type Type of element
* @param[in] el Return next element after elem.
* @code
* struct a *list; # existing element (or list)
* NEXTQ(struct a*, el);
*/
#define NEXTQ(type, elem) ((type)((elem)?((qelem_t *)(elem))->q_next:NULL))
#endif /* _CLIXON_QUEUE_H_ */