summaryrefslogtreecommitdiff
path: root/lib/northbound.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/northbound.h')
-rw-r--r--lib/northbound.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/northbound.h b/lib/northbound.h
index ce79d907f9..fbd7771db7 100644
--- a/lib/northbound.h
+++ b/lib/northbound.h
@@ -72,6 +72,7 @@ enum nb_operation {
NB_OP_MODIFY,
NB_OP_DESTROY,
NB_OP_MOVE,
+ NB_OP_PRE_VALIDATE,
NB_OP_APPLY_FINISH,
NB_OP_GET_ELEM,
NB_OP_GET_NEXT,
@@ -199,6 +200,19 @@ struct nb_callbacks {
/*
* Optional configuration callback.
*
+ * This callback can be used to validate subsections of the
+ * configuration being committed before validating the configuration
+ * changes themselves. It's useful to perform more complex validations
+ * that depend on the relationship between multiple nodes.
+ *
+ * dnode
+ * libyang data node associated with the 'pre_validate' callback.
+ */
+ int (*pre_validate)(const struct lyd_node *dnode);
+
+ /*
+ * Optional configuration callback.
+ *
* The 'apply_finish' callbacks are called after all other callbacks
* during the apply phase (NB_EV_APPLY). These callbacks are called only
* under one of the following two cases:
@@ -435,25 +449,15 @@ enum nb_client {
/* Northbound configuration. */
struct nb_config {
- /* Configuration data. */
struct lyd_node *dnode;
-
- /* Configuration version. */
uint32_t version;
-
- /*
- * Lock protecting this structure. The use of this lock is always
- * necessary when reading or modifying the global running configuration.
- * For candidate configurations, use of this lock is optional depending
- * on the threading scheme of the northbound plugin.
- */
- pthread_rwlock_t lock;
};
/* Northbound configuration callback. */
struct nb_config_cb {
RB_ENTRY(nb_config_cb) entry;
enum nb_operation operation;
+ uint32_t seq;
char xpath[XPATH_MAXLEN];
const struct nb_node *nb_node;
const struct lyd_node *dnode;