static sr_conn_ctx_t *connection;
static struct nb_transaction *transaction;
-static int frr_sr_read_cb(struct thread *thread);
+static void frr_sr_read_cb(struct thread *thread);
static int frr_sr_finish(void);
/* Convert FRR YANG data value to sysrepo YANG data value. */
static int yang_data_frr2sr(struct yang_data *frr_data, sr_val_t *sr_data)
{
struct nb_node *nb_node;
- const struct lys_node *snode;
- struct lys_node_container *scontainer;
- struct lys_node_leaf *sleaf;
- struct lys_node_leaflist *sleaflist;
+ const struct lysc_node *snode;
+ struct lysc_node_container *scontainer;
+ struct lysc_node_leaf *sleaf;
+ struct lysc_node_leaflist *sleaflist;
LY_DATA_TYPE type;
sr_val_set_xpath(sr_data, frr_data->xpath);
snode = nb_node->snode;
switch (snode->nodetype) {
case LYS_CONTAINER:
- scontainer = (struct lys_node_container *)snode;
- if (!scontainer->presence)
+ scontainer = (struct lysc_node_container *)snode;
+ if (!CHECK_FLAG(scontainer->flags, LYS_PRESENCE))
return -1;
sr_data->type = SR_CONTAINER_PRESENCE_T;
return 0;
sr_data->type = SR_LIST_T;
return 0;
case LYS_LEAF:
- sleaf = (struct lys_node_leaf *)snode;
+ sleaf = (struct lysc_node_leaf *)snode;
type = sleaf->type.base;
break;
case LYS_LEAFLIST:
- sleaflist = (struct lys_node_leaflist *)snode;
+ sleaflist = (struct lysc_node_leaflist *)snode;
type = sleaflist->type.base;
break;
default:
}
}
-static int frr_sr_state_data_iter_cb(const struct lys_node *snode,
+static int frr_sr_state_data_iter_cb(const struct lysc_node *snode,
struct yang_translator *translator,
struct yang_data *data, void *arg)
{
return NB_OK;
}
-static int frr_sr_read_cb(struct thread *thread)
+static void frr_sr_read_cb(struct thread *thread)
{
- sr_subscription_ctx_t *sr_subscription = THREAD_ARG(thread);
+ struct yang_module *module = THREAD_ARG(thread);
int fd = THREAD_FD(thread);
int ret;
- ret = sr_process_events(sr_subscription, session, NULL);
+ ret = sr_process_events(module->sr_subscription, session, NULL);
if (ret != SR_ERR_OK) {
flog_err(EC_LIB_LIBSYSREPO, "%s: sr_fd_event_process(): %s",
__func__, sr_strerror(ret));
- return -1;
+ return;
}
- thread = NULL;
- thread_add_read(master, frr_sr_read_cb, sr_subscription, fd, &thread);
-
- return 0;
+ thread_add_read(master, frr_sr_read_cb, module, fd, &module->sr_thread);
}
static void frr_sr_subscribe_config(struct yang_module *module)
sr_strerror(ret));
}
-static int frr_sr_subscribe_state(const struct lys_node *snode, void *arg)
+static int frr_sr_subscribe_state(const struct lysc_node *snode, void *arg)
{
struct yang_module *module = arg;
struct nb_node *nb_node;
return YANG_ITER_CONTINUE;
}
-static int frr_sr_subscribe_rpc(const struct lys_node *snode, void *arg)
+static int frr_sr_subscribe_rpc(const struct lysc_node *snode, void *arg)
{
struct yang_module *module = arg;
struct nb_node *nb_node;
sr_strerror(ret));
goto cleanup;
}
- thread_add_read(master, frr_sr_read_cb, module->sr_subscription,
+ thread_add_read(master, frr_sr_read_cb, module,
event_pipe, &module->sr_thread);
}