High Performance OPC UA Server SDK  1.7.1.383

Create/delete/find nodes and access base attributes. More...

Macros

#define UA_NODE_INVALID   (ua_node_t)-1
 Value of an invalid node handle.
 
#define UA_NODE_ID_GLOBAL_VARIABLE   0x3FFFFFFF
 
#define UA_NODE_DEFAULT_CERTIFICATEGROUP_STR   "ns=0;i=14156"
 

Typedefs

typedef int32_t ua_node_t
 Handle for a node in the addressspace.
 

Functions

SERVER_EXPORT struct ua_addressspaceua_node_get_addressspace (ua_node_t node)
 Returns the address space this node belongs to. More...
 
SERVER_EXPORT ua_node_t ua_node_create (uint16_t, enum ua_nodeclass type)
 Create a new node from class type in the namespace with index nsidx. More...
 
SERVER_EXPORT ua_node_t ua_node_create_with_attributes (struct ua_nodeid *nodeid, enum ua_nodeclass nodeclass, uint16_t browsename_nsidx, const char *browsename, const char *displayname, ua_node_t typedef_node, ua_node_t parent, ua_node_t reftype_node)
 Create a new node with basic attributes. More...
 
SERVER_EXPORT int ua_node_delete (ua_node_t node)
 Delete a node from the addressspace and clear all attributes. More...
 
SERVER_EXPORT int ua_node_remove (ua_node_t node)
 Removes the given node and all its references. More...
 
SERVER_EXPORT enum ua_nodeclass ua_node_get_nodeclass (ua_node_t node)
 Get the nodeclass of the node.
 
SERVER_EXPORT int ua_node_set_nodeid (ua_node_t node, const struct ua_nodeid *id)
 Sets the nodeid attribute of the given node. More...
 
SERVER_EXPORT int ua_node_get_nodeid (ua_node_t node, struct ua_nodeid *id)
 Returns the nodeid of the given node. More...
 
SERVER_EXPORT int ua_node_get_nodeid_as_string (ua_node_t node, struct ua_string *sid)
 Returns the node's nodeid as string. More...
 
SERVER_EXPORT int ua_node_set_displayname (ua_node_t node, const char *name)
 Sets or changes the displayname attribute of the given node. More...
 
SERVER_EXPORT int ua_node_set_displayname_n (ua_node_t node, const char *name, size_t len)
 Sets or changes the displayname attribute of the given node. More...
 
SERVER_EXPORT const char * ua_node_get_displayname (ua_node_t node)
 Returns the text part of the displayname attribute. More...
 
SERVER_EXPORT int ua_node_set_browsename (ua_node_t node, const char *name)
 Sets the browsename attribute of the given node. More...
 
SERVER_EXPORT int ua_node_set_browsename_n (ua_node_t node, const char *name, size_t len)
 Sets the browsename attribute of the given node. More...
 
SERVER_EXPORT int ua_node_set_browsename0 (ua_node_t node, const char *name)
 Sets the browsename attribute of the given node. More...
 
SERVER_EXPORT int ua_node_set_browsename0_n (ua_node_t node, const char *name, size_t len)
 Sets the browsename attribute of the given node. More...
 
SERVER_EXPORT int ua_node_set_browsename_ex (ua_node_t node, const struct ua_qualifiedname *qn)
 Sets the browsename attribute of the given node. More...
 
SERVER_EXPORT int ua_node_get_browsename (ua_node_t node, struct ua_qualifiedname *qn)
 Returns the browsename attribute as qualifiedname. More...
 
SERVER_EXPORT int ua_node_get_browsename_const (ua_node_t node, struct ua_qualifiedname *qn)
 Returns the browsename attribute as qualifiedname. More...
 
SERVER_EXPORT int ua_node_set_description (ua_node_t node, const char *text)
 Sets the description attribute of the given node. More...
 
SERVER_EXPORT int ua_node_set_description_n (ua_node_t node, const char *text, size_t len)
 Sets the description attribute of the given node. More...
 
SERVER_EXPORT const char * ua_node_get_description (ua_node_t node)
 Returns the text part of the description attribute. More...
 
