S2OPC OPCUA Toolkit
toolkit_helpers.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 
26 #ifndef TOOLKIT_HELPERS_H_
27 #define TOOLKIT_HELPERS_H_
28 
29 #define MAX_NOTIFICATIONS_PER_REQUEST 1000
30 
31 #include <stdarg.h>
32 #include <stdbool.h>
33 
34 #include "sopc_key_manager.h"
35 #include "sopc_types.h"
36 
37 /* The following includes are required to fetch the SOPC_LibSub_Value, SOPC_LibSub_DataTime and logger types */
38 #include "sopc_builtintypes.h"
39 #include "sopc_crypto_profiles.h"
40 #include "sopc_log_manager.h"
41 #include "sopc_types.h"
42 #include "sopc_user_app_itf.h"
43 #define SKIP_S2OPC_DEFINITIONS
45 
52  const char* szServerUri,
53  const char* szSecuPolicy,
54  OpcUa_MessageSecurityMode msgSecurityMode,
55  bool bDisablePKI,
56  const char* szPathCertifAuth,
57  const char* szPathCertServer,
58  const char* szPathCertClient,
59  const char* szPathKeyClient,
60  const char* szPathCrl,
61  uint32_t iScRequestedLifetime,
62  const OpcUa_GetEndpointsResponse* expectedEndpoints,
63  SOPC_Client_Config* clientAppCfg,
64  SOPC_SecureChannel_Config** ppNewCfg);
65 
70 
75  uint32_t iCntMaxKeepAlive,
76  uint32_t iCntLifetime,
77  void** ppRequest);
86 SOPC_ReturnStatus Helpers_NewDeleteSubscriptionRequest(uint32_t subscriptionId, void** ppRequest);
87 
91 SOPC_ReturnStatus Helpers_NewPublishRequest(bool bAck, uint32_t iSubId, uint32_t iSeqNum, void** ppRequest);
92 
97  const uint32_t* liAttrId,
98  int32_t nElems,
99  uint32_t iSubId,
100  OpcUa_TimestampsToReturn tsToReturn,
101  uint32_t* liCliHndl,
102  uint32_t iQueueSize,
103  void** ppRequest);
104 
112 
118 
125 void Helpers_Log(const SOPC_Log_Level log_level, const char* format, ...);
126 
133 
138 
139 #endif /* TOOLKIT_HELPERS_H_ */
Helpers_OPCTimeToNTP
SOPC_LibSub_Timestamp Helpers_OPCTimeToNTP(SOPC_DateTime ts)
OPC-UA time (hundreds of nanosecs since 1601/01/01 00:00:00 UTC) to NTP time (2**-32 seconds since 19...
SOPC_NodeId
This structure describes a basic NodeID in OPC UA.
Definition: sopc_builtintypes.h:187
sopc_types.h
SOPC_LibSub_Value
Structure defining the value of a node.
Definition: libs2opc_client.h:165
Helpers_Log
void Helpers_Log(const SOPC_Log_Level log_level, const char *format,...)
Buffers a log message, then calls the callback configured with the LibSub.
OpcUa_TimestampsToReturn
enum _OpcUa_TimestampsToReturn OpcUa_TimestampsToReturn
Helpers_NewPublishRequest
SOPC_ReturnStatus Helpers_NewPublishRequest(bool bAck, uint32_t iSubId, uint32_t iSeqNum, void **ppRequest)
Creates a new PublishRequest.
Helpers_SecureChannel_Config_Free
void Helpers_SecureChannel_Config_Free(SOPC_SecureChannel_Config **ppscConfig)
A SOPC_SecureChannel_Config destructor which free elements from Helpers_NewSCConfigFromLibSubCfg().
sopc_key_manager.h
The SOPC_KeyManager provides an API for Asymmetric Key Management such as loading signed public keys ...
Helpers_NewSCConfigFromLibSubCfg
SOPC_ReturnStatus Helpers_NewSCConfigFromLibSubCfg(const char *szServerUrl, const char *szServerUri, const char *szSecuPolicy, OpcUa_MessageSecurityMode msgSecurityMode, bool bDisablePKI, const char *szPathCertifAuth, const char *szPathCertServer, const char *szPathCertClient, const char *szPathKeyClient, const char *szPathCrl, uint32_t iScRequestedLifetime, const OpcUa_GetEndpointsResponse *expectedEndpoints, SOPC_Client_Config *clientAppCfg, SOPC_SecureChannel_Config **ppNewCfg)
Creates a new Toolkit secure channel configuration from elements of the SOPC_LibSub_ConnectionCfg.
Helpers_NewValueFromDataValue
SOPC_ReturnStatus Helpers_NewValueFromDataValue(SOPC_DataValue *pVal, SOPC_LibSub_Value **pplsVal)
Converts a SOPC_DataValue to a SOPC_LibSub_Value, returns NULL when the conversion is not possible (o...
OpcUa_MessageSecurityMode
OpcUa_MessageSecurityMode
Definition: libs2opc_client.h:89
SOPC_LibSub_CstString
const char * SOPC_LibSub_CstString
Definition: libs2opc_client.h:118
sopc_builtintypes.h
_OpcUa_GetEndpointsResponse
Definition: sopc_types.h:2434
SOPC_Log_Level
SOPC_Log_Level
Definition: libs2opc_client.h:79
SOPC_LibSub_LogCbk
void SOPC_LibSub_LogCbk(const SOPC_Log_Level log_level, SOPC_LibSub_CstString text)
Log callback type.
Definition: libs2opc_client.h:224
sopc_log_manager.h
Provide circular logging.
Helpers_NewCreateSubscriptionRequest
SOPC_ReturnStatus Helpers_NewCreateSubscriptionRequest(double fPublishIntervalMs, uint32_t iCntMaxKeepAlive, uint32_t iCntLifetime, void **ppRequest)
Creates a new CreateSubscriptionRequest.
Helpers_NewDeleteSubscriptionRequest
SOPC_ReturnStatus Helpers_NewDeleteSubscriptionRequest(uint32_t subscriptionId, void **ppRequest)
Creates a new DeleteSubscriptionRequest.
sopc_user_app_itf.h
Contains the types to be used by the user application to use the Toolkit.
SOPC_DateTime
int64_t SOPC_DateTime
Definition: sopc_builtintypes.h:158
SOPC_SecureChannel_Config
Client configuration of a Secure Channel.
Definition: sopc_user_app_itf.h:51
Helpers_LoggerStdout
void Helpers_LoggerStdout(const SOPC_Log_Level log_level, const SOPC_LibSub_CstString text)
Prints a log message to stdout, with the following format "# log_level: text\n".
Helpers_SetLogger
void Helpers_SetLogger(SOPC_LibSub_LogCbk cbk)
Sets the cbk function as the called callback by Helpers_Log().
SOPC_DataValue
Each attribute in OPC UA has a DataValue caracterized by the following structure.
Definition: sopc_builtintypes.h:385
libs2opc_client.h
Interface of an example client library supporting the subscription management.
Helpers_NewCreateMonitoredItemsRequest
SOPC_ReturnStatus Helpers_NewCreateMonitoredItemsRequest(SOPC_NodeId **lpNid, const uint32_t *liAttrId, int32_t nElems, uint32_t iSubId, OpcUa_TimestampsToReturn tsToReturn, uint32_t *liCliHndl, uint32_t iQueueSize, void **ppRequest)
Creates a new CreateMonitoredItemsRequest with multiple ItemToCreate.
SOPC_Client_Config
OPC UA client configuration structure.
Definition: sopc_user_app_itf.h:257
sopc_crypto_profiles.h
Defines the cryptographic profiles: constants and struct.
SOPC_LibSub_Timestamp
uint64_t SOPC_LibSub_Timestamp
Definition: libs2opc_client.h:134
SOPC_ReturnStatus
SOPC_ReturnStatus
Definition: libs2opc_client.h:64