S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_common_constants.h File Reference

Contains the configuration constants used by S2OPC common library. Those constants could be modified for specific use. More...

#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "sopc_protocol_constants.h"

Go to the source code of this file.

Data Structures

struct  SOPC_Common_EncodingConstants
 Configuration structure of message and types encoding limits. More...
 

Macros

#define SOPC_DEFAULT_TCP_UA_MAX_BUFFER_SIZE   UINT16_MAX
 Maximum chunk buffer size used (must be >= SOPC_TCP_UA_MIN_BUFFER_SIZE)
 
#define SOPC_DEFAULT_RECEIVE_MAX_NB_CHUNKS   5
 Maximum number of chunks received accepted for 1 message, 0 means no limit. Note: if 0 is chosen SOPC_RECEIVE_MAX_MESSAGE_LENGTH definition shall be changed not to use it and shall not be 0.
 
#define SOPC_DEFAULT_RECEIVE_MAX_MESSAGE_LENGTH   SOPC_DEFAULT_TCP_UA_MAX_BUFFER_SIZE* SOPC_DEFAULT_RECEIVE_MAX_NB_CHUNKS
 Maximum message length accepted in reception (must be >= SOPC_TCP_UA_MAX_BUFFER_SIZE), 0 means no limit. Note: if 0 is chosen SOPC_RECEIVE_MAX_NB_CHUNKS shall not be 0.
 
#define SOPC_DEFAULT_SEND_MAX_NB_CHUNKS   12
 Maximum number of chunks sent for 1 message, 0 means no limit. Note: if 0 is chosen SOPC_SEND_MAX_MESSAGE_LENGTH definition shall be changed not to use it and shall not be 0.
 
#define SOPC_DEFAULT_SEND_MAX_MESSAGE_LENGTH   SOPC_DEFAULT_TCP_UA_MAX_BUFFER_SIZE* SOPC_DEFAULT_SEND_MAX_NB_CHUNKS
 Maximum message length sent (must be >= SOPC_TCP_UA_MAX_BUFFER_SIZE), 0 means no limit. Note: if 0 is chosen SOPC_SEND_MAX_NB_CHUNKS shall not be 0.
 
#define SOPC_DEFAULT_MAX_STRING_LENGTH   UINT16_MAX
 Maximum ByteString/String/XmlElement length in bytes used.
 
#define SOPC_DEFAULT_MAX_ARRAY_LENGTH   1000000
 Maximum array length that could be stored in a variant.
 
#define SOPC_DEFAULT_MAX_DIAG_INFO_NESTED_LEVEL   100
 Maximum levels of nested diagnostic information structure Note: OPC UA specification v1.03 part 6 §5.2.2.12 indicates "Decoders shall support at least 100 nesting levels ...".
 
#define SOPC_DEFAULT_MAX_STRUCT_NESTED_LEVEL   50
 Maximum levels of nested structs, excluding Diagnostic Information which is handled by SOPC_DEFAULT_MAX_DIAG_INFO_NESTED_LEVEL.
 
#define SOPC_MAX_NB_ELEMENTS_ASYNC_QUEUE   5000
 
#define SOPC_MAX_NB_ELEMENTS_ASYNC_QUEUE_WARNING_ONLY   true
 
#define SOPC_LOG_MAX_USER_LINE_LENGTH   512
 Maximum length of a User-defined log line.
 
#define SOPC_HAS_FILESYSTEM   true
 Indicates whether the host has a file system.
 
#define SOPC_MAX_TIMERS   UINT8_MAX /* TODO: avoid static maximum (see monitoredItems Id creation) */
 Maximum number of timers.
 
#define SOPC_CONSOLE_PRINTF   printf
 define host-specific console print function If no console is provided or log wants to be omitted, the following can be used:
 
#define SOPC_IS_LITTLE_ENDIAN   1
 Define Endianness.
 
