open62541 1.4.15
Open source implementation of OPC UA
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
server.h File Reference
#include <open62541/types.h>
#include <open62541/common.h>
#include <open62541/util.h>
#include <open62541/plugin/log.h>
#include <open62541/plugin/pki.h>
#include <open62541/plugin/nodestore.h>
#include <open62541/plugin/eventloop.h>
#include <open62541/plugin/accesscontrol.h>
#include <open62541/plugin/securitypolicy.h>
#include <open62541/client.h>
#include <open62541/server_pubsub.h>
#include <open62541/plugin/historydatabase.h>

Go to the source code of this file.

Data Structures

struct  UA_ServerConfig
 
struct  UA_ServerStatistics
 

Macros

#define UA_Server_removeRepeatedCallback(server, callbackId)    UA_Server_removeCallback(server, callbackId);
 
#define HAVE_NODEITER_CALLBACK
 
#define UA_Server_setMethodNode_callback(server, methodNodeId, methodCallback)    UA_Server_setMethodNodeCallback(server, methodNodeId, methodCallback)
 

Typedefs

typedef struct UA_PubSubConfiguration UA_PubSubConfiguration
 
typedef void(* UA_Server_AsyncOperationNotifyCallback) (UA_Server *server)
 
typedef UA_StatusCode(* UA_NodeIteratorCallback) (UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle)
 
typedef void(* UA_Server_registerServerCallback) (const UA_RegisteredServer *registeredServer, void *data)
 
typedef void(* UA_Server_DataChangeNotificationCallback) (UA_Server *server, UA_UInt32 monitoredItemId, void *monitoredItemContext, const UA_NodeId *nodeId, void *nodeContext, UA_UInt32 attributeId, const UA_DataValue *value)
 
typedef void(* UA_Server_EventNotificationCallback) (UA_Server *server, UA_UInt32 monId, void *monContext, size_t nEventFields, const UA_Variant *eventFields)
 
typedef void(* UA_Server_ReverseConnectStateCallback) (UA_Server *server, UA_UInt64 handle, UA_SecureChannelState state, void *context)
 

Functions

void UA_ServerConfig_clean (UA_ServerConfig *config)
 
UA_EXPORT UA_ServerUA_Server_new (void)
 
UA_EXPORT UA_ServerUA_Server_newWithConfig (UA_ServerConfig *config)
 
UA_EXPORT UA_StatusCode UA_Server_delete (UA_Server *server)
 
UA_EXPORT UA_ServerConfigUA_Server_getConfig (UA_Server *server)
 
UA_EXPORT UA_LifecycleState UA_Server_getLifecycleState (UA_Server *server)
 
UA_EXPORT UA_StatusCode UA_Server_run (UA_Server *server, const volatile UA_Boolean *running)
 
UA_EXPORT UA_StatusCode UA_Server_runUntilInterrupt (UA_Server *server)
 
UA_EXPORT UA_StatusCode UA_Server_run_startup (UA_Server *server)
 
UA_EXPORT UA_UInt16 UA_Server_run_iterate (UA_Server *server, UA_Boolean waitInternal)
 
UA_EXPORT UA_StatusCode UA_Server_run_shutdown (UA_Server *server)
 
UA_StatusCode UA_THREADSAFE UA_Server_addTimedCallback (UA_Server *server, UA_ServerCallback callback, void *data, UA_DateTime date, UA_UInt64 *callbackId)
 
UA_StatusCode UA_THREADSAFE UA_Server_addRepeatedCallback (UA_Server *server, UA_ServerCallback callback, void *data, UA_Double interval_ms, UA_UInt64 *callbackId)
 
UA_StatusCode UA_THREADSAFE UA_Server_changeRepeatedCallbackInterval (UA_Server *server, UA_UInt64 callbackId, UA_Double interval_ms)
 
void UA_THREADSAFE UA_Server_removeCallback (UA_Server *server, UA_UInt64 callbackId)
 
UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_closeSession (UA_Server *server, const UA_NodeId *sessionId)
 
UA_EXPORT UA_StatusCode UA_Server_getSessionAttribute (UA_Server *server, const UA_NodeId *sessionId, const UA_QualifiedName key, UA_Variant *outValue)
 
UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_getSessionAttributeCopy (UA_Server *server, const UA_NodeId *sessionId, const UA_QualifiedName key, UA_Variant *outValue)
 
UA_EXPORT UA_StatusCode UA_Server_getSessionAttribute_scalar (UA_Server *server, const UA_NodeId *sessionId, const UA_QualifiedName key, const UA_DataType *type, void *outValue)
 
UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_setSessionAttribute (UA_Server *server, const UA_NodeId *sessionId, const UA_QualifiedName key, const UA_Variant *value)
 
UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_deleteSessionAttribute (UA_Server *server, const UA_NodeId *sessionId, const UA_QualifiedName key)
 
UA_DataValue UA_THREADSAFE UA_Server_read (UA_Server *server, const UA_ReadValueId *item, UA_TimestampsToReturn timestamps)
 
UA_StatusCode UA_THREADSAFE __UA_Server_read (UA_Server *server, const UA_NodeId *nodeId, UA_AttributeId attributeId, void *v)
 
UA_StatusCode UA_THREADSAFE UA_Server_write (UA_Server *server, const UA_WriteValue *value)
 
UA_StatusCode UA_THREADSAFE __UA_Server_write (UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, const UA_DataType *attr_type, const void *attr)
 
