High Performance OPC UA Server SDK  1.7.1.383
ua_type_table

Management for builtin and custom structures registered at the encoder. More...

Data Structures

struct  ua_type_table_base_fcts
 Base functions for builtin types. More...
 
struct  ua_type_table_encoder_fcts
 Encode and decode functions for builtin types. More...
 
struct  ua_type_table_idx_table
 Index table for a type table to enable an efficient lookup using the encoding id. More...
 
struct  ua_type_table
 Struct for one entry in the type table. More...
 

Enumerations

enum  ua_type_table_sorting { UA_TYPE_TABLE_SORTING_NONE, UA_TYPE_TABLE_SORTING_ASC, UA_TYPE_TABLE_SORTING_IDX_TABLE }
 Possible sortings for custom type tables to be registered. More...
 

Functions

BASE_EXPORT const struct ua_type_tableua_type_table_find (uint16_t ns)
 Lookup the type table for a certain namespace index. More...
 
BASE_EXPORT int ua_type_table_register_table (const char *ns_url, uint16_t nsidx, struct ua_dict_structure *structures, uint16_t num_structures, uint16_t max_structures, enum ua_type_table_sorting sorting)
 Register new type table for a certain namespace. More...
 
BASE_EXPORT int ua_type_table_register_const_table (const char *ns_url, uint16_t nsidx, const struct ua_dict_structure *structures, uint16_t num_structures, enum ua_type_table_sorting sorting)
 Register new constant type table for a certain namespace. More...
 
BASE_EXPORT int ua_type_table_register_const_table_with_idx_table (const char *ns_url, uint16_t nsidx, const struct ua_dict_structure *structures, uint16_t num_structures, const struct ua_type_table_idx_table *idx_table)
 Like ua_type_table_register_const_table, but with an additional index table for efficient lookup. More...
 
BASE_EXPORT int ua_type_table_register_structure (uint16_t nsidx, const struct ua_dict_structure *structure)
 Add a new type to an existing type table. More...
 
BASE_EXPORT int ua_type_table_init (const struct ua_type_table_encoder_fcts *ns0_encoder_fcts)
 Register the encoder functions for ns 0 and validate ns 0 types. More...
 
BASE_EXPORT void ua_type_table_clear (void)
 Clear all registered type tables. More...
 
BASE_EXPORT const struct ua_dict_structureua_type_table_lookup_local_type (uint16_t local_ns, uint32_t local_type)
 Lookup a structure description by its local type. More...
 
BASE_EXPORT const struct ua_dict_structureua_type_table_lookup_binary_encoding (const struct ua_nodeid *binary_encoding_id, uint32_t *local_type)
 Lookup a structure description by its binary encoding id. More...
 
BASE_EXPORT const struct ua_dict_structureua_type_table_lookup_type_id (const struct ua_nodeid *type_id, uint32_t *local_type)
 Lookup a structure description by its type id. More...
 
BASE_EXPORT void ua_type_table_clear_structure (uint16_t local_ns, uint32_t local_type, void *val)
 Clear a structure identified by its local namespace and type.
 
BASE_EXPORT int ua_type_table_compare_structure (uint16_t local_ns, uint32_t local_type, const void *a, const void *b)
 Compare two structures of the same type identified by their local namespace and type.
 
BASE_EXPORT int ua_type_table_copy_structure (uint16_t local_ns, uint32_t local_type, void *dst, const void *src)
 Copy a structure identified by its local namespace and type.
 
BASE_EXPORT SDK_INTERNAL int ua_type_table_create_nsidx_mapping (const struct ua_string *ns_array, uint16_t num_ns_array, struct ua_nsmap **map, int32_t *num_map)
 Create a namespace index mapping table for the locally registered type tables and the given remote urls. More...
 

Variables

BASE_EXPORT const struct ua_type_table_base_fcts g_base_fcts_ns0 [UA_TYPE_TABLE_NUM_NS0_FCTS]
 Array with namespace zero builtin base functions (copy, compare, clear)
 
BASE_EXPORT const struct ua_dict_structure g_type_table_ns0 [UA_TYPE_NUM_VALUES - countof(g_base_fcts_ns0)]
 Array with namespace zero structures.
 
BASE_EXPORT const struct ua_type_table_idx_table g_type_table_ns0_idx_table [UA_TYPE_NUM_VALUES - countof(g_base_fcts_ns0)]
 Index table for g_type_table_ns0.
 

Detailed Description

Management for builtin and custom structures registered at the encoder.

These are automatically decoded when found inside an extensionobject.

Enumeration Type Documentation

◆ ua_type_table_sorting

Possible sortings for custom type tables to be registered.

Based on the sorting the lookup function is chosen.

Enumerator
UA_TYPE_TABLE_SORTING_NONE 

The table is not sorted at all.

UA_TYPE_TABLE_SORTING_ASC 

The type ids and encoding ids are each sorted numerical ascending.

UA_TYPE_TABLE_SORTING_IDX_TABLE 

The table is sorted ascending by type id and an additional index table is used for lookup by encoding id.

Function Documentation

◆ ua_type_table_clear()

BASE_EXPORT void ua_type_table_clear ( void  )

Clear all registered type tables.

Called during encoder cleanup.

◆ ua_type_table_create_nsidx_mapping()

