summaryrefslogtreecommitdiff
path: root/mgmtd/mgmt_be_adapter.c
diff options
context:
space:
mode:
Diffstat (limited to 'mgmtd/mgmt_be_adapter.c')
-rw-r--r--mgmtd/mgmt_be_adapter.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/mgmtd/mgmt_be_adapter.c b/mgmtd/mgmt_be_adapter.c
index aba02e4653..d85d87b4b6 100644
--- a/mgmtd/mgmt_be_adapter.c
+++ b/mgmtd/mgmt_be_adapter.c
@@ -592,14 +592,22 @@ static void mgmt_be_adapter_send_notify(struct mgmt_msg_notify_data *msg,
{
struct mgmt_be_client_adapter *adapter;
struct mgmt_be_xpath_map *map;
- const char *notif;
+ char notif[XPATH_MAXLEN];
+ struct lyd_node *dnode;
+ LY_ERR err;
uint id;
if (!darr_len(be_notif_xpath_map))
return;
- /* "{\"modname:notification-name\": ...}" */
- notif = (const char *)msg->result + 2;
+ err = yang_parse_notification(msg->result_type, (char *)msg->result,
+ &dnode);
+ if (err)
+ return;
+
+ lysc_path(dnode->schema, LYSC_PATH_DATA, notif, sizeof(notif));
+
+ lyd_free_all(dnode);
darr_foreach_p (be_notif_xpath_map, map) {
if (strncmp(map->xpath_prefix, notif, strlen(map->xpath_prefix)))
@@ -917,22 +925,17 @@ uint64_t mgmt_be_interested_clients(const char *xpath, bool config)
static bool be_is_client_interested(const char *xpath,
enum mgmt_be_client_id id, bool config)
{
- const char *const *xpaths;
+ uint64_t clients;
assert(id < MGMTD_BE_CLIENT_ID_MAX);
__dbg("Checking client: %s for xpath: '%s'", mgmt_be_client_id2name(id),
xpath);
- xpaths = config ? be_client_config_xpaths[id]
- : be_client_oper_xpaths[id];
- if (xpaths) {
- for (; *xpaths; xpaths++) {
- if (mgmt_be_xpath_prefix(*xpaths, xpath)) {
- __dbg("xpath: %s: matched: %s", *xpaths, xpath);
- return true;
- }
- }
+ clients = mgmt_be_interested_clients(xpath, config);
+ if (IS_IDBIT_SET(clients, id)) {
+ __dbg("client: %s: interested", mgmt_be_client_id2name(id));
+ return true;
}
__dbg("client: %s: not interested", mgmt_be_client_id2name(id));