UA_BrowseResult UA_THREADSAFE UA_Server_browse (UA_Server *server, UA_UInt32 maxReferences, const UA_BrowseDescription *bd)
 
UA_BrowseResult UA_THREADSAFE UA_Server_browseNext (UA_Server *server, UA_Boolean releaseContinuationPoint, const UA_ByteString *continuationPoint)
 
UA_StatusCode UA_THREADSAFE UA_Server_browseRecursive (UA_Server *server, const UA_BrowseDescription *bd, size_t *resultsSize, UA_ExpandedNodeId **results)
 
UA_BrowsePathResult UA_THREADSAFE UA_Server_translateBrowsePathToNodeIds (UA_Server *server, const UA_BrowsePath *browsePath)
 
UA_BrowsePathResult UA_THREADSAFE UA_Server_browseSimplifiedBrowsePath (UA_Server *server, const UA_NodeId origin, size_t browsePathSize, const UA_QualifiedName *browsePath)
 
UA_StatusCode UA_THREADSAFE UA_Server_forEachChildNodeCall (UA_Server *server, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
 
UA_StatusCode UA_THREADSAFE UA_Server_registerDiscovery (UA_Server *server, UA_ClientConfig *cc, const UA_String discoveryServerUrl, const UA_String semaphoreFilePath)
 
UA_StatusCode UA_THREADSAFE UA_Server_deregisterDiscovery (UA_Server *server, UA_ClientConfig *cc, const UA_String discoveryServerUrl)
 
void UA_THREADSAFE UA_Server_setRegisterServerCallback (UA_Server *server, UA_Server_registerServerCallback cb, void *data)
 
void UA_Server_setAdminSessionContext (UA_Server *server, void *context)
 
UA_StatusCode UA_THREADSAFE UA_Server_setNodeTypeLifecycle (UA_Server *server, UA_NodeId nodeId, UA_NodeTypeLifecycle lifecycle)
 
UA_StatusCode UA_THREADSAFE UA_Server_getNodeContext (UA_Server *server, UA_NodeId nodeId, void **nodeContext)
 
UA_StatusCode UA_THREADSAFE UA_Server_setNodeContext (UA_Server *server, UA_NodeId nodeId, void *nodeContext)
 
UA_StatusCode UA_THREADSAFE UA_Server_setVariableNode_dataSource (UA_Server *server, const UA_NodeId nodeId, const UA_DataSource dataSource)
 
UA_StatusCode UA_THREADSAFE UA_Server_setVariableNode_valueCallback (UA_Server *server, const UA_NodeId nodeId, const UA_ValueCallback callback)
 
UA_StatusCode UA_THREADSAFE UA_Server_setVariableNode_valueBackend (UA_Server *server, const UA_NodeId nodeId, const UA_ValueBackend valueBackend)
 
UA_MonitoredItemCreateResult UA_THREADSAFE UA_Server_createDataChangeMonitoredItem (UA_Server *server, UA_TimestampsToReturn timestampsToReturn, const UA_MonitoredItemCreateRequest item, void *monitoredItemContext, UA_Server_DataChangeNotificationCallback callback)
 
UA_StatusCode UA_THREADSAFE UA_Server_deleteMonitoredItem (UA_Server *server, UA_UInt32 monitoredItemId)
 
UA_StatusCode UA_THREADSAFE UA_Server_setMethodNodeCallback (UA_Server *server, const UA_NodeId methodNodeId, UA_MethodCallback methodCallback)
 
UA_StatusCode UA_THREADSAFE UA_Server_getMethodNodeCallback (UA_Server *server, const UA_NodeId methodNodeId, UA_MethodCallback *outMethodCallback)
 
UA_CallMethodResult UA_THREADSAFE UA_Server_call (UA_Server *server, const UA_CallMethodRequest *request)
 
UA_StatusCode UA_THREADSAFE UA_Server_writeObjectProperty (UA_Server *server, const UA_NodeId objectId, const UA_QualifiedName propertyName, const UA_Variant value)
 
UA_StatusCode UA_THREADSAFE UA_Server_writeObjectProperty_scalar (UA_Server *server, const UA_NodeId objectId, const UA_QualifiedName propertyName, const void *value, const UA_DataType *type)
 
UA_StatusCode UA_THREADSAFE UA_Server_readObjectProperty (UA_Server *server, const UA_NodeId objectId, const UA_QualifiedName propertyName, UA_Variant *value)
 
UA_StatusCode UA_THREADSAFE __UA_Server_addNode (UA_Server *server, const UA_NodeClass nodeClass, const UA_NodeId *requestedNewNodeId, const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId *typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, void *nodeContext, UA_NodeId *outNewNodeId)
 
UA_StatusCode UA_THREADSAFE UA_Server_addDataSourceVariableNode (UA_Server *server, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_VariableAttributes attr, const UA_DataSource dataSource, void *nodeContext, UA_NodeId *outNewNodeId)
 
UA_StatusCode UA_THREADSAFE UA_Server_setVariableNodeDynamic (UA_Server *server, const UA_NodeId nodeId, UA_Boolean isDynamic)
 
UA_StatusCode UA_THREADSAFE UA_Server_addMethodNodeEx (UA_Server *server, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_MethodAttributes attr, UA_MethodCallback method, size_t inputArgumentsSize, const UA_Argument *inputArguments, const UA_NodeId inputArgumentsRequestedNewNodeId, UA_NodeId *inputArgumentsOutNewNodeId, size_t outputArgumentsSize, const UA_Argument *outputArguments, const UA_NodeId outputArgumentsRequestedNewNodeId, UA_NodeId *outputArgumentsOutNewNodeId, void *nodeContext, UA_NodeId *outNewNodeId)
 
UA_StatusCode UA_THREADSAFE UA_Server_addNode_begin (UA_Server *server, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const void *attr, const UA_DataType *attributeType, void *nodeContext, UA_NodeId *outNewNodeId)
 
UA_StatusCode UA_THREADSAFE UA_Server_addNode_finish (UA_Server *server, const UA_NodeId nodeId)
 
UA_StatusCode UA_THREADSAFE UA_Server_addMethodNode_finish (UA_Server *server, const UA_NodeId nodeId, UA_MethodCallback method, size_t inputArgumentsSize, const UA_Argument *inputArguments, size_t outputArgumentsSize, const UA_Argument *outputArguments)
 
UA_StatusCode UA_THREADSAFE UA_Server_deleteNode (UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences)
 
UA_StatusCode UA_THREADSAFE UA_Server_addReference (UA_Server *server, const UA_NodeId sourceId, const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId, UA_Boolean isForward)
 
UA_StatusCode UA_THREADSAFE UA_Server_deleteReference (UA_Server *server, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
 
UA_StatusCode UA_THREADSAFE UA_Server_createEvent (UA_Server *server, const UA_NodeId eventType, UA_NodeId *outNodeId)
 
UA_StatusCode UA_THREADSAFE UA_Server_triggerEvent (UA_Server *server, const UA_NodeId eventNodeId, const UA_NodeId originId, UA_ByteString *outEventId, const UA_Boolean deleteEventNode)
 
UA_StatusCode UA_Server_updateCertificate (UA_Server *server, const UA_ByteString *oldCertificate, const UA_ByteString *newCertificate, const UA_ByteString *newPrivateKey, UA_Boolean closeSessions, UA_Boolean closeSecureChannels)
 
UA_EXPORT const UA_DataTypeUA_Server_findDataType (UA_Server *server, const UA_NodeId *typeId)
 
UA_UInt16 UA_THREADSAFE UA_Server_addNamespace (UA_Server *server, const char *name)
 
UA_StatusCode UA_THREADSAFE UA_Server_getNamespaceByName (UA_Server *server, const UA_String namespaceUri, size_t *foundIndex)
 
UA_StatusCode UA_THREADSAFE UA_Server_getNamespaceByIndex (UA_Server *server, const size_t namespaceIndex, UA_String *foundUri)
 
UA_ServerStatistics UA_THREADSAFE UA_Server_getStatistics (UA_Server *server)
 
UA_StatusCode UA_Server_addReverseConnect (UA_Server *server, UA_String url, UA_Server_ReverseConnectStateCallback stateCallback, void *callbackContext, UA_UInt64 *handle)
 
UA_StatusCode UA_Server_removeReverseConnect (UA_Server *server, UA_UInt64 handle)
 

Macro Definition Documentation

◆ HAVE_NODEITER_CALLBACK

#define HAVE_NODEITER_CALLBACK

Definition at line 823 of file server.h.

◆ UA_Server_removeRepeatedCallback

#define UA_Server_removeRepeatedCallback (   server,
  callbackId 
)     UA_Server_removeCallback(server, callbackId);

Definition at line 425 of file server.h.

◆ UA_Server_setMethodNode_callback

#define UA_Server_setMethodNode_callback (   server,
  methodNodeId,
  methodCallback 
)     UA_Server_setMethodNodeCallback(server, methodNodeId, methodCallback)