SERVER_EXPORT int ua_node_set_accessrestrictions (ua_node_t node, uint16_t access_restrictions)
 Sets the accessrestrictions attribute of the given node. More...
 
SERVER_EXPORT int ua_node_set_accessrestrictions_ns_default (ua_node_t node)
 Sets the accessrestrictions attribute of the given node to use the namespace defaults. More...
 
SERVER_EXPORT int ua_node_get_accessrestrictions (ua_node_t node, uint16_t *access_restrictions, bool *is_default)
 Gets the accessrestrictions attribute of the given node. More...
 
SERVER_EXPORT ua_statuscode ua_node_check_accessrestrictions (ua_node_t node, enum ua_messagesecuritymode security_mode, uint32_t permission, bool has_session)
 Checks if the accessrestrictions of the node restrict access for a particular permission for a particular user. More...
 
SERVER_EXPORT int ua_node_get_dataindex (ua_node_t node)
 
SERVER_EXPORT int ua_node_set_userindex (ua_node_t node, uintptr_t idx)
 Set the user index for node. More...
 
SERVER_EXPORT int ua_node_get_userindex (ua_node_t node, uintptr_t *idx)
 Get the user index for node. More...
 
SERVER_EXPORT ua_node_t ua_node_create_with_type (uint16_t, enum ua_nodeclass type, ua_node_t type_id)
 Create a node with a typedefinition from any namespace. More...
 
SERVER_EXPORT ua_node_t ua_node_create_with_type0 (uint16_t, enum ua_nodeclass type, uint32_t type_id)
 Create a node with a typedefinition from namespace zero. More...
 
SERVER_EXPORT int ua_node_set_flag (ua_node_t node, uint8_t bit, uint8_t flag)
 Set the flag value in the given node. More...
 
SERVER_EXPORT int ua_node_get_flag (ua_node_t node, uint8_t bit)
 Returns the flag value of the given node. More...
 
SERVER_EXPORT int ua_node_copy_flag (ua_node_t dst, ua_node_t src, uint8_t bit)
 Copy the value of a flag from node src to dst. More...
 
SERVER_EXPORT int ua_node_initialize_nodes (void)
 Initialize the well known node handles, this is automatically done in the serverprovider, but must be done manually if the serverprovider is not loaded.
 
SERVER_EXPORT int ua_node_is_static (ua_node_t node, bool *is_static)
 Test whether a node is from a static namespace. More...
 
SERVER_EXPORT ua_node_t ua_node_create_copy (const struct ua_nodeid *dst_id, ua_node_t src_node)
 Create a copy of node src_node. More...
 
SERVER_EXPORT int ua_node_copy (ua_node_t dst, ua_node_t src)
 Copy all attributes from node src to node dst. More...
 
SERVER_EXPORT int ua_node_copy_base_attributes (ua_node_t dst, ua_node_t src)
 Copy all base attributes from node src to node dst. More...
 
SERVER_EXPORT ua_node_t ua_node_find (const struct ua_nodeid *id)
 Finds a node by its NodeId. More...
 
SERVER_EXPORT ua_node_t ua_node_find0 (uint32_t numeric_id)
 Convenience function for finding nodes is OPC.UA namespace 0 based on their numeric nodeid. More...
 
SERVER_EXPORT ua_node_t ua_node_find_numeric (uint16_t nsindex, uint32_t numeric_id)
 Convenience function for finding nodes based on their numeric nodeid. More...
 
SERVER_EXPORT ua_node_t ua_node_find_string (uint16_t nsindex, const char *string_id)
 Convenience function for finding nodes based on their string nodeid. More...
 
SERVER_EXPORT const char * ua_node_printable (ua_node_t node)
 Return a printable nodeid representation of a node. More...
 

Variables

SERVER_EXPORT ua_node_t UA_NODE_HASPROPERTY
 
SERVER_EXPORT ua_node_t UA_NODE_HASCOMPONENT
 
SERVER_EXPORT ua_node_t UA_NODE_HASEVENTSOURCE
 
SERVER_EXPORT ua_node_t UA_NODE_HASNOTIFIER
 
SERVER_EXPORT ua_node_t UA_NODE_HASTYPEDEFINITION
 
