S2OPC OPCUA Toolkit
Typedefs | Functions
sopc_toolkit_config.h File Reference

This module shall be used to initialize, configure and clear/terminate the toolkit execution. More...

#include "sopc_address_space.h"
#include "sopc_user_app_itf.h"
#include "sopc_builtintypes.h"
#include "sopc_common_build_info.h"
#include "sopc_types.h"

Go to the source code of this file.

Typedefs

typedef uint32_t SOPC_SecureChannelConfigIdx
 Index type for client secure channel configuration, 0 is an invalid index. More...
 
typedef uint32_t SOPC_EndpointConfigIdx
 Index type for server endpoint configuration, 0 is an invalid index. More...
 
typedef uint32_t SOPC_ReverseEndpointConfigIdx
 Index type for reverse endpoint configuration, 0 is an invalid index. More...
 

Functions

SOPC_ReturnStatus SOPC_Toolkit_Initialize (SOPC_ComEvent_Fct *pAppFct)
 Initialize the toolkit configuration, libraries and threads. More...
 
SOPC_ReturnStatus SOPC_ToolkitServer_Configured (void)
 Define toolkit configuration as configured and lock its state until toolkit clear operation. More...
 
void SOPC_Toolkit_Clear (void)
 Clear the stack configuration. More...
 
SOPC_ReturnStatus SOPC_ToolkitServer_SetAddressSpaceConfig (SOPC_AddressSpace *addressSpace)
 Set the given Address Space for the current toolkit server (SOPC_Toolkit_Initialize required and prior to SOPC_ToolkitServer_Configured call). Note: only one address space can be set, further call will be refused. More...
 
SOPC_ReturnStatus SOPC_ToolkitServer_SetAddressSpaceNotifCb (SOPC_AddressSpaceNotif_Fct *pAddSpaceNotifFct)
 Set the given Address Space modification notification callback for the current toolkit server (SOPC_Toolkit_Initialize required and prior to SOPC_ToolkitServer_Configured call). More...
 
SOPC_SecureChannelConfigIdx SOPC_ToolkitClient_AddSecureChannelConfig (SOPC_SecureChannel_Config *scConfig)
 Record the given secure channel configuration for endpoint connection in returned index (SOPC_Toolkit_Initialize required and prior to SOPC_ToolkitServer_Configured call). More...
 
SOPC_EndpointConfigIdx SOPC_ToolkitServer_AddEndpointConfig (SOPC_Endpoint_Config *config)
 Record the given endpoint configuration in given index (SOPC_Toolkit_Initialize required and prior to SOPC_ToolkitServer_Configured call). More...
 
SOPC_ReverseEndpointConfigIdx SOPC_ToolkitClient_AddReverseEndpointConfig (const char *reverseEndpointURL)
 Record the given client reverse endpoint configuration in returned index (SOPC_Toolkit_Initialize required). More...
 
SOPC_Toolkit_Build_Info SOPC_ToolkitConfig_GetBuildInfo (void)
 Get Toolkit build information. More...
 
void SOPC_ToolkitClient_ClearAllSCs (void)
 Close all Secure Channels established as client and clear associated configurations added by SOPC_ToolkitClient_AddSecureChannelConfig. All previous index returned by SOPC_ToolkitClient_AddSecureChannelConfig are invalid after calling this function. More...
 

Detailed Description

This module shall be used to initialize, configure and clear/terminate the toolkit execution.

It is in charge to initialize each event based layer (sockets, secure channels, services) which will start the associated threads. It is also necessary to configure the endpoint description configuration and address space of a toolkit server instance, or the endpoint connection configuration of a toolkit client instance.

Typedef Documentation

◆ SOPC_SecureChannelConfigIdx

typedef uint32_t SOPC_SecureChannelConfigIdx

Index type for client secure channel configuration, 0 is an invalid index.

◆ SOPC_EndpointConfigIdx

typedef uint32_t SOPC_EndpointConfigIdx

Index type for server endpoint configuration, 0 is an invalid index.

◆ SOPC_ReverseEndpointConfigIdx

Index type for reverse endpoint configuration, 0 is an invalid index.

Function Documentation

◆ SOPC_Toolkit_Initialize()

SOPC_ReturnStatus SOPC_Toolkit_Initialize ( SOPC_ComEvent_Fct pAppFct)

Initialize the toolkit configuration, libraries and threads.

Note
This function and SOPC_Toolkit_Clear function are not thread-safe and shall be called in the same thread.
Parameters
pAppFctPointer to applicative code function in charge of toolkit communication events
Returns
SOPC_STATUS_OK if initialization succeeded, SOPC_STATUS_INVALID_PARAMETERS if pAppFct == NULL or SOPC_STATUS_INVALID_STATE if toolkit already initialized and SOPC_STATUS_NOK otherwise