BASE_EXPORT SDK_INTERNAL int ua_type_table_create_nsidx_mapping ( const struct ua_string ns_array,
uint16_t  num_ns_array,
struct ua_nsmap **  map,
int32_t *  num_map 
)

Create a namespace index mapping table for the locally registered type tables and the given remote urls.

Parameters
ns_arrayArray of namespace urls, the index in the array is used as the remote index in the resulting map.
num_ns_arrayNumber of entries in the array.
mapThe nsidx map is allocated by this function and must be freed by the caller with ipc_free, if the function indicates success.
num_mapNumber of entries in the map.
Returns
Zero on success or negative errorcode on failure.

◆ ua_type_table_find()

BASE_EXPORT const struct ua_type_table* ua_type_table_find ( uint16_t  ns)

Lookup the type table for a certain namespace index.

Parameters
nsThe namespace index to search for.

◆ ua_type_table_init()

BASE_EXPORT int ua_type_table_init ( const struct ua_type_table_encoder_fcts ns0_encoder_fcts)

Register the encoder functions for ns 0 and validate ns 0 types.

Called during the encoder initialization.

◆ ua_type_table_lookup_binary_encoding()

BASE_EXPORT const struct ua_dict_structure* ua_type_table_lookup_binary_encoding ( const struct ua_nodeid binary_encoding_id,
uint32_t *  local_type 
)

Lookup a structure description by its binary encoding id.

Parameters
binary_encoding_idThe node id of the binary encoding node.
local_typeIf not NULL the local type of the found structure is written to this address.
Returns
Pointer to the structure description or NULL if not found.

◆ ua_type_table_lookup_local_type()

BASE_EXPORT const struct ua_dict_structure* ua_type_table_lookup_local_type ( uint16_t  local_ns,
uint32_t  local_type 
)

Lookup a structure description by its local type.

Parameters
local_nsThe namespace index of the type.
local_typeThe SDK internal typeid of this type.
Returns
Pointer to the structure description or NULL if not found.

◆ ua_type_table_lookup_type_id()

BASE_EXPORT const struct ua_dict_structure* ua_type_table_lookup_type_id ( const struct ua_nodeid type_id,
uint32_t *  local_type 
)

Lookup a structure description by its type id.

Parameters
type_idThe node id of the type node.
local_typeIf not NULL the local type of the found structure is written to this address.
Returns
Pointer to the structure description or NULL if not found.

◆ ua_type_table_register_const_table()

BASE_EXPORT int ua_type_table_register_const_table ( const char *  ns_url,
uint16_t  nsidx,
const struct ua_dict_structure structures,
uint16_t  num_structures,
enum ua_type_table_sorting  sorting 
)

Register new constant type table for a certain namespace.

Parameters
ns_urlNamespace url of the new types, there can only be one table for each namespace.
nsidxNamespace index of the new types, there can only be one table for each namespace.
structuresArray with descriptions of the new types.
num_structuresNumber of valid entries in the structures array.
sortingSorting of the new types, in case of UA_TYPE_TABLE_SORTING_NONE this function will try to use a better sorting.
Returns
Zero on success or errorcode on error.

◆ ua_type_table_register_const_table_with_idx_table()

BASE_EXPORT int ua_type_table_register_const_table_with_idx_table ( const char *  ns_url,
uint16_t  nsidx,
const struct ua_dict_structure structures,
uint16_t  num_structures,
const struct ua_type_table_idx_table idx_table 
)

Like ua_type_table_register_const_table, but with an additional index table for efficient lookup.

In case it is not possible to sort the structures array by both type id and encoding id ascending, this function allows the structures array to be sorted by type id and and additional index table that is sorted by encoding id. This allows an efficient lookup when searching by type id and encoding id. The index table must be of the same length as the structures array.

Returns
Zero on success or errorcode on error.

◆ ua_type_table_register_structure()

BASE_EXPORT int ua_type_table_register_structure ( uint16_t  nsidx,
const struct ua_dict_structure structure 
)

Add a new type to an existing type table.

The existing type table must have been registered with ua_type_table_register_table and still a free entry.

All memory referenced by the struct will be freed with ipc_free at shutdown. The struct itself will not be freed.

Parameters
nsidxNamespace index of the new type.
structureThe new type to add. All memory referenced by this struct will be freed with ipc_free at shutdown. The struct itself will not be freed.
Returns
Zero on success or errorcode on error.

◆ ua_type_table_register_table()

BASE_EXPORT int ua_type_table_register_table ( const char *  ns_url,
uint16_t  nsidx,
struct ua_dict_structure structures,
uint16_t  num_structures,
uint16_t  max_structures,
enum ua_type_table_sorting  sorting 
)

Register new type table for a certain namespace.

This functions allows to register new types right now, but also add single types later using ua_type_table_register_structure. At server shutdown the table and their referenced fields are freed using ipc_free.

Parameters
ns_urlNamespace url of the new types, there can only be one table for each namespace.
nsidxNamespace index of the new types, there can only be one table for each namespace.
structuresArray with descriptions of the new types.
num_structuresNumber of valid entries in the structures array, may also be 0.
max_structuresMaximum number of entries in the structres array. The difference to num_structes determines the number of types that can be added later.
sortingSorting of the types and all types added later.
Returns
Zero on success or errorcode on error.