S2OPC OPCUA Toolkit
Data Structures | Macros | Typedefs | Functions
sopc_address_space.h File Reference
#include <stdint.h>
#include "sopc_types.h"

Go to the source code of this file.

Data Structures

struct  SOPC_Value_Timestamp
 
struct  SOPC_AddressSpace_Node
 

Macros

#define FOR_EACH_ELEMENT_TYPE(x, extra)
 AddressSpace module provides an abstract representation of the address space. This is the representation provided by AddressSpace loaders SOPC_Embedded_AddressSpace_Load or SOPC_UANodeSet_Parse or might be used to build an AddressSpace from scratch. More...
 

Typedefs

typedef struct SOPC_Value_Timestamp SOPC_Value_Timestamp
 
typedef struct _SOPC_AddressSpace SOPC_AddressSpace
 
typedef void SOPC_AddressSpace_ForEach_Fct(const uintptr_t key, const uintptr_t value, uintptr_t user_data)
 Type of callback functions for SOPC_AddressSpace_ForEach. Both the key and value belong to the address space and shall not be modified. The value of user_data is set when calling SOPC_AddressSpace_ForEach. Note: key actual type is const SOPC_NodeId* but shall remain void in declaration for generic data structure usage Note: value actual type is const SOPC_AddressSpace_Node* but shall remain void in declaration for generic data structure usage. More...
 

Functions

SOPC_AddressSpaceSOPC_AddressSpace_Create (bool free_nodes)
 Create an empty AddressSpace to fill with nodes with SOPC_AddressSpace_Append. More...
 
bool SOPC_AddressSpace_AreNodesReleasable (const SOPC_AddressSpace *space)
 Returns true if the AddressSpace will release nodes on SOPC_AddressSpace_Delete. It means it has been created using SOPC_AddressSpace_Create with (free_nodes=true) More...
 
SOPC_AddressSpaceSOPC_AddressSpace_CreateReadOnlyNodes (uint32_t nb_nodes, SOPC_AddressSpace_Node *nodes, uint32_t nb_variables, SOPC_Variant *variables)
 Create an AddressSpace filled with given nodes and variants for variables values. The nodes are read only and cannot be modified and only the given variables values can be changed after AddresSpace creation. The Variable nodes values shall contain the index in the variants array as an UInt32 single value. More...
 
bool SOPC_AddressSpace_AreReadOnlyNodes (const SOPC_AddressSpace *space)
 Returns true if the AddressSpace has been created using SOPC_AddressSpace_CreateReadOnlyNodes. More...
 
