High Performance OPC UA Server SDK  1.7.1.383
UA Server Library

Modules

 addressspace
 Functions and definitions for addressspace operations and attribute handling.
 
 authentication
 Interface for implementing an authentication backend.
 
 authorization
 Frontend for the authorization backend.
 
 event
 
 filetransfer
 For creating instances of filetypes and managing those types.
 
 method
 Functions and structures related to the UA Call Service.
 
 valuestore
 Functions and definitions for using the valuestore infrastructure of the SDK.
 

Data Structures

struct  uaserver_provider
 Entry for the provider array used for provider initialization. More...
 
struct  uaserver_callbacks
 Callback table for uaserver context. More...
 
struct  ua_monitoreditem
 Structure to represent a monitoreditem in the server. More...
 

Macros

#define UASERVER_PROVIDER_INITIALIZER(init_fct)   { -1, init_fct, NULL }
 Initializer for the uaserver_provider struct with the init function only.
 
#define UASERVER_PROVIDER_INITIALIZER2(init_fct, user_data)   { -1, init_fct, user_data }
 Initializer for the uaserver_provider struct with the init function and user data.
 

Typedefs

typedef int(* uaserver_init_user_management) (void)
 Called when the SDK is ready to setup users and groups. More...
 

Enumerations

enum  uaserver_write_match {
  UASERVER_WRITE_MATCH_DEFAULT = 0, UASERVER_WRITE_MATCH_ALLOW_VT_NULL = 1, UASERVER_WRITE_MATCH_ALLOW_EO_NONE = 2, UASERVER_WRITE_MATCH_ALLOW_EO_BINARY = 4,
  UASERVER_WRITE_MATCH_ALLOW_EO_EMPTY_ARRAY = 8
}
 Controls the behaviour of uaserver_write_matches_datatype. More...
 

Functions

UA_BEGIN_EXTERN_C SERVER_EXPORT void uaserver_read_internal (ua_node_t node, struct uasession_session *session, enum ua_timestampstoreturn ts, uint32_t attribute_id, struct ua_indexrange *index_range, unsigned int num_ranges, struct ua_datavalue *result)
 Read the attribute of a node. More...
 
SERVER_EXPORT ua_statuscode uaserver_write_internal (ua_node_t node, struct uasession_session *session, uint32_t attribute_id, struct ua_indexrange *range, unsigned int num_ranges, struct ua_datavalue *value)
 Write the attribute of a node. More...
 
UA_BEGIN_EXTERN_C SERVER_EXPORT bool uaserver_write_matches_datatype (ua_node_t node, const struct ua_variant *value, uint32_t mode)
 Check if the value has the correct datatype to be written to the node according to UA rules. More...
 
SERVER_EXPORT int uaserver_init (struct uaserver_provider *provider, int num_provider)
 Initialize server. More...
 
SERVER_EXPORT int uaserver_init_ipc (void)
 
SERVER_EXPORT void uaserver_clear (struct uaserver_provider *provider, int num_provider)
 Clear server. More...
 
SERVER_EXPORT void uaserver_clear_ipc (void)
 
SERVER_EXPORT int uaserver_start (void)
 Start server. More...
 
SERVER_EXPORT int uaserver_stop (void)
 Stop the server. More...
 
SERVER_EXPORT void uaserver_set_callbacks (struct uaserver_callbacks *callbacks)
 Configures the server callbacks.
 
static void uaserver_callbacks_init (struct uaserver_callbacks *callbacks)
 initializes the given callback interface. More...
 
static int uaserver_shutdown (unsigned int timeout_sec)
 Updates server shutdown information. More...
 
UA_BEGIN_EXTERN_C SERVER_EXPORT int uaserver_registernode_internal (ua_node_t node, uint16_t nsidx, struct ua_nodeid *out)
 Creates a registered node from the given node handle. More...
 

Detailed Description

Typedef Documentation

◆ uaserver_init_user_management

typedef int(* uaserver_init_user_management) (void)

Called when the SDK is ready to setup users and groups.

This is not needed when loading the user management from files, but it can be used to setup custom user configurations without files.

Enumeration Type Documentation

◆ uaserver_write_match

Controls the behaviour of uaserver_write_matches_datatype.

Mutiple enums can be combined with the bitwise or operator.

Enumerator
UASERVER_WRITE_MATCH_DEFAULT 

default behaviour, none of the other options are enabled

UASERVER_WRITE_MATCH_ALLOW_VT_NULL 

allow to write NULL variants

UASERVER_WRITE_MATCH_ALLOW_EO_NONE 

allow to write extensionobjects with no body

UASERVER_WRITE_MATCH_ALLOW_EO_BINARY 

allow to write extensionobjects that are still binary encoded

UASERVER_WRITE_MATCH_ALLOW_EO_EMPTY_ARRAY 

allow to write a null or empty extensionobject array or matrix

