context FEATURE new ly_ctx_get_module_older()
add function to allow getting all revisions of the module from the
context when caller does not know the revision.
diff --git a/src/libyang.h b/src/libyang.h
index d04ebf7..18067ee 100644
--- a/src/libyang.h
+++ b/src/libyang.h
@@ -602,6 +602,25 @@
const struct lys_module *ly_ctx_get_module(const struct ly_ctx *ctx, const char *name, const char *revision);
/**
+ * @brief Get pointer to the older schema tree to the specified one in the provided context.
+ *
+ * The module is not necessarily from the provided \p ctx. If there are multiple schemas older than the
+ * provided one, the newest of them is returned.
+ *
+ * The function can be used in combination with ly_ctx_get_module() to get all revisions of a module in a context:
+ * \code{.c}
+ * for (mod = ly_ctx_get_module(ctx, name, NULL); mod; mod = ly_ctx_get_module_older(ctx, mod)) {
+ * ...
+ * }
+ * \endcode
+ *
+ * @param[in] ctx Context to work in.
+ * @param[in] module YANG module to compare with
+ * @return Pointer to the data model structure, NULL if no older schema is present in the context.
+ */
+const struct lys_module *ly_ctx_get_module_older(const struct ly_ctx *ctx, const struct lys_module *module);
+
+/**
* @brief Try to find the model in the searchpath of \p ctx and load it into it. If custom missing
* module callback is set, it is used instead.
*