S2OPC OPCUA Toolkit
Data Structures | Macros | Typedefs | Enumerations | Functions
sopc_user_app_itf.h File Reference

Contains the types to be used by the user application to use the Toolkit. More...

#include <stdbool.h>
#include "sopc_call_method_manager.h"
#include "sopc_common_build_info.h"
#include "sopc_crypto_profiles.h"
#include "sopc_key_cert_pair.h"
#include "sopc_key_manager.h"
#include "sopc_pki_decl.h"
#include "sopc_service_call_context.h"
#include "sopc_toolkit_config_constants.h"
#include "sopc_types.h"
#include "sopc_user_manager.h"

Go to the source code of this file.

Data Structures

struct  SOPC_SecureChannel_Config
 Client configuration of a Secure Channel. More...
 
struct  SOPC_SecurityPolicy
 Endpoint security policy configuration. More...
 
struct  SOPC_Server_ClientToConnect
 OPC UA server client to reverse connect configuration type. From specification part 6 (v1.05.01): "For each Client, the administrator shall provide an ApplicationUri and an EndpointUrl for the Client.". More...
 
struct  SOPC_Endpoint_Config
 Server configuration of a Endpoint connection listener. More...
 
struct  SOPC_Session_UserX509_ConfigFromPaths
 Client temporary configuration structure used to store user X509 configuration data from paths. Those paths are should be used to load the serialized version for the certificate / key. More...
 
struct  SOPC_Session_UserX509
 Client configuration structure used to store session activation data for an X509 user token type. More...
 
struct  SOPC_Session_UserName
 Client configuration structure used to store session activation data for a user name token type. More...
 
struct  SOPC_Session_Config
 Client configuration structure used to store session activation configuration data. More...
 
struct  SOPC_SecureConnection_Config
 Structure representing a secure connection configuration (secure channel + session) which allow to establish a connection to a server. More...
 
struct  SOPC_Client_ConfigFromPaths
 Client temporary configuration structure used to store client certificate / key / PKI configuration data from paths. Those paths are should be used to load the serialized version for the certificate / key and instantiate PKI. More...
 
struct  SOPC_Client_Config
 OPC UA client configuration structure. More...
 
struct  SOPC_Server_Config
 OPC UA server configuration structure. More...
 
struct  SOPC_S2OPC_Config
 S2OPC configuration. More...
 
struct  SOPC_Toolkit_Build_Info
 Toolkit build information. More...
 

Macros

#define SOPC_SECURITY_MODE_NONE_MASK   0x01
 
#define SOPC_SECURITY_MODE_SIGN_MASK   0x02
 
#define SOPC_SECURITY_MODE_SIGNANDENCRYPT_MASK   0x04
 
#define SOPC_SECURITY_MODE_ANY_MASK   0x07
 
#define SOPC_MAX_SECU_POLICIES_CFG   5 /* Maximum number of security policies in a configuration array */
 
#define SOPC_MAX_CLIENT_SECURE_CONNECTIONS_CONFIG   SOPC_MAX_SECURE_CONNECTIONS
 

Typedefs

typedef struct SOPC_Client_Config SOPC_Client_Config
 OPC UA client configuration type. More...
 
typedef struct SOPC_SecureChannel_Config SOPC_SecureChannel_Config
 Client configuration of a Secure Channel. More...
 
typedef struct SOPC_SecurityPolicy SOPC_SecurityPolicy
 Endpoint security policy configuration. More...
 
typedef struct SOPC_Server_Config SOPC_Server_Config
 OPC UA server configuration type. More...
 
typedef struct SOPC_Server_ClientToConnect SOPC_Server_ClientToConnect
 OPC UA server client to reverse connect configuration type. From specification part 6 (v1.05.01): "For each Client, the administrator shall provide an ApplicationUri and an EndpointUrl for the Client.". More...
 
typedef struct SOPC_Endpoint_Config SOPC_Endpoint_Config
 Server configuration of a Endpoint connection listener. More...
 
typedef struct SOPC_Session_UserX509_ConfigFromPaths SOPC_Session_UserX509_ConfigFromPaths
 Client temporary configuration structure used to store user X509 configuration data from paths. Those paths are should be used to load the serialized version for the certificate / key. More...
 
typedef struct SOPC_Session_UserX509 SOPC_Session_UserX509
 Client configuration structure used to store session activation data for an X509 user token type. More...
 
typedef struct SOPC_Session_UserName SOPC_Session_UserName
 Client configuration structure used to store session activation data for a user name token type. More...
 