Function Documentation

◆ uaserver_callbacks_init()

static void uaserver_callbacks_init ( struct uaserver_callbacks callbacks)
inlinestatic

initializes the given callback interface.

◆ uaserver_clear()

SERVER_EXPORT void uaserver_clear ( struct uaserver_provider provider,
int  num_provider 
)

Clear server.

Parameters
providerArray of providers to unload.
num_providerNumber of elements in provider array.

◆ uaserver_init()

SERVER_EXPORT int uaserver_init ( struct uaserver_provider provider,
int  num_provider 
)

Initialize server.

Parameters
providerArray with providers to load. Each provider will be assigned a handle on success.
num_providerNumber of elements in provider array.
Returns
Zero on success or errorcode on failure.

◆ uaserver_read_internal()

UA_BEGIN_EXTERN_C SERVER_EXPORT void uaserver_read_internal ( ua_node_t  node,
struct uasession_session session,
enum ua_timestampstoreturn  ts,
uint32_t  attribute_id,
struct ua_indexrange index_range,
unsigned int  num_ranges,
struct ua_datavalue result 
)

Read the attribute of a node.

If the value attribute is to be read, this function tries to read it from a store, other attributes are read directly from the addressspace.

Parameters
nodeNode to read the attribute from.
sessionThe session to read the attribute for. If NULL it is ignored.
tsThe timestamps to return, see: ua_timestampstoreturn.
attribute_idId of the attribute to read.
index_rangeArray of index ranges to read. For each dimension to limit the range there is one array entry.
num_rangesNumber of entries in the index_range array.
resultThe attribute that was read, in case of an error a bad statuscode is written to the statuscode of the ua_datavalue.

◆ uaserver_registernode_internal()

UA_BEGIN_EXTERN_C SERVER_EXPORT int uaserver_registernode_internal ( ua_node_t  node,
uint16_t  nsidx,
struct ua_nodeid out 
)

Creates a registered node from the given node handle.

Because the internal node representation only supports 30bit numeric values (0-1,073,741,824 ~ 10^9 values), we can use the highest bit 31 to mark the node as a registered node. This allows to convert every node id of the server into a efficient numeric nodeid without changing the nsidx. Note, if you change the internal node representation you also need to fix this function and ua_node_find() to reflect this change.

Parameters
nodeNode handle to create a registered nodeid for.
nsidxNsidx of node, just passed to for performance reasons to avoid an ua_node_get_nodeid() call. The provider should already know this nsidx.
outThe registed nodeid to return.
Returns
0, this function always succeeds with the current implementation.

◆ uaserver_shutdown()

static int uaserver_shutdown ( unsigned int  timeout_sec)
inlinestatic

Updates server shutdown information.

This is used to inform clients that the server is shutting down.

Parameters
timeout_secTimeout in seconds until the server is shut down.
Returns
Zero on success.

◆ uaserver_start()

SERVER_EXPORT int uaserver_start ( void  )

Start server.

Start listening for network connections.

Returns
Zero on success or errorcode on failure.

◆ uaserver_stop()

SERVER_EXPORT int uaserver_stop ( void  )

Stop the server.

Stop listening for network connections and clear network related resources and sessions.

Returns
Zero on success.

◆ uaserver_write_internal()

SERVER_EXPORT ua_statuscode uaserver_write_internal ( ua_node_t  node,
struct uasession_session session,
uint32_t  attribute_id,
struct ua_indexrange range,
unsigned int  num_ranges,
struct ua_datavalue value 
)

Write the attribute of a node.

This function tries to write the value attribute of a node using the store infrastructure. Other attributes are not implemented.

Parameters
nodeNode to write the attribute to.
sessionThe session to write the attribute for. If NULL it is ignored.
attribute_idId of the attribute to write.
rangeArray of index ranges to write. For each dimension to limit the range there is one array entry.
num_rangesNumber of entries in the range array.
valueThe new value to write to the attribute of the node.
Returns
Statuscode to indicate the result of the operation.

◆ uaserver_write_matches_datatype()

UA_BEGIN_EXTERN_C SERVER_EXPORT bool uaserver_write_matches_datatype ( ua_node_t  node,
const struct ua_variant value,
uint32_t  mode 
)

Check if the value has the correct datatype to be written to the node according to UA rules.

Note this check is rather expensive, it should be omitted when possible. E.g. by comparing the type with the previous value and run the check only when it does not match or for extensionobjects:

if (new_value->type != old_value->type || (new_value->type & UA_VT_TYPEMASK) == UA_VT_EXTENSIONOBJECT) {
// when the new type does not match the current type, run the intense check
}
}
// write new_value
Parameters
nodeNode the value should be written to, must be of nodeclass variable or variabletype.
valueValue that should be written.
modeCombination of uaserver_write_match to control behaviour of the function.
Returns
True if the value matches the datatype of the node, false otherwise.