data tree CHANGE optional support for priv pointer in data nodes

Fixes #478
diff --git a/src/tree_data.h b/src/tree_data.h
index 4db32c1..a7e74ee 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -179,6 +179,10 @@
                                           node in the list. */
     struct lyd_node *parent;         /**< pointer to the parent node, NULL in case of root node */
 
+#ifdef LY_ENABLED_LYD_PRIV
+    void *priv;                      /**< private user data, not used by libyang */
+#endif
+
 #ifdef LY_ENABLED_CACHE
     uint32_t hash;                   /**< hash of this particular node (module name + schema name + key string values if list) */
     struct hash_table *ht;           /**< hash table with all the direct children (except keys for a list, lists without keys) */
@@ -217,6 +221,10 @@
                                           node in the list. */
     struct lyd_node *parent;         /**< pointer to the parent node, NULL in case of root node */
 
+#ifdef LY_ENABLED_LYD_PRIV
+    void *priv;                      /**< private user data, not used by libyang */
+#endif
+
 #ifdef LY_ENABLED_CACHE
     uint32_t hash;                   /**< hash of this particular node (module name + schema name + string value if leaf-list) */
 #endif
@@ -263,6 +271,10 @@
                                           node in the list. */
     struct lyd_node *parent;         /**< pointer to the parent node, NULL in case of root node */
 
+#ifdef LY_ENABLED_LYD_PRIV
+    void *priv;                      /**< private user data, not used by libyang */
+#endif
+
 #ifdef LY_ENABLED_CACHE
     uint32_t hash;                   /**< hash of this particular node (module name + schema name) */
 #endif
@@ -1294,6 +1306,21 @@
  */
 double lyd_dec64_to_double(const struct lyd_node *node);
 
+#ifdef LY_ENABLED_LYD_PRIV
+
+/**
+ * @brief Set a schema private pointer to a user pointer.
+ *
+ * @param[in] node Data node, whose private field will be assigned.
+ * @param[in] priv Arbitrary user-specified pointer.
+ * @return Previous private object of the \p node (NULL if this is the first call on the \p node). Note, that
+ * the caller is in this case responsible (if it is necessary) for freeing the replaced private object. In case
+ * of invalid (NULL) \p node, NULL is returned and #ly_errno is set to #LY_EINVAL.
+ */
+void *lyd_set_private(const struct lyd_node *node, void *priv);
+
+#endif
+
 /**@} */
 
 #ifdef __cplusplus