plugins types FEATURE make useful value structures public
diff --git a/src/plugins_types/date_and_time.c b/src/plugins_types/date_and_time.c
index 78b7673..6611346 100644
--- a/src/plugins_types/date_and_time.c
+++ b/src/plugins_types/date_and_time.c
@@ -44,14 +44,6 @@
 static void lyplg_type_free_date_and_time(const struct ly_ctx *ctx, struct lyd_value *value);
 
 /**
- * @brief Stored value structure for date-and-time
- */
-struct lyd_value_date_and_time {
-    time_t time;        /**< UNIX timestamp */
-    char *fractions_s;  /**< fractions of a second */
-};
-
-/**
  * @brief Convert date-and-time from string to UNIX timestamp and fractions of a second.
  *
  * @param[in] value Valid string value.
diff --git a/src/plugins_types/ipv4_address.c b/src/plugins_types/ipv4_address.c
index 8deb860..a95752e 100644
--- a/src/plugins_types/ipv4_address.c
+++ b/src/plugins_types/ipv4_address.c
@@ -44,14 +44,6 @@
  * | string length | no        | `char *` | IPv4 address zone string |
  */
 
-/**
- * @brief Stored value structure for ipv4-address
- */
-struct lyd_value_ipv4_address {
-    struct in_addr addr;
-    const char *zone;
-};
-
 static void lyplg_type_free_ipv4_address(const struct ly_ctx *ctx, struct lyd_value *value);
 
 /**
diff --git a/src/plugins_types/ipv4_address_no_zone.c b/src/plugins_types/ipv4_address_no_zone.c
index db69910..a17a7ef 100644
--- a/src/plugins_types/ipv4_address_no_zone.c
+++ b/src/plugins_types/ipv4_address_no_zone.c
@@ -44,13 +44,6 @@
  */
 
 /**
- * @brief Stored value structure for ipv4-address-no-zone
- */
-struct lyd_value_ipv4_address_no_zone {
-    struct in_addr addr;
-};
-
-/**
  * @brief Implementation of ::lyplg_type_store_clb for the ipv4-address-no-zone ietf-inet-types type.
  */
 static LY_ERR
diff --git a/src/plugins_types/ipv4_prefix.c b/src/plugins_types/ipv4_prefix.c
index 2b99698..3108b2c 100644
--- a/src/plugins_types/ipv4_prefix.c
+++ b/src/plugins_types/ipv4_prefix.c
@@ -43,14 +43,6 @@
  * | 1 | yes | `uint8_t *` | prefix length up to 32 |
  */
 
-/**
- * @brief Stored value structure for ipv4-prefix
- */
-struct lyd_value_ipv4_prefix {
-    struct in_addr addr;
-    uint8_t prefix;
-};
-
 static void lyplg_type_free_ipv4_prefix(const struct ly_ctx *ctx, struct lyd_value *value);
 
 /**
diff --git a/src/plugins_types/ipv6_address.c b/src/plugins_types/ipv6_address.c
index 4b08f1e..e759864 100644
--- a/src/plugins_types/ipv6_address.c
+++ b/src/plugins_types/ipv6_address.c
@@ -44,14 +44,6 @@
  * | string length | no        | `char *` | IPv6 address zone string |
  */
 
-/**
- * @brief Stored value structure for ipv6-address
- */
-struct lyd_value_ipv6_address {
-    struct in6_addr addr;
-    const char *zone;
-};
-
 static void lyplg_type_free_ipv6_address(const struct ly_ctx *ctx, struct lyd_value *value);
 
 /**
diff --git a/src/plugins_types/ipv6_address_no_zone.c b/src/plugins_types/ipv6_address_no_zone.c
index d7b168f..c612b66 100644
--- a/src/plugins_types/ipv6_address_no_zone.c
+++ b/src/plugins_types/ipv6_address_no_zone.c
@@ -43,13 +43,6 @@
  * | 16       | yes       | `struct in6_addr *` | IPv6 address in network-byte order |
  */
 
-/**
- * @brief Stored value structure for ipv6-address-no-zone
- */
-struct lyd_value_ipv6_address_no_zone {
-    struct in6_addr addr;
-};
-
 static void lyplg_type_free_ipv6_address_no_zone(const struct ly_ctx *ctx, struct lyd_value *value);
 
 /**
diff --git a/src/plugins_types/ipv6_prefix.c b/src/plugins_types/ipv6_prefix.c
index 9c29ff4..a56da54 100644
--- a/src/plugins_types/ipv6_prefix.c
+++ b/src/plugins_types/ipv6_prefix.c
@@ -43,14 +43,6 @@
  * | 1 | yes | `uint8_t *` | prefix length up to 128 |
  */
 