typedef struct SOPC_Session_Config SOPC_Session_Config
 Client configuration structure used to store session activation configuration data. More...
 
typedef struct SOPC_SecureConnection_Config SOPC_SecureConnection_Config
 Structure representing a secure connection configuration (secure channel + session) which allow to establish a connection to a server. More...
 
typedef struct SOPC_Client_ConfigFromPaths SOPC_Client_ConfigFromPaths
 Client temporary configuration structure used to store client certificate / key / PKI configuration data from paths. Those paths are should be used to load the serialized version for the certificate / key and instantiate PKI. More...
 
typedef bool SOPC_CreateMI_NodeAvailFunc(const SOPC_NodeId *nodeId, OpcUa_NodeClass *outNodeClass, SOPC_StatusCode *outUnavailabilityStatus)
 Type of the callback called by CreateMonitoredItem service when a NodeId is not already part of server address space, the callback result indicates if it shall be considered known by server (and might exist later using AddNode service). More...
 
typedef struct SOPC_S2OPC_Config SOPC_S2OPC_Config
 S2OPC configuration. More...
 
typedef uint32_t SOPC_SessionId
 Session identifier type, instances are generated by SE_ACTIVATED_SESSION. More...
 
typedef enum SOPC_App_Com_Event SOPC_App_Com_Event
 Client and Server communication events to be managed by applicative code. More...
 
typedef enum SOPC_App_AddSpace_Event SOPC_App_AddSpace_Event
 Server address space access/modification notifications to applicative code. More...
 
typedef void SOPC_ComEvent_Fct(SOPC_App_Com_Event event, uint32_t IdOrStatus, void *param, uintptr_t appContext)
 Toolkit communication events application callback type. More...
 
typedef void SOPC_AddressSpaceNotif_Fct(const SOPC_CallContext *callCtxPtr, SOPC_App_AddSpace_Event event, void *opParam, SOPC_StatusCode opStatus)
 Toolkit address space notification events callback type. More...
 

Enumerations

enum  SOPC_App_Com_Event {
  SE_REVERSE_ENDPOINT_CLOSED = 0x700, SE_SESSION_ACTIVATION_FAILURE, SE_ACTIVATED_SESSION, SE_SESSION_REACTIVATING,
  SE_RCV_SESSION_RESPONSE, SE_CLOSED_SESSION, SE_RCV_DISCOVERY_RESPONSE, SE_SND_REQUEST_FAILED,
  SE_CLOSED_ENDPOINT, SE_LOCAL_SERVICE_RESPONSE
}
 Client and Server communication events to be managed by applicative code. More...
 
enum  SOPC_App_AddSpace_Event { AS_WRITE_EVENT = 0x800 }
 Server address space access/modification notifications to applicative code. More...
 

Functions

void SOPC_S2OPC_Config_Initialize (SOPC_S2OPC_Config *config)
 Initialize the content of the SOPC_S2OPC_Config. Calls both SOPC_ServerConfig_Initialize and SOPC_ClientConfig_Initialize. More...
 
void SOPC_S2OPC_Config_Clear (SOPC_S2OPC_Config *config)
 Clear the content of the SOPC_S2OPC_Config Calls both SOPC_ServerConfig_Clear and SOPC_ClientConfig_Clear. More...
 
void SOPC_ServerConfig_Initialize (SOPC_Server_Config *config)
 Initialize the content of the SOPC_Server_Config. More...
 
void SOPC_ServerConfig_Clear (SOPC_Server_Config *config)
 Clear the content of the SOPC_Server_Config. More...
 
void SOPC_ClientConfig_Initialize (SOPC_Client_Config *config)
 Initialize the content of the SOPC_Client_Config. More...
 
void SOPC_ClientConfig_Clear (SOPC_Client_Config *config)
 Clear the content of the SOPC_Client_Config. More...
 

Detailed Description

Contains the types to be used by the user application to use the Toolkit.

Macro Definition Documentation

◆ SOPC_SECURITY_MODE_NONE_MASK

#define SOPC_SECURITY_MODE_NONE_MASK   0x01

◆ SOPC_SECURITY_MODE_SIGN_MASK

#define SOPC_SECURITY_MODE_SIGN_MASK   0x02

◆ SOPC_SECURITY_MODE_SIGNANDENCRYPT_MASK

#define SOPC_SECURITY_MODE_SIGNANDENCRYPT_MASK   0x04

