diff options
| author | Christian Hopps <chopps@labn.net> | 2025-01-08 10:34:57 -0500 |
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2025-01-13 23:40:52 -0500 |
| commit | 255026c2cef831e38539a0f044c39d45cc0d41bd (patch) | |
| tree | ba4d640a2651bf21b02404707c30a767da9ba763 /lib/mgmt_be_client.c | |
| parent | 709b2ae23f1b74e8c319ce88625d621e0d6f7beb (diff) | |
mgmtd: add notify selectors to filter datastore notifications
- Additionally push the selectors down to the backends
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/mgmt_be_client.c')
| -rw-r--r-- | lib/mgmt_be_client.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index 155d56aa68..a443d83b52 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -322,8 +322,6 @@ static int __send_notification(struct mgmt_be_client *client, const char *xpath, LY_ERR err; int ret = 0; - assert(tree); - debug_be_client("%s: sending %sYANG %snotification: %s", __func__, op == NOTIFY_OP_DS_DELETE ? "delete " : op == NOTIFY_OP_DS_REPLACE ? "replace " @@ -1155,6 +1153,22 @@ static void be_client_handle_notify(struct mgmt_be_client *client, void *msgbuf, } /* + * Process a notify select msg + */ +static void be_client_handle_notify_select(struct mgmt_be_client *client, void *msgbuf, + size_t msg_len) +{ + struct mgmt_msg_notify_select *msg = msgbuf; + const char **selectors = NULL; + + debug_be_client("Received notify-select for client %s", client->name); + + if (msg_len >= sizeof(*msg)) + selectors = mgmt_msg_native_strings_decode(msg, msg_len, msg->selectors); + nb_notif_set_filters(selectors, msg->replace); +} + +/* * Handle a native encoded message * * We don't create transactions with native messaging. @@ -1175,6 +1189,9 @@ static void be_client_handle_native_msg(struct mgmt_be_client *client, case MGMT_MSG_CODE_NOTIFY: be_client_handle_notify(client, msg, msg_len); break; + case MGMT_MSG_CODE_NOTIFY_SELECT: + be_client_handle_notify_select(client, msg, msg_len); + break; default: log_err_be_client("unknown native message txn-id %" PRIu64 " req-id %" PRIu64 " code %u to client %s", |
