ua_server.h 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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_NodeStore;
  26. typedef struct UA_NodeStore UA_NodeStoreInterface;
  27. struct UA_Server;
  28. typedef struct UA_Server UA_Server;
  29. struct open62541NodeStore;
  30. typedef struct open62541NodeStore open62541NodeStore;
  31. struct UA_NamespaceManager;
  32. typedef struct UA_NamespaceManager UA_NamespaceManager;
  33. typedef UA_Int32 (*UA_NodeStore_addNodes)(const UA_RequestHeader *requestHeader, UA_AddNodesItem *nodesToAdd,UA_UInt32 *indices,UA_UInt32 indicesSize, UA_AddNodesResult* addNodesResults, UA_DiagnosticInfo *diagnosticInfos);
  34. typedef UA_Int32 (*UA_NodeStore_addReferences)(const UA_RequestHeader *requestHeader,UA_AddReferencesItem* referencesToAdd,UA_UInt32 *indices,UA_UInt32 indicesSize, UA_StatusCode *addReferencesResults, UA_DiagnosticInfo *diagnosticInfos);
  35. typedef UA_Int32 (*UA_NodeStore_deleteNodes)(const UA_RequestHeader *requestHeader,UA_DeleteNodesItem *nodesToDelete,UA_UInt32 *indices,UA_UInt32 indicesSize, UA_StatusCode *deleteNodesResults, UA_DiagnosticInfo *diagnosticInfos);
  36. typedef UA_Int32 (*UA_NodeStore_deleteReferences)(const UA_RequestHeader *requestHeader,UA_DeleteReferencesItem *referenceToDelete,UA_UInt32 *indices, UA_UInt32 indicesSize,UA_StatusCode deleteReferencesresults, UA_DiagnosticInfo *diagnosticInfos);
  37. typedef UA_Int32 (*UA_NodeStore_readNodes)(const UA_RequestHeader *requestHeader,UA_ReadValueId *readValueIds,UA_UInt32 *indices,UA_UInt32 indicesSize,UA_DataValue *readNodesResults, UA_Boolean timeStampToReturn, UA_DiagnosticInfo *diagnosticInfos);
  38. typedef UA_Int32 (*UA_NodeStore_writeNodes)(const UA_RequestHeader *requestHeader,UA_WriteValue *writeValues,UA_UInt32 *indices ,UA_UInt32 indicesSize, UA_StatusCode *writeNodesResults, UA_DiagnosticInfo *diagnosticInfo);
  39. typedef UA_Int32 (*UA_NodeStore_browseNodes)(const UA_RequestHeader *requestHeader,UA_BrowseDescription *browseDescriptions,UA_UInt32 *indices,UA_UInt32 indicesSize, UA_UInt32 requestedMaxReferencesPerNode, UA_BrowseResult *browseResults, UA_DiagnosticInfo *diagnosticInfos);
  40. struct UA_NodeStore {
  41. //new, set, get, remove,
  42. UA_NodeStore_addNodes addNodes;
  43. UA_NodeStore_deleteNodes deleteNodes;
  44. UA_NodeStore_writeNodes writeNodes;
  45. UA_NodeStore_readNodes readNodes;
  46. UA_NodeStore_browseNodes browseNodes;
  47. UA_NodeStore_addReferences addReferences;
  48. UA_NodeStore_deleteReferences deleteReferences;
  49. };
  50. UA_Server UA_EXPORT * UA_Server_new(UA_String *endpointUrl, UA_ByteString *serverCertificate, UA_NodeStoreInterface *ns0Nodestore,UA_Boolean useOpen62541NodeStore);
  51. void UA_EXPORT UA_Server_delete(UA_Server *server);
  52. void UA_EXPORT UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, const UA_ByteString *msg);
  53. /* Services for local use */
  54. void UA_EXPORT UA_Server_addScalarVariableNode(UA_Server *server, UA_QualifiedName *browseName, void *value,
  55. const UA_VTable_Entry *vt, UA_ExpandedNodeId *parentNodeId,
  56. UA_NodeId *referenceTypeId );
  57. //UA_AddNodesResult UA_EXPORT UA_Server_addNode(UA_Server *server, UA_Node **node, UA_ExpandedNodeId *parentNodeId,
  58. // UA_NodeId *referenceTypeId);
  59. //void UA_EXPORT UA_Server_addReferences(UA_Server *server, const UA_AddReferencesRequest *request,
  60. // UA_AddReferencesResponse *response);
  61. UA_Int32 UA_EXPORT UA_Server_addNamespace(UA_Server *server, UA_UInt16 namespaceIndex, UA_NodeStoreInterface *nodeStore);
  62. UA_Int32 UA_EXPORT UA_Server_removeNamespace(UA_Server *server, UA_UInt16 namespaceIndex);
  63. UA_Int32 UA_EXPORT UA_Server_setNodeStore(UA_Server *server, UA_UInt16 namespaceIndex, UA_NodeStoreInterface *nodeStore);
  64. #ifdef __cplusplus
  65. } // extern "C"
  66. #endif
  67. #endif /* UA_SERVER_H_ */