* Set access/subscribe base URL with: CLICON_STREAM_URL_PREFIX (default https\

://localhost/streams).
    * Example: new stream "foo" will get access URL: https://localhost/streams/\
foo
  * Optional pub/sub support enabled by ./configure --enable-publish
    * Set publish URL base with: CLICON_STREAM_PUB_PREFIX (default http://local\
host/pub)
    * Example: new stream "foo" will get pub URL: https://localhost/pub/foo
This commit is contained in:
Olof Hagsand 2018-10-15 22:08:38 +02:00
parent dcec834455
commit d5f4969780
15 changed files with 438 additions and 58 deletions

View file

@ -81,14 +81,20 @@ ce_find_bypid(struct client_entry *ce_list,
return NULL;
}
/*! Stream callback for netconf stream notification (RFC 5277)
* @param[in] h Clicon handle
* @param[in] event Event as XML
* @param[in] arg Extra argument provided in stream_cb_add
* @see stream_cb_add
*/
static int
ce_event_cb(clicon_handle h,
void *event,
cxobj *event,
void *arg)
{
struct client_entry *ce = (struct client_entry *)arg;
if (send_msg_notify_xml(ce->ce_s, (cxobj*)event) < 0){
if (send_msg_notify_xml(ce->ce_s, event) < 0){
if (errno == ECONNRESET || errno == EPIPE){
clicon_log(LOG_WARNING, "client %d reset", ce->ce_nr);
#if 0

View file

@ -91,6 +91,7 @@ backend_terminate(clicon_handle h)
yspec_free(yspec);
if ((x = clicon_conf_xml(h)) != NULL)
xml_free(x);
stream_publish_exit();
clixon_plugin_exit(h);
/* Delete all backend plugin RPC callbacks */
rpc_callback_delete_all();
@ -720,9 +721,9 @@ main(int argc,
return -1;
}
if (stream_register(h, "NETCONF", "default NETCONF event stream") < 0)
/* Publish stream on pubsub channels XXX conditional? */
if (stream_publish_init() < 0)
goto done;
if ((xmldb_plugin = clicon_xmldb_plugin(h)) == NULL){
clicon_log(LOG_ERR, "No xmldb plugin given (specify option CLICON_XMLDB_PLUGIN).\n");
goto done;