server messages MAINTENANCE update param management param
diff --git a/src/messages_p.h b/src/messages_p.h
index e832b08..c5a0a6f 100644
--- a/src/messages_p.h
+++ b/src/messages_p.h
@@ -71,6 +71,7 @@
 struct nc_server_notif {
     char *eventtime;        /**< eventTime of the notification */
     struct lyd_node *tree;  /**< libyang data tree of the message */
+    int free;
 };
 
 struct nc_client_reply_error {
diff --git a/src/messages_server.c b/src/messages_server.c
index 7899020..559b5e4 100644
--- a/src/messages_server.c
+++ b/src/messages_server.c
@@ -821,7 +821,7 @@
 }
 
 API struct nc_server_notif *
-nc_server_notif_new(struct lyd_node* event, char *eventtime, int eventtime_const)
+nc_server_notif_new(struct lyd_node* event, char *eventtime, NC_PARAMTYPE paramtype)
 {
     struct nc_server_notif *ntf;
 
@@ -834,12 +834,14 @@
     }
 
     ntf = malloc(sizeof *ntf);
-    if (eventtime_const) {
+    if (paramtype == NC_PARAMTYPE_DUP_AND_FREE) {
         ntf->eventtime = strdup(eventtime);
+        ntf->tree = lyd_dup(event, 1);
     } else {
         ntf->eventtime = eventtime;
+        ntf->tree = event;
     }
-    ntf->tree = event;
+    ntf->free = (paramtype == NC_PARAMTYPE_CONST ? 0 : 1);
 
     return ntf;
 }
@@ -851,7 +853,9 @@
         return;
     }
 
-    lyd_free(notif->tree);
-    free(notif->eventtime);
+    if (notif->free) {
+        lyd_free(notif->tree);
+        free(notif->eventtime);
+    }
     free(notif);
 }
diff --git a/src/messages_server.h b/src/messages_server.h
index a265a4d..dd83ccb 100644
--- a/src/messages_server.h
+++ b/src/messages_server.h
@@ -3,7 +3,7 @@
  * \author Michal Vasko <mvasko@cesnet.cz>
  * \brief libnetconf2's functions and structures of server NETCONF messages.
  *
- * Copyright (c) 2015 CESNET, z.s.p.o.
+ * Copyright (c) 2015-2017 CESNET, z.s.p.o.
  *
  * This source code is licensed under BSD 3-Clause License (the "License").
  * You may not use this file except in compliance with the License.
@@ -298,15 +298,12 @@
  * @param[in] event Notification data tree (valid as LYD_OPT_NOTIF) from libyang. The tree is directly used in created
  * object, so the caller is supposed to not free the tree on its own, but only via freeng the created object.
  * @param[in] eventtime YANG dateTime format value of the time when the event was generated by the event source.
- * Caller can use nc_time2datetime() to create the value from the time_t value. By default, the \p eventtime is handled
- * the same way as the \p event tree - it is directly used in the created object and caller is supposed to avoid any
- * further manipulation of the string. This can be changed by the \p eventtime_const parameter, which (set to nonzero)
- * cause to make copy of the provided \p eventtime instead of using it directly.
- * @param[in] eventtime_const Flag for changing the \p eventtime handling.
+ * Caller can use nc_time2datetime() to create the value from the time_t value.
+ * @param[in] paramtype How to further manage data parameters.
  * @return Newly created structure of the Event Notification object to be sent to the clients via nc_server_send_notif()
  * and freed using nc_server_notif_free().
  */
-struct nc_server_notif *nc_server_notif_new(struct lyd_node* event, char *eventtime, int eventtime_const);
+struct nc_server_notif *nc_server_notif_new(struct lyd_node* event, char *eventtime, NC_PARAMTYPE paramtype);
 
 /**
  * @brief Send NETCONF Event Notification via the session.