S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
libs2opc_client_internal.h
Go to the documentation of this file.
1/*
2 * Licensed to Systerel under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work
4 * for additional information regarding copyright ownership.
5 * Systerel licenses this file to you under the Apache
6 * License, Version 2.0 (the "License"); you may not use this
7 * file except in compliance with the License. You may obtain
8 * a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
29#ifndef LIBS2OPC_CLIENT_INTERNAL_H_
30#define LIBS2OPC_CLIENT_INTERNAL_H_
31
32#include <stdbool.h>
33
34#include "libs2opc_client.h"
35
36#include "sopc_mutexes.h"
37#include "sopc_toolkit_config.h"
38#include "sopc_user_app_itf.h"
39
40// The client helper dedicated configuration in addition to configuration ::SOPC_S2OPC_Config
41typedef struct SOPC_ClientHelper_Config
42{
43 // Flag atomically set when the structure is initialized during call to SOPC_ClientConfigHelper_Initialize
44 // and singleton config is initialized
45 int32_t initialized;
46 SOPC_Mutex configMutex;
47 SOPC_Condition reverseEPsClosedCond;
48
51 configuredReverseEndpointsToCfgIdx[SOPC_MAX_CLIENT_SECURE_CONNECTIONS_CONFIG]; // Max 1 per secure connection
52 bool openedReverseEndpointsFromCfgIdx[SOPC_MAX_ENDPOINT_DESCRIPTION_CONFIGURATIONS +
53 1]; // index is valid
54 // (SOPC_ReverseEndpointConfigIdx -
55 // SOPC_MAX_ENDPOINT_DESCRIPTION_CONFIGURATIONS)
56 // : ]0 : SOPC_MAX_ENDPOINT_DESCRIPTION_CONFIGURATIONS]
57
58 SOPC_ServiceAsyncResp_Fct* asyncRespCb;
59
60 SOPC_GetPassword_Fct* getClientKeyPasswordCb;
61
62 SOPC_GetClientUserKeyPassword_Fct* getUserKeyPasswordCb;
63 SOPC_GetClientUserNamePassword_Fct* getUserNamePasswordCb;
64} SOPC_ClientHelper_Config;
65
66// The singleton configuration structure
67extern SOPC_ClientHelper_Config sopc_client_helper_config;
68
69// Returns true if the client is initialize, false otherwise
70bool SOPC_ClientInternal_IsInitialized(void);
71
72void SOPC_ClientInternal_ToolkitEventCallback(SOPC_App_Com_Event event,
73 uint32_t IdOrStatus,
74 void* param,
75 uintptr_t appContext);
76
77// Finalize the SecureChannel configuration by parsing the necessary files
78SOPC_ReturnStatus SOPC_ClientConfigHelper_Finalize_SecureConnectionConfig(SOPC_Client_Config* cConfig,
79 SOPC_SecureConnection_Config* secConnConfig);
80
89bool SOPC_ClientInternal_GetClientKeyPassword(char** outPassword);
90
96bool SOPC_ClientInternal_IsEncryptedClientKey(void);
97
108bool SOPC_ClientInternal_GetUserKeyPassword(const SOPC_SecureConnection_Config* secConnConfig,
109 const char* cert1Sha1,
110 char** outPassword);
111
122bool SOPC_ClientInternal_GetUserNamePassword(const SOPC_SecureConnection_Config* secConnConfig,
123 char** outUserName,
124 char** outPassword);
125
126uint32_t SOPC_ClientInternal_GetReverseEPcfgIdxNoOffset(SOPC_ReverseEndpointConfigIdx rEPcfgIdx);
127
131void SOPC_ClientInternal_KeyCertPairUpdateCb(uintptr_t updateParam);
132
136void SOPC_ClientInternal_PKIProviderUpdateCb(uintptr_t updateParam);
137
138#endif /* LIBS2OPC_CLIENT_INTERNAL_H_ */
High level interface to run an OPC UA client.
struct SOPC_ClientConnection SOPC_ClientConnection
Structure representing a secure connection to a server.
Definition libs2opc_client.h:56
bool SOPC_GetClientUserKeyPassword_Fct(const SOPC_SecureConnection_Config *secConnConfig, const char *userCertThumb, char **outPassword)
Type of callback to retrieve password for decryption of the user private key.
Definition libs2opc_client_config.h:203
bool SOPC_GetClientUserNamePassword_Fct(const SOPC_SecureConnection_Config *secConnConfig, char **outUserName, char **outPassword)
Type of callback to retrieve username and password for session activation.
Definition libs2opc_client_config.h:172
bool SOPC_GetPassword_Fct(char **outPassword)
Type of callback to retrieve password for decryption of the client application private key or the use...
Definition libs2opc_client_config.h:233
void SOPC_ServiceAsyncResp_Fct(SOPC_EncodeableType *type, const void *response, uintptr_t userContext)
Type of callback to provide asynchronous service response.
Definition libs2opc_client_config.h:139
enum _SOPC_ReturnStatus SOPC_ReturnStatus
Common enumerations for S2OPC.
This module shall be used to initialize, configure and clear/terminate the toolkit execution.
uint32_t SOPC_ReverseEndpointConfigIdx
Index type for reverse endpoint configuration, 0 is an invalid index.
Definition sopc_toolkit_config.h:142
#define SOPC_MAX_ENDPOINT_DESCRIPTION_CONFIGURATIONS
Maximum number of classic endpoint descriptions configured (same as number of connection listeners)....
Definition sopc_toolkit_config_constants.h:68
Contains the types to be used by the user application to use the Toolkit.
#define SOPC_MAX_CLIENT_SECURE_CONNECTIONS_CONFIG
Definition sopc_user_app_itf.h:91
enum _SOPC_App_Com_Event SOPC_App_Com_Event
Client and Server communication events to be managed by applicative code.
OPC UA client configuration structure.
Definition sopc_user_app_itf.h:259
Definition p_sopc_synchronisation.h:57
Definition p_sopc_synchronisation.h:64
Structure representing a secure connection configuration (secure channel + session) which allow to es...
Definition sopc_user_app_itf.h:216