ua_server_config.h 5.0 KB

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