SERVER_EXPORT ua_node_t UA_NODE_HASSUBTYPE
 
SERVER_EXPORT ua_node_t UA_NODE_HASMODELLINGRULE
 
SERVER_EXPORT ua_node_t UA_NODE_MODELLINGRULE_MANDATORY
 
SERVER_EXPORT ua_node_t UA_NODE_MODELLINGRULE_OPTIONAL
 
SERVER_EXPORT ua_node_t UA_NODE_OBJECTSFOLDER
 
SERVER_EXPORT ua_node_t UA_NODE_SERVEROBJECT
 
SERVER_EXPORT ua_node_t UA_NODE_ORGANIZES
 
SERVER_EXPORT ua_node_t UA_NODE_HIERARCHICALREFERENCES
 
SERVER_EXPORT ua_node_t UA_NODE_NONHIERARCHICALREFERENCES
 
SERVER_EXPORT ua_node_t UA_NODE_FOLDERTYPE
 
SERVER_EXPORT ua_node_t UA_NODE_FILETYPE
 
SERVER_EXPORT ua_node_t UA_NODE_TRUSTLIST_FILETYPE
 
SERVER_EXPORT ua_node_t UA_NODE_BASEDATAVARIABLETYPE
 
SERVER_EXPORT ua_node_t UA_NODE_PROPERTYTYPE
 
SERVER_EXPORT ua_node_t UA_NODE_BASEDATATYPE
 
SERVER_EXPORT ua_node_t UA_NODE_BASEOBJECTTYPE
 
SERVER_EXPORT ua_node_t UA_NODE_HASDICTIONARYENTRY
 
SERVER_EXPORT ua_node_t UA_NODE_SERVERCONFIGURATIONTYPE
 
SERVER_EXPORT ua_node_t UA_NODE_STRUCTURE
 
SERVER_EXPORT ua_node_t UA_NODE_RSAMINAPPLICATIONCERTIFICATETYPE
 
SERVER_EXPORT ua_node_t UA_NODE_RSASHA256APPLICATIONCERTIFICATETYPE
 

Detailed Description

Create/delete/find nodes and access base attributes.

Function Documentation

◆ ua_node_check_accessrestrictions()

SERVER_EXPORT ua_statuscode ua_node_check_accessrestrictions ( ua_node_t  node,
enum ua_messagesecuritymode  security_mode,
uint32_t  permission,
bool  has_session 
)

Checks if the accessrestrictions of the node restrict access for a particular permission for a particular user.

Parameters
nodeHandle for the node to check the restrictions
security_modeSecurity mode the user is connected with.
permissionThe permission to check the restriction for, the result can be different for different permission bits, so the caller must set only a single permission bit.
has_sessionFalse if the user uses a sessionless service call.
Returns
Bad statuscode if access is restricted, 0 otherwise.

◆ ua_node_copy()

SERVER_EXPORT int ua_node_copy ( ua_node_t  dst,
ua_node_t  src 
)

Copy all attributes from node src to node dst.

If the value of a variable node is readonly the valueindex and storeindex are copied, so the src and dst nodes point to the same value. For writeable values no valueindex and storeindex is set.

Returns
Zero on success or errorcode on failure.

◆ ua_node_copy_base_attributes()

SERVER_EXPORT int ua_node_copy_base_attributes ( ua_node_t  dst,
ua_node_t  src 
)

Copy all base attributes from node src to node dst.

Returns
Zero on success or errorcode on failure.

◆ ua_node_copy_flag()

SERVER_EXPORT int ua_node_copy_flag ( ua_node_t  dst,
ua_node_t  src,
uint8_t  bit 
)

Copy the value of a flag from node src to dst.

Both nodes must have the same nodeclass.

Parameters
dstdestination node.
srcsource node.
bitthe bit index of the flag.
Returns
Zero on success or errorcode on failure.

◆ ua_node_create()

SERVER_EXPORT ua_node_t ua_node_create ( uint16_t  nsidx,
enum ua_nodeclass  type 
)

Create a new node from class type in the namespace with index nsidx.

The attributes of the new node are not set and must be initialized with the corresponding setter.

