High Performance OPC UA Server SDK  1.4.2.279
management

General addressspace management like register/unregister namespaces. More...

Data Structures

struct  ua_addressspace_config
 

Enumerations

enum  ua_addressspace_index_type { UA_INDEX_BTREE, UA_INDEX_HASHTABLE, UA_INDEX_HASHTABLEQP }
 Possible index types for nodes in the addressspace. More...
 
enum  ua_addressspace_loading_mode { UA_LOADING_MODE_CREATE, UA_LOADING_MODE_UPDATE }
 

Functions

int ua_addressspace_init (void)
 Allocate resources for addressspace management. More...
 
void ua_addressspace_clear (void)
 Remove all registered namespaces from the addressspace and free their resources.
 
void ua_addressspace_config_init (struct ua_addressspace_config *config)
 Initialize the given ua_addressspace_config structure.
 
void ua_addressspace_config_clear (struct ua_addressspace_config *config)
 Clears the given ua_addressspace_config structure.
 
void ua_addressspace_config_trace (const char *name, struct ua_addressspace_config *config)
 
int ua_addressspace_register (const char *url, struct ua_addressspace_config *config, enum ua_addressspace_index_type type)
 Registers a new namespace. More...
 
int ua_addressspace_register_static (const char *url, int hashtablesize, struct mem_objectpool_static *nodepool, struct mem_objectpool_static *varpool, struct mem_objectpool_static *vartypepool, struct mem_objectpool_static *methodpool, struct mem_objectpool_static *refpool, struct mem_objectpool_static *stringpool, const char *const stringtable[], struct mem_objectpool_static *guidpool, struct mem_objectpool_static *dimpool, uint16_t nsidx, unsigned int num_placeholders, enum ua_addressspace_index_type type)
 Registers a new namespace. More...
 
void ua_addressspace_unregister (uint16_t nsidx)
 Unregister a namespace from the addressspace. More...
 
struct ua_addressspaceua_addressspace_getaddr (uint16_t nsidx)
 Get the pointer to the ua_addressspace struct of a namespace. More...
 
struct ua_addressspaceua_addressspace_lookup_uri (const char *nsuri)
 Finds address space context by is URI. More...
 
bool ua_addressspace_is_static (struct ua_addressspace *addr)
 Returns true if the address space is static. More...
 
uint16_t ua_addressspace_get_nsidx (struct ua_addressspace *addr)
 Returns the namespace index for the given address space. More...
 
const char * ua_addressspace_get_nsuri (struct ua_addressspace *addr)
 Returns the namespace URI for the given address space. More...
 
int ua_addressspace_foreach_node (uint16_t nsidx, int(*callback)(ua_node_t handle))
 Iterates over all nodes in namespace and calls the given callback. More...
 
void ua_addressspace_set_digest (const unsigned char *digest, size_t len)
 Set the digest which was used to generate NS0. More...
 
bool ua_addressspace_verify_digest (const unsigned char *digest, size_t len)
 Returns true if the digest is ok, false otherwise. More...
 
void ua_addressspace_print_stat (uint16_t)
 Print addressspace statistics for a namespace. More...
 

Detailed Description

General addressspace management like register/unregister namespaces.

Enumeration Type Documentation

◆ ua_addressspace_index_type

Possible index types for nodes in the addressspace.

Enumerator
UA_INDEX_BTREE 

Index using a binary tree (not implemented).

UA_INDEX_HASHTABLE 

Index using a hashtable with linked list for collision handling.

UA_INDEX_HASHTABLEQP 

Index using a hashtable with quadratic probing for collision handling.

◆ ua_addressspace_loading_mode

Enumerator
UA_LOADING_MODE_CREATE 

Creates the namespaces that get loaded.

UA_LOADING_MODE_UPDATE 

Updates the namespace that get loaded.

The namespaces must already exist.

Function Documentation

◆ ua_addressspace_foreach_node()

int ua_addressspace_foreach_node ( uint16_t  nsidx,
int(*)(ua_node_t handle)  callback 
)

Iterates over all nodes in namespace and calls the given callback.

This functions uses the internal hashtable to iterate efficiently over all nodes without the need of following UA references.

Parameters
nsidxNamespace to iterate through.
callbackCallback to call for each node. This callback will receive the node handle, so you can perform any task on the node. A typical usage of callback is to use simply ua_node_remove as callback, which will remove all nodes of the give namespace.
Returns

