session FEATURE session version getter
diff --git a/src/session.c b/src/session.c
index a703a83..8b860f7 100644
--- a/src/session.c
+++ b/src/session.c
@@ -136,6 +136,17 @@
return session->id;
}
+API int
+nc_session_get_version(const struct nc_session *session)
+{
+ if (!session) {
+ ERRARG;
+ return -1;
+ }
+
+ return (session->version == NC_VERSION_10 ? 0 : 1);
+}
+
API NC_TRANSPORT_IMPL
nc_session_get_ti(const struct nc_session *session)
{
diff --git a/src/session.h b/src/session.h
index 613306f..62121da 100644
--- a/src/session.h
+++ b/src/session.h
@@ -100,6 +100,14 @@
uint32_t nc_session_get_id(const struct nc_session *session);
/**
+ * @brief Get session NETCONF version.
+ *
+ * @param[in] session Session to get the information from.
+ * @return 0 for version 1.0, non-zero for version 1.1.
+ */
+int nc_session_get_version(const struct nc_session *session);
+
+/**
* @brief Get session transport used.
*
* @param[in] session Session to get the information from.