summaryrefslogtreecommitdiff
path: root/lib/mgmt_be_client.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mgmt_be_client.h')
-rw-r--r--lib/mgmt_be_client.h40
1 files changed, 32 insertions, 8 deletions
diff --git a/lib/mgmt_be_client.h b/lib/mgmt_be_client.h
index 8ad482cacf..d144ebc728 100644
--- a/lib/mgmt_be_client.h
+++ b/lib/mgmt_be_client.h
@@ -60,14 +60,29 @@ struct mgmt_be_client_txn_ctx {
* Callbacks:
* client_connect_notify: called when connection is made/lost to mgmtd.
* txn_notify: called when a txn has been created
+ * notify_cbs: callbacks for notifications.
+ * nnotify_cbs: number of notification callbacks.
+ *
*/
struct mgmt_be_client_cbs {
void (*client_connect_notify)(struct mgmt_be_client *client,
uintptr_t usr_data, bool connected);
-
+ void (*subscr_done)(struct mgmt_be_client *client, uintptr_t usr_data,
+ bool success);
void (*txn_notify)(struct mgmt_be_client *client, uintptr_t usr_data,
struct mgmt_be_client_txn_ctx *txn_ctx,
bool destroyed);
+
+ struct mgmt_be_client_notification_cb *notify_cbs;
+ uint nnotify_cbs;
+};
+
+struct mgmt_be_client_notification_cb {
+ const char *xpath; /* the notification */
+ uint8_t format; /* currently only LYD_JSON supported */
+ void (*callback)(struct mgmt_be_client *client, uintptr_t usr_data,
+ struct mgmt_be_client_notification_cb *this,
+ const char *notif_data);
};
/***************************************************************
@@ -80,12 +95,12 @@ extern struct debug mgmt_dbg_be_client;
* API prototypes
***************************************************************/
-#define MGMTD_BE_CLIENT_DBG(fmt, ...) \
+#define debug_be_client(fmt, ...) \
DEBUGD(&mgmt_dbg_be_client, "BE-CLIENT: %s: " fmt, __func__, \
##__VA_ARGS__)
-#define MGMTD_BE_CLIENT_ERR(fmt, ...) \
+#define log_err_be_client(fmt, ...) \
zlog_err("BE-CLIENT: %s: ERROR: " fmt, __func__, ##__VA_ARGS__)
-#define MGMTD_DBG_BE_CLIENT_CHECK() \
+#define debug_check_be_client() \
DEBUG_MODE_CHECK(&mgmt_dbg_be_client, DEBUG_MODE_ALL)
/**
@@ -124,7 +139,7 @@ extern void mgmt_debug_be_client_show_debug(struct vty *vty);
* The client object.
*
* reg_yang_xpaths
- * Yang xpath(s) that needs to be [un]-subscribed from/to
+ * Yang xpath(s) that needs to be subscribed to
*
* num_xpaths
* Number of xpaths
@@ -132,9 +147,18 @@ extern void mgmt_debug_be_client_show_debug(struct vty *vty);
* Returns:
* MGMTD_SUCCESS on success, MGMTD_* otherwise.
*/
-extern int mgmt_be_send_subscr_req(struct mgmt_be_client *client,
- bool subscr_xpaths, int num_xpaths,
- char **reg_xpaths);
+extern int mgmt_be_send_subscr_req(struct mgmt_be_client *client_ctx,
+ int n_config_xpaths, char **config_xpaths,
+ int n_oper_xpaths, char **oper_xpaths);
+
+/**
+ * mgmt_be_notification_send() - send a YANG notification to FE clients.
+ * @tree: libyang tree for the notification. The tree will be freed by
+ * this function.
+ *
+ */
+extern void mgmt_be_send_notification(struct lyd_node *tree);
+
/*
* Destroy backend client and cleanup everything.