High Performance OPC UA Server SDK  1.7.1.383

Functions and definitions for using the valuestore infrastructure of the SDK. More...

Modules

 NS Metadata Store
 This store is used to access certain values of Properties of NamespaceMetadataType Objects.
 
 ua_callbackstore
 This store uses a node's user index to store a callback per node for accessing the value.
 
 ua_rolestore
 This store is used to access the values of Properties of RoleType Objects.
 
 ua_structurestore
 This store uses a node's user index to store the pointer to a UA structure or scalar.
 

Data Structures

struct  ua_valuestore_interface
 
struct  ua_floatstore
 Implementation of a store using in-memory float values. More...
 
struct  ua_memorystore
 Implementation of a store using in-memory values. More...
 
struct  ua_pointerstore
 Implementation of a store using in-memory float values. More...
 
struct  ua_staticstore
 Implementation of a store using preencoded values. More...
 
struct  ua_uint32store
 Implementation of a store using in-memory uint32 values. More...
 

Macros

#define UA_VALUESTORE_IDX_STRUCTURESTORE   240
 Fixed index for the structurestore.
 
#define UA_VALUESTORE_IDX_CALLBACKSTORE   241
 Fixed index for the callbackstore.
 
#define UA_VALUESTORE_IDX_ROLESTORE   242
 Fixed index for the rolestore.
 
#define UA_VALUESTORE_IDX_NSMETADATASTORE   243
 Fixed index for the NS metadatastore.
 
#define UA_VALUESTORE_IDX_FILETYPESTORE   244
 Fixed index for the NS filetypestore.
 
#define UA_VALUESTORE_IDX_TRUSTLISTSTORE   245
 Fixed index for the trustlist store.
 

Typedefs

typedef void(* ua_valuestore_get) (void *store, ua_node_t node, unsigned int valueindex, bool source_ts, struct ua_indexrange *range, unsigned int num_ranges, struct ua_datavalue *value)
 Get the value identified with valueindex from the store. More...
 
typedef void(* ua_valuestore_get2) (void *store, const struct ua_valuestore_address_info *address, const struct ua_valuestore_servicecall_info *info, struct ua_datavalue *value)
 Get the value identified with valueindex from the store. More...
 
typedef ua_statuscode(* ua_valuestore_attach) (void *store, ua_node_t node, unsigned int valueindex, struct ua_indexrange *range, unsigned int num_ranges, struct ua_datavalue *value)
 Attach the value identified with valueindex to the store. More...
 
typedef ua_statuscode(* ua_valuestore_attach2) (void *store, const struct ua_valuestore_address_info *address, const struct ua_valuestore_servicecall_info *info, struct ua_datavalue *value)
 Attach the value identified with valueindex to the store. More...
 
typedef int(* ua_valuestore_add) (void *store, unsigned int *valueindex, const char *data, unsigned int len)
 Adds a new value to the store. More...
 

Functions

SERVER_EXPORT void ua_valuestore_interface_init (struct ua_valuestore_interface *store_interface)
 Initialize a ua_store_interface structure.
 
SERVER_EXPORT int ua_valuestore_register_store (struct ua_valuestore_interface *store_if, uint8_t *storeindex)
 Register a new store. More...
 
SERVER_EXPORT int ua_valuestore_unregister_store (uint8_t storeindex)
 Unregister a store. More...
 
SERVER_EXPORT struct ua_valuestore_interfaceua_valuestore_get_storeif (uint8_t storeindex)
 
SERVER_EXPORT int ua_valuestore_get_store_index (const void *store)
 Returns the store index if the given store. More...
 
SERVER_EXPORT uint8_t ua_valuestore_constrain_store_index (unsigned int storeindex)
 Contrains the unsigned int storeindex to the allowed range. More...
 
SERVER_EXPORT int ua_valuestore_attach_value (const struct ua_valuestore_address_info *address, const struct ua_valuestore_servicecall_info *info, struct ua_datavalue *value, ua_statuscode *result)
 Attach a value to a node using the valuestore configured for the node. More...
 
SERVER_EXPORT int ua_valuestore_get_value (const struct ua_valuestore_address_info *address, const struct ua_valuestore_servicecall_info *info, struct ua_datavalue *value)
 Get a value from a node using the valuestore configured for the node. More...
 

Detailed Description

Functions and definitions for using the valuestore infrastructure of the SDK.

For store implementations provided by the SDK see:

Overview of available store implementations:

Store Get Attach Add Remarks
StaticStore yes no yes Ready only pre-encoded variant data.
MemoryStore yes yes yes Stores data in array of ua_variant
FloatStore yes yes no Only supports UA_VT_FLOAT.
UInt32Store yes yes no Only supports UA_VT_UINT32.
PointerStore yes yes no Only supports scalar data types.
StructureStore yes no no Supports UA structures and scalars.
CallbackStore yes yes no Registers a callback per node.

Typedef Documentation

◆ ua_valuestore_add

typedef int(* ua_valuestore_add) (void *store, unsigned int *valueindex, const char *data, unsigned int len)

Adds a new value to the store.

This function is used for populating a value store at startup, e.g. by loading a binary file. Because this data typically is read-only (see ua_staticstore), this data is pre-encoded as variant, which means it can be written to the wire with a simple memcpy and no serialization is necessary.

