High Performance OPC UA Server SDK
1.7.1.383
|
General addressspace management like register/unregister namespaces. More...
Data Structures | |
struct | ua_addressspace_config |
struct | ua_pool_stat |
Datatype used in ua_addressspace_pool_stat. More... | |
struct | ua_addressspace_pool_stat |
Datatype used in ua_addressspace_get_stat. More... | |
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, UA_LOADING_MODE_CREATE_OR_UPDATE } |
The loading mode defines how files are loaded in ua_addressspace_load_file. More... | |
Functions | |
SERVER_EXPORT int | ua_addressspace_init (void) |
Allocate resources for addressspace management. More... | |
SERVER_EXPORT void | ua_addressspace_clear (void) |
Remove all registered namespaces from the addressspace and free their resources. | |
SERVER_EXPORT void | ua_addressspace_config_init (struct ua_addressspace_config *config) |
Initialize the given ua_addressspace_config structure. | |
SERVER_EXPORT void | ua_addressspace_config_clear (struct ua_addressspace_config *config) |
Clears the given ua_addressspace_config structure. | |
SERVER_EXPORT void | ua_addressspace_config_trace (const char *name, const struct ua_addressspace_config *config) |
SERVER_EXPORT int | ua_addressspace_register (const char *url, const struct ua_addressspace_config *config, enum ua_addressspace_index_type type) |
Registers a new namespace. More... | |
SERVER_EXPORT 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, struct ua_staticstore *dtdef_store, uint16_t nsidx, unsigned int num_placeholders, enum ua_addressspace_index_type type) |
Registers a new namespace. More... | |
SERVER_EXPORT void | ua_addressspace_unregister (uint16_t nsidx) |
Unregister a namespace from the addressspace. More... | |
SERVER_EXPORT struct ua_addressspace * | ua_addressspace_getaddr (uint16_t nsidx) |
Get the pointer to the ua_addressspace struct of a namespace. More... | |
SERVER_EXPORT struct ua_addressspace * | ua_addressspace_lookup_uri (const char *nsuri) |
Finds address space context by is URI. More... | |
SERVER_EXPORT bool | ua_addressspace_is_static (struct ua_addressspace *addr) |
Returns true if the address space is static. More... | |
SERVER_EXPORT uint16_t | ua_addressspace_get_nsidx (struct ua_addressspace *addr) |
Returns the namespace index for the given address space. More... | |
SERVER_EXPORT const char * | ua_addressspace_get_nsuri (struct ua_addressspace *addr) |
Returns the namespace URI for the given address space. More... | |
SERVER_EXPORT const char * | ua_addressspace_get_nsversion (const struct ua_addressspace *addr) |
Returns the namespace version for the given address space. More... | |
SERVER_EXPORT ua_datetime | ua_addressspace_get_nspublication_date (const struct ua_addressspace *addr) |
Returns the namespace publication_date for the given address space. More... | |
SERVER_EXPORT void | ua_addressspace_get_stat (struct ua_addressspace *addr, struct ua_addressspace_pool_stat *stat) |
Returns statistics of the address space's memory pools. More... | |
SERVER_EXPORT uint16_t | ua_addressspace_get_default_accessrestrictions (struct ua_addressspace *addr) |
Returns the namespace default accessrestrictions for the given addressspace object. | |
SERVER_EXPORT int | ua_addressspace_set_default_accessrestrictions (struct ua_addressspace *addr, uint16_t accessrestrictions) |
Set the namespace default accessrestrictions for the given addressspace object. More... | |
SERVER_EXPORT const struct ua_nodepermission * | ua_addressspace_get_default_rolepermissions (struct ua_addressspace *addr, uint16_t *num_perms) |
Get the namespace default rolepermissions for the given addressspace object. More... | |
SERVER_EXPORT int | ua_addressspace_set_default_rolepermissions (struct ua_addressspace *addr, const struct ua_nodepermission *perms, uint16_t num_perms) |
Set the namespace default rolepermissions for the given addressspace object. More... | |
SERVER_EXPORT int | ua_addressspace_set_default_default_rolepermissions (struct ua_addressspace *addr) |
Sets the namespace default rolepermissions for the given addressspace object to the SDK defaults. More... | |
SERVER_EXPORT 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... | |
SERVER_EXPORT int | ua_addressspace_foreach_node_ext (uint16_t nsidx, int(*callback2)(ua_node_t handle, void *userdata), void *userdata) |
Iterates over all nodes in namespace and calls the given callback. More... | |
SERVER_EXPORT void | ua_addressspace_set_digest (const unsigned char *digest, size_t len) |
Set the digest which was used to generate NS0. More... | |
SERVER_EXPORT bool | ua_addressspace_verify_digest (const unsigned char *digest, size_t len) |
Returns true if the digest is ok, false otherwise. More... | |
SERVER_EXPORT void | ua_addressspace_print_stat (uint16_t) |
Print addressspace statistics for a namespace. More... | |
General addressspace management like register/unregister namespaces.
The loading mode defines how files are loaded in ua_addressspace_load_file.
SERVER_EXPORT 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.
nsidx | Namespace to iterate through. |
callback | Callback 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. |
Example:
SERVER_EXPORT int ua_addressspace_foreach_node_ext | ( | uint16_t | nsidx, |
int(*)(ua_node_t handle, void *userdata) | callback, | ||
void * | userdata | ||
) |
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.
This version extends the existing ua_addressspace_foreach_node by adding a userdata pointer.
nsidx | Namespace to iterate through. |
callback | Callback 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. |
userdata | Will be returned in the callback . |
Example:
SERVER_EXPORT const struct ua_nodepermission* ua_addressspace_get_default_rolepermissions | ( | struct ua_addressspace * | addr, |
uint16_t * | num_perms | ||
) |
Get the namespace default rolepermissions for the given addressspace object.
addr | Addressspace to get the rolepermissions for. |
num_perms | The number of aray entries in the return value are written to this address. |
SERVER_EXPORT uint16_t ua_addressspace_get_nsidx | ( | struct ua_addressspace * | addr | ) |
Returns the namespace index for the given address space.
addr | Address space context. |
SERVER_EXPORT ua_datetime ua_addressspace_get_nspublication_date | ( | const struct ua_addressspace * | addr | ) |
Returns the namespace publication_date for the given address space.
addr | Address space context. |
SERVER_EXPORT const char* ua_addressspace_get_nsuri | ( | struct ua_addressspace * | addr | ) |
Returns the namespace URI for the given address space.
addr | Address space context. |
SERVER_EXPORT const char* ua_addressspace_get_nsversion | ( | const struct ua_addressspace * | addr | ) |
Returns the namespace version for the given address space.
addr | Address space context. |
SERVER_EXPORT void ua_addressspace_get_stat | ( | struct ua_addressspace * | addr, |
struct ua_addressspace_pool_stat * | stat | ||
) |
Returns statistics of the address space's memory pools.
addr | Address space context. |
stat | Pointer to statistic structure. |
SERVER_EXPORT struct ua_addressspace* ua_addressspace_getaddr | ( | uint16_t | nsidx | ) |
Get the pointer to the ua_addressspace struct of a namespace.
nsidx | Index of the namespace. |
SERVER_EXPORT int ua_addressspace_init | ( | void | ) |
Allocate resources for addressspace management.
SERVER_EXPORT 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.
SERVER_EXPORT struct ua_addressspace* ua_addressspace_lookup_uri | ( | const char * | nsuri | ) |
Finds address space context by is URI.
nsuri | Namespace URI of the namespace. |
SERVER_EXPORT 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.
nsidx | index of namespace to print statistics for |
SERVER_EXPORT int ua_addressspace_register | ( | const char * | url, |
const struct ua_addressspace_config * | config, | ||
enum ua_addressspace_index_type | type | ||
) |
Registers a new namespace.
url | URL of namespace. |
config | Address space configuration which defines the pool sizes. |
type | Index type to use for indexing nodes. Note: Using UA_INDEX_HASHTABLEQP is not allowed as deleting nodes would corrupt the hashtable. |
SERVER_EXPORT 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, | ||
struct ua_staticstore * | dtdef_store, | ||
uint16_t | nsidx, | ||
unsigned int | num_placeholders, | ||
enum ua_addressspace_index_type | type | ||
) |
Registers a new namespace.
url | URL of namespace. |
hashtablesize | Size of hashtable for indexing nodes. |
nodepool | Static memory pool of nodes. |
varpool | Static memory pool of variables. |
vartypepool | Static memory pool of variable types. |
methodpool | Static memory pool of methods. |
refpool | Static memory pool of references. |
stringpool | Static memory pool of strings. |
stringtable | String table with const strings. |
guidpool | Static memory pool of guids. |
dimpool | Static memory pool of guids. |
dtdef_store | The static store for the data type definitions. |
nsidx | Requested namespace index. Set to -1 if you don't care. |
num_placeholders | Number of placeholde references that get allocated in RAM. |
type | Index type to use for indexing nodes. |
SERVER_EXPORT int ua_addressspace_set_default_accessrestrictions | ( | struct ua_addressspace * | addr, |
uint16_t | accessrestrictions | ||
) |
Set the namespace default accessrestrictions for the given addressspace object.
SERVER_EXPORT int ua_addressspace_set_default_default_rolepermissions | ( | struct ua_addressspace * | addr | ) |
Sets the namespace default rolepermissions for the given addressspace object to the SDK defaults.
This function is called automatically by the SDK when loading an addressspace without default rolepermissions.
The SDK defaults are arbitrarily chosen and may change with any version of the SDK, so it is recommended to either load namespaces which already have a default set or use ua_addressspace_set_default_rolepermissions to set explicit defaults.
SERVER_EXPORT int ua_addressspace_set_default_rolepermissions | ( | struct ua_addressspace * | addr, |
const struct ua_nodepermission * | perms, | ||
uint16_t | num_perms | ||
) |
Set the namespace default rolepermissions for the given addressspace object.
addr | Addressspace to set the rolepermissions for. |
perms | The permissions array to set, copied by this function, so it can be deleted by the caller after calling. |
num_perms | Number of entries in the permissions array. |
SERVER_EXPORT void ua_addressspace_set_digest | ( | const unsigned char * | digest, |
size_t | len | ||
) |
Set the digest which was used to generate NS0.
SERVER_EXPORT void ua_addressspace_unregister | ( | uint16_t | nsidx | ) |
Unregister a namespace from the addressspace.
Remove all nodes from the given namespace.
nsidx | index of the namespace to unregister. |
SERVER_EXPORT bool ua_addressspace_verify_digest | ( | const unsigned char * | digest, |
size_t | len | ||
) |
Returns true if the digest is ok, false otherwise.