◆ ua_addressspace_get_nsidx()

uint16_t ua_addressspace_get_nsidx ( struct ua_addressspace addr)

Returns the namespace index for the given address space.

Parameters
addrAddress space context.
Returns
The namespace index this address space was registered for.

◆ ua_addressspace_get_nsuri()

const char* ua_addressspace_get_nsuri ( struct ua_addressspace addr)

Returns the namespace URI for the given address space.

Parameters
addrAddress space context.
Returns
The namespace URI this address space was registered for.

◆ ua_addressspace_getaddr()

struct ua_addressspace* ua_addressspace_getaddr ( uint16_t  nsidx)

Get the pointer to the ua_addressspace struct of a namespace.

Parameters
nsidxIndex of the namespace.
Returns
Valid pointer on success or NULL on failure.

◆ ua_addressspace_init()

int ua_addressspace_init ( void  )

Allocate resources for addressspace management.

Returns
Zero on success or errorcode on failure.

◆ ua_addressspace_is_static()

bool ua_addressspace_is_static ( struct ua_addressspace addr)

Returns true if the address space is static.

Static means it's compiled into the application and is constant. On embedded systems static address space can lie in ROM.

◆ ua_addressspace_lookup_uri()

struct ua_addressspace* ua_addressspace_lookup_uri ( const char *  nsuri)

Finds address space context by is URI.

Parameters
nsuriNamespace URI of the namespace.
Returns
Valid pointer on success or NULL on failure.

◆ ua_addressspace_print_stat()

void ua_addressspace_print_stat ( uint16_t  nsidx)

Print addressspace statistics for a namespace.

The statistics are printed to trace at level debug and facility session.

Parameters
nsidxindex of namespace to print statistics for

◆ ua_addressspace_register()

int ua_addressspace_register ( const char *  url,
struct ua_addressspace_config config,
enum ua_addressspace_index_type  type 
)

Registers a new namespace.

Parameters
urlURL of namespace.
configAddress space configuration which defines the pool sizes.
typeIndex type to use for indexing nodes. Note: Using UA_INDEX_HASHTABLEQP is not allowed as deleting nodes would corrupt the hashtable.
Returns
Returns the assigned namespace index or negative errorcode in case of an error.

◆ ua_addressspace_register_static()

int ua_addressspace_register_static ( const char *  url,
int  hashtablesize,
struct mem_objectpool_static nodepool,
struct mem_objectpool_static varpool,
struct mem_objectpool_static vartypepool,
struct mem_objectpool_static methodpool,
struct mem_objectpool_static refpool,
struct mem_objectpool_static stringpool,
const char *const  stringtable[],
struct mem_objectpool_static guidpool,
struct mem_objectpool_static dimpool,
uint16_t  nsidx,
unsigned int  num_placeholders,
enum ua_addressspace_index_type  type 
)

Registers a new namespace.

Parameters
urlURL of namespace.
hashtablesizeSize of hashtable for indexing nodes.
nodepoolStatic memory pool of nodes.
varpoolStatic memory pool of variables.
vartypepoolStatic memory pool of variable types.
methodpoolStatic memory pool of methods.
refpoolStatic memory pool of references.
stringpoolStatic memory pool of strings.
stringtableString table with const strings.
guidpoolStatic memory pool of guids.
dimpoolStatic memory pool of guids.
nsidxRequested namespace index. Set to -1 if you don't care.
num_placeholdersNumber of placeholde references that get allocated in RAM.
typeIndex type to use for indexing nodes.
Returns
Returns the assigned namespace index or -1 in case of an error.

◆ ua_addressspace_set_digest()

void ua_addressspace_set_digest ( const unsigned char *  digest,
size_t  len 
)

Set the digest which was used to generate NS0.

◆ ua_addressspace_unregister()

void ua_addressspace_unregister ( uint16_t  nsidx)

Unregister a namespace from the addressspace.

Remove all nodes from the given namespace.

Parameters
nsidxindex of the namespace to unregister.

◆ ua_addressspace_verify_digest()

bool ua_addressspace_verify_digest ( const unsigned char *  digest,
size_t  len 
)

Returns true if the digest is ok, false otherwise.