Server: provide server session changes/events notifications

Description

On server side, it is interesting for application to be aware of the server sessions changes/events (creation, activation, closure). This might be used to adapt behavior of the server (e.g. data update).

Code version and environment identification

S2OPC toolkit 1.7.0

Current behavior

Server sessions are managed internally and no information is available to application.

Expected behavior

Application registers a callback to be informed on the changes/events of the server sessions. It means successful/failed session creation, activation or closure are notified through the callback with some context associated.

Security impact

No security impact identified.

Implementation

Define new API functions:

  • SOPC_ServerConfigHelper_SetSessionEventNotifCallback with new callback type:
    • typedef void SOPC_SessionEventNotif_Fct(const SOPC_CallContext* callCtxPtr, SOPC_ServerSessionEvent sessionEvent, SOPC_SessionId id, SOPC_StatusCode opStatus);
  • const char* SOPC_CallContext_GetSessionName(const SOPC_CallContext* callContextPtr);
  • const SOPC_ExtensionObject* SOPC_CallContext_GetFailedActivationUserToken(const SOPC_CallContext* callContextPtr);
  • const char* SOPC_CallContext_GetClientIpPort(const SOPC_CallContext* callContextPtr);
Edited by Vincent Monfort