Backwards compatibility definition.

Definition at line 1007 of file server.h.

Typedef Documentation

◆ UA_NodeIteratorCallback

typedef UA_StatusCode(* UA_NodeIteratorCallback) (UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle)

Iterate over all nodes referenced by parentNodeId by calling the callback function for each child node (in ifdef because GCC/CLANG handle include order differently)

Definition at line 827 of file server.h.

◆ UA_PubSubConfiguration

Definition at line 45 of file server.h.

◆ UA_Server_AsyncOperationNotifyCallback

typedef void(* UA_Server_AsyncOperationNotifyCallback) (UA_Server *server)

Definition at line 46 of file server.h.

◆ UA_Server_DataChangeNotificationCallback

typedef void(* UA_Server_DataChangeNotificationCallback) (UA_Server *server, UA_UInt32 monitoredItemId, void *monitoredItemContext, const UA_NodeId *nodeId, void *nodeContext, UA_UInt32 attributeId, const UA_DataValue *value)

Definition at line 956 of file server.h.

◆ UA_Server_EventNotificationCallback

typedef void(* UA_Server_EventNotificationCallback) (UA_Server *server, UA_UInt32 monId, void *monContext, size_t nEventFields, const UA_Variant *eventFields)

Definition at line 961 of file server.h.

◆ UA_Server_registerServerCallback

typedef void(* UA_Server_registerServerCallback) (const UA_RegisteredServer *registeredServer, void *data)

Callback for RegisterServer.

Data is passed from the register call

Definition at line 866 of file server.h.

◆ UA_Server_ReverseConnectStateCallback

typedef void(* UA_Server_ReverseConnectStateCallback) (UA_Server *server, UA_UInt64 handle, UA_SecureChannelState state, void *context)