Returns
node handle of the new node or UA_NODE_INVALID in case of error.

◆ ua_node_create_copy()

SERVER_EXPORT ua_node_t ua_node_create_copy ( const struct ua_nodeid dst_id,
ua_node_t  src_node 
)

Create a copy of node src_node.

A new node is created and all attributes are copied from src_node, except for the nodeid, which must be passed as dst_id.

If the value of a variable node is readonly the valueindex and storeindex are copied, so the src and dst nodes point to the same value. For writeable values no valueindex and storeindex is set.

Returns
Handle of the created node on success or UA_NODE_INVALID on failure.

◆ ua_node_create_with_attributes()

SERVER_EXPORT ua_node_t ua_node_create_with_attributes ( struct ua_nodeid nodeid,
enum ua_nodeclass  nodeclass,
uint16_t  browsename_nsidx,
const char *  browsename,
const char *  displayname,
ua_node_t  typedef_node,
ua_node_t  parent,
ua_node_t  reftype_node 
)

Create a new node with basic attributes.

Create a new node in the addressspace and set the mandatory base attributes. Optionally add a HasTypeDefinition reference and a reference from the the parent node to this node.

Parameters
nodeidNodeid of the new node (mandatory).
nodeclassNodeclass of the new node (mandatory).
browsename_nsidxNamespaceindex of the browsename of the new node (mandatory).
browsenameBrowsename of the new node (mandatory).
displaynameDisplayname of the new node, if NULL the browsename will be used.
typedef_nodeTarget for the HasTypeDefinition reference of the new node. If UA_NODE_INVALID no HasTypeDefinition reference is created.
parentParent node to create a reference from, if UA_NODE_INVALID no reference to the parent is created.
reftype_nodeType of the reference from the parent, if UA_NODE_INVALID no reference to the parent is created.
Returns
handle of the new node on success, UA_NODE_INVALID on failure.

◆ ua_node_create_with_type()

SERVER_EXPORT ua_node_t ua_node_create_with_type ( uint16_t  nsidx,
enum ua_nodeclass  type,
ua_node_t  type_id 
)

Create a node with a typedefinition from any namespace.

This will create a new node and add a reference to the typedefinition node.

Parameters
nsidxindex of the namespace to create the node in
typeclass of the new node
type_idnode handle of the typedefinition node
Returns
Handle for the new node, or UA_NODE_INVALID on failure.

◆ ua_node_create_with_type0()

SERVER_EXPORT ua_node_t ua_node_create_with_type0 ( uint16_t  nsidx,
enum ua_nodeclass  type,
uint32_t  type_id 
)

Create a node with a typedefinition from namespace zero.

See also
ua_node_create_with_type
Parameters
nsidxindex of the namespace to create the node in
typeclass of the new node
type_idnumeric identifier of the typedefinition node from namespace zero.
Returns
Handle for the new node, or UA_NODE_INVALID on failure.

◆ ua_node_delete()

SERVER_EXPORT int ua_node_delete ( ua_node_t  node)

Delete a node from the addressspace and clear all attributes.

References to and from the node are NOT deleted. Use ua_node_remove() to remove a node an all its references.

See also
ua_node_remove
Parameters
nodeNode to delete
Returns
Zero on success, errorcode on failure.

◆ ua_node_find()

SERVER_EXPORT ua_node_t ua_node_find ( const struct ua_nodeid id)

Finds a node by its NodeId.

Parameters
idThe NodeId to search for.
Returns
Node handle.
See also
ua_node_find0

◆ ua_node_find0()

SERVER_EXPORT ua_node_t ua_node_find0 ( uint32_t  numeric_id)

Convenience function for finding nodes is OPC.UA namespace 0 based on their numeric nodeid.

Parameters
numeric_idNumeric NodeId. You can use the defines from identifiers.h for this.
Returns
Node handle.
See also
ua_node_find

◆ ua_node_find_numeric()

SERVER_EXPORT ua_node_t ua_node_find_numeric ( uint16_t  nsindex,
uint32_t  numeric_id 
)

Convenience function for finding nodes based on their numeric nodeid.

◆ ua_node_find_string()