◆ SOPC_ToolkitServer_Configured()

SOPC_ReturnStatus SOPC_ToolkitServer_Configured ( void  )

Define toolkit configuration as configured and lock its state until toolkit clear operation.

Warning
it is only necessary for the server configuration finalization and should not be set before server configuration ended.
Returns
SOPC_STATUS_OK if initialization succeeded, SOPC_STATUS_INVALID_STATE if toolkit is not initialized or already configured, SOPC_STATUS_INVALID_PARAMETERS if server configuration is defined but no address space is set

◆ SOPC_Toolkit_Clear()

void SOPC_Toolkit_Clear ( void  )

Clear the stack configuration.

Note
This function and SOPC_Toolkit_Initialize function are not thread-safe and shall be called in the same thread.

◆ SOPC_ToolkitServer_SetAddressSpaceConfig()

SOPC_ReturnStatus SOPC_ToolkitServer_SetAddressSpaceConfig ( SOPC_AddressSpace addressSpace)

Set the given Address Space for the current toolkit server (SOPC_Toolkit_Initialize required and prior to SOPC_ToolkitServer_Configured call). Note: only one address space can be set, further call will be refused.

Parameters
addressSpaceThe address space definition
Returns
SOPC_STATUS_OK if configuration succeeded, SOPC_STATUS_INVALID_STATE if toolkit is not initialized, already configured or address space is already set, SOPC_STATUS_NOK otherwise

◆ SOPC_ToolkitServer_SetAddressSpaceNotifCb()

SOPC_ReturnStatus SOPC_ToolkitServer_SetAddressSpaceNotifCb ( SOPC_AddressSpaceNotif_Fct pAddSpaceNotifFct)

Set the given Address Space modification notification callback for the current toolkit server (SOPC_Toolkit_Initialize required and prior to SOPC_ToolkitServer_Configured call).

Note: only one callback can be set, further call will be refused.

Parameters
pAddSpaceNotifFctThe address space notification event callback definition
Returns
SOPC_STATUS_OK if configuration succeeded, SOPC_STATUS_INVALID_STATE if toolkit is not initialized, already configured or address space is already set, SOPC_STATUS_NOK otherwise

◆ SOPC_ToolkitClient_AddSecureChannelConfig()

SOPC_SecureChannelConfigIdx SOPC_ToolkitClient_AddSecureChannelConfig ( SOPC_SecureChannel_Config scConfig)

Record the given secure channel configuration for endpoint connection in returned index (SOPC_Toolkit_Initialize required and prior to SOPC_ToolkitServer_Configured call).

Returns
secure channel configuration index if configuration succeeded, 0 if toolkit is not initialized, already configured or otherwise

◆ SOPC_ToolkitServer_AddEndpointConfig()

SOPC_EndpointConfigIdx SOPC_ToolkitServer_AddEndpointConfig ( SOPC_Endpoint_Config config)

Record the given endpoint configuration in given index (SOPC_Toolkit_Initialize required and prior to SOPC_ToolkitServer_Configured call).

Note1: it is forbidden to have 2 configurations with same endpointURL Note2: if security policy None is not activated, less than SOPC_MAX_SECU_POLICIES_CFG shall be defined to allow discovery services access to be added.

Returns
endpoint configuration index configuration succeeded, 0 if toolkit is not initialized, already configured or parameters provided are incorrect

◆ SOPC_ToolkitClient_AddReverseEndpointConfig()

SOPC_ReverseEndpointConfigIdx SOPC_ToolkitClient_AddReverseEndpointConfig ( const char *  reverseEndpointURL)

Record the given client reverse endpoint configuration in returned index (SOPC_Toolkit_Initialize required).

Parameters
reverseEndpointURLThe client endpointURL for reverse connections from server(s)

Note1: it is forbidden to have 2 configurations with same endpointURL

Returns
reverse endpoint configuration index configuration succeeded, 0 if toolkit is not initialized or parameters provided are incorrect

◆ SOPC_ToolkitConfig_GetBuildInfo()

SOPC_Toolkit_Build_Info SOPC_ToolkitConfig_GetBuildInfo ( void  )

Get Toolkit build information.

Returns
Toolkit build information

◆ SOPC_ToolkitClient_ClearAllSCs()

void SOPC_ToolkitClient_ClearAllSCs ( void  )

Close all Secure Channels established as client and clear associated configurations added by SOPC_ToolkitClient_AddSecureChannelConfig. All previous index returned by SOPC_ToolkitClient_AddSecureChannelConfig are invalid after calling this function.

Note
Any client active session should be closed prior to calling this function.
It should be used to ensure configuration previously added with SOPC_ToolkitClient_AddSecureChannelConfig are not used anymore by toolkit. Other alternative to ensure that is call to SOPC_Toolkit_Clear.