plugins types FEATURE add value sorting callback
Unused for now.
Refs #1547
diff --git a/src/plugins_types.h b/src/plugins_types.h
index dc7ca13..c074f3b 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -473,6 +473,17 @@
typedef LY_ERR (*lyplg_type_compare_clb)(const struct lyd_value *val1, const struct lyd_value *val2);
/**
+ * @brief Unused callback for sorting values.
+ *
+ * @param[in] val1 First value to compare.
+ * @param[in] val2 Second value to compare.
+ * @return -1 if val1 < val2,
+ * @return 0 if val1 == val2,
+ * @return 1 if val1 > val2.
+ */
+typedef int (*lyplg_type_sort_clb)(const struct lyd_value *val1, const struct lyd_value *val2);
+
+/**
* @brief Callback for getting the value of the data stored in @p value.
*
* Canonical value (@p format of ::LY_VALUE_CANON) must always be a zero-terminated const string stored in
@@ -530,6 +541,7 @@
lyplg_type_store_clb store; /**< store and canonize the value in the type-specific way */
lyplg_type_validate_clb validate; /**< optional, validate the value in the type-specific way in data */
lyplg_type_compare_clb compare; /**< comparison callback to compare 2 values of the same type */
+ lyplg_type_sort_clb sort; /**< unused comparison callback for sorting values */
lyplg_type_print_clb print; /**< printer callback to get string representing the value */
lyplg_type_dup_clb duplicate; /**< data duplication callback */
lyplg_type_free_clb free; /**< optional function to free the type-spceific way stored value */
diff --git a/src/plugins_types/binary.c b/src/plugins_types/binary.c
index 7fe387b..bdb54d7 100644
--- a/src/plugins_types/binary.c
+++ b/src/plugins_types/binary.c
@@ -393,6 +393,7 @@
.plugin.store = lyplg_type_store_binary,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_binary,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_binary,
.plugin.duplicate = lyplg_type_dup_binary,
.plugin.free = lyplg_type_free_binary,
diff --git a/src/plugins_types/bits.c b/src/plugins_types/bits.c
index bd76e4d..9d086ff 100644
--- a/src/plugins_types/bits.c
+++ b/src/plugins_types/bits.c
@@ -501,6 +501,7 @@
.plugin.store = lyplg_type_store_bits,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_bits,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_bits,
.plugin.duplicate = lyplg_type_dup_bits,
.plugin.free = lyplg_type_free_bits
diff --git a/src/plugins_types/boolean.c b/src/plugins_types/boolean.c
index 72358c2..dc2493c 100644
--- a/src/plugins_types/boolean.c
+++ b/src/plugins_types/boolean.c
@@ -157,6 +157,7 @@
.plugin.store = lyplg_type_store_boolean,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_boolean,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_boolean,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
diff --git a/src/plugins_types/date_and_time.c b/src/plugins_types/date_and_time.c
index cbfb809..78b7673 100644
--- a/src/plugins_types/date_and_time.c
+++ b/src/plugins_types/date_and_time.c
@@ -418,6 +418,7 @@
.plugin.store = lyplg_type_store_date_and_time,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_date_and_time,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_date_and_time,
.plugin.duplicate = lyplg_type_dup_date_and_time,
.plugin.free = lyplg_type_free_date_and_time
diff --git a/src/plugins_types/decimal64.c b/src/plugins_types/decimal64.c
index 7c8a6b9..7dbdcaa 100644
--- a/src/plugins_types/decimal64.c
+++ b/src/plugins_types/decimal64.c
@@ -212,6 +212,7 @@
.plugin.store = lyplg_type_store_decimal64,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_decimal64,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_decimal64,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
diff --git a/src/plugins_types/empty.c b/src/plugins_types/empty.c
index 3753923..48d32bc 100644
--- a/src/plugins_types/empty.c
+++ b/src/plugins_types/empty.c
@@ -94,6 +94,7 @@
.plugin.store = lyplg_type_store_empty,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_simple,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
diff --git a/src/plugins_types/enumeration.c b/src/plugins_types/enumeration.c
index 092bd57..f080533 100644
--- a/src/plugins_types/enumeration.c
+++ b/src/plugins_types/enumeration.c
@@ -155,6 +155,7 @@
.plugin.store = lyplg_type_store_enum,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_enum,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
diff --git a/src/plugins_types/identityref.c b/src/plugins_types/identityref.c
index c8e655a..90546d6 100644
--- a/src/plugins_types/identityref.c
+++ b/src/plugins_types/identityref.c
@@ -310,6 +310,7 @@
.plugin.store = lyplg_type_store_identityref,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_identityref,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_identityref,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
diff --git a/src/plugins_types/instanceid.c b/src/plugins_types/instanceid.c
index 7559f8e..8013e3c 100644
--- a/src/plugins_types/instanceid.c
+++ b/src/plugins_types/instanceid.c
@@ -360,6 +360,7 @@
.plugin.store = lyplg_type_store_instanceid,
.plugin.validate = lyplg_type_validate_instanceid,
.plugin.compare = lyplg_type_compare_instanceid,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_instanceid,
.plugin.duplicate = lyplg_type_dup_instanceid,
.plugin.free = lyplg_type_free_instanceid
diff --git a/src/plugins_types/integer.c b/src/plugins_types/integer.c
index 2e63a4e..44e87f9 100644
--- a/src/plugins_types/integer.c
+++ b/src/plugins_types/integer.c
@@ -448,6 +448,7 @@
.plugin.store = lyplg_type_store_uint,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_uint,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_uint,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
@@ -460,6 +461,7 @@
.plugin.store = lyplg_type_store_uint,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_uint,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_uint,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
@@ -472,6 +474,7 @@
.plugin.store = lyplg_type_store_uint,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_uint,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_uint,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
@@ -484,6 +487,7 @@
.plugin.store = lyplg_type_store_uint,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_uint,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_uint,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
@@ -496,6 +500,7 @@
.plugin.store = lyplg_type_store_int,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_int,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_int,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
@@ -508,6 +513,7 @@
.plugin.store = lyplg_type_store_int,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_int,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_int,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
@@ -520,6 +526,7 @@
.plugin.store = lyplg_type_store_int,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_int,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_int,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
@@ -532,6 +539,7 @@
.plugin.store = lyplg_type_store_int,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_int,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_int,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
diff --git a/src/plugins_types/ipv4_address.c b/src/plugins_types/ipv4_address.c
index 96af2d2..8deb860 100644
--- a/src/plugins_types/ipv4_address.c
+++ b/src/plugins_types/ipv4_address.c
@@ -371,6 +371,7 @@
.plugin.store = lyplg_type_store_ipv4_address,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_ipv4_address,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_ipv4_address,
.plugin.duplicate = lyplg_type_dup_ipv4_address,
.plugin.free = lyplg_type_free_ipv4_address
diff --git a/src/plugins_types/ipv4_address_no_zone.c b/src/plugins_types/ipv4_address_no_zone.c
index 0c99351..5018161 100644
--- a/src/plugins_types/ipv4_address_no_zone.c
+++ b/src/plugins_types/ipv4_address_no_zone.c
@@ -216,6 +216,7 @@
.plugin.store = lyplg_type_store_ipv4_address_no_zone,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_ipv4_address_no_zone,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_ipv4_address_no_zone,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
diff --git a/src/plugins_types/ipv4_prefix.c b/src/plugins_types/ipv4_prefix.c
index 2d66b00..2b99698 100644
--- a/src/plugins_types/ipv4_prefix.c
+++ b/src/plugins_types/ipv4_prefix.c
@@ -327,6 +327,7 @@
.plugin.store = lyplg_type_store_ipv4_prefix,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_ipv4_prefix,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_ipv4_prefix,
.plugin.duplicate = lyplg_type_dup_ipv4_prefix,
.plugin.free = lyplg_type_free_ipv4_prefix
diff --git a/src/plugins_types/ipv6_address.c b/src/plugins_types/ipv6_address.c
index 39450f1f..4b08f1e 100644
--- a/src/plugins_types/ipv6_address.c
+++ b/src/plugins_types/ipv6_address.c
@@ -373,6 +373,7 @@
.plugin.store = lyplg_type_store_ipv6_address,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_ipv6_address,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_ipv6_address,
.plugin.duplicate = lyplg_type_dup_ipv6_address,
.plugin.free = lyplg_type_free_ipv6_address
diff --git a/src/plugins_types/ipv6_address_no_zone.c b/src/plugins_types/ipv6_address_no_zone.c
index 409f381..d7b168f 100644
--- a/src/plugins_types/ipv6_address_no_zone.c
+++ b/src/plugins_types/ipv6_address_no_zone.c
@@ -303,6 +303,7 @@
.plugin.store = lyplg_type_store_ipv6_address_no_zone,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_ipv6_address_no_zone,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_ipv6_address_no_zone,
.plugin.duplicate = lyplg_type_dup_ipv6_address_no_zone,
.plugin.free = lyplg_type_free_ipv6_address_no_zone
diff --git a/src/plugins_types/ipv6_prefix.c b/src/plugins_types/ipv6_prefix.c
index 22fa2c6..9c29ff4 100644
--- a/src/plugins_types/ipv6_prefix.c
+++ b/src/plugins_types/ipv6_prefix.c
@@ -339,6 +339,7 @@
.plugin.store = lyplg_type_store_ipv6_prefix,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_ipv6_prefix,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_ipv6_prefix,
.plugin.duplicate = lyplg_type_dup_ipv6_prefix,
.plugin.free = lyplg_type_free_ipv6_prefix
diff --git a/src/plugins_types/leafref.c b/src/plugins_types/leafref.c
index c5d3719..ab5842a 100644
--- a/src/plugins_types/leafref.c
+++ b/src/plugins_types/leafref.c
@@ -129,6 +129,7 @@
.plugin.store = lyplg_type_store_leafref,
.plugin.validate = lyplg_type_validate_leafref,
.plugin.compare = lyplg_type_compare_leafref,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_leafref,
.plugin.duplicate = lyplg_type_dup_leafref,
.plugin.free = lyplg_type_free_leafref
diff --git a/src/plugins_types/string.c b/src/plugins_types/string.c
index eede579..938936d 100644
--- a/src/plugins_types/string.c
+++ b/src/plugins_types/string.c
@@ -100,6 +100,7 @@
.plugin.store = lyplg_type_store_string,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_simple,
.plugin.duplicate = lyplg_type_dup_simple,
.plugin.free = lyplg_type_free_simple
diff --git a/src/plugins_types/union.c b/src/plugins_types/union.c
index cda1e1a..15b0054 100644
--- a/src/plugins_types/union.c
+++ b/src/plugins_types/union.c
@@ -362,6 +362,7 @@
.plugin.store = lyplg_type_store_union,
.plugin.validate = lyplg_type_validate_union,
.plugin.compare = lyplg_type_compare_union,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_union,
.plugin.duplicate = lyplg_type_dup_union,
.plugin.free = lyplg_type_free_union
diff --git a/src/plugins_types/xpath1.0.c b/src/plugins_types/xpath1.0.c
index 29059ba..64568ce 100644
--- a/src/plugins_types/xpath1.0.c
+++ b/src/plugins_types/xpath1.0.c
@@ -377,6 +377,7 @@
.plugin.store = lyplg_type_store_xpath10,
.plugin.validate = NULL,
.plugin.compare = lyplg_type_compare_simple,
+ .plugin.sort = NULL,
.plugin.print = lyplg_type_print_xpath10,
.plugin.duplicate = lyplg_type_dup_xpath10,
.plugin.free = lyplg_type_free_xpath10