SERVER_EXPORT ua_node_t ua_node_find_string ( uint16_t  nsindex,
const char *  string_id 
)

Convenience function for finding nodes based on their string nodeid.

◆ ua_node_get_accessrestrictions()

SERVER_EXPORT int ua_node_get_accessrestrictions ( ua_node_t  node,
uint16_t *  access_restrictions,
bool *  is_default 
)

Gets the accessrestrictions attribute of the given node.

Parameters
nodeThe node handle
access_restrictionsPointer to write the effective AccessRestrictions of this node to. Optional, e.g. when the caller is only interrested whether the node uses namespace default permissions.
is_defaultPointer to write to whether the node uses the namespace default accessrestrictions. Optional, the caller may not be interrested in this information.
Returns
Zero on success, or negative errorcode on failure.

◆ ua_node_get_addressspace()

SERVER_EXPORT struct ua_addressspace* ua_node_get_addressspace ( ua_node_t  node)

Returns the address space this node belongs to.

Parameters
nodeNode handle
Returns
Pointer to address space or NULL if the nodehandle was invalid.

◆ ua_node_get_browsename()

SERVER_EXPORT int ua_node_get_browsename ( ua_node_t  node,
struct ua_qualifiedname qn 
)

Returns the browsename attribute as qualifiedname.

You must call ua_qualifiedname_clear to free the result. This function is used to fill browsenames into service results which may be used across process boundaries via shared memory, therefor ua_string_smart_attachn_const is used internally to copy/assign the name part of the qualifiedname. If you only need the browsename in the current process, e.g. for filtering nodes, then you should better use ua_node_get_browsename_const, which does not allocate/copy memory.

Parameters
nodethe node handle
qnthe variable which receives the operation result
Returns
Zero on success, a negative status code on error.

◆ ua_node_get_browsename_const()

SERVER_EXPORT int ua_node_get_browsename_const ( ua_node_t  node,
struct ua_qualifiedname qn 
)

Returns the browsename attribute as qualifiedname.

This is an overload of ua_node_get_browsename, which does not allocate/copy memory, so you don't need to call ua_qualifiedname_clear on the result.

Parameters
nodethe node handle
qnthe variable which receives the operation result
Returns
Zero on success, a negative status code on error.

◆ ua_node_get_description()

SERVER_EXPORT const char* ua_node_get_description ( ua_node_t  node)

Returns the text part of the description attribute.

Parameters
nodethe node handle
Returns
The description on success, NULL on error.

◆ ua_node_get_displayname()

SERVER_EXPORT const char* ua_node_get_displayname ( ua_node_t  node)

Returns the text part of the displayname attribute.

Parameters
nodethe node handle
Returns
The displayname on success, NULL on error.

◆ ua_node_get_flag()

SERVER_EXPORT int ua_node_get_flag ( ua_node_t  node,
uint8_t  bit 
)

Returns the flag value of the given node.

Parameters
nodethe node handle
bitthe bit index. Only bits 6-7 are allowed to be used by the application. Bits 0-5 are reserved for the SDK and are described in node.h.
Returns
On success the function will return 0 (false) or 1 (true) which is the flag's value. On failure the function will return a negative result.

◆ ua_node_get_nodeid()

SERVER_EXPORT int ua_node_get_nodeid ( ua_node_t  node,
struct ua_nodeid id 
)

Returns the nodeid of the given node.

Parameters
nodeThe node handle.
idNodeId result
Returns
Zero on success, a negative status code on error.

◆ ua_node_get_nodeid_as_string()

SERVER_EXPORT int ua_node_get_nodeid_as_string ( ua_node_t  node,
struct ua_string sid 
)

Returns the node's nodeid as string.

This is mainly useful for trace output. If ENABLE_TO_STRING is disabled this returns the string constant "<disabled>" instead, but the caller does not need to think about this detail problem.

Parameters
nodeThe node handle.
sidNodeId as string.
Returns
Zero on success, a negative status code on error. Possible errros are:
  • UA_EBADINVALIDARGUMENT: when an invalid node handle was used
  • UA_EBADNOMEM: if memory allocation for the string fails

◆ ua_node_get_userindex()