The reverse connect state change callback is called whenever the state of a reverse connect is changed by a connection attempt, a successful connection or a connection loss.

The reverse connect states reflect the state of the secure channel currently associated with a reverse connect. The state will remain UA_SECURECHANNELSTATE_CONNECTING while the server attempts repeatedly to establish a connection.

Definition at line 1621 of file server.h.

Function Documentation

◆ __UA_Server_addNode()

UA_StatusCode UA_THREADSAFE __UA_Server_addNode ( UA_Server server,
const UA_NodeClass  nodeClass,
const UA_NodeId requestedNewNodeId,
const UA_NodeId parentNodeId,
const UA_NodeId referenceTypeId,
const UA_QualifiedName  browseName,
const UA_NodeId typeDefinition,
const UA_NodeAttributes attr,
const UA_DataType attributeType,
void *  nodeContext,
UA_NodeId outNewNodeId 
)

Don't use this function.

There are typed versions as inline functions.

◆ __UA_Server_read()

UA_StatusCode UA_THREADSAFE __UA_Server_read ( UA_Server server,
const UA_NodeId nodeId,
UA_AttributeId  attributeId,
void *  v 
)

Don't use this function.

There are typed versions for every supported attribute.

◆ __UA_Server_write()

UA_StatusCode UA_THREADSAFE __UA_Server_write ( UA_Server server,
const UA_NodeId nodeId,
const UA_AttributeId  attributeId,
const UA_DataType attr_type,
const void *  attr 
)

Don't use this function.

There are typed versions with no additional overhead.

◆ UA_Server_addDataSourceVariableNode()

UA_StatusCode UA_THREADSAFE UA_Server_addDataSourceVariableNode ( UA_Server server,
const UA_NodeId  requestedNewNodeId,
const UA_NodeId  parentNodeId,
const UA_NodeId  referenceTypeId,
const UA_QualifiedName  browseName,
const UA_NodeId  typeDefinition,
const UA_VariableAttributes  attr,
const UA_DataSource  dataSource,
void *  nodeContext,
UA_NodeId outNewNodeId 
)

◆ UA_Server_addMethodNode_finish()

UA_StatusCode UA_THREADSAFE UA_Server_addMethodNode_finish ( UA_Server server,
const UA_NodeId  nodeId,
UA_MethodCallback  method,
size_t  inputArgumentsSize,
const UA_Argument inputArguments,
size_t  outputArgumentsSize,
const UA_Argument outputArguments 
)

◆ UA_Server_addMethodNodeEx()

UA_StatusCode UA_THREADSAFE UA_Server_addMethodNodeEx ( UA_Server server,
const UA_NodeId  requestedNewNodeId,
const UA_NodeId  parentNodeId,
const UA_NodeId  referenceTypeId,
const UA_QualifiedName  browseName,
const UA_MethodAttributes  attr,
UA_MethodCallback  method,
size_t  inputArgumentsSize,
const UA_Argument inputArguments,
const UA_NodeId  inputArgumentsRequestedNewNodeId,
UA_NodeId inputArgumentsOutNewNodeId,
size_t  outputArgumentsSize,
const UA_Argument outputArguments,
const UA_NodeId  outputArgumentsRequestedNewNodeId,
UA_NodeId outputArgumentsOutNewNodeId,
void *  nodeContext,
UA_NodeId outNewNodeId 
)

◆ UA_Server_addNamespace()

UA_UInt16 UA_THREADSAFE UA_Server_addNamespace ( UA_Server server,
const char *  name 
)

Add a new namespace to the server.

Returns the index of the new namespace

◆ UA_Server_addNode_begin()

UA_StatusCode UA_THREADSAFE UA_Server_addNode_begin ( UA_Server server,
const UA_NodeClass  nodeClass,
const UA_NodeId  requestedNewNodeId,
const UA_NodeId  parentNodeId,
const UA_NodeId  referenceTypeId,
const UA_QualifiedName  browseName,
const UA_NodeId  typeDefinition,
const void *  attr,
const UA_DataType attributeType,
void *  nodeContext,
UA_NodeId outNewNodeId 
)

The attr argument must have a type according to the NodeClass.

VariableAttributes for variables, ObjectAttributes for objects, and so on. Missing attributes are taken from the TypeDefinition node if applicable.

◆ UA_Server_addNode_finish()

UA_StatusCode UA_THREADSAFE UA_Server_addNode_finish ( UA_Server server,
const UA_NodeId  nodeId 
)

◆ UA_Server_addReference()

UA_StatusCode UA_THREADSAFE UA_Server_addReference ( UA_Server server,
const UA_NodeId  sourceId,
const UA_NodeId  refTypeId,
const UA_ExpandedNodeId  targetId,
UA_Boolean  isForward 
)

◆ UA_Server_addRepeatedCallback()

UA_StatusCode UA_THREADSAFE UA_Server_addRepeatedCallback ( UA_Server server,
UA_ServerCallback  callback,
void *  data,
UA_Double  interval_ms,
UA_UInt64 callbackId 
)

Add a callback for cyclic repetition to the server.

Parameters
serverThe server object.
callbackThe callback that shall be added.
dataData that is forwarded to the callback.
interval_msThe callback shall be repeatedly executed with the given interval (in ms). The interval must be positive. The first execution occurs at now() + interval at the latest.
callbackIdSet to the identifier of the repeated callback . This can be used to cancel the callback later on. If the pointer is null, the identifier is not set.
Returns
Upon success, UA_STATUSCODE_GOOD is returned. An error code otherwise.

◆ UA_Server_addReverseConnect()

UA_StatusCode UA_Server_addReverseConnect ( UA_Server server,
UA_String  url,
UA_Server_ReverseConnectStateCallback  stateCallback,
void *  callbackContext,
UA_UInt64 handle 
)

Registers a reverse connect in the server.

The server periodically attempts to establish a connection if the initial connect fails or if the connection breaks.

Parameters
serverThe server object
urlThe URL of the remote client
stateCallbackThe callback which will be called on state changes
callbackContextThe context for the state callback
handleIs set to the handle of the reverse connect if not NULL
Returns
Returns UA_STATUSCODE_GOOD if the reverse connect has been registered

◆ UA_Server_addTimedCallback()

UA_StatusCode UA_THREADSAFE UA_Server_addTimedCallback ( UA_Server server,
UA_ServerCallback  callback,
void *  data,
UA_DateTime  date,
UA_UInt64 callbackId 
)

Add a callback for execution at a specified time.

If the indicated time lies in the past, then the callback is executed at the next iteration of the server's main loop.

Parameters
serverThe server object.
callbackThe callback that shall be added.
dataData that is forwarded to the callback.
dateThe timestamp for the execution time.
callbackIdSet to the identifier of the repeated callback . This can be used to cancel the callback later on. If the pointer is null, the identifier is not set.
Returns
Upon success, UA_STATUSCODE_GOOD is returned. An error code otherwise.

◆ UA_Server_browse()

UA_BrowseResult UA_THREADSAFE UA_Server_browse ( UA_Server server,
UA_UInt32  maxReferences,
const UA_BrowseDescription bd 
)

Browse the references of a particular node.

See the definition of BrowseDescription structure for details.

Referenced by getTypeDefinitionId(), and hasReference().

◆ UA_Server_browseNext()

UA_BrowseResult UA_THREADSAFE UA_Server_browseNext ( UA_Server server,
UA_Boolean  releaseContinuationPoint,
const UA_ByteString continuationPoint 
)

◆ UA_Server_browseRecursive()

UA_StatusCode UA_THREADSAFE UA_Server_browseRecursive ( UA_Server server,
const UA_BrowseDescription bd,
size_t *  resultsSize,
UA_ExpandedNodeId **  results 
)

Non-standard version of the Browse service that recurses into child nodes.

Possible loops (that can occur for non-hierarchical references) are handled internally. Every node is added at most once to the results array.

Nodes are only added if they match the NodeClassMask in the BrowseDescription. However, child nodes are still recursed into if the NodeClass does not match. So it is possible, for example, to get all VariableNodes below a certain ObjectNode, with additional objects in the hierarchy below.

◆ UA_Server_browseSimplifiedBrowsePath()

UA_BrowsePathResult UA_THREADSAFE UA_Server_browseSimplifiedBrowsePath ( UA_Server server,
const UA_NodeId  origin,
size_t  browsePathSize,
const UA_QualifiedName browsePath 
)

A simplified TranslateBrowsePathsToNodeIds based on the SimpleAttributeOperand type (Part 4, 7.4.4.5).

This specifies a relative path using a list of BrowseNames instead of the RelativePath structure. The list of BrowseNames is equivalent to a RelativePath that specifies forward references which are subtypes of the HierarchicalReferences ReferenceType. All Nodes followed by the browsePath shall be of the NodeClass Object or Variable.

◆ UA_Server_call()

UA_CallMethodResult UA_THREADSAFE UA_Server_call ( UA_Server server,
const UA_CallMethodRequest request 
)

◆ UA_Server_changeRepeatedCallbackInterval()

UA_StatusCode UA_THREADSAFE UA_Server_changeRepeatedCallbackInterval ( UA_Server server,
UA_UInt64  callbackId,
UA_Double  interval_ms 
)

◆ UA_Server_closeSession()

UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_closeSession ( UA_Server server,
const UA_NodeId sessionId 
)

Manually close a session.

◆ UA_Server_createDataChangeMonitoredItem()

UA_MonitoredItemCreateResult UA_THREADSAFE UA_Server_createDataChangeMonitoredItem ( UA_Server server,
UA_TimestampsToReturn  timestampsToReturn,
const UA_MonitoredItemCreateRequest  item,
void *  monitoredItemContext,
UA_Server_DataChangeNotificationCallback  callback 
)

Create a local MonitoredItem with a sampling interval that detects data changes.

Parameters
serverThe server executing the MonitoredItem @timestampsToReturn Shall timestamps be added to the value for the callback? @item The parameters of the new MonitoredItem. Note that the attribute of the ReadValueId (the node that is monitored) can not be UA_ATTRIBUTEID_EVENTNOTIFIER. A different callback type needs to be registered for event notifications. @monitoredItemContext A pointer that is forwarded with the callback @callback The callback that is executed on detected data changes
Returns
Returns a description of the created MonitoredItem. The structure also contains a StatusCode (in case of an error) and the identifier of the new MonitoredItem.

◆ UA_Server_createEvent()

UA_StatusCode UA_THREADSAFE UA_Server_createEvent ( UA_Server server,
const UA_NodeId  eventType,
UA_NodeId outNodeId 
)

Creates a node representation of an event.

Parameters
serverThe server object
eventTypeThe type of the event for which a node should be created
outNodeIdThe NodeId of the newly created node for the event
Returns
The StatusCode of the UA_Server_createEvent method

◆ UA_Server_delete()

UA_EXPORT UA_StatusCode UA_Server_delete ( UA_Server server)

Delete the server.

◆ UA_Server_deleteMonitoredItem()

UA_StatusCode UA_THREADSAFE UA_Server_deleteMonitoredItem ( UA_Server server,
UA_UInt32  monitoredItemId 
)

UA_MonitoredItemCreateResult.

UA_Server_createEventMonitoredItem(UA_Server *server, UA_TimestampsToReturn timestampsToReturn, const UA_MonitoredItemCreateRequest item, void *context, UA_Server_EventNotificationCallback callback);

◆ UA_Server_deleteNode()

UA_StatusCode UA_THREADSAFE UA_Server_deleteNode ( UA_Server server,
const UA_NodeId  nodeId,
UA_Boolean  deleteReferences 
)

Deletes a node and optionally all references leading to the node.

◆ UA_Server_deleteReference()

UA_StatusCode UA_THREADSAFE UA_Server_deleteReference ( UA_Server server,
const UA_NodeId  sourceNodeId,
const UA_NodeId  referenceTypeId,
UA_Boolean  isForward,
const UA_ExpandedNodeId  targetNodeId,
UA_Boolean  deleteBidirectional 
)

◆ UA_Server_deleteSessionAttribute()

UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_deleteSessionAttribute ( UA_Server server,
const UA_NodeId sessionId,
const UA_QualifiedName  key 
)

◆ UA_Server_deregisterDiscovery()

UA_StatusCode UA_THREADSAFE UA_Server_deregisterDiscovery ( UA_Server server,
UA_ClientConfig cc,
const UA_String  discoveryServerUrl 
)

Deregister the given server instance from the discovery server.

This should be called when the server is shutting down.

◆ UA_Server_findDataType()

UA_EXPORT const UA_DataType * UA_Server_findDataType ( UA_Server server,
const UA_NodeId typeId 
)

Lookup a datatype by its NodeId.

Takes the custom types in the server configuration into account. Return NULL if none found.

◆ UA_Server_forEachChildNodeCall()

UA_StatusCode UA_THREADSAFE UA_Server_forEachChildNodeCall ( UA_Server server,
UA_NodeId  parentNodeId,
UA_NodeIteratorCallback  callback,
void *  handle 
)

◆ UA_Server_getConfig()

UA_EXPORT UA_ServerConfig * UA_Server_getConfig ( UA_Server server)

Get the configuration.

Always succeeds as this simplfy resolves a pointer. Attention! Do not adjust the configuration while the server is running!

◆ UA_Server_getLifecycleState()

UA_EXPORT UA_LifecycleState UA_Server_getLifecycleState ( UA_Server server)

Get the current server lifecycle state.

◆ UA_Server_getMethodNodeCallback()

UA_StatusCode UA_THREADSAFE UA_Server_getMethodNodeCallback ( UA_Server server,
const UA_NodeId  methodNodeId,
UA_MethodCallback outMethodCallback 
)

◆ UA_Server_getNamespaceByIndex()

UA_StatusCode UA_THREADSAFE UA_Server_getNamespaceByIndex ( UA_Server server,
const size_t  namespaceIndex,
UA_String foundUri 
)

Get namespace by id from the server.

◆ UA_Server_getNamespaceByName()

UA_StatusCode UA_THREADSAFE UA_Server_getNamespaceByName ( UA_Server server,
const UA_String  namespaceUri,
size_t *  foundIndex 
)

Get namespace by name from the server.

◆ UA_Server_getNodeContext()

UA_StatusCode UA_THREADSAFE UA_Server_getNodeContext ( UA_Server server,
UA_NodeId  nodeId,
void **  nodeContext 
)

◆ UA_Server_getSessionAttribute()

UA_EXPORT UA_StatusCode UA_Server_getSessionAttribute ( UA_Server server,
const UA_NodeId sessionId,
const UA_QualifiedName  key,
UA_Variant outValue 
)

Returns a shallow copy of the attribute.

Don't _clear or _delete the value variant. Don't use the value once the Session could be already closed in the background or the attribute of the session replaced. Hence don't use this in a multi-threaded application.

◆ UA_Server_getSessionAttribute_scalar()

UA_EXPORT UA_StatusCode UA_Server_getSessionAttribute_scalar ( UA_Server server,
const UA_NodeId sessionId,
const UA_QualifiedName  key,
const UA_DataType type,
void *  outValue 
)

Returns NULL if the attribute is not defined or not a scalar or not of the right datatype.

Otherwise a shallow copy of the scalar value is created at the target location of the void pointer. Hence don't use this in a multi-threaded application.

◆ UA_Server_getSessionAttributeCopy()

UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_getSessionAttributeCopy ( UA_Server server,
const UA_NodeId sessionId,
const UA_QualifiedName  key,
UA_Variant outValue 
)

Return a deep copy of the attribute.

◆ UA_Server_getStatistics()

UA_ServerStatistics UA_THREADSAFE UA_Server_getStatistics ( UA_Server server)

◆ UA_Server_new()

UA_EXPORT UA_Server * UA_Server_new ( void  )

Create a new server with a default configuration that adds plugins for networking, security, logging and so on.

See server_config_default.h for more detailed options.

The default configuration can be used as the starting point to adjust the server configuration to individual needs. UA_Server_new is implemented in the /plugins folder under the CC0 license. Furthermore the server confiugration only uses the public server API.

Returns
Returns the configured server or NULL if an error occurs.

◆ UA_Server_newWithConfig()

UA_EXPORT UA_Server * UA_Server_newWithConfig ( UA_ServerConfig config)

Creates a new server.

Moves the config into the server with a shallow copy. The config content is cleared together with the server.

◆ UA_Server_read()

UA_DataValue UA_THREADSAFE UA_Server_read ( UA_Server server,
const UA_ReadValueId item,
UA_TimestampsToReturn  timestamps 
)

Read an attribute of a node.

The specialized functions below provide a more concise syntax.

Parameters
serverThe server object.
itemReadValueIds contain the NodeId of the target node, the id of the attribute to read and (optionally) an index range to read parts of an array only. See the section on NumericRange for the format used for array ranges.
timestampsWhich timestamps to return for the attribute.
Returns
Returns a DataValue that contains either an error code, or a variant with the attribute value and the timestamps.

◆ UA_Server_readObjectProperty()

UA_StatusCode UA_THREADSAFE UA_Server_readObjectProperty ( UA_Server server,
const UA_NodeId  objectId,
const UA_QualifiedName  propertyName,
UA_Variant value 
)

Read an object property.

Parameters
serverThe server object
objectIdThe identifier of the object (node)
propertyNameThe name of the property
valueContains the property value after reading. Must not be NULL.
Returns
The StatusCode for setting the event attribute

◆ UA_Server_registerDiscovery()

UA_StatusCode UA_THREADSAFE UA_Server_registerDiscovery ( UA_Server server,
UA_ClientConfig cc,
const UA_String  discoveryServerUrl,
const UA_String  semaphoreFilePath 
)

Register the given server instance at the discovery server.

This should be called periodically, for example every 10 minutes, depending on the configuration of the discovery server. You should also call _unregisterDiscovery when the server shuts down.

The supplied client configuration is used to create a new client to connect to the discovery server. The client configuration is moved over to the server and eventually cleaned up internally. The structure pointed at by cc is zeroed to avoid accessing outdated information.

The eventloop and logging plugins in the client configuration are replaced by those configured in the server.

◆ UA_Server_removeCallback()

void UA_THREADSAFE UA_Server_removeCallback ( UA_Server server,
UA_UInt64  callbackId 
)

Remove a repeated callback.

Does nothing if the callback is not found.

Parameters
serverThe server object.
callbackIdThe id of the callback

◆ UA_Server_removeReverseConnect()

UA_StatusCode UA_Server_removeReverseConnect ( UA_Server server,
UA_UInt64  handle 
)

Removes a reverse connect from the server and closes the connection if it is currently open.

Parameters
serverThe server object
handleThe handle of the reverse connect to remove
Returns
Returns UA_STATUSCODE_GOOD if the reverse connect has been successfully removed

◆ UA_Server_run()

UA_EXPORT UA_StatusCode UA_Server_run ( UA_Server server,
const volatile UA_Boolean running 
)

Runs the server until interrupted.

On Unix/Windows this registers an interrupt for SIGINT (ctrl-c). The method only returns after having received the interrupt. The logical sequence is as follows:

  • UA_Server_run_startup
  • Loop until interrupt: UA_Server_run_iterate
  • UA_Server_run_shutdown
Parameters
serverThe server object.
Returns
Returns a bad statuscode if an error occurred internally.

◆ UA_Server_run_iterate()

UA_EXPORT UA_UInt16 UA_Server_run_iterate ( UA_Server server,
UA_Boolean  waitInternal 
)

Executes a single iteration of the server's main loop.

Parameters
serverThe server object.
waitInternalShould we wait for messages in the networklayer? Otherwise, the timouts for the networklayers are set to zero. The default max wait time is 200ms.
Returns
Returns how long we can wait until the next scheduled callback (in ms)

◆ UA_Server_run_shutdown()

UA_EXPORT UA_StatusCode UA_Server_run_shutdown ( UA_Server server)

The epilogue part of UA_Server_run (no need to use if you call UA_Server_run or UA_Server_runUntilInterrupt)

◆ UA_Server_run_startup()

UA_EXPORT UA_StatusCode UA_Server_run_startup ( UA_Server server)

The prologue part of UA_Server_run (no need to use if you call UA_Server_run or UA_Server_runUntilInterrupt)

◆ UA_Server_runUntilInterrupt()

UA_EXPORT UA_StatusCode UA_Server_runUntilInterrupt ( UA_Server server)

Runs the server until interrupted.

On Unix/Windows this registers an interrupt for SIGINT (ctrl-c). The method only returns after having received the interrupt or upon an error condition. The logical sequence is as follows:

  • Register the interrupt
  • UA_Server_run_startup
  • Loop until interrupt: UA_Server_run_iterate
  • UA_Server_run_shutdown
  • Deregister the interrupt

Attention! This method is implemented individually for the different platforms (POSIX/Win32/etc.). The default implementation is in /plugins/ua_config_default.c under the CC0 license. Adjust as needed.

Parameters
serverThe server object.
Returns
Returns a bad statuscode if an error occurred internally.

◆ UA_Server_setAdminSessionContext()

void UA_Server_setAdminSessionContext ( UA_Server server,
void *  context 
)

◆ UA_Server_setMethodNodeCallback()

UA_StatusCode UA_THREADSAFE UA_Server_setMethodNodeCallback ( UA_Server server,
const UA_NodeId  methodNodeId,
UA_MethodCallback  methodCallback 
)

◆ UA_Server_setNodeContext()

UA_StatusCode UA_THREADSAFE UA_Server_setNodeContext ( UA_Server server,
UA_NodeId  nodeId,
void *  nodeContext 
)

Careful! The user has to ensure that the destructor callbacks still work.

◆ UA_Server_setNodeTypeLifecycle()

UA_StatusCode UA_THREADSAFE UA_Server_setNodeTypeLifecycle ( UA_Server server,
UA_NodeId  nodeId,
UA_NodeTypeLifecycle  lifecycle 
)

◆ UA_Server_setRegisterServerCallback()

void UA_THREADSAFE UA_Server_setRegisterServerCallback ( UA_Server server,
UA_Server_registerServerCallback  cb,
void *  data 
)

Set the callback which is called if another server registeres or unregisters with this instance.

This callback is called every time the server gets a register call. This especially means that for every periodic server register the callback will be called.

Parameters
server
cbthe callback
datadata passed to the callback
Returns
UA_STATUSCODE_SUCCESS on success

◆ UA_Server_setSessionAttribute()

UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_setSessionAttribute ( UA_Server server,
const UA_NodeId sessionId,
const UA_QualifiedName  key,
const UA_Variant value 
)

◆ UA_Server_setVariableNode_dataSource()

UA_StatusCode UA_THREADSAFE UA_Server_setVariableNode_dataSource ( UA_Server server,
const UA_NodeId  nodeId,
const UA_DataSource  dataSource 
)

◆ UA_Server_setVariableNode_valueBackend()

UA_StatusCode UA_THREADSAFE UA_Server_setVariableNode_valueBackend ( UA_Server server,
const UA_NodeId  nodeId,
const UA_ValueBackend  valueBackend 
)

◆ UA_Server_setVariableNode_valueCallback()

UA_StatusCode UA_THREADSAFE UA_Server_setVariableNode_valueCallback ( UA_Server server,
const UA_NodeId  nodeId,
const UA_ValueCallback  callback 
)

◆ UA_Server_setVariableNodeDynamic()

UA_StatusCode UA_THREADSAFE UA_Server_setVariableNodeDynamic ( UA_Server server,
const UA_NodeId  nodeId,
UA_Boolean  isDynamic 
)

VariableNodes that are "dynamic" (default for user-created variables) receive and store a SourceTimestamp.

For non-dynamic VariableNodes the current time is used for the SourceTimestamp.

◆ UA_Server_translateBrowsePathToNodeIds()

UA_BrowsePathResult UA_THREADSAFE UA_Server_translateBrowsePathToNodeIds ( UA_Server server,
const UA_BrowsePath browsePath 
)

◆ UA_Server_triggerEvent()

UA_StatusCode UA_THREADSAFE UA_Server_triggerEvent ( UA_Server server,
const UA_NodeId  eventNodeId,
const UA_NodeId  originId,
UA_ByteString outEventId,
const UA_Boolean  deleteEventNode 
)

Triggers a node representation of an event by applying EventFilters and adding the event to the appropriate queues.

Parameters
serverThe server object
eventNodeIdThe NodeId of the node representation of the event which should be triggered
outEventthe EventId of the new event
deleteEventNodeSpecifies whether the node representation of the event should be deleted
Returns
The StatusCode of the UA_Server_triggerEvent method

◆ UA_Server_updateCertificate()

UA_StatusCode UA_Server_updateCertificate ( UA_Server server,
const UA_ByteString oldCertificate,
const UA_ByteString newCertificate,
const UA_ByteString newPrivateKey,
UA_Boolean  closeSessions,
UA_Boolean  closeSecureChannels 
)

◆ UA_Server_write()

UA_StatusCode UA_THREADSAFE UA_Server_write ( UA_Server server,
const UA_WriteValue value 
)

Overwrite an attribute of a node.

The specialized functions below provide a more concise syntax.

Parameters
serverThe server object.
valueWriteValues contain the NodeId of the target node, the id of the attribute to overwritten, the actual value and (optionally) an index range to replace parts of an array only. of an array only. See the section on NumericRange for the format used for array ranges.
Returns
Returns a status code.

◆ UA_Server_writeObjectProperty()

UA_StatusCode UA_THREADSAFE UA_Server_writeObjectProperty ( UA_Server server,
const UA_NodeId  objectId,
const UA_QualifiedName  propertyName,
const UA_Variant  value 
)

Write an object property.

The property is represented as a VariableNode with a HasProperty reference from the ObjectNode. The VariableNode is identified by its BrowseName. Writing the property sets the value attribute of the VariableNode.

Parameters
serverThe server object
objectIdThe identifier of the object (node)
propertyNameThe name of the property
valueThe value to be set for the event attribute
Returns
The StatusCode for setting the event attribute

◆ UA_Server_writeObjectProperty_scalar()

UA_StatusCode UA_THREADSAFE UA_Server_writeObjectProperty_scalar ( UA_Server server,
const UA_NodeId  objectId,
const UA_QualifiedName  propertyName,
const void *  value,
const UA_DataType type 
)

Directly point to the scalar value instead of a variant.

◆ UA_ServerConfig_clean()

void UA_ServerConfig_clean ( UA_ServerConfig config)