libnetconf CHANGE support for new draft netconf-server nodes
diff --git a/src/session_p.h b/src/session_p.h
index 92daa59..269fa67 100644
--- a/src/session_p.h
+++ b/src/session_p.h
@@ -39,6 +39,14 @@
 #   define NC_SSH_AUTH_COUNT 3
 
 /* ACCESS unlocked */
+struct nc_keepalives {
+    int enabled;
+    uint16_t idle_time;
+    uint16_t max_probes;
+    uint16_t probe_interval;
+};
+
+/* ACCESS unlocked */
 struct nc_client_ssh_opts {
     /* SSH authentication method preferences */
     struct {
@@ -134,6 +142,7 @@
     char *schema_searchpath;
     ly_module_imp_clb schema_clb;
     void *schema_clb_data;
+    struct nc_keepalives ka;
 
     struct nc_bind {
         const char *address;
@@ -189,17 +198,17 @@
     int (*user_verify_clb)(const struct nc_session *session);
 
     int (*server_cert_clb)(const char *name, void *user_data, char **cert_path, char **cert_data,char **privkey_path,
-                           char **privkey_data, NC_SSH_KEY *privkey_type);
+            char **privkey_data, NC_SSH_KEY_TYPE *privkey_type);
     void *server_cert_data;
     void (*server_cert_data_free)(void *data);
 
     int (*server_cert_chain_clb)(const char *name, void *user_data, char ***cert_paths, int *cert_path_count,
-                                 char ***cert_data, int *cert_data_count);
+            char ***cert_data, int *cert_data_count);
     void *server_cert_chain_data;
     void (*server_cert_chain_data_free)(void *data);
 
     int (*trusted_cert_list_clb)(const char *name, void *user_data, char ***cert_paths, int *cert_path_count,
-                                 char ***cert_data, int *cert_data_count);
+            char ***cert_data, int *cert_data_count);
     void *trusted_cert_list_data;
     void (*trusted_cert_list_data_free)(void *data);
 #endif
@@ -215,7 +224,7 @@
     uint16_t authkey_count;
     pthread_mutex_t authkey_lock;
 
-    int (*hostkey_clb)(const char *name, void *user_data, char **privkey_path, char **privkey_data, NC_SSH_KEY *privkey_type);
+    int (*hostkey_clb)(const char *name, void *user_data, char **privkey_path, char **privkey_data, NC_SSH_KEY_TYPE *privkey_type);
     void *hostkey_data;
     void (*hostkey_data_free)(void *data);
 #endif
@@ -229,6 +238,7 @@
     struct nc_endpt {
         const char *name;
         NC_TRANSPORT_IMPL ti;
+        struct nc_keepalives ka;
         union {
 #ifdef NC_ENABLED_SSH
             struct nc_server_ssh_opts *ssh;
@@ -252,6 +262,7 @@
             const char *address;
             uint16_t port;
             int sock_pending;
+            struct nc_keepalives ka;
         } *ch_endpts;
         uint16_t ch_endpt_count;
         union {
@@ -265,13 +276,9 @@
         NC_CH_CONN_TYPE conn_type;
         union {
             struct {
-                uint32_t idle_timeout;
-                uint16_t ka_max_wait;
-                uint8_t ka_max_attempts;
-            } persist;
-            struct {
+                uint16_t period;
+                time_t anchor_time;
                 uint16_t idle_timeout;
-                uint16_t reconnect_timeout;
             } period;
         } conn;
         NC_CH_START_WITH start_with;
@@ -409,7 +416,7 @@
     /* other */
     struct ly_ctx *ctx;            /**< libyang context of the session */
     void *data;                    /**< arbitrary user data */
-    uint8_t flags;                 /**< various flags of the session - TODO combine with status and/or side */
+    uint8_t flags;                 /**< various flags of the session */
 #define NC_SESSION_SHAREDCTX 0x01
 #define NC_SESSION_CALLHOME 0x02
 
@@ -505,9 +512,9 @@
 
 void nc_addtimespec(struct timespec *ts, uint32_t msec);
 
-const char *nc_keytype2str(NC_SSH_KEY type);
+const char *nc_keytype2str(NC_SSH_KEY_TYPE type);
 
-int nc_sock_enable_keepalive(int sock);
+int nc_sock_enable_keepalive(int sock, struct nc_keepalives *ka);
 
 struct nc_session *nc_new_session(NC_SIDE side, int shared_ti);
 
@@ -548,11 +555,12 @@
  * @param[in] host Hostname to connect to.
  * @param[in] port Port to connect on.
  * @param[in] timeout for blocking the connect+select call (-1 for infinite).
+ * @param[in] ka Keepalives parameters.
  * @param[in,out] sock_pending for exchanging the pending socket, if the blocking timeout was != -1
  * @param[out] ip_host Optional parameter with string IP address of the connected host.
  * @return Connected socket or -1 on error.
  */
-int nc_sock_connect(const char *host, uint16_t port, int timeout, int* sock_pending, char **ip_host);
+int nc_sock_connect(const char *host, uint16_t port, int timeout, struct nc_keepalives *ka, int *sock_pending, char **ip_host);
 
 /**
  * @brief Accept a new socket connection.
@@ -570,9 +578,10 @@
  *
  * @param[in] address IP address to listen on.
  * @param[in] port Port to listen on.
+ * @param[in] ka Keepalives parameters.
  * @return Listening socket, -1 on error.
  */
-int nc_sock_listen_inet(const char *address, uint16_t port);
+int nc_sock_listen_inet(const char *address, uint16_t port, struct nc_keepalives *ka);
 
 /**
  * @brief Create a listening socket (AF_UNIX).