ua_server_config.h 4.7 KB

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