open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
server.h File Reference

Go to the source code of this file.

Data Structures

struct  UA_UInt32Range
 
struct  UA_DurationRange
 
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)
 
#define UA_DEFAULT_ATTRIBUTES_DEFINED
 

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)
 

Functions

void UA_ServerConfig_clean (UA_ServerConfig *config)
 
UA_ServerUA_Server_newWithConfig (UA_ServerConfig *config)
 
void UA_Server_delete (UA_Server *server)
 
UA_ServerConfigUA_Server_getConfig (UA_Server *server)
 
UA_StatusCode UA_Server_run (UA_Server *server, const volatile UA_Boolean *running)
 
UA_StatusCode UA_Server_run_startup (UA_Server *server)
 
UA_UInt16 UA_Server_run_iterate (UA_Server *server, UA_Boolean waitInternal)
 
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_THREADSAFE UA_Server_setSessionParameter (UA_Server *server, const UA_NodeId *sessionId, const char *name, const UA_Variant *parameter)
 
UA_EXPORT void UA_THREADSAFE UA_Server_deleteSessionParameter (UA_Server *server, const UA_NodeId *sessionId, const char *name)
 
UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_getSessionParameter (UA_Server *server, const UA_NodeId *sessionId, const char *name, UA_Variant *outParameter)
 
UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_getSessionScalarParameter (UA_Server *server, const UA_NodeId *sessionId, const char *name, const UA_DataType *type, UA_Variant *outParameter)
 
UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_getSessionArrayParameter (UA_Server *server, const UA_NodeId *sessionId, const char *name, const UA_DataType *type, UA_Variant *outParameter)
 
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_register_discovery (UA_Server *server, struct UA_Client *client, const char *semaphoreFilePath)
 
UA_StatusCode UA_THREADSAFE UA_Server_unregister_discovery (UA_Server *server, struct UA_Client *client)
 
UA_StatusCode UA_THREADSAFE UA_Server_addPeriodicServerRegisterCallback (UA_Server *server, struct UA_Client *client, const char *discoveryServerUrl, UA_Double intervalMs, UA_Double delayFirstRegisterMs, UA_UInt64 *periodicCallbackId)
 
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_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_Server_getStatistics (UA_Server *server)
 

Variables

UA_EXPORT const UA_VariableAttributes UA_VariableAttributes_default
 
UA_EXPORT const UA_VariableTypeAttributes UA_VariableTypeAttributes_default
 
UA_EXPORT const UA_MethodAttributes UA_MethodAttributes_default
 
UA_EXPORT const UA_ObjectAttributes UA_ObjectAttributes_default
 
UA_EXPORT const UA_ObjectTypeAttributes UA_ObjectTypeAttributes_default
 
UA_EXPORT const UA_ReferenceTypeAttributes UA_ReferenceTypeAttributes_default
 
UA_EXPORT const UA_DataTypeAttributes UA_DataTypeAttributes_default
 
UA_EXPORT const UA_ViewAttributes UA_ViewAttributes_default
 

Macro Definition Documentation

◆ UA_Server_removeRepeatedCallback

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

Definition at line 354 of file server.h.

◆ HAVE_NODEITER_CALLBACK

#define HAVE_NODEITER_CALLBACK

Definition at line 731 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 947 of file server.h.

◆ UA_DEFAULT_ATTRIBUTES_DEFINED

#define UA_DEFAULT_ATTRIBUTES_DEFINED

Protect against redundant definitions for server/client.

Definition at line 998 of file server.h.

Typedef Documentation

◆ UA_PubSubConfiguration

typedef struct UA_PubSubConfiguration UA_PubSubConfiguration

Definition at line 47 of file server.h.

◆ UA_Server_AsyncOperationNotifyCallback

typedef void(* UA_Server_AsyncOperationNotifyCallback) (UA_Server *server)

Definition at line 49 of file server.h.

◆ 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 735 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 806 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 896 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 901 of file server.h.

Function Documentation

◆ UA_ServerConfig_clean()

void UA_ServerConfig_clean ( UA_ServerConfig * config)

◆ UA_Server_newWithConfig()

UA_Server * UA_Server_newWithConfig ( UA_ServerConfig * config)

The method UA_Server_new is defined in server_config_default.h.

So default plugins outside of the core library (for logging, etc) are already available during the initialization.

UA_Server * UA_Server_new(void); 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_delete()

void UA_Server_delete ( UA_Server * server)

◆ UA_Server_getConfig()

UA_ServerConfig * UA_Server_getConfig ( UA_Server * server)

◆ UA_Server_run()

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

Runs the main loop of the server.

In each iteration, this calls into the networklayers to see if messages have arrived.

Parameters
serverThe server object.
runningThe loop is run as long as *running is true. Otherwise, the server shuts down.
Returns
Returns the statuscode of the UA_Server_run_shutdown method

◆ UA_Server_run_startup()

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)

◆ UA_Server_run_iterate()

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 50millisec.
Returns
Returns how long we can wait until the next scheduled callback (in ms)

◆ UA_Server_run_shutdown()

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)

◆ 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_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_changeRepeatedCallbackInterval()

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

◆ 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_closeSession()

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

Manually close a session.

◆ UA_Server_setSessionParameter()

UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_setSessionParameter ( UA_Server * server,
const UA_NodeId * sessionId,
const char * name,
const UA_Variant * parameter )

Session Parameters: Besides the user-definable session context pointer, so-called session parameters are a way to attach key-value parameters to a session.

This enables "plugins" to attach data to a session without impacting the user-definedable session context pointer.

◆ UA_Server_deleteSessionParameter()

UA_EXPORT void UA_THREADSAFE UA_Server_deleteSessionParameter ( UA_Server * server,
const UA_NodeId * sessionId,
const char * name )

◆ UA_Server_getSessionParameter()

UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_getSessionParameter ( UA_Server * server,
const UA_NodeId * sessionId,
const char * name,
UA_Variant * outParameter )

Returns NULL if the session or the parameter are not defined.

Returns a deep copy otherwise

◆ UA_Server_getSessionScalarParameter()

UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_getSessionScalarParameter ( UA_Server * server,
const UA_NodeId * sessionId,
const char * name,
const UA_DataType * type,
UA_Variant * outParameter )

Returns NULL if the parameter is not defined or not of the right datatype.

◆ UA_Server_getSessionArrayParameter()

UA_EXPORT UA_StatusCode UA_THREADSAFE UA_Server_getSessionArrayParameter ( UA_Server * server,
const UA_NodeId * sessionId,
const char * name,
const UA_DataType * type,
UA_Variant * outParameter )

◆ 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_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_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_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_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.

◆ 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_translateBrowsePathToNodeIds()

UA_BrowsePathResult UA_THREADSAFE UA_Server_translateBrowsePathToNodeIds ( UA_Server * server,
const UA_BrowsePath * browsePath )

◆ 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_forEachChildNodeCall()

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

◆ UA_Server_register_discovery()

UA_StatusCode UA_THREADSAFE UA_Server_register_discovery ( UA_Server * server,
struct UA_Client * client,
const char * semaphoreFilePath )

Register the given server instance at the discovery server.

This should be called periodically. The semaphoreFilePath is optional. If the given file is deleted, the server will automatically be unregistered. This could be for example a pid file which is deleted if the server crashes.

When the server shuts down you need to call unregister.

Parameters
server
clientthe client which is used to call the RegisterServer. It must already be connected to the correct endpoint
semaphoreFilePathoptional parameter pointing to semaphore file.

◆ UA_Server_unregister_discovery()

UA_StatusCode UA_THREADSAFE UA_Server_unregister_discovery ( UA_Server * server,
struct UA_Client * client )

Unregister the given server instance from the discovery server.

This should only be called when the server is shutting down.

Parameters
server
clientthe client which is used to call the RegisterServer. It must already be connected to the correct endpoint

◆ UA_Server_addPeriodicServerRegisterCallback()

UA_StatusCode UA_THREADSAFE UA_Server_addPeriodicServerRegisterCallback ( UA_Server * server,
struct UA_Client * client,
const char * discoveryServerUrl,
UA_Double intervalMs,
UA_Double delayFirstRegisterMs,
UA_UInt64 * periodicCallbackId )

◆ 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_setAdminSessionContext()

void UA_Server_setAdminSessionContext ( UA_Server * server,
void * context )

◆ UA_Server_setNodeTypeLifecycle()

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

◆ UA_Server_getNodeContext()

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

◆ 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_setVariableNode_dataSource()

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

◆ 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_setVariableNode_valueBackend()

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

◆ 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_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_setMethodNodeCallback()

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

◆ UA_Server_getMethodNodeCallback()

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

◆ UA_Server_call()

UA_CallMethodResult UA_THREADSAFE UA_Server_call ( UA_Server * server,
const UA_CallMethodRequest * request )

◆ 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_getStatistics()

UA_ServerStatistics UA_Server_getStatistics ( UA_Server * server)

Variable Documentation

◆ UA_VariableAttributes_default

UA_EXPORT const UA_VariableAttributes UA_VariableAttributes_default
extern

The default for variables is "BaseDataType" for the datatype, -2 for the valuerank and a read-accesslevel.

◆ UA_VariableTypeAttributes_default

UA_EXPORT const UA_VariableTypeAttributes UA_VariableTypeAttributes_default
extern

◆ UA_MethodAttributes_default

UA_EXPORT const UA_MethodAttributes UA_MethodAttributes_default
extern

Methods are executable by default.

◆ UA_ObjectAttributes_default

UA_EXPORT const UA_ObjectAttributes UA_ObjectAttributes_default
extern

The remaining attribute definitions are currently all zeroed out.

◆ UA_ObjectTypeAttributes_default

UA_EXPORT const UA_ObjectTypeAttributes UA_ObjectTypeAttributes_default
extern

◆ UA_ReferenceTypeAttributes_default

UA_EXPORT const UA_ReferenceTypeAttributes UA_ReferenceTypeAttributes_default
extern

◆ UA_DataTypeAttributes_default

UA_EXPORT const UA_DataTypeAttributes UA_DataTypeAttributes_default
extern

◆ UA_ViewAttributes_default

UA_EXPORT const UA_ViewAttributes UA_ViewAttributes_default
extern