SERVER_EXPORT int ua_node_get_userindex ( ua_node_t  node,
uintptr_t *  idx 
)

Get the user index for node.

Retrieve the index previously set with ua_node_set_userindex. If no index was set UINTPTR_MAX is returned;

Returns
Zero on success, a negative status code on error.

◆ ua_node_is_static()

SERVER_EXPORT int ua_node_is_static ( ua_node_t  node,
bool *  is_static 
)

Test whether a node is from a static namespace.

A node from a static namespace can not be modified, so the ua_node_set_* functions may not be called on such a node.

Returns
Zero on success or negative errorcode on failure.

◆ ua_node_printable()

SERVER_EXPORT const char* ua_node_printable ( ua_node_t  node)

Return a printable nodeid representation of a node.

The returned string is intended for printing/tracing the nodeid, it is purely informative and you cannot rely on the format of the returned value. Also the string may be incomplete if the whole nodeid does not fit into the internal buffer.

The string is allocated in a static internal buffer, every call to this function overwrites the previously returned string. So to print multiple nodeids each must be printed in a separated statement or the returned string must be copied.

The buffer is shared with ua_nodeid_printable, so these two functions may not be used in the same trace line.

This function always returns a zero terminated string, which can be directly used for printing.

◆ ua_node_remove()

SERVER_EXPORT int ua_node_remove ( ua_node_t  node)

Removes the given node and all its references.

This is the recommended way to remove single nodes from the address space. This will also delete the node and remove it from the hashtable index.

Parameters
nodeThe node to remove.
Returns
Zero on success.

◆ ua_node_set_accessrestrictions()

SERVER_EXPORT int ua_node_set_accessrestrictions ( ua_node_t  node,
uint16_t  access_restrictions 
)

Sets the accessrestrictions attribute of the given node.

Parameters
nodeThe node handle
access_restrictionsThe AccessRestrictions to set, OR-ed values of ua_accessrestrictiontype.
Returns
Zero on success, or negative errorcode on failure.

◆ ua_node_set_accessrestrictions_ns_default()

SERVER_EXPORT int ua_node_set_accessrestrictions_ns_default ( ua_node_t  node)

Sets the accessrestrictions attribute of the given node to use the namespace defaults.

Parameters
nodeThe node handle
Returns
Zero on success, or negative errorcode on failure.

◆ ua_node_set_browsename()

SERVER_EXPORT int ua_node_set_browsename ( ua_node_t  node,
const char *  name 
)

Sets the browsename attribute of the given node.

This function will use the node's namespace index also for the qualifiedname.

Parameters
nodethe node handle
namethe text part of the browsename (qualifiedname)
See also
ua_node_set_browsename_ex

◆ ua_node_set_browsename0()

SERVER_EXPORT int ua_node_set_browsename0 ( ua_node_t  node,
const char *  name 
)

Sets the browsename attribute of the given node.

This function is provided for convenience is used to set qualifiednames which are defined in NS 0.

Parameters
nodethe node handle
namethe browsname as qualifiedname
See also
ua_node_set_browsename_ex, ua_node_set_browsename

◆ ua_node_set_browsename0_n()

SERVER_EXPORT int ua_node_set_browsename0_n ( ua_node_t  node,
const char *  name,
size_t  len 
)

Sets the browsename attribute of the given node.

This function is provided for convenience is used to set qualifiednames which are defined in NS 0.

Parameters
nodethe node handle
namethe browsname as qualifiedname
lenlength of name
See also
ua_node_set_browsename_ex, ua_node_set_browsename

◆ ua_node_set_browsename_ex()

SERVER_EXPORT int ua_node_set_browsename_ex ( ua_node_t  node,
const struct ua_qualifiedname qn 
)

Sets the browsename attribute of the given node.

Parameters
nodethe node handle
qnthe browsname as qualifiedname
See also
ua_node_set_browsename0, ua_node_set_browsename

◆ ua_node_set_browsename_n()

SERVER_EXPORT int ua_node_set_browsename_n ( ua_node_t  node,
const char *  name,
size_t  len 
)

Sets the browsename attribute of the given node.