#define SOPC_IS_DOUBLE_MIDDLE_ENDIAN   0
 Define Double Middle-endian option (Used on some old ARM CPUs) In that case, the double are little-endian but with 4-bytes words reversed. If Set to 1, it overrides SOPC_IS_LITTLE_ENDIAN for double encoding, whatever its value.
 

Typedefs

typedef struct SOPC_Common_EncodingConstants SOPC_Common_EncodingConstants
 Configuration structure of message and types encoding limits.
 

Functions

SOPC_Common_EncodingConstants SOPC_Common_GetDefaultEncodingConstants (void)
 Get the default encoding constants (contains values below by default)
 
bool SOPC_Common_SetEncodingConstants (SOPC_Common_EncodingConstants config)
 Set the encodings constants with current structure value. It shall be done before initialization and cannot be called twice.
 
bool SOPC_Common_EncodingConstantsGetInitialized (void)
 Retrieve the S2OPC encoding constants "initialized" state.
 
const SOPC_Common_EncodingConstantsSOPC_Internal_Common_GetEncodingConstants (void)
 
bool SOPC_Internal_Common_Constants_RuntimeCheck (void)
 

Detailed Description

Contains the configuration constants used by S2OPC common library. Those constants could be modified for specific use.

Macro Definition Documentation

◆ SOPC_DEFAULT_TCP_UA_MAX_BUFFER_SIZE

#define SOPC_DEFAULT_TCP_UA_MAX_BUFFER_SIZE   UINT16_MAX

Maximum chunk buffer size used (must be >= SOPC_TCP_UA_MIN_BUFFER_SIZE)

◆ SOPC_DEFAULT_RECEIVE_MAX_NB_CHUNKS

#define SOPC_DEFAULT_RECEIVE_MAX_NB_CHUNKS   5

Maximum number of chunks received accepted for 1 message, 0 means no limit. Note: if 0 is chosen SOPC_RECEIVE_MAX_MESSAGE_LENGTH definition shall be changed not to use it and shall not be 0.

◆ SOPC_DEFAULT_RECEIVE_MAX_MESSAGE_LENGTH

#define SOPC_DEFAULT_RECEIVE_MAX_MESSAGE_LENGTH   SOPC_DEFAULT_TCP_UA_MAX_BUFFER_SIZE* SOPC_DEFAULT_RECEIVE_MAX_NB_CHUNKS

Maximum message length accepted in reception (must be >= SOPC_TCP_UA_MAX_BUFFER_SIZE), 0 means no limit. Note: if 0 is chosen SOPC_RECEIVE_MAX_NB_CHUNKS shall not be 0.

◆ SOPC_DEFAULT_SEND_MAX_NB_CHUNKS

#define SOPC_DEFAULT_SEND_MAX_NB_CHUNKS   12

Maximum number of chunks sent for 1 message, 0 means no limit. Note: if 0 is chosen SOPC_SEND_MAX_MESSAGE_LENGTH definition shall be changed not to use it and shall not be 0.

◆ SOPC_DEFAULT_SEND_MAX_MESSAGE_LENGTH

#define SOPC_DEFAULT_SEND_MAX_MESSAGE_LENGTH   SOPC_DEFAULT_TCP_UA_MAX_BUFFER_SIZE* SOPC_DEFAULT_SEND_MAX_NB_CHUNKS

Maximum message length sent (must be >= SOPC_TCP_UA_MAX_BUFFER_SIZE), 0 means no limit. Note: if 0 is chosen SOPC_SEND_MAX_NB_CHUNKS shall not be 0.

◆ SOPC_DEFAULT_MAX_STRING_LENGTH

#define SOPC_DEFAULT_MAX_STRING_LENGTH   UINT16_MAX

Maximum ByteString/String/XmlElement length in bytes used.

◆ SOPC_DEFAULT_MAX_ARRAY_LENGTH

#define SOPC_DEFAULT_MAX_ARRAY_LENGTH   1000000

Maximum array length that could be stored in a variant.

◆ SOPC_DEFAULT_MAX_DIAG_INFO_NESTED_LEVEL

