ua_server_config.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include "ua_server.h"
  16. #include "ua_plugin_log.h"
  17. #include "ua_plugin_network.h"
  18. #include "ua_plugin_access_control.h"
  19. #include "ua_plugin_pki.h"
  20. #include "ua_plugin_securitypolicy.h"
  21. #include "ua_plugin_nodestore.h"
  22. #ifdef UA_ENABLE_PUBSUB
  23. #include "ua_plugin_pubsub.h"
  24. #endif
  25. #ifdef UA_ENABLE_HISTORIZING
  26. #include "ua_plugin_history_data_service.h"
  27. #endif
  28. /**
  29. * .. _server-configuration:
  30. *
  31. * Server Configuration
  32. * --------------------
  33. * The configuration structure is passed to the server during initialization.
  34. * The server expects that the configuration is not modified during runtime.
  35. * Currently, only one server can use a configuration at a time. During
  36. * shutdown, the server will clean up the parts of the configuration that are
  37. * modified at runtime through the provided API.
  38. *
  39. * Examples for configurations are provided in the ``/plugins`` folder.
  40. * The usual usage is as follows:
  41. *
  42. * 1. Create a server configuration with default settings as a starting point
  43. * 2. Modifiy the configuration, e.g. by adding a server certificate
  44. * 3. Instantiate a server with it
  45. * 4. After shutdown of the server, clean up the configuration (free memory)
  46. *
  47. * The :ref:`tutorials` provide a good starting point for this. */
  48. typedef struct {
  49. UA_UInt32 min;
  50. UA_UInt32 max;
  51. } UA_UInt32Range;
  52. typedef struct {
  53. UA_Duration min;
  54. UA_Duration max;
  55. } UA_DurationRange;
  56. struct UA_ServerConfig {
  57. UA_UInt16 nThreads; /* only if multithreading is enabled */
  58. UA_Logger logger;
  59. /* Server Description */
  60. UA_BuildInfo buildInfo;
  61. UA_ApplicationDescription applicationDescription;
  62. UA_ByteString serverCertificate;
  63. /* MDNS Discovery */
  64. #ifdef UA_ENABLE_DISCOVERY
  65. UA_String mdnsServerName;
  66. size_t serverCapabilitiesSize;
  67. UA_String *serverCapabilities;
  68. #endif
  69. /* Custom DataTypes */
  70. size_t customDataTypesSize;
  71. UA_DataType *customDataTypes;
  72. /**
  73. * .. note:: See the section on :ref:`generic-types`. Examples for working
  74. * with custom data types are provided in
  75. * ``/examples/custom_datatype/``. */
  76. /* Nodestore */
  77. UA_Nodestore nodestore;
  78. /* Networking */
  79. size_t networkLayersSize;
  80. UA_ServerNetworkLayer *networkLayers;
  81. UA_String customHostname;
  82. #ifdef UA_ENABLE_PUBSUB
  83. /*PubSub network layer */
  84. size_t pubsubTransportLayersSize;
  85. UA_PubSubTransportLayer *pubsubTransportLayers;
  86. #endif
  87. /* Available endpoints */
  88. size_t endpointsSize;
  89. UA_Endpoint *endpoints;
  90. /* Node Lifecycle callbacks */
  91. UA_GlobalNodeLifecycle nodeLifecycle;
  92. /**
  93. * .. note:: See the section for :ref:`node lifecycle
  94. * handling<node-lifecycle>`. */
  95. /* Access Control */
  96. UA_AccessControl accessControl;
  97. /**
  98. * .. note:: See the section for :ref:`access-control
  99. * handling<access-control>`. */
  100. /* Certificate Verification */
  101. UA_CertificateVerification certificateVerification;
  102. /* Limits for SecureChannels */
  103. UA_UInt16 maxSecureChannels;
  104. UA_UInt32 maxSecurityTokenLifetime; /* in ms */
  105. /* Limits for Sessions */
  106. UA_UInt16 maxSessions;
  107. UA_Double maxSessionTimeout; /* in ms */
  108. /* Operation limits */
  109. UA_UInt32 maxNodesPerRead;
  110. UA_UInt32 maxNodesPerWrite;
  111. UA_UInt32 maxNodesPerMethodCall;
  112. UA_UInt32 maxNodesPerBrowse;
  113. UA_UInt32 maxNodesPerRegisterNodes;
  114. UA_UInt32 maxNodesPerTranslateBrowsePathsToNodeIds;
  115. UA_UInt32 maxNodesPerNodeManagement;
  116. UA_UInt32 maxMonitoredItemsPerCall;
  117. /* Limits for Requests */
  118. UA_UInt32 maxReferencesPerNode;
  119. /* Limits for Subscriptions */
  120. UA_UInt32 maxSubscriptionsPerSession;
  121. UA_DurationRange publishingIntervalLimits;
  122. UA_UInt32Range lifeTimeCountLimits;
  123. UA_UInt32Range keepAliveCountLimits;
  124. UA_UInt32 maxNotificationsPerPublish;
  125. UA_UInt32 maxRetransmissionQueueSize; /* 0 -> unlimited size */
  126. #ifdef UA_ENABLE_SUBSCRIPTIONS_EVENTS
  127. UA_UInt32 maxEventsPerNode; /* 0 -> unlimited size */
  128. #endif
  129. /* Limits for MonitoredItems */
  130. UA_UInt32 maxMonitoredItemsPerSubscription;
  131. UA_DurationRange samplingIntervalLimits;
  132. UA_UInt32Range queueSizeLimits; /* Negotiated with the client */
  133. /* Limits for PublishRequests */
  134. UA_UInt32 maxPublishReqPerSession;
  135. /* Discovery */
  136. #ifdef UA_ENABLE_DISCOVERY
  137. /* Timeout in seconds when to automatically remove a registered server from
  138. * the list, if it doesn't re-register within the given time frame. A value
  139. * of 0 disables automatic removal. Default is 60 Minutes (60*60). Must be
  140. * bigger than 10 seconds, because cleanup is only triggered approximately
  141. * ervery 10 seconds. The server will still be removed depending on the
  142. * state of the semaphore file. */
  143. UA_UInt32 discoveryCleanupTimeout;
  144. #endif
  145. /* Historical Access */
  146. #ifdef UA_ENABLE_HISTORIZING
  147. UA_HistoryDataService historyDataService;
  148. UA_Boolean accessHistoryDataCapability;
  149. UA_UInt32 maxReturnDataValues; /* 0 -> unlimited size */
  150. UA_Boolean accessHistoryEventsCapability;
  151. UA_UInt32 maxReturnEventValues; /* 0 -> unlimited size */
  152. UA_Boolean insertDataCapability;
  153. UA_Boolean insertEventCapability;
  154. UA_Boolean insertAnnotationsCapability;
  155. UA_Boolean replaceDataCapability;
  156. UA_Boolean replaceEventCapability;
  157. UA_Boolean updateDataCapability;
  158. UA_Boolean updateEventCapability;
  159. UA_Boolean deleteRawCapability;
  160. UA_Boolean deleteEventCapability;
  161. UA_Boolean deleteAtTimeDataCapability;
  162. #endif
  163. };
  164. #ifdef __cplusplus
  165. }
  166. #endif
  167. #endif /* UA_SERVER_CONFIG_H_ */