summaryrefslogtreecommitdiff
path: root/lib/northbound.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/northbound.h')
-rw-r--r--lib/northbound.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/northbound.h b/lib/northbound.h
index c31f007e70..0468c58de3 100644
--- a/lib/northbound.h
+++ b/lib/northbound.h
@@ -386,6 +386,11 @@ struct nb_callbacks {
int (*destroy)(struct nb_cb_destroy_args *args);
/*
+ * Flags to control the how northbound callbacks are invoked.
+ */
+ uint flags;
+
+ /*
* Configuration callback.
*
* A list entry or leaf-list entry has been moved. Only applicable when
@@ -622,6 +627,12 @@ struct nb_callbacks {
void (*cli_show_end)(struct vty *vty, const struct lyd_node *dnode);
};
+/*
+ * Flag indicating the northbound should recurse destroy the children of this
+ * node when it is destroyed.
+ */
+#define F_NB_CB_DESTROY_RECURSE 0x01
+
struct nb_dependency_callbacks {
void (*get_dependant_xpath)(const struct lyd_node *dnode, char *xpath);
void (*get_dependency_xpath)(const struct lyd_node *dnode, char *xpath);
@@ -663,6 +674,8 @@ struct nb_node {
#define F_NB_NODE_KEYLESS_LIST 0x02
/* Ignore config callbacks for this node */
#define F_NB_NODE_IGNORE_CFG_CBS 0x04
+/* Ignore state callbacks for this node */
+#define F_NB_NODE_HAS_GET_TREE 0x08
/*
* HACK: old gcc versions (< 5.x) have a bug that prevents C99 flexible arrays
@@ -690,6 +703,22 @@ struct frr_yang_module_info {
*/
const char **features;
+ /*
+ * If the module keeps its oper-state in a libyang tree
+ * this function should return that tree (locked if multi-threading).
+ * If this function is provided then the state callback functions
+ * (get_elem, get_keys, get_next, lookup_entry) need not be set for a
+ * module. The unlock_tree function if non-NULL will be called with
+ * the returned tree and the *user_lock value.
+ */
+ const struct lyd_node *(*get_tree_locked)(const char *xpath, void **user_lock);
+
+ /*
+ * This function will be called following a call to get_tree_locked() in
+ * order to unlock the tree if locking was required.
+ */
+ void (*unlock_tree)(const struct lyd_node *tree, void *user_lock);
+
/* Northbound callbacks. */
const struct {
/* Data path of this YANG node. */
@@ -1825,6 +1854,18 @@ extern struct lyd_node *nb_op_updatef(struct lyd_node *tree, const char *path, c
extern struct lyd_node *nb_op_vupdatef(struct lyd_node *tree, const char *path, const char *val_fmt,
va_list ap);
+/**
+ * nb_notif_add() - Notice that the value at `path` has changed.
+ * @path - Absolute path in the state tree that has changed (either added or
+ * updated).
+ */
+void nb_notif_add(const char *path);
+
+/**
+ * nb_notif_delete() - Notice that the value at `path` has been deleted.
+ * @path - Absolute path in the state tree that has been deleted.
+ */
+void nb_notif_delete(const char *path);
/**
* nb_notif_set_filters() - add or replace notification filters
@@ -1835,6 +1876,15 @@ extern struct lyd_node *nb_op_vupdatef(struct lyd_node *tree, const char *path,
*/
extern void nb_notif_set_filters(const char **selectors, bool replace);
+/**
+ * nb_notif_enable_multi_thread() - enable use of multiple threads with nb_notif
+ *
+ * If the nb_notif_XXX calls will be made from multiple threads then locking is
+ * required. Call this function to enable that functionality, prior to using the
+ * nb_notif_XXX API.
+ */
+extern void nb_notif_enable_multi_thread(void);
+
extern void nb_notif_init(struct event_loop *loop);
extern void nb_notif_terminate(void);