Skip to content

Commit 8f43059

Browse files
committed
server session CHANGE function to check whether a session is call home
Refs CESNET/netopeer2#398
1 parent 9f083fa commit 8f43059

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/session_server.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,3 +3272,18 @@ nc_session_get_notif_status(const struct nc_session *session)
32723272

32733273
return session->opts.server.ntf_status;
32743274
}
3275+
3276+
API int
3277+
nc_session_is_callhome(const struct nc_session *session)
3278+
{
3279+
if (!session || (session->side != NC_SERVER)) {
3280+
ERRARG("session");
3281+
return 0;
3282+
}
3283+
3284+
if (session->flags & NC_SESSION_CALLHOME) {
3285+
return 1;
3286+
}
3287+
3288+
return 0;
3289+
}

src/session_server.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,15 @@ void nc_session_set_notif_status(struct nc_session *session, int notif_status);
860860
*/
861861
int nc_session_get_notif_status(const struct nc_session *session);
862862

863+
/**
864+
* @brief Learn whether a session was created using Call Home or not.
865+
* Works only for server sessions.
866+
*
867+
* @param[in] session Session to get the information from.
868+
* @return 0 if a standard session, non-zero if a Call Home session.
869+
*/
870+
int nc_session_is_callhome(const struct nc_session *session);
871+
863872
/**@} Server Session */
864873

865874
#ifdef __cplusplus

0 commit comments

Comments
 (0)