* Notification event streams enhancements

* Yang 1.1 notification support
  * Event stream discovery support according to RFC 5277 Sec 3.2.5.1 (netconf) and RFC 8040 (restconf)
This commit is contained in:
Olof hagsand 2018-09-18 22:49:29 +02:00
parent f37fdb954f
commit 0631be19cb
16 changed files with 502 additions and 34 deletions

View file

@ -53,6 +53,8 @@
#include "clixon_log.h"
#include "clixon_err.h"
#include "clixon_yang.h"
#include "clixon_xml.h"
#include "clixon_stream.h"
#include "clixon_options.h"
#define CLICON_MAGIC 0x99aafabe
@ -65,9 +67,10 @@
* @see struct backend_handle
*/
struct clicon_handle {
int ch_magic; /* magic (HDR) */
clicon_hash_t *ch_copt; /* clicon option list (HDR) */
clicon_hash_t *ch_data; /* internal clicon data (HDR) */
int ch_magic; /* magic (HDR) */
clicon_hash_t *ch_copt; /* clicon option list (HDR) */
clicon_hash_t *ch_data; /* internal clicon data (HDR) Unclear why two? */
event_stream_t *ch_stream; /* notification streams, see clixon_stream.[ch] */
};
/*! Internal call to allocate a CLICON handle.
@ -133,6 +136,7 @@ clicon_handle_exit(clicon_handle h)
hash_free(copt);
if ((data = clicon_data(h)) != NULL)
hash_free(data);
stream_free(clicon_stream(h));
free(ch);
return 0;
}
@ -172,3 +176,26 @@ clicon_data(clicon_handle h)
return ch->ch_data;
}
/*! Return stream hash-array given a clicon handle.
* @param[in] h Clicon handle
*/
event_stream_t *
clicon_stream(clicon_handle h)
{
struct clicon_handle *ch = handle(h);
return ch->ch_stream;
}
int
clicon_stream_append(clicon_handle h,
event_stream_t *es)
{
struct clicon_handle *ch = handle(h);
event_stream_t **ep;
for (ep = &ch->ch_stream; (*ep); ep=&(*ep)->es_next);
*ep = es;
return 0;
}