server session CHANGE function to check whether a session is call home
Refs cesnet/netopeer2#398
diff --git a/src/session_server.c b/src/session_server.c
index e372619..b884bc9 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -3272,3 +3272,18 @@
return session->opts.server.ntf_status;
}
+
+API int
+nc_session_is_callhome(const struct nc_session *session)
+{
+ if (!session || (session->side != NC_SERVER)) {
+ ERRARG("session");
+ return 0;
+ }
+
+ if (session->flags & NC_SESSION_CALLHOME) {
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/src/session_server.h b/src/session_server.h
index 95dd12c..c3e584c 100644
--- a/src/session_server.h
+++ b/src/session_server.h
@@ -860,6 +860,15 @@
*/
int nc_session_get_notif_status(const struct nc_session *session);
+/**
+ * @brief Learn whether a session was created using Call Home or not.
+ * Works only for server sessions.
+ *
+ * @param[in] session Session to get the information from.
+ * @return 0 if a standard session, non-zero if a Call Home session.
+ */
+int nc_session_is_callhome(const struct nc_session *session);
+
/**@} Server Session */
#ifdef __cplusplus