Parameters
storeThe store to add the value to.
valueindexThe assigned valueindex returned by the store.
dataThe value to add, which is a pre-encoded variant value in UA Binary format. This can be attached to a variant using the type UA_VT_ENCODED_BINARY.
lenThe length of data in bytes.

◆ ua_valuestore_attach

typedef ua_statuscode(* ua_valuestore_attach) (void *store, ua_node_t node, unsigned int valueindex, struct ua_indexrange *range, unsigned int num_ranges, struct ua_datavalue *value)

Attach the value identified with valueindex to the store.

This function may take responsibility for the given ua_datavalue struct and clear it. In case of an error a bad statuscode must be returned.

This function is used to implement writing of the value attribute. It is designed to take the ownership of the value and does not perform a deep copy. Hence it is named attach instead of write or set.

For an example how to implement this function see: Write Value

◆ ua_valuestore_attach2

typedef ua_statuscode(* ua_valuestore_attach2) (void *store, const struct ua_valuestore_address_info *address, const struct ua_valuestore_servicecall_info *info, struct ua_datavalue *value)

Attach the value identified with valueindex to the store.

This function may take responsibility for the given ua_datavalue struct and clear it. In case of an error a bad statuscode must be returned.

This function is used to implement writing of the value attribute. It is designed to take the ownership of the value and does not perform a deep copy. Hence it is named attach instead of write or set.

This is an extended version of ua_valuestore_attach.

◆ ua_valuestore_get

typedef void(* ua_valuestore_get) (void *store, ua_node_t node, unsigned int valueindex, bool source_ts, struct ua_indexrange *range, unsigned int num_ranges, struct ua_datavalue *value)

Get the value identified with valueindex from the store.

The function must copy the value in the provided ua_datavalue struct. In case of an error while getting the value the statuscode of the value be set to the corresponding bad statuscode.

This function is used to implement reading of the value attribute.

For an example how to implement this function see: Read Value

◆ ua_valuestore_get2

typedef void(* ua_valuestore_get2) (void *store, const struct ua_valuestore_address_info *address, const struct ua_valuestore_servicecall_info *info, struct ua_datavalue *value)

Get the value identified with valueindex from the store.

The function must copy the value in the provided ua_datavalue struct. In case of an error while getting the value the statuscode of the value be set to the corresponding bad statuscode.

This function is used to implement reading of the value attribute.

This is an extended version of ua_valuestore_get.

Function Documentation

◆ ua_valuestore_attach_value()

SERVER_EXPORT int ua_valuestore_attach_value ( const struct ua_valuestore_address_info address,
const struct ua_valuestore_servicecall_info info,
struct ua_datavalue value,
ua_statuscode result 
)

Attach a value to a node using the valuestore configured for the node.

Parameters
addressAddress info of the node, may be retrieved with ua_variable_get_access_level_address.
infoService call info, may be given for more options. If the session is not NULL, permissions will be checked. This parameter is optional.
valueThe value to attach, the store may or may not take ownership, in any case it is left in a consistent condition and should be cleared afterwards.
resultStatuscode returned from the attach function. If the return value is not good this value is not set.
Returns
Returns zero on success or a negative errorcode on failure, if the attach function cannot be called. Especially UA_EBADNOTIMPL if a store has no attach function implemented.

◆ ua_valuestore_constrain_store_index()

SERVER_EXPORT uint8_t ua_valuestore_constrain_store_index ( unsigned int  storeindex)

Contrains the unsigned int storeindex to the allowed range.

Parameters
storeindexThe store index to be verified.
Returns
Either a valid store index or 0 if the storeindex is out of range. 0 is not an allowed store index.

◆ ua_valuestore_get_store_index()

SERVER_EXPORT int ua_valuestore_get_store_index ( const void *  store)

Returns the store index if the given store.

Returns
Store index or UA_EBADNOTFOUND if the given store was not found.

◆ ua_valuestore_get_value()

SERVER_EXPORT int ua_valuestore_get_value ( const struct ua_valuestore_address_info address,
const struct ua_valuestore_servicecall_info info,
struct ua_datavalue value 
)

Get a value from a node using the valuestore configured for the node.

Parameters
addressAddress info of the node, may be retrieved with ua_variable_get_access_level_address.
infoService call info, may be given for more options. If the session is not NULL, permissions will be checked. This parameter is optional.
valueA datavalue for the store to write the value into. This structure is only valid when the function returns zero, otherwise it must be ignored.
Returns
Returns zero on success or a negative errorcode on failure, if the get function cannot be called. Especially UA_EBADNOTIMPL if a store has no get function implemented.

◆ ua_valuestore_register_store()

SERVER_EXPORT int ua_valuestore_register_store ( struct ua_valuestore_interface store_if,
uint8_t *  storeindex 
)

Register a new store.

Parameters
store_ifStore context and functions for the new store. This function will create a copy of the struct so caller is responsible for freeing memory.
storeindexPointer to store index. If the store index is 0 the next free index will be assigned and written to this value. If the store index is not 0 this index will be assigned to the store, if this index was already taken by another store an error is returned.
Returns
Zero on success or errorcode on failure.

◆ ua_valuestore_unregister_store()

SERVER_EXPORT int ua_valuestore_unregister_store ( uint8_t  storeindex)

Unregister a store.

Parameters
storeindexIndex of store to unregister.
Returns
Zero on success or errorcode on failure.