ua_server.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. void UA_EXPORT UA_Server_addScalarVariableNode(UA_Server *server, UA_QualifiedName *browseName, void *value,
  32. const UA_VTable_Entry *vt, const UA_ExpandedNodeId *parentNodeId,
  33. const UA_NodeId *referenceTypeId );
  34. /** @ingroup server
  35. @defgroup external_nodestore External Nodestore
  36. To plug in outside data sources, one can use
  37. - VariableNodes with a data source (functions that are called for read and write access)
  38. - An external nodestore that is mapped to specific namespaces
  39. If no external nodestore is defined for a nodeid, it is always looked up in
  40. the "local" nodestore of open62541. Namespace Zero is always in the local nodestore.
  41. */
  42. typedef UA_Int32 (*UA_ExternalNodeStore_addNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_AddNodesItem *nodesToAdd,
  43. UA_UInt32 *indices,UA_UInt32 indicesSize, UA_AddNodesResult* addNodesResults,
  44. UA_DiagnosticInfo *diagnosticInfos);
  45. typedef UA_Int32 (*UA_ExternalNodeStore_addReferences)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_AddReferencesItem* referencesToAdd,
  46. UA_UInt32 *indices,UA_UInt32 indicesSize, UA_StatusCode *addReferencesResults,
  47. UA_DiagnosticInfo *diagnosticInfos);
  48. typedef UA_Int32 (*UA_ExternalNodeStore_deleteNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_DeleteNodesItem *nodesToDelete, UA_UInt32 *indices,
  49. UA_UInt32 indicesSize, UA_StatusCode *deleteNodesResults, UA_DiagnosticInfo *diagnosticInfos);
  50. typedef UA_Int32 (*UA_ExternalNodeStore_deleteReferences)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_DeleteReferencesItem *referenceToDelete,
  51. UA_UInt32 *indices, UA_UInt32 indicesSize, UA_StatusCode deleteReferencesresults,
  52. UA_DiagnosticInfo *diagnosticInfos);
  53. typedef UA_Int32 (*UA_ExternalNodeStore_readNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_ReadValueId *readValueIds, UA_UInt32 *indices,
  54. UA_UInt32 indicesSize,UA_DataValue *readNodesResults, UA_Boolean timeStampToReturn, UA_DiagnosticInfo *diagnosticInfos);
  55. typedef UA_Int32 (*UA_ExternalNodeStore_writeNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_WriteValue *writeValues, UA_UInt32 *indices,
  56. UA_UInt32 indicesSize, UA_StatusCode *writeNodesResults, UA_DiagnosticInfo *diagnosticInfo);
  57. typedef UA_Int32 (*UA_ExternalNodeStore_browseNodes)(void *ensHandle, const UA_RequestHeader *requestHeader, UA_BrowseDescription *browseDescriptions, UA_UInt32 *indices,
  58. UA_UInt32 indicesSize, UA_UInt32 requestedMaxReferencesPerNode, UA_BrowseResult *browseResults, UA_DiagnosticInfo *diagnosticInfos);
  59. typedef UA_Int32 (*UA_ExternalNodeStore_delete)(void *ensHandle);
  60. typedef struct UA_ExternalNodeStore {
  61. void *ensHandle;
  62. UA_ExternalNodeStore_addNodes addNodes;
  63. UA_ExternalNodeStore_deleteNodes deleteNodes;
  64. UA_ExternalNodeStore_writeNodes writeNodes;
  65. UA_ExternalNodeStore_readNodes readNodes;
  66. UA_ExternalNodeStore_browseNodes browseNodes;
  67. UA_ExternalNodeStore_addReferences addReferences;
  68. UA_ExternalNodeStore_deleteReferences deleteReferences;
  69. UA_ExternalNodeStore_delete delete;
  70. } UA_ExternalNodeStore;
  71. UA_StatusCode UA_EXPORT UA_Server_addExternalNamespace(UA_Server *server, UA_UInt16 namespaceIndex, UA_ExternalNodeStore *nodeStore);
  72. #ifdef __cplusplus
  73. } // extern "C"
  74. #endif
  75. #endif /* UA_SERVER_H_ */