This function will use the node's namespace index also for the qualifiedname.

Parameters
nodethe node handle
namethe text part of the browsename (qualifiedname)
lenlength of name
See also
ua_node_set_browsename_ex

◆ ua_node_set_description()

SERVER_EXPORT int ua_node_set_description ( ua_node_t  node,
const char *  text 
)

Sets the description attribute of the given node.

Parameters
nodethe node handle
textthe text part of the description
Returns
Zero on success, a negative status code on error.

◆ ua_node_set_description_n()

SERVER_EXPORT int ua_node_set_description_n ( ua_node_t  node,
const char *  text,
size_t  len 
)

Sets the description attribute of the given node.

Parameters
nodethe node handle
textthe text part of the description
lenlength of text
Returns
Zero on success, a negative status code on error.

◆ ua_node_set_displayname()

SERVER_EXPORT int ua_node_set_displayname ( ua_node_t  node,
const char *  name 
)

Sets or changes the displayname attribute of the given node.

Parameters
nodethe node handle
namethe text part of the displayname
Returns
Zero on success, a negative status code on error.

◆ ua_node_set_displayname_n()

SERVER_EXPORT int ua_node_set_displayname_n ( ua_node_t  node,
const char *  name,
size_t  len 
)

Sets or changes the displayname attribute of the given node.

When name is a NULL pointer it will just clear the current string from the internal string table and does not set a new string.

Parameters
nodethe node handle
namethe text part of the displayname
lenlength of name. Ignored if name is NULL.
Returns
Zero on success, a negative status code on error.

◆ ua_node_set_flag()

SERVER_EXPORT int ua_node_set_flag ( ua_node_t  node,
uint8_t  bit,
uint8_t  flag 
)

Set the flag value in the given node.

Parameters
nodethe node handle
bitthe bit index. Only bits 6-7 are allowed to be used by the application. Bits 0-5 are reserved for the SDK.
flagthe flag value. This may be 0 (false) or 1 (true).
Returns
Zero on success, a negative error code on failure.

◆ ua_node_set_nodeid()

SERVER_EXPORT int ua_node_set_nodeid ( ua_node_t  node,
const struct ua_nodeid id 
)

Sets the nodeid attribute of the given node.

This also causes the node to be indexed in a hashtable.

By setting an NULL nodeid the node will get removed from the hashtable. When changing the nodeid it must be cleared before to avoid hashtable leaks.

This function will return UA_EBADINVALIDSTATE when calling it with a non-NULL nodeid and the node has already a nodeid.

Limitation: This invalid state cannot be detected if the node uses a numeric nodeid with the value 0, as this cannot be distinguished from its initial unset state.

struct ua_nodeid one, two, null = UA_NODEID_INITIALIZER;
// define nodeids
// set initial nodeid
ret = ua_node_set_node(n, &one);
// ret = UA_EGOOD
// clear initial nodeid
ret = ua_node_set_node(n, &null);
// ret = UA_EGOOD
// set new nodeid
ret = ua_node_set_node(n, &two);
// ret = UA_EGOOD
// set new nodeid without clearing (error)
ret = ua_node_set_node(n, &one);
// ret = UA_EBADINVALIDSTATE
Parameters
nodeThe node handle.
idNew node id.
Returns
Zero on success, a negative error code if the operation fails:
  • UA_EBADINVALIDARGUMENT: One of the arguments was invalid. Possible reasons are:
    • The node handle was invalid
    • The nodeid uses a nsidx which does not match nsidx if the created node.
    • The nodeid is already used by another node.
  • UA_EBADINVALIDSTATE: The node has already a nodeid. Clear it before setting a new nodeid.
  • UA_EBADNOMEM: Out of memory.
  • UA_EBAD: Generic error. E.g. if the internal hashtable operation failed.

◆ ua_node_set_userindex()

SERVER_EXPORT int ua_node_set_userindex ( ua_node_t  node,
uintptr_t  idx 
)

Set the user index for node.

The index can be freely used by the user to connect application specific data with the node. It can only be set for nodes from dynamic addressspaces. The index can be retrieved from a node with ua_node_get_userindex.

Returns
Zero on success, a negative status code on error.