#define SOPC_DEFAULT_MAX_DIAG_INFO_NESTED_LEVEL   100

Maximum levels of nested diagnostic information structure Note: OPC UA specification v1.03 part 6 §5.2.2.12 indicates "Decoders shall support at least 100 nesting levels ...".

◆ SOPC_DEFAULT_MAX_STRUCT_NESTED_LEVEL

#define SOPC_DEFAULT_MAX_STRUCT_NESTED_LEVEL   50

Maximum levels of nested structs, excluding Diagnostic Information which is handled by SOPC_DEFAULT_MAX_DIAG_INFO_NESTED_LEVEL.

◆ SOPC_MAX_NB_ELEMENTS_ASYNC_QUEUE

#define SOPC_MAX_NB_ELEMENTS_ASYNC_QUEUE   5000

◆ SOPC_MAX_NB_ELEMENTS_ASYNC_QUEUE_WARNING_ONLY

#define SOPC_MAX_NB_ELEMENTS_ASYNC_QUEUE_WARNING_ONLY   true

◆ SOPC_LOG_MAX_USER_LINE_LENGTH

#define SOPC_LOG_MAX_USER_LINE_LENGTH   512

Maximum length of a User-defined log line.

◆ SOPC_HAS_FILESYSTEM

#define SOPC_HAS_FILESYSTEM   true

Indicates whether the host has a file system.

◆ SOPC_MAX_TIMERS

#define SOPC_MAX_TIMERS   UINT8_MAX /* TODO: avoid static maximum (see monitoredItems Id creation) */

Maximum number of timers.

◆ SOPC_CONSOLE_PRINTF

#define SOPC_CONSOLE_PRINTF   printf

define host-specific console print function If no console is provided or log wants to be omitted, the following can be used:

#define SOPC_CONSOLE_PRINTF(...) do{} while (0)

◆ SOPC_IS_LITTLE_ENDIAN

#define SOPC_IS_LITTLE_ENDIAN   1

Define Endianness.

◆ SOPC_IS_DOUBLE_MIDDLE_ENDIAN

#define SOPC_IS_DOUBLE_MIDDLE_ENDIAN   0

Define Double Middle-endian option (Used on some old ARM CPUs) In that case, the double are little-endian but with 4-bytes words reversed. If Set to 1, it overrides SOPC_IS_LITTLE_ENDIAN for double encoding, whatever its value.

Typedef Documentation

◆ SOPC_Common_EncodingConstants

typedef struct SOPC_Common_EncodingConstants SOPC_Common_EncodingConstants

Configuration structure of message and types encoding limits.

Function Documentation

◆ SOPC_Common_GetDefaultEncodingConstants()

SOPC_Common_EncodingConstants SOPC_Common_GetDefaultEncodingConstants ( void )

Get the default encoding constants (contains values below by default)

Returns
The default value of the encoding constants

◆ SOPC_Common_SetEncodingConstants()

bool SOPC_Common_SetEncodingConstants ( SOPC_Common_EncodingConstants config)

Set the encodings constants with current structure value. It shall be done before initialization and cannot be called twice.

Parameters
configThe new encoding constants structure to be configured. It should be a modified version of SOPC_Common_GetDefaultEncodingConstants().
Returns
True if it succeeds, false otherwise if it is not the first call or if it is not compliant with constraints defined on default values below

◆ SOPC_Common_EncodingConstantsGetInitialized()

bool SOPC_Common_EncodingConstantsGetInitialized ( void )

Retrieve the S2OPC encoding constants "initialized" state.

Returns
True if the encoding constants are already initialized (when SOPC_Common_SetEncodingConstants is called))

◆ SOPC_Internal_Common_GetEncodingConstants()

const SOPC_Common_EncodingConstants * SOPC_Internal_Common_GetEncodingConstants ( void )

◆ SOPC_Internal_Common_Constants_RuntimeCheck()

bool SOPC_Internal_Common_Constants_RuntimeCheck ( void )