session server UPDATE do not use dflt clbs if global clb is set
They can be called from the global clb since
they are public now.
diff --git a/src/session_server.c b/src/session_server.c
index 907c3ca..4a05771 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -566,7 +566,7 @@
return -1;
}
-static struct nc_server_reply *
+API struct nc_server_reply *
nc_clb_default_get_schema(struct lyd_node *rpc, struct nc_session *session)
{
const char *identifier = NULL, *revision = NULL, *format = NULL;
@@ -662,7 +662,7 @@
return nc_server_reply_data(data, NC_WD_EXPLICIT, NC_PARAMTYPE_FREE);
}
-static struct nc_server_reply *
+API struct nc_server_reply *
nc_clb_default_close_session(struct lyd_node *UNUSED(rpc), struct nc_session *session)
{
session->term_reason = NC_SESSION_TERM_CLOSED;
@@ -679,6 +679,11 @@
{
struct lysc_node *rpc;
+ if (global_rpc_clb) {
+ /* expect it to handle these RPCs as well */
+ return;
+ }
+
/* set default <get-schema> callback if not specified */
rpc = NULL;
if (ly_ctx_get_module_implemented(ctx, "ietf-netconf-monitoring")) {
diff --git a/src/session_server.h b/src/session_server.h
index 1674ac7..c4228c5 100644
--- a/src/session_server.h
+++ b/src/session_server.h
@@ -87,10 +87,32 @@
* @brief Set a global nc_rpc_clb that is called if the particular RPC request is
* received and the private field in the corresponding RPC schema node is NULL.
*
+ * If this callback is set, the default callbacks for "get-schema" and "close-session" are not used.
+ *
* @param[in] clb An user-defined nc_rpc_clb function callback, NULL to default.
*/
void nc_set_global_rpc_clb(nc_rpc_clb clb);
+/**
+ * @brief Default RPC callback used for "ietf-netconf-monitoring:get-schema" RPC if no other specific
+ * or global callback is set.
+ *
+ * @param[in] rpc Received RPC.
+ * @param[in] session NC session @p rpc was received on.
+ * @return Server reply.
+ */
+struct nc_server_reply *nc_clb_default_get_schema(struct lyd_node *rpc, struct nc_session *session);
+
+/**
+ * @brief Default RPC callback used for "ietf-netconf:close-session" RPC if no other specific
+ * or global callback is set.
+ *
+ * @param[in] rpc Received RPC.
+ * @param[in] session NC session @p rpc was received on.
+ * @return Server reply.
+ */
+struct nc_server_reply *nc_clb_default_close_session(struct lyd_node *rpc, struct nc_session *session);
+
/** @} Server Session */
/**