S2OPC OPCUA Toolkit
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_new_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
41 typedef 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;
60 
61  SOPC_GetPassword_Fct* getClientKeyPasswordCb;
62 
63  SOPC_GetClientUserKeyPassword_Fct* getUserKeyPasswordCb;
64  SOPC_GetClientUserNamePassword_Fct* getUserNamePasswordCb;
65 } SOPC_ClientHelper_Config;
66 
67 // The singleton configuration structure
68 extern SOPC_ClientHelper_Config sopc_client_helper_config;
69 
70 // Returns true if the client is initialize, false otherwise
71 bool SOPC_ClientInternal_IsInitialized(void);
72 
73 void SOPC_ClientInternal_ToolkitEventCallback(SOPC_App_Com_Event event,
74  uint32_t IdOrStatus,
75  void* param,
76  uintptr_t appContext);
77 
78 // Finalize the SecureChannel configuration by parsing the necessary files
79 SOPC_ReturnStatus SOPC_ClientConfigHelper_Finalize_SecureConnectionConfig(SOPC_Client_Config* cConfig,
80  SOPC_SecureConnection_Config* secConnConfig);
81 
90 bool SOPC_ClientInternal_GetClientKeyPassword(char** outPassword);
91 
97 bool SOPC_ClientInternal_IsEncryptedClientKey(void);
98 
108 bool SOPC_ClientInternal_GetUserKeyPassword(const char* cert1Sha1, char** outPassword);
109 
119 bool SOPC_ClientInternal_GetUserNamePassword(char** outUserName, char** outPassword);
120 
121 uint32_t SOPC_ClientInternal_GetReverseEPcfgIdxNoOffset(SOPC_ReverseEndpointConfigIdx rEPcfgIdx);
122 
126 void SOPC_ClientInternal_KeyCertPairUpdateCb(uintptr_t updateParam);
127 
128 #endif /* LIBS2OPC_CLIENT_INTERNAL_H_ */
SOPC_ReverseEndpointConfigIdx
uint32_t SOPC_ReverseEndpointConfigIdx
Index type for reverse endpoint configuration, 0 is an invalid index.
Definition: sopc_toolkit_config.h:142
libs2opc_new_client.h
High level interface to run an OPC UA client.
SOPC_ServiceAsyncResp_Fct
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:122
SOPC_GetPassword_Fct
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:210
SOPC_ClientConnection
struct SOPC_ClientConnection SOPC_ClientConnection
Structure representing a secure connection to a server.
Definition: libs2opc_new_client.h:56
SOPC_Mutex
QueueHandle_t SOPC_Mutex
Definition: p_sopc_synchronisation.h:77
SOPC_GetClientUserKeyPassword_Fct
bool SOPC_GetClientUserKeyPassword_Fct(const char *userCertThumb, char **outPassword)
Type of callback to retrieve password for decryption of the user private key.
Definition: libs2opc_client_config.h:182
sopc_mutexes.h
A platform independent API to use mutexes and condition variables.
SOPC_ClientSubscriptionNotification_Fct
void SOPC_ClientSubscriptionNotification_Fct(const SOPC_ClientHelper_Subscription *subscription, SOPC_StatusCode status, SOPC_EncodeableType *notificationType, uint32_t nbNotifElts, const void *notification, uintptr_t *monitoredItemCtxArray)
Type of callback called on Subscription Notification.
Definition: libs2opc_new_client.h:311
SOPC_MAX_CLIENT_SECURE_CONNECTIONS_CONFIG
#define SOPC_MAX_CLIENT_SECURE_CONNECTIONS_CONFIG
Definition: sopc_user_app_itf.h:89
SOPC_MAX_ENDPOINT_DESCRIPTION_CONFIGURATIONS
#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
sopc_user_app_itf.h
Contains the types to be used by the user application to use the Toolkit.
SOPC_App_Com_Event
SOPC_App_Com_Event
Client and Server communication events to be managed by applicative code.
Definition: sopc_user_app_itf.h:381
tConditionVariable
Definition: p_sopc_synchronisation.h:56
sopc_toolkit_config.h
This module shall be used to initialize, configure and clear/terminate the toolkit execution.
SOPC_SecureConnection_Config
Structure representing a secure connection configuration (secure channel + session) which allow to es...
Definition: sopc_user_app_itf.h:214
SOPC_Client_Config
OPC UA client configuration structure.
Definition: sopc_user_app_itf.h:257
SOPC_GetClientUserNamePassword_Fct
bool SOPC_GetClientUserNamePassword_Fct(char **outUserName, char **outPassword)
Type of callback to retrieve username and password for session activation.
Definition: libs2opc_client_config.h:154
SOPC_ReturnStatus
SOPC_ReturnStatus
Definition: libs2opc_client.h:64