ua_server_config.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. *
  5. * Copyright 2017 (c) Fraunhofer IOSB (Author: Julius Pfrommer)
  6. * Copyright 2017 (c) Stefan Profanter, fortiss GmbH
  7. * Copyright 2017 (c) Henrik Norrman
  8. * Copyright 2018 (c) Fabian Arndt, Root-Core
  9. */
  10. #ifndef UA_SERVER_CONFIG_H_
  11. #define UA_SERVER_CONFIG_H_
  12. #include "ua_server.h"
  13. #include "ua_plugin_log.h"
  14. #include "ua_plugin_network.h"
  15. #include "ua_plugin_access_control.h"
  16. #include "ua_plugin_pki.h"
  17. #include "ua_plugin_securitypolicy.h"
  18. #include "ua_plugin_nodestore.h"
  19. #ifdef UA_ENABLE_PUBSUB
  20. #include "ua_plugin_pubsub.h"
  21. #endif
  22. #ifdef UA_ENABLE_HISTORIZING
  23. #include "ua_plugin_history_data_service.h"
  24. #endif
  25. _UA_BEGIN_DECLS
  26. /**
  27. * .. _server-configuration:
  28. *
  29. * Server Configuration
  30. * --------------------
  31. * The configuration structure is passed to the server during initialization.
  32. * The server expects that the configuration is not modified during runtime.
  33. * Currently, only one server can use a configuration at a time. During
  34. * shutdown, the server will clean up the parts of the configuration that are
  35. * modified at runtime through the provided API.
  36. *
  37. * Examples for configurations are provided in the ``/plugins`` folder.
  38. * The usual usage is as follows:
  39. *
  40. * 1. Create a server configuration with default settings as a starting point
  41. * 2. Modifiy the configuration, e.g. by adding a server certificate
  42. * 3. Instantiate a server with it
  43. * 4. After shutdown of the server, clean up the configuration (free memory)
  44. *
  45. * The :ref:`tutorials` provide a good starting point for this. */
  46. typedef struct {
  47. UA_UInt32 min;
  48. UA_UInt32 max;
  49. } UA_UInt32Range;
  50. typedef struct {
  51. UA_Duration min;
  52. UA_Duration max;
  53. } UA_DurationRange;
  54. struct UA_ServerConfig {
  55. UA_UInt16 nThreads; /* only if multithreading is enabled */
  56. UA_Logger logger;
  57. /* Server Description */
  58. UA_BuildInfo buildInfo;
  59. UA_ApplicationDescription applicationDescription;
  60. UA_ByteString serverCertificate;
  61. /* MDNS Discovery */
  62. #ifdef UA_ENABLE_DISCOVERY
  63. UA_String mdnsServerName;
  64. size_t serverCapabilitiesSize;
  65. UA_String *serverCapabilities;
  66. #endif
  67. /* Custom DataTypes */
  68. size_t customDataTypesSize;
  69. UA_DataType *customDataTypes;
  70. /**
  71. * .. note:: See the section on :ref:`generic-types`. Examples for working
  72. * with custom data types are provided in
  73. * ``/examples/custom_datatype/``. */
  74. /* Nodestore */
  75. UA_Nodestore nodestore;
  76. /* Networking */
  77. size_t networkLayersSize;
  78. UA_ServerNetworkLayer *networkLayers;
  79. UA_String customHostname;
  80. #ifdef UA_ENABLE_PUBSUB
  81. /*PubSub network layer */
  82. size_t pubsubTransportLayersSize;
  83. UA_PubSubTransportLayer *pubsubTransportLayers;
  84. #endif
  85. /* Available endpoints */
  86. size_t endpointsSize;
  87. UA_Endpoint *endpoints;
  88. /* Node Lifecycle callbacks */
  89. UA_GlobalNodeLifecycle nodeLifecycle;
  90. /**
  91. * .. note:: See the section for :ref:`node lifecycle
  92. * handling<node-lifecycle>`. */
  93. /* Access Control */
  94. UA_AccessControl accessControl;
  95. /**
  96. * .. note:: See the section for :ref:`access-control
  97. * handling<access-control>`. */
  98. /* Certificate Verification */
  99. UA_CertificateVerification certificateVerification;
  100. /* Limits for SecureChannels */
  101. UA_UInt16 maxSecureChannels;
  102. UA_UInt32 maxSecurityTokenLifetime; /* in ms */
  103. /* Limits for Sessions */
  104. UA_UInt16 maxSessions;
  105. UA_Double maxSessionTimeout; /* in ms */
  106. /* Operation limits */
  107. UA_UInt32 maxNodesPerRead;
  108. UA_UInt32 maxNodesPerWrite;
  109. UA_UInt32 maxNodesPerMethodCall;
  110. UA_UInt32 maxNodesPerBrowse;
  111. UA_UInt32 maxNodesPerRegisterNodes;
  112. UA_UInt32 maxNodesPerTranslateBrowsePathsToNodeIds;
  113. UA_UInt32 maxNodesPerNodeManagement;
  114. UA_UInt32 maxMonitoredItemsPerCall;
  115. /* Limits for Requests */
  116. UA_UInt32 maxReferencesPerNode;
  117. /* Limits for Subscriptions */
  118. UA_UInt32 maxSubscriptionsPerSession;
  119. UA_DurationRange publishingIntervalLimits;
  120. UA_UInt32Range lifeTimeCountLimits;
  121. UA_UInt32Range keepAliveCountLimits;
  122. UA_UInt32 maxNotificationsPerPublish;
  123. UA_UInt32 maxRetransmissionQueueSize; /* 0 -> unlimited size */
  124. #ifdef UA_ENABLE_SUBSCRIPTIONS_EVENTS
  125. UA_UInt32 maxEventsPerNode; /* 0 -> unlimited size */
  126. #endif
  127. /* Limits for MonitoredItems */
  128. UA_UInt32 maxMonitoredItemsPerSubscription;
  129. UA_DurationRange samplingIntervalLimits;
  130. UA_UInt32Range queueSizeLimits; /* Negotiated with the client */
  131. /* Limits for PublishRequests */
  132. UA_UInt32 maxPublishReqPerSession;
  133. /* Discovery */
  134. #ifdef UA_ENABLE_DISCOVERY
  135. /* Timeout in seconds when to automatically remove a registered server from
  136. * the list, if it doesn't re-register within the given time frame. A value
  137. * of 0 disables automatic removal. Default is 60 Minutes (60*60). Must be
  138. * bigger than 10 seconds, because cleanup is only triggered approximately
  139. * ervery 10 seconds. The server will still be removed depending on the
  140. * state of the semaphore file. */
  141. UA_UInt32 discoveryCleanupTimeout;
  142. #endif
  143. #ifdef UA_ENABLE_SUBSCRIPTIONS
  144. /* Register MonitoredItem in Userland
  145. *
  146. * @param server Allows the access to the server object
  147. * @param sessionId The session id, represented as an node id
  148. * @param sessionContext An optional pointer to user-defined data for the specific data source
  149. * @param nodeid Id of the node in question
  150. * @param nodeidContext An optional pointer to user-defined data, associated
  151. * with the node in the nodestore. Note that, if the node has already been removed,
  152. * this value contains a NULL pointer.
  153. * @param attributeId Identifies which attribute (value, data type etc.) is monitored
  154. * @param removed Determines if the MonitoredItem was removed or created. */
  155. void (*monitoredItemRegisterCallback)(UA_Server *server,
  156. const UA_NodeId *sessionId, void *sessionContext,
  157. const UA_NodeId *nodeId, void *nodeContext,
  158. UA_UInt32 attibuteId, UA_Boolean removed);
  159. #endif
  160. /* Historical Access */
  161. #ifdef UA_ENABLE_HISTORIZING
  162. UA_HistoryDataService historyDataService;
  163. UA_Boolean accessHistoryDataCapability;
  164. UA_UInt32 maxReturnDataValues; /* 0 -> unlimited size */
  165. UA_Boolean accessHistoryEventsCapability;
  166. UA_UInt32 maxReturnEventValues; /* 0 -> unlimited size */
  167. UA_Boolean insertDataCapability;
  168. UA_Boolean insertEventCapability;
  169. UA_Boolean insertAnnotationsCapability;
  170. UA_Boolean replaceDataCapability;
  171. UA_Boolean replaceEventCapability;
  172. UA_Boolean updateDataCapability;
  173. UA_Boolean updateEventCapability;
  174. UA_Boolean deleteRawCapability;
  175. UA_Boolean deleteEventCapability;
  176. UA_Boolean deleteAtTimeDataCapability;
  177. #endif
  178. };
  179. _UA_END_DECLS
  180. #endif /* UA_SERVER_CONFIG_H_ */