SOPC_ReturnStatus SOPC_AddressSpace_Append (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 Appends a new node to the AddressSpace. More...
 
void SOPC_AddressSpace_Delete (SOPC_AddressSpace *space)
 Deletes the AddressSpace content. It clears the Variable / VariableType nodes values and clear/free each node when AddressSpace was created using SOPC_AddressSpace_Create with (free_nodes=true) configuration. More...
 
SOPC_AddressSpace_NodeSOPC_AddressSpace_Get_Node (SOPC_AddressSpace *space, const SOPC_NodeId *key, bool *found)
 
void SOPC_AddressSpace_ForEach (SOPC_AddressSpace *space, SOPC_AddressSpace_ForEach_Fct *pFunc, uintptr_t user_data)
 
bool SOPC_AddressSpace_Has_Attribute (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node, SOPC_AttributeId attribute)
 
OpcUa_NodeClassSOPC_AddressSpace_Get_NodeClass (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_NodeIdSOPC_AddressSpace_Get_NodeId (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_QualifiedNameSOPC_AddressSpace_Get_BrowseName (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_LocalizedTextSOPC_AddressSpace_Get_DisplayName (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_LocalizedTextSOPC_AddressSpace_Get_Description (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
uint32_t * SOPC_AddressSpace_Get_WriteMask (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
uint32_t * SOPC_AddressSpace_Get_UserWriteMask (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
int32_t * SOPC_AddressSpace_Get_NoOfReferences (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
OpcUa_ReferenceNode ** SOPC_AddressSpace_Get_References (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_VariantSOPC_AddressSpace_Get_Value (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_Byte SOPC_AddressSpace_Get_AccessLevel (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_Boolean SOPC_AddressSpace_Get_Executable (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_NodeIdSOPC_AddressSpace_Get_DataType (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
int32_t * SOPC_AddressSpace_Get_ValueRank (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
int32_t SOPC_AddressSpace_Get_NoOfArrayDimensions (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
uint32_t * SOPC_AddressSpace_Get_ArrayDimensions (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_ExtensionObjectSOPC_AddressSpace_Get_DataTypeDefinition (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_BooleanSOPC_AddressSpace_Get_IsAbstract (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
SOPC_StatusCode SOPC_AddressSpace_Get_StatusCode (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
bool SOPC_AddressSpace_Set_StatusCode (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node, SOPC_StatusCode status)
 
SOPC_Value_Timestamp SOPC_AddressSpace_Get_SourceTs (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 
bool SOPC_AddressSpace_Set_SourceTs (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node, SOPC_Value_Timestamp ts)
 
void SOPC_AddressSpace_Node_Initialize (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node, OpcUa_NodeClass element_type)
 
void SOPC_AddressSpace_Node_Clear (SOPC_AddressSpace *space, SOPC_AddressSpace_Node *node)
 

Macro Definition Documentation

◆ FOR_EACH_ELEMENT_TYPE

#define FOR_EACH_ELEMENT_TYPE (   x,
  extra 
)
Value:
x(DataType, data_type, extra) x(Method, method, extra) x(Object, object, extra) x(ObjectType, object_type, extra) \
x(ReferenceType, reference_type, extra) x(Variable, variable, extra) x(VariableType, variable_type, extra) \
x(View, view, extra)

AddressSpace module provides an abstract representation of the address space. This is the representation provided by AddressSpace loaders SOPC_Embedded_AddressSpace_Load or SOPC_UANodeSet_Parse or might be used to build an AddressSpace from scratch.

Note
Once configured the AddressSpace is managed by services layer and shall not be accessed directly. AddressSpaceAccess might be provided for limited scopes (e.g. method call implementation).

Typedef Documentation

◆ SOPC_Value_Timestamp

◆ SOPC_AddressSpace

typedef struct _SOPC_AddressSpace SOPC_AddressSpace

◆ SOPC_AddressSpace_ForEach_Fct

typedef void SOPC_AddressSpace_ForEach_Fct(const uintptr_t key, const uintptr_t value, uintptr_t user_data)

Type of callback functions for SOPC_AddressSpace_ForEach. Both the key and value belong to the address space and shall not be modified. The value of user_data is set when calling SOPC_AddressSpace_ForEach. Note: key actual type is const SOPC_NodeId* but shall remain void in declaration for generic data structure usage Note: value actual type is const SOPC_AddressSpace_Node* but shall remain void in declaration for generic data structure usage.

Function Documentation

◆ SOPC_AddressSpace_Create()

SOPC_AddressSpace* SOPC_AddressSpace_Create ( bool  free_nodes)

Create an empty AddressSpace to fill with nodes with SOPC_AddressSpace_Append.

Warning
The NodeManagement services are incompatible with an AddressSpace created with parameter free_nodes = false
Parameters
free_nodesindicates if the nodes shall be freed on call to SOPC_AddressSpace_Delete. In order to have NodeManagement services enabled, this parameter shall be set to true.
Returns
the created AddressSpace to fill with nodes

◆ SOPC_AddressSpace_AreNodesReleasable()

bool SOPC_AddressSpace_AreNodesReleasable ( const SOPC_AddressSpace space)

Returns true if the AddressSpace will release nodes on SOPC_AddressSpace_Delete. It means it has been created using SOPC_AddressSpace_Create with (free_nodes=true)

Parameters
spacethe AddressSpace to be evaluated
Returns
true if the AddressSpace nodes will be freed on call to SOPC_AddressSpace_Delete, false otherwise

◆ SOPC_AddressSpace_CreateReadOnlyNodes()

SOPC_AddressSpace* SOPC_AddressSpace_CreateReadOnlyNodes ( uint32_t  nb_nodes,
SOPC_AddressSpace_Node nodes,
uint32_t  nb_variables,
SOPC_Variant variables 
)

Create an AddressSpace filled with given nodes and variants for variables values. The nodes are read only and cannot be modified and only the given variables values can be changed after AddresSpace creation. The Variable nodes values shall contain the index in the variants array as an UInt32 single value.

Note
This functionality allows to have a constant nodes array that can be stored in ROM on device with limited memory resources.
Warning
The NodeManagement services are incompatible with an AddressSpace created with this function
Parameters
nb_nodesthe number of nodes in the nodes array
nodesthe array of nodes contained by this constant AddressSpace, the Variable(/VariableType) nodes Value field shall contain the index in the variables array containing the actual value as a single UInt32 value. And the nodes array shall be constant to be stored in ROM.
nb_variablesthe number of variants in the variables array
variablesthe array containing the actual Variable nodes Value field.
Returns
the created read only nodes AddressSpace

◆ SOPC_AddressSpace_AreReadOnlyNodes()

bool SOPC_AddressSpace_AreReadOnlyNodes ( const SOPC_AddressSpace space)

Returns true if the AddressSpace has been created using SOPC_AddressSpace_CreateReadOnlyNodes.

Parameters
spacethe AddressSpace to be evaluated
Returns
true if the AddressSpace nodes are read only, false otherwise

◆ SOPC_AddressSpace_Append()

SOPC_ReturnStatus SOPC_AddressSpace_Append ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

Appends a new node to the AddressSpace.

Parameters
spacethe AddressSpace to which the node will be appended
nodethe node to append
Returns
SOPC_STATUS_OK in case of success, SOPC_STATUS_INVALID_STATE if the AddressSpace nodes are read only and SOPC_STATUS_NOK in other cases of failure.

◆ SOPC_AddressSpace_Delete()

void SOPC_AddressSpace_Delete ( SOPC_AddressSpace space)

Deletes the AddressSpace content. It clears the Variable / VariableType nodes values and clear/free each node when AddressSpace was created using SOPC_AddressSpace_Create with (free_nodes=true) configuration.

Parameters
spacethe AddressSpace to delete

◆ SOPC_AddressSpace_Get_Node()

SOPC_AddressSpace_Node* SOPC_AddressSpace_Get_Node ( SOPC_AddressSpace space,
const SOPC_NodeId key,
bool *  found 
)

◆ SOPC_AddressSpace_ForEach()

void SOPC_AddressSpace_ForEach ( SOPC_AddressSpace space,
SOPC_AddressSpace_ForEach_Fct pFunc,
uintptr_t  user_data 
)

◆ SOPC_AddressSpace_Has_Attribute()

bool SOPC_AddressSpace_Has_Attribute ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node,
SOPC_AttributeId  attribute 
)

◆ SOPC_AddressSpace_Get_NodeClass()

OpcUa_NodeClass* SOPC_AddressSpace_Get_NodeClass ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_NodeId()

SOPC_NodeId* SOPC_AddressSpace_Get_NodeId ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_BrowseName()

SOPC_QualifiedName* SOPC_AddressSpace_Get_BrowseName ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_DisplayName()

SOPC_LocalizedText* SOPC_AddressSpace_Get_DisplayName ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_Description()

SOPC_LocalizedText* SOPC_AddressSpace_Get_Description ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_WriteMask()

uint32_t* SOPC_AddressSpace_Get_WriteMask ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_UserWriteMask()

uint32_t* SOPC_AddressSpace_Get_UserWriteMask ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_NoOfReferences()

int32_t* SOPC_AddressSpace_Get_NoOfReferences ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_References()

OpcUa_ReferenceNode** SOPC_AddressSpace_Get_References ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_Value()

SOPC_Variant* SOPC_AddressSpace_Get_Value ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_AccessLevel()

SOPC_Byte SOPC_AddressSpace_Get_AccessLevel ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_Executable()

SOPC_Boolean SOPC_AddressSpace_Get_Executable ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_DataType()

SOPC_NodeId* SOPC_AddressSpace_Get_DataType ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_ValueRank()

int32_t* SOPC_AddressSpace_Get_ValueRank ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_NoOfArrayDimensions()

int32_t SOPC_AddressSpace_Get_NoOfArrayDimensions ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_ArrayDimensions()

uint32_t* SOPC_AddressSpace_Get_ArrayDimensions ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_DataTypeDefinition()

SOPC_ExtensionObject* SOPC_AddressSpace_Get_DataTypeDefinition ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_IsAbstract()

SOPC_Boolean* SOPC_AddressSpace_Get_IsAbstract ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Get_StatusCode()

SOPC_StatusCode SOPC_AddressSpace_Get_StatusCode ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Set_StatusCode()

bool SOPC_AddressSpace_Set_StatusCode ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node,
SOPC_StatusCode  status 
)

◆ SOPC_AddressSpace_Get_SourceTs()

SOPC_Value_Timestamp SOPC_AddressSpace_Get_SourceTs ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)

◆ SOPC_AddressSpace_Set_SourceTs()

bool SOPC_AddressSpace_Set_SourceTs ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node,
SOPC_Value_Timestamp  ts 
)

◆ SOPC_AddressSpace_Node_Initialize()

void SOPC_AddressSpace_Node_Initialize ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node,
OpcUa_NodeClass  element_type 
)

◆ SOPC_AddressSpace_Node_Clear()

void SOPC_AddressSpace_Node_Clear ( SOPC_AddressSpace space,
SOPC_AddressSpace_Node node 
)