-/**
- * @brief Stored value structure for ipv6-prefix
- */
-struct lyd_value_ipv6_prefix {
-    struct in6_addr addr;
-    uint8_t prefix;
-};
-
 static void lyplg_type_free_ipv6_prefix(const struct ly_ctx *ctx, struct lyd_value *value);
 
 /**
diff --git a/src/tree_data.h b/src/tree_data.h
index 5ebd921..e742b02 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -1,6 +1,7 @@
 /**
  * @file tree_data.h
  * @author Radek Krejci <rkrejci@cesnet.cz>
+ * @author Michal Vasko <mvasko@cesnet.cz>
  * @brief libyang representation of YANG data trees.
  *
  * Copyright (c) 2015 - 2021 CESNET, z.s.p.o.
@@ -15,8 +16,14 @@
 #ifndef LY_TREE_DATA_H_
 #define LY_TREE_DATA_H_
 
+#include <arpa/inet.h>
+#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__)
+#include <netinet/in.h>
+#include <sys/socket.h>
+#endif
 #include <stddef.h>
 #include <stdint.h>
+#include <time.h>
 
 #include "config.h"
 #include "log.h"
@@ -568,7 +575,7 @@
      : ((type_val) = ((void *)((value)->fixed_mem))))
 
 /**
- * @brief Special lyd_value structure for union.
+ * @brief Special lyd_value structure for built-in union values.
  *
  * Represents data with multiple types (union). The ::lyd_value_union.value contains representation according to
  * one of the union's types. The ::lyd_value_union.prefix_data provides (possible) mappings from prefixes in
@@ -588,10 +595,7 @@
 };
 
 /**
- * @brief Special lyd_value structure for bits.
- *
- * Note that the allocate memory is rounded to bytes. Meaning that if a type defines a bit with the highest position
- * 18, for example, only 3 bytes will be allocated and casting to a 4-byte type will not work!
+ * @brief Special lyd_value structure for built-in bits values.
  */
 struct lyd_value_bits {
     char *bitmap;                           /**< bitmap of size ::lyplg_type_bits_bitmap_size(), if its value is
@@ -602,9 +606,7 @@
 };
 
 /**
- * @brief Special lyd_value structure for binary.
- *
- * Represents an arbitrary binary value.
+ * @brief Special lyd_value structure for built-in binary values.
  */
 struct lyd_value_binary {
     void *data;     /**< binary value itself */
@@ -612,6 +614,60 @@
 };
 
 /**
+ * @brief Special lyd_value structure for ietf-inet-types ipv4-address-no-zone values.
+ */
+struct lyd_value_ipv4_address_no_zone {
+    struct in_addr addr;    /**< IPv4 address in binary */
+};
+
+/**
+ * @brief Special lyd_value structure for ietf-inet-types ipv4-address values.
+ */
+struct lyd_value_ipv4_address {
+    struct in_addr addr;    /**< IPv4 address in binary */
+    const char *zone;       /**< Optional address zone */
+};
+
+/**
+ * @brief Special lyd_value structure for ietf-inet-types ipv4-prefix values.
+ */
+struct lyd_value_ipv4_prefix {
+    struct in_addr addr;    /**< IPv4 host address in binary */
+    uint8_t prefix;         /**< prefix length (0 - 32) */
+};
+
+/**
+ * @brief Special lyd_value structure for ietf-inet-types ipv6-address-no-zone values.
+ */
+struct lyd_value_ipv6_address_no_zone {
+    struct in6_addr addr;   /**< IPv6 address in binary */
+};
+
+/**
+ * @brief Special lyd_value structure for ietf-inet-types ipv6-address values.
+ */
+struct lyd_value_ipv6_address {
+    struct in6_addr addr;   /**< IPv6 address in binary */
+    const char *zone;       /**< Optional address zone */
+};
+
+/**
+ * @brief Special lyd_value structure for ietf-inet-types ipv6-prefix values.
+ */
+struct lyd_value_ipv6_prefix {
+    struct in6_addr addr;   /**< IPv6 host address in binary */
+    uint8_t prefix;         /**< prefix length (0 - 128) */
+};
+
+/**
+ * @brief Special lyd_value structure for ietf-yang-types date-and-time values.
+ */
+struct lyd_value_date_and_time {
+    time_t time;        /**< UNIX timestamp */
+    char *fractions_s;  /**< Optional fractions of a second */
+};
+
+/**
  * @brief Metadata structure.
  *
  * The structure provides information about metadata of a data element. Such attributes must map to