◆ SOPC_SECURITY_MODE_ANY_MASK

#define SOPC_SECURITY_MODE_ANY_MASK   0x07

◆ SOPC_MAX_SECU_POLICIES_CFG

#define SOPC_MAX_SECU_POLICIES_CFG   5 /* Maximum number of security policies in a configuration array */

◆ SOPC_MAX_CLIENT_SECURE_CONNECTIONS_CONFIG

#define SOPC_MAX_CLIENT_SECURE_CONNECTIONS_CONFIG   SOPC_MAX_SECURE_CONNECTIONS

Typedef Documentation

◆ SOPC_Client_Config

OPC UA client configuration type.

◆ SOPC_SecureChannel_Config

Client configuration of a Secure Channel.

◆ SOPC_SecurityPolicy

Endpoint security policy configuration.

◆ SOPC_Server_Config

OPC UA server configuration type.

◆ SOPC_Server_ClientToConnect

OPC UA server client to reverse connect configuration type. From specification part 6 (v1.05.01): "For each Client, the administrator shall provide an ApplicationUri and an EndpointUrl for the Client.".

Note
There is no indication to validate the ApplicationUri in specification. It might be checked in the future using the CreateSessionRequest content .

◆ SOPC_Endpoint_Config

Server configuration of a Endpoint connection listener.

◆ SOPC_Session_UserX509_ConfigFromPaths

Client temporary configuration structure used to store user X509 configuration data from paths. Those paths are should be used to load the serialized version for the certificate / key.

◆ SOPC_Session_UserX509

Client configuration structure used to store session activation data for an X509 user token type.

◆ SOPC_Session_UserName

Client configuration structure used to store session activation data for a user name token type.

◆ SOPC_Session_Config

Client configuration structure used to store session activation configuration data.

◆ SOPC_SecureConnection_Config

Structure representing a secure connection configuration (secure channel + session) which allow to establish a connection to a server.

◆ SOPC_Client_ConfigFromPaths

Client temporary configuration structure used to store client certificate / key / PKI configuration data from paths. Those paths are should be used to load the serialized version for the certificate / key and instantiate PKI.

◆ SOPC_CreateMI_NodeAvailFunc

typedef bool SOPC_CreateMI_NodeAvailFunc(const SOPC_NodeId *nodeId, OpcUa_NodeClass *outNodeClass, SOPC_StatusCode *outUnavailabilityStatus)

Type of the callback called by CreateMonitoredItem service when a NodeId is not already part of server address space, the callback result indicates if it shall be considered known by server (and might exist later using AddNode service).

It returns true when CreateMonitoredItem for this nodeId shall succeed, in this case outNodeClass shall be set to the expected NodeClass and outBadStatus shall be set with an appropriate Bad StatusCode returned in the Publish response as first value notification. It returns false otherwise, in this case server will return Bad_NodeIdUnknown in the CreateMonitoredItem response.

Warning
This callback shall not block the thread that calls it, and shall return immediately.
Parameters
nodeIdNodeId that is not part of the server address space yet and which is requested in a MonitoredItemCreateRequest. It might be added by AddNode service later.
[out]outNodeClassThe NodeClass of the known node when it will be available. It shall always be the same for the same NodeId.
[out]outUnavailabilityStatusThe appropriate Bad StatusCode to return in the Publish response. OpcUa_BadDataUnavailable or OpcUa_BadWouldBlock are recommended.
Returns
true when CreateMonitoredItem for this nodeId shall succeed, false otherwise.

◆ SOPC_S2OPC_Config

S2OPC configuration.

◆ SOPC_SessionId

typedef uint32_t SOPC_SessionId

Session identifier type, instances are generated by SE_ACTIVATED_SESSION.

◆ SOPC_App_Com_Event

Client and Server communication events to be managed by applicative code.

◆ SOPC_App_AddSpace_Event

Server address space access/modification notifications to applicative code.

◆ SOPC_ComEvent_Fct

typedef void SOPC_ComEvent_Fct(SOPC_App_Com_Event event, uint32_t IdOrStatus, void *param, uintptr_t appContext)

Toolkit communication events application callback type.

◆ SOPC_AddressSpaceNotif_Fct

typedef void SOPC_AddressSpaceNotif_Fct(const SOPC_CallContext *callCtxPtr, SOPC_App_AddSpace_Event event, void *opParam, SOPC_StatusCode opStatus)

Toolkit address space notification events callback type.

Enumeration Type Documentation

◆ SOPC_App_Com_Event

Client and Server communication events to be managed by applicative code.

Enumerator
SE_REVERSE_ENDPOINT_CLOSED 

Client side only:
Notifies the reverse connection is closed
id = reverse endpoint configuration index
auxParams = (SOPC_ReturnStatus) status reason

SE_SESSION_ACTIVATION_FAILURE 

Client side only:
Notifies the session activation (or re-activation) failed
id = (SOPC_SessionId) internal session id (or 0 if not yet defined)
params = (SOPC_StatusCode)(uintptr_t) status code reason
auxParam = user application session context

SE_ACTIVATED_SESSION 

Client side only:
Notifies the session is active (newly created session or re-activated session)
id = (SOPC_SessionId) internal session id
auxParam = user application session context

SE_SESSION_REACTIVATING 

Client side only:
Notifies the session is currently re-activating due to connection issue.
id = (SOPC_SessionId) internal session id
auxParam = user application session context

SE_RCV_SESSION_RESPONSE 

Client side only:
Notifies the service response to a previously (non-discovery) service request sent over a session
id = (SOPC_SessionId) internal session id
params =(OpcUa_<MessageStruct>*) OPC UA message header + payload structure
(deallocated by toolkit after callback call ends)
auxParam = user application request context

SE_CLOSED_SESSION 

Client side only:
Notifies the session is closed after requesting a session close.
id = (SOPC_SessionId) internal session id
params = (SOPC_StatusCode)(uintptr_t) status code reason
auxParam = user application session context

SE_RCV_DISCOVERY_RESPONSE 

Client side only:
Notifies the service response to a previously discovery service request sent
params = (OpcUa_<MessageStruct>*) OPC UA discovery message header + payload
structure (deallocated by toolkit after callback call ends)
auxParam = user application request context

SE_SND_REQUEST_FAILED 

Client side only:
Notifies the service request sending failed (connection issue or timeout for response to be received)
idOrStatus = (SOPC_ReturnStatus) status,
params = (SOPC_EncodeableType*) request type (shall not be deallocated)
auxParam = user application request context

SE_CLOSED_ENDPOINT 

Server side only:
Notifies the endpoint listening for connections is closed or failed to be opened.
id = endpoint configuration index,
auxParam = SOPC_ReturnStatus

SE_LOCAL_SERVICE_RESPONSE 

Server side only:
Notifies the service response for the local service request previously requested.
id = endpoint configuration index,
params =(OpcUa_<MessageStruct>*) OPC UA message header + payload structure
(deallocated by toolkit after callback call ends)
auxParam = user application request context

◆ SOPC_App_AddSpace_Event

Server address space access/modification notifications to applicative code.

Enumerator
AS_WRITE_EVENT 

Server side only:
Notifies a write operation on the server address space.
opParam = (OpcUa_WriteValue*) single write value operation
opStatus = status of the write operation

Function Documentation

◆ SOPC_S2OPC_Config_Initialize()

void SOPC_S2OPC_Config_Initialize ( SOPC_S2OPC_Config config)

Initialize the content of the SOPC_S2OPC_Config. Calls both SOPC_ServerConfig_Initialize and SOPC_ClientConfig_Initialize.

Parameters
configThe s2opc client/server configuration to initialize

◆ SOPC_S2OPC_Config_Clear()

void SOPC_S2OPC_Config_Clear ( SOPC_S2OPC_Config config)

Clear the content of the SOPC_S2OPC_Config Calls both SOPC_ServerConfig_Clear and SOPC_ClientConfig_Clear.

Parameters
configThe s2opc client/server configuration to clear

◆ SOPC_ServerConfig_Initialize()

void SOPC_ServerConfig_Initialize ( SOPC_Server_Config config)

Initialize the content of the SOPC_Server_Config.

Parameters
configThe s2opc server configuration to initialize

◆ SOPC_ServerConfig_Clear()

void SOPC_ServerConfig_Clear ( SOPC_Server_Config config)

Clear the content of the SOPC_Server_Config.

Parameters
configThe s2opc server configuration to clear

◆ SOPC_ClientConfig_Initialize()

void SOPC_ClientConfig_Initialize ( SOPC_Client_Config config)

Initialize the content of the SOPC_Client_Config.

Parameters
configThe s2opc client configuration to initialize

◆ SOPC_ClientConfig_Clear()

void SOPC_ClientConfig_Clear ( SOPC_Client_Config config)

Clear the content of the SOPC_Client_Config.

Parameters
configThe s2opc client configuration to clear