S2OPC OPCUA Toolkit
Macros | Functions
toolkit_helpers.h File Reference

Helpers for the Toolkit API. More...

#include <stdarg.h>
#include <stdbool.h>
#include "sopc_key_manager.h"
#include "sopc_types.h"
#include "sopc_builtintypes.h"
#include "sopc_crypto_profiles.h"
#include "sopc_log_manager.h"
#include "sopc_user_app_itf.h"
#include "libs2opc_client.h"

Go to the source code of this file.

Macros

#define MAX_NOTIFICATIONS_PER_REQUEST   1000
 
#define SKIP_S2OPC_DEFINITIONS
 

Functions

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. More...
 
void Helpers_SecureChannel_Config_Free (SOPC_SecureChannel_Config **ppscConfig)
 A SOPC_SecureChannel_Config destructor which free elements from Helpers_NewSCConfigFromLibSubCfg(). More...
 
SOPC_ReturnStatus Helpers_NewCreateSubscriptionRequest (double fPublishIntervalMs, uint32_t iCntMaxKeepAlive, uint32_t iCntLifetime, void **ppRequest)
 Creates a new CreateSubscriptionRequest. More...
 
SOPC_ReturnStatus Helpers_NewDeleteSubscriptionRequest (uint32_t subscriptionId, void **ppRequest)
 Creates a new DeleteSubscriptionRequest. More...
 
SOPC_ReturnStatus Helpers_NewPublishRequest (bool bAck, uint32_t iSubId, uint32_t iSeqNum, void **ppRequest)
 Creates a new PublishRequest. More...
 
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. More...
 
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 (or on memory allocation failure, or when an uint64_t is greater than the INT64_MAX). More...
 
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 1900/01/01 00:00:00 UTC). More...
 
void Helpers_Log (const SOPC_Log_Level log_level, const char *format,...)
 Buffers a log message, then calls the callback configured with the LibSub. More...
 
void Helpers_SetLogger (SOPC_LibSub_LogCbk cbk)
 Sets the cbk function as the called callback by Helpers_Log(). More...
 
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". More...
 

Detailed Description

Helpers for the Toolkit API.

Macro Definition Documentation

◆ MAX_NOTIFICATIONS_PER_REQUEST

#define MAX_NOTIFICATIONS_PER_REQUEST   1000

◆ SKIP_S2OPC_DEFINITIONS

#define SKIP_S2OPC_DEFINITIONS

Function Documentation

◆ 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.

Parameters are copied where needed, and can be freed after the call to this function.

◆ Helpers_SecureChannel_Config_Free()

void Helpers_SecureChannel_Config_Free ( SOPC_SecureChannel_Config **  ppscConfig)

A SOPC_SecureChannel_Config destructor which free elements from Helpers_NewSCConfigFromLibSubCfg().

◆ 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.

Parameters
subscriptionIdsubscription id
ppRequestpointer to the request to be filled

◆ Helpers_NewPublishRequest()

SOPC_ReturnStatus Helpers_NewPublishRequest ( bool  bAck,
uint32_t  iSubId,
uint32_t  iSeqNum,
void **  ppRequest 
)

Creates a new PublishRequest.

◆ 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.

◆ 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 (or on memory allocation failure, or when an uint64_t is greater than the INT64_MAX).

Does not handle arrays.

◆ 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 1900/01/01 00:00:00 UTC).

◆ 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.

See Helpers_SetLogger().

◆ Helpers_SetLogger()

void Helpers_SetLogger ( SOPC_LibSub_LogCbk  cbk)

Sets the cbk function as the called callback by Helpers_Log().

The default log function outputs to the standard output.

◆ 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".