session FEATURE function for capab availability checking
diff --git a/src/session.c b/src/session.c
index b90299e..cca7fb4 100644
--- a/src/session.c
+++ b/src/session.c
@@ -105,6 +105,21 @@
return session->cpblts;
}
+API const char *
+nc_session_cpblt(const struct nc_session *session, const char *capab)
+{
+ int i, len;
+
+ len = strlen(capab);
+ for (i = 0; session->cpblts[i]; ++i) {
+ if (!strncmp(session->cpblts[i], capab, len)) {
+ return session->cpblts[i];
+ }
+ }
+
+ return NULL;
+}
+
/*
* @return 0 - success
* -1 - timeout
diff --git a/src/session.h b/src/session.h
index 70af196..e4343d3 100644
--- a/src/session.h
+++ b/src/session.h
@@ -157,6 +157,16 @@
const char **nc_session_get_cpblts(const struct nc_session *session);
/**
+ * @brief Check capability presence in a session.
+ *
+ * @param[in] session Session to check.
+ * @param[in] capab Capability to look for, capability with any additional suffix will match.
+ *
+ * @return Matching capability, NULL if none found.
+ */
+const char *nc_session_cpblt(const struct nc_session *session, const char *capab);
+
+/**
* @brief Connect to the NETCONF server via proviaded input/output file descriptors.
*
* Transport layer is supposed to be already set. Function do not cover authentication