Server API: add custom callback for asynchronous local services

Description

Add an API SOPC_ServerHelper_LocalServiceAsyncCustom to run local services on server and allow to provide a custom callback that will be used as response callback for this particular local service request.

Code version identification

13319a9c

Current behavior

When calling asynchronous local services with SOPC_ServerHelper_LocalServiceAsync, the previously registered callback SOPC_ServerConfigHelper_SetLocalServiceAsyncResponse is used to receive responses. This implies to filter responses in a unique callback for application code which might lead to complex implementation.

Expected behavior

Define a new API SOPC_ServerHelper_LocalServiceAsyncCustom which allow to provide a custom callback with the local service request that will be called on response. Thus the provided callback might be specialized for this particular request (or a group of request) in application code which simplifies the application implementation.

Security impact

No security impact.

Implementation

Add an SOPC_ServerHelper_LocalServiceAsyncCustom API and records the callback in the request context. On any response reception, check if the custom callback is defined in context and use it, otherwise the default callback registered with SOPC_ServerConfigHelper_SetLocalServiceAsyncResponse is used instead.

Add an equivalent internal API for which the only difference is the context provided with response is directly the internal context structure.

Assignee Loading
Time tracking Loading