17#ifndef UA_SERVER_INTERNAL_H_
18#define UA_SERVER_INTERNAL_H_
32#if UA_MULTITHREADING >= 100
34#define UA_THREADSAFE UA_DEPRECATED
37#ifdef UA_ENABLE_PUBSUB
41#ifdef UA_ENABLE_DISCOVERY
45#ifdef UA_ENABLE_SUBSCRIPTIONS
99#if UA_MULTITHREADING >= 100
100 UA_AsyncManager asyncManager;
123#ifdef UA_ENABLE_DISCOVERY
128#ifdef UA_ENABLE_SUBSCRIPTIONS
140# ifdef UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS
147#ifdef UA_ENABLE_PUBSUB
151#if UA_MULTITHREADING >= 100
152 UA_Lock networkMutex;
153 UA_Lock serviceMutex;
296 UA_NodeId **typeHierarchy,
size_t *typeHierarchySize);
301 UA_NodeId **interfaceChildNodes,
size_t *interfaceChildNodesSize);
303#ifdef UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS
310UA_ConditionList_delete(
UA_Server *server);
333 const void *requestOperation,
334 void *responseOperation);
340 const size_t *requestOperations,
342 size_t *responseOperations,
358 void *nodeContext,
UA_NodeId *outNewNodeId);
397#ifdef UA_ENABLE_SUBSCRIPTIONS
404#ifdef UA_ENABLE_SUBSCRIPTIONS_EVENTS
444#ifdef UA_ENABLE_DISCOVERY
449 const char* semaphoreFilePath);
468#define UA_REFTREE_INITIAL_SIZE 16
527 UA_Int32 targetValueRank,
size_t targetArrayDimensionsSize,
550 const UA_UInt32 *constraintArrayDimensions,
551 size_t testArrayDimensionsSize,
560 UA_Int32 valueRank,
size_t arrayDimensionsSize);
607#ifdef UA_ENABLE_DIAGNOSTICS
619readSubscriptionDiagnosticsArray(
UA_Server *server,
620 const UA_NodeId *sessionId,
void *sessionContext,
621 const UA_NodeId *nodeId,
void *nodeContext,
626readSessionDiagnosticsArray(
UA_Server *server,
627 const UA_NodeId *sessionId,
void *sessionContext,
628 const UA_NodeId *nodeId,
void *nodeContext,
633readSessionSecurityDiagnostics(
UA_Server *server,
634 const UA_NodeId *sessionId,
void *sessionContext,
635 const UA_NodeId *nodeId,
void *nodeContext,
644#define UA_NODESTORE_NEW(server, nodeClass) \
645 server->config.nodestore.newNode(server->config.nodestore.context, nodeClass)
647#define UA_NODESTORE_DELETE(server, node) \
648 server->config.nodestore.deleteNode(server->config.nodestore.context, node)
650#define UA_NODESTORE_GET(server, nodeid) \
651 server->config.nodestore.getNode(server->config.nodestore.context, nodeid)
657#define UA_NODESTORE_RELEASE(server, node) \
658 server->config.nodestore.releaseNode(server->config.nodestore.context, node)
660#define UA_NODESTORE_GETCOPY(server, nodeid, outnode) \
661 server->config.nodestore.getNodeCopy(server->config.nodestore.context, \
664#define UA_NODESTORE_INSERT(server, node, addedNodeId) \
665 server->config.nodestore.insertNode(server->config.nodestore.context, \
668#define UA_NODESTORE_REPLACE(server, node) \
669 server->config.nodestore.replaceNode(server->config.nodestore.context, node)
671#define UA_NODESTORE_REMOVE(server, nodeId) \
672 server->config.nodestore.removeNode(server->config.nodestore.context, nodeId)
674#define UA_NODESTORE_GETREFERENCETYPEID(server, index) \
675 server->config.nodestore.getReferenceTypeId(server->config.nodestore.context, \
UA_AttributeId
This Source Code Form is subject to the terms of the Mozilla Public License, v.
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
#define LIST_HEAD(name, type)
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)
const UA_ExpandedNodeId * target
ZIP_ENTRY(RefEntry) zipfields
UA_ExpandedNodeId * targets
This Source Code Form is subject to the terms of the Mozilla Public License, v.
UA_Server_DataChangeNotificationCallback dataChangeCallback
UA_MonitoredItem monitoredItem
Every Node starts with these attributes.
List of reference targets with the same reference type and direction.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
UA_UInt32 activeSessionCount
TAILQ_HEAD(, channel_entry) channels
UA_UInt32 lastSubscriptionId
UA_DiscoveryManager discoveryManager
UA_SecureChannelStatistics secureChannelStatistics
UA_PubSubManager pubSubManager
LIST_HEAD(, UA_MonitoredItem) localMonitoredItems
UA_UInt32 lastLocalMonitoredItemId
UA_ServerDiagnosticsSummaryDataType serverDiagnosticsSummary
size_t monitoredItemsSize
LIST_HEAD(session_list, session_list_entry) sessions
UA_NetworkStatistics networkStatistics
LIST_HEAD(, UA_Subscription) subscriptions
Subscriptions are managed in a server-wide linked list.
UA_TimerEntry cleanupCallback
TAILQ_ENTRY(channel_entry) pointers
LIST_ENTRY(session_list_entry) pointers
UA_TimerEntry cleanupCallback
_UA_BEGIN_DECLS typedef bool UA_Boolean
This Source Code Form is subject to the terms of the Mozilla Public License, v.
const UA_DataType UA_TYPES[191]
UA_StatusCode RefTree_init(RefTree *rt)
UA_StatusCode filterEvent(UA_Server *server, UA_Session *session, const UA_NodeId *eventNode, UA_EventFilter *filter, UA_EventFieldList *efl, UA_EventFilterResult *result)
Filters the given event with the given filter and writes the results into a notification.
UA_Session * getSessionByToken(UA_Server *server, const UA_NodeId *token)
UA_StatusCode readObjectProperty(UA_Server *server, const UA_NodeId objectId, const UA_QualifiedName propertyName, UA_Variant *value)
UA_Boolean compatibleValue(UA_Server *server, UA_Session *session, const UA_NodeId *targetDataTypeId, UA_Int32 targetValueRank, size_t targetArrayDimensionsSize, const UA_UInt32 *targetArrayDimensions, const UA_Variant *value, const UA_NumericRange *range, const char **reason)
Test whether the value matches a variable definition given by.
UA_StatusCode 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)
void UA_Server_deleteSecureChannels(UA_Server *server)
SecureChannel Handling.
UA_Boolean isNodeInTree(UA_Server *server, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind, const UA_ReferenceTypeSet *relevantRefs)
Recursively searches "upwards" in the tree following specific reference types.
UA_Boolean compatibleValueArrayDimensions(const UA_Variant *value, size_t targetArrayDimensionsSize, const UA_UInt32 *targetArrayDimensions)
void UA_Server_cleanupTimedOutSecureChannels(UA_Server *server, UA_DateTime nowMonotonic)
Remove timed out securechannels with a delayed callback.
UA_StatusCode addRepeatedCallback(UA_Server *server, UA_ServerCallback callback, void *data, UA_Double interval_ms, UA_UInt64 *callbackId)
void Operation_Browse(UA_Server *server, UA_Session *session, const UA_UInt32 *maxrefs, const UA_BrowseDescription *descr, UA_BrowseResult *result)
UA_UInt16 addNamespace(UA_Server *server, const UA_String name)
UA_StatusCode referenceTypeIndices(UA_Server *server, const UA_NodeId *refType, UA_ReferenceTypeSet *indices, UA_Boolean includeSubtypes)
Get the bitfield indices of a ReferenceType and possibly its subtypes.
UA_StatusCode sendResponse(UA_Server *server, UA_Session *session, UA_SecureChannel *channel, UA_UInt32 requestId, UA_Response *response, const UA_DataType *responseType)
UA_StatusCode UA_Server_configSecureChannel(void *application, UA_SecureChannel *channel, const UA_AsymmetricAlgorithmSecurityHeader *asymHeader)
UA_Boolean RefTree_contains(RefTree *rt, const UA_ExpandedNodeId *target)
UA_StatusCode deleteNode(UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences)
Internal function calls, without locks.
UA_StatusCode UA_Server_createSession(UA_Server *server, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_Session **session)
struct channel_entry channel_entry
UA_StatusCode readValueAttribute(UA_Server *server, UA_Session *session, const UA_VariableNode *vn, UA_DataValue *v)
UA_StatusCode changeRepeatedCallbackInterval(UA_Server *server, UA_UInt64 callbackId, UA_Double interval_ms)
void UA_Server_closeSecureChannel(UA_Server *server, UA_SecureChannel *channel, UA_DiagnosticEvent event)
UA_StatusCode UA_Server_initNS0(UA_Server *server)
Create Namespace 0.
UA_StatusCode addRef(UA_Server *server, UA_Session *session, const UA_NodeId *sourceId, const UA_NodeId *referenceTypeId, const UA_NodeId *targetId, UA_Boolean forward)
UA_StatusCode triggerEvent(UA_Server *server, const UA_NodeId eventNodeId, const UA_NodeId origin, UA_ByteString *outEventId, const UA_Boolean deleteEventNode)
UA_BrowsePathResult browseSimplifiedBrowsePath(UA_Server *server, const UA_NodeId origin, size_t browsePathSize, const UA_QualifiedName *browsePath)
UA_StatusCode RefTree_addNodeId(RefTree *rt, const UA_NodeId *target, UA_Boolean *duplicate)
UA_Boolean UA_Node_hasSubTypeOrInstances(const UA_NodeHead *head)
UA_SecurityPolicy * getSecurityPolicyByUri(const UA_Server *server, const UA_ByteString *securityPolicyUri)
Gets the a pointer to the context of a security policy supported by the server matched by the securit...
UA_Boolean compatibleArrayDimensions(size_t constraintArrayDimensionsSize, const UA_UInt32 *constraintArrayDimensions, size_t testArrayDimensionsSize, const UA_UInt32 *testArrayDimensions)
UA_BrowsePathResult translateBrowsePathToNodeIds(UA_Server *server, const UA_BrowsePath *browsePath)
UA_StatusCode writeNs0VariableArray(UA_Server *server, UA_UInt32 id, void *v, size_t length, const UA_DataType *type)
UA_StatusCode getNamespaceByIndex(UA_Server *server, const size_t namespaceIndex, UA_String *foundUri)
UA_StatusCode setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId, const UA_DataSource dataSource)
void ReadWithNode(const UA_Node *node, UA_Server *server, UA_Session *session, UA_TimestampsToReturn timestampsToReturn, const UA_ReadValueId *id, UA_DataValue *v)
Check Information Model Consistency.
void monitoredItem_sampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem)
UA_Subscription * UA_Server_getSubscriptionById(UA_Server *server, UA_UInt32 subscriptionId)
UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, UA_EditNodeCallback callback, void *data)
const UA_Node * getNodeType(UA_Server *server, const UA_NodeHead *nodeHead)
Returns the type node from the node on the stack top.
@ UA_SERVERLIFECYCLE_FRESH
@ UA_SERVERLIFECYLE_RUNNING
UA_StatusCode browseRecursive(UA_Server *server, size_t startNodesSize, const UA_NodeId *startNodes, UA_BrowseDirection browseDirection, const UA_ReferenceTypeSet *refTypes, UA_UInt32 nodeClassMask, UA_Boolean includeStartNodes, size_t *resultsSize, UA_ExpandedNodeId **results)
Returns an array with the hierarchy of nodes.
void UA_Server_removeSession(UA_Server *server, session_list_entry *sentry, UA_DiagnosticEvent event)
@ UA_DIAGNOSTICEVENT_REJECT
@ UA_DIAGNOSTICEVENT_ABORT
@ UA_DIAGNOSTICEVENT_CLOSE
@ UA_DIAGNOSTICEVENT_PURGE
@ UA_DIAGNOSTICEVENT_SECURITYREJECT
@ UA_DIAGNOSTICEVENT_TIMEOUT
const UA_Node * UA_NODESTORE_GETFROMREF(UA_Server *server, UA_NodePointer target)
Returns NULL if the target is an external Reference (per the ExpandedNodeId)
UA_StatusCode(* UA_EditNodeCallback)(UA_Server *, UA_Session *, UA_Node *node, void *)
Node Handling.
UA_Boolean compatibleValueRankArrayDimensions(UA_Server *server, UA_Session *session, UA_Int32 valueRank, size_t arrayDimensionsSize)
UA_Boolean compatibleDataTypes(UA_Server *server, const UA_NodeId *dataType, const UA_NodeId *constraintDataType)
Is the DataType compatible.
UA_Session * UA_Server_getSessionById(UA_Server *server, const UA_NodeId *sessionId)
UA_StatusCode writeObjectProperty(UA_Server *server, const UA_NodeId objectId, const UA_QualifiedName propertyName, const UA_Variant value)
UA_StatusCode AddNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId)
Type-check type-definition; Run the constructors.
UA_StatusCode UA_Server_createSecureChannel(UA_Server *server, UA_Connection *connection)
void setupNs1Uri(UA_Server *server)
Utility Functions.
void UA_Server_cleanupSessions(UA_Server *server, UA_DateTime nowMonotonic)
UA_Boolean isNodeInTree_singleRef(UA_Server *server, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind, const UA_Byte relevantRefTypeIndex)
Convenience function with just a single ReferenceTypeIndex.
UA_StatusCode register_server_with_discovery_server(UA_Server *server, void *client, const UA_Boolean isUnregister, const char *semaphoreFilePath)
UA_StatusCode readWithReadValue(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, void *v)
UA_StatusCode sendServiceFault(UA_SecureChannel *channel, UA_UInt32 requestId, UA_UInt32 requestHandle, UA_StatusCode statusCode)
const struct aa_head refNameTree
References Handling.
const UA_ReferenceTarget * UA_NodeReferenceKind_findTarget(const UA_NodeReferenceKind *rk, const UA_ExpandedNodeId *targetId)
UA_StatusCode AddNode_raw(UA_Server *server, UA_Session *session, void *nodeContext, const UA_AddNodesItem *item, UA_NodeId *outNewNodeId)
AddNodes Begin and Finish.
UA_StatusCode UA_Server_removeSessionByToken(UA_Server *server, const UA_NodeId *token, UA_DiagnosticEvent event)
UA_StatusCode writeAttribute(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, const UA_AttributeId attributeId, const void *attr, const UA_DataType *attr_type)
UA_Boolean RefTree_containsNodeId(RefTree *rt, const UA_NodeId *target)
UA_StatusCode getNamespaceByName(UA_Server *server, const UA_String namespaceUri, size_t *foundIndex)
Session Handling.
UA_StatusCode getAllInterfaceChildNodeIds(UA_Server *server, const UA_NodeId *objectNode, const UA_NodeId *objectTypeNode, UA_NodeId **interfaceChildNodes, size_t *interfaceChildNodesSize)
Returns the recursive interface hierarchy of the node.
void adjustValueType(UA_Server *server, UA_Variant *value, const UA_NodeId *targetDataTypeId)
Set to the target type if compatible.
UA_StatusCode getParentTypeAndInterfaceHierarchy(UA_Server *server, const UA_NodeId *typeNode, UA_NodeId **typeHierarchy, size_t *typeHierarchySize)
Returns the recursive type and interface hierarchy of the node.
UA_StatusCode AddNode_addRefs(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, const UA_NodeId *typeDefinitionId)
Check the reference to the parent node; Add references.
void removeCallback(UA_Server *server, UA_UInt64 callbackId)
UA_StatusCode getBoundSession(UA_Server *server, const UA_SecureChannel *channel, const UA_NodeId *token, UA_Session **session)
struct session_list_entry session_list_entry
void(* UA_ServiceOperation)(UA_Server *server, UA_Session *session, const void *context, const void *requestOperation, void *responseOperation)
Many services come as an array of operations.
void RefTree_clear(RefTree *rt)
UA_Boolean compatibleValueRanks(UA_Int32 valueRank, UA_Int32 constraintValueRank)
UA_StatusCode setNodeContext(UA_Server *server, UA_NodeId nodeId, void *nodeContext)
UA_DataValue readAttribute(UA_Server *server, const UA_ReadValueId *item, UA_TimestampsToReturn timestamps)
UA_StatusCode UA_Server_processServiceOperations(UA_Server *server, UA_Session *session, UA_ServiceOperation operationCallback, const void *context, const size_t *requestOperations, const UA_DataType *requestOperationsType, size_t *responseOperations, const UA_DataType *responseOperationsType)
UA_StatusCode getNodeContext(UA_Server *server, UA_NodeId nodeId, void **nodeContext)
UA_Boolean compatibleValueDataType(UA_Server *server, const UA_DataType *dataType, const UA_NodeId *constraintDataType)
Is the Value compatible with the DataType? Can perform additional checks compared to compatibleDataTy...
UA_DataValue UA_Server_readWithSession(UA_Server *server, UA_Session *session, const UA_ReadValueId *item, UA_TimestampsToReturn timestampsToReturn)
struct UA_ConditionSource UA_ConditionSource
Tagged Pointer structure.
void(* UA_ServerCallback)(UA_Server *server, void *data)
#define ZIP_HEAD(name, type)
Reusable zip tree implementation.