ua_server.h 5.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (C) 2014 the contributors as stated in the AUTHORS file
  3. *
  4. * This file is part of open62541. open62541 is free software: you can
  5. * redistribute it and/or modify it under the terms of the GNU Lesser General
  6. * Public License, version 3 (as published by the Free Software Foundation) with
  7. * a static linking exception as stated in the LICENSE file provided with
  8. * open62541.
  9. *
  10. * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
  11. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  13. * details.
  14. */
  15. #ifndef UA_SERVER_H_
  16. #define UA_SERVER_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #include "ua_types.h"
  21. #include "ua_types_generated.h"
  22. #include "ua_connection.h"
  23. #include "ua_log.h"
  24. /** @defgroup server Server */
  25. struct UA_Server;
  26. typedef struct UA_Server UA_Server;
  27. UA_Server UA_EXPORT * UA_Server_new(UA_String *endpointUrl, UA_ByteString *serverCertificate);
  28. void UA_EXPORT UA_Server_delete(UA_Server *server);
  29. void UA_EXPORT UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, const UA_ByteString *msg);
  30. /* Services for local use */
  31. UA_AddNodesResult UA_EXPORT UA_Server_addNode(UA_Server *server, const UA_Node **node,
  32. const UA_ExpandedNodeId *parentNodeId,
  33. const UA_NodeId *referenceTypeId);
  34. UA_StatusCode UA_EXPORT UA_Server_addReference(UA_Server *server, const UA_AddReferencesItem *item);
  35. void UA_EXPORT UA_Server_addScalarVariableNode(UA_Server *server, UA_QualifiedName *browseName, void *value,
  36. const UA_VTable_Entry *vt, const UA_ExpandedNodeId *parentNodeId,
  37. const UA_NodeId *referenceTypeId );
  38. /** @ingroup server
  39. @defgroup external_nodestore External Nodestore
  40. To plug in outside data sources, one can use
  41. - VariableNodes with a data source (functions that are called for read and write access)
  42. - An external nodestore that is mapped to specific namespaces
  43. If no external nodestore is defined for a nodeid, it is always looked up in
  44. the "local" nodestore of open62541. Namespace Zero is always in the local nodestore.
  45. */
  46. typedef UA_Int32 (*UA_ExternalNodeStore_addNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_AddNodesItem *nodesToAdd,
  47. UA_UInt32 *indices,UA_UInt32 indicesSize, UA_AddNodesResult* addNodesResults,
  48. UA_DiagnosticInfo *diagnosticInfos);
  49. typedef UA_Int32 (*UA_ExternalNodeStore_addReferences)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_AddReferencesItem* referencesToAdd,
  50. UA_UInt32 *indices,UA_UInt32 indicesSize, UA_StatusCode *addReferencesResults,
  51. UA_DiagnosticInfo *diagnosticInfos);
  52. typedef UA_Int32 (*UA_ExternalNodeStore_deleteNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_DeleteNodesItem *nodesToDelete, UA_UInt32 *indices,
  53. UA_UInt32 indicesSize, UA_StatusCode *deleteNodesResults, UA_DiagnosticInfo *diagnosticInfos);
  54. typedef UA_Int32 (*UA_ExternalNodeStore_deleteReferences)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_DeleteReferencesItem *referenceToDelete,
  55. UA_UInt32 *indices, UA_UInt32 indicesSize, UA_StatusCode deleteReferencesresults,
  56. UA_DiagnosticInfo *diagnosticInfos);
  57. typedef UA_Int32 (*UA_ExternalNodeStore_readNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_ReadValueId *readValueIds, UA_UInt32 *indices,
  58. UA_UInt32 indicesSize,UA_DataValue *readNodesResults, UA_Boolean timeStampToReturn, UA_DiagnosticInfo *diagnosticInfos);
  59. typedef UA_Int32 (*UA_ExternalNodeStore_writeNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_WriteValue *writeValues, UA_UInt32 *indices,
  60. UA_UInt32 indicesSize, UA_StatusCode *writeNodesResults, UA_DiagnosticInfo *diagnosticInfo);
  61. typedef UA_Int32 (*UA_ExternalNodeStore_browseNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_BrowseDescription *browseDescriptions, UA_UInt32 *indices,
  62. UA_UInt32 indicesSize, UA_UInt32 requestedMaxReferencesPerNode, UA_BrowseResult *browseResults, UA_DiagnosticInfo *diagnosticInfos);
  63. typedef UA_Int32 (*UA_ExternalNodeStore_delete)(void *ensHandle);
  64. typedef struct UA_ExternalNodeStore {
  65. void *ensHandle;
  66. UA_ExternalNodeStore_addNodes addNodes;
  67. UA_ExternalNodeStore_deleteNodes deleteNodes;
  68. UA_ExternalNodeStore_writeNodes writeNodes;
  69. UA_ExternalNodeStore_readNodes readNodes;
  70. UA_ExternalNodeStore_browseNodes browseNodes;
  71. UA_ExternalNodeStore_addReferences addReferences;
  72. UA_ExternalNodeStore_deleteReferences deleteReferences;
  73. UA_ExternalNodeStore_delete delete;
  74. } UA_ExternalNodeStore;
  75. UA_StatusCode UA_EXPORT UA_Server_addExternalNamespace(UA_Server *server, UA_UInt16 namespaceIndex, UA_ExternalNodeStore *nodeStore);
  76. #ifdef __cplusplus
  77. } // extern "C"
  78. #endif
  79. #endif /* UA_SERVER_H_ */