ua_config_standard.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  5. * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
  6. #include "ua_config_standard.h"
  7. #include "ua_log_stdout.h"
  8. #include "ua_network_tcp.h"
  9. #include "ua_accesscontrol_default.h"
  10. /*******************************/
  11. /* Default Connection Settings */
  12. /*******************************/
  13. const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard = {
  14. 0, /* .protocolVersion */
  15. 65535, /* .sendBufferSize, 64k per chunk */
  16. 65535, /* .recvBufferSize, 64k per chunk */
  17. 0, /* .maxMessageSize, 0 -> unlimited */
  18. 0 /* .maxChunkCount, 0 -> unlimited */
  19. };
  20. /***************************/
  21. /* Default Server Settings */
  22. /***************************/
  23. #define MANUFACTURER_NAME "open62541"
  24. #define PRODUCT_NAME "open62541 OPC UA Server"
  25. #define PRODUCT_URI "http://open62541.org"
  26. #define APPLICATION_NAME "open62541-based OPC UA Application"
  27. #define APPLICATION_URI "urn:unconfigured:application"
  28. #define UA_STRING_STATIC(s) {sizeof(s)-1, (UA_Byte*)s}
  29. #define UA_STRING_STATIC_NULL {0, NULL}
  30. #define STRINGIFY(arg) #arg
  31. #define VERSION(MAJOR, MINOR, PATCH, LABEL) \
  32. STRINGIFY(MAJOR) "." STRINGIFY(MINOR) "." STRINGIFY(PATCH) LABEL
  33. /* Access Control. The following definitions are defined as "extern" in
  34. ua_accesscontrol_default.h */
  35. #define ENABLEANONYMOUSLOGIN true
  36. #define ENABLEUSERNAMEPASSWORDLOGIN true
  37. const UA_Boolean enableAnonymousLogin = ENABLEANONYMOUSLOGIN;
  38. const UA_Boolean enableUsernamePasswordLogin = ENABLEUSERNAMEPASSWORDLOGIN;
  39. const size_t usernamePasswordsSize = 2;
  40. UA_UsernamePasswordLogin UsernamePasswordLogin[2] = {
  41. { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") },
  42. { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } };
  43. const UA_UsernamePasswordLogin *usernamePasswords = UsernamePasswordLogin;
  44. const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard = {
  45. 1, /* .nThreads */
  46. UA_Log_Stdout, /* .logger */
  47. /* Server Description */
  48. {UA_STRING_STATIC(PRODUCT_URI),
  49. UA_STRING_STATIC(MANUFACTURER_NAME),
  50. UA_STRING_STATIC(PRODUCT_NAME),
  51. UA_STRING_STATIC(VERSION(UA_OPEN62541_VER_MAJOR, UA_OPEN62541_VER_MINOR,
  52. UA_OPEN62541_VER_PATCH, UA_OPEN62541_VER_LABEL)),
  53. UA_STRING_STATIC(__DATE__ " " __TIME__), 0 }, /* .buildInfo */
  54. {UA_STRING_STATIC(APPLICATION_URI),
  55. UA_STRING_STATIC(PRODUCT_URI),
  56. {UA_STRING_STATIC("en"),UA_STRING_STATIC(APPLICATION_NAME) },
  57. UA_APPLICATIONTYPE_SERVER,
  58. UA_STRING_STATIC_NULL,
  59. UA_STRING_STATIC_NULL,
  60. 0, NULL }, /* .applicationDescription */
  61. UA_STRING_STATIC_NULL, /* .serverCertificate */
  62. /* Custom DataTypes */
  63. 0, /* .customDataTypesSize */
  64. NULL, /* .customDataTypes */
  65. /* Networking */
  66. 0, /* .networkLayersSize */
  67. NULL, /* .networkLayers */
  68. /* Access Control */
  69. {ENABLEANONYMOUSLOGIN, ENABLEUSERNAMEPASSWORDLOGIN,
  70. activateSession_default, closeSession_default,
  71. getUserRightsMask_default, getUserAccessLevel_default,
  72. getUserExecutable_default, getUserExecutableOnObject_default,
  73. allowAddNode_default, allowAddReference_default,
  74. allowDeleteNode_default, allowDeleteReference_default},
  75. /* Limits for SecureChannels */
  76. 40, /* .maxSecureChannels */
  77. 10 * 60 * 1000, /* .maxSecurityTokenLifetime, 10 minutes */
  78. /* Limits for Sessions */
  79. 100, /* .maxSessions */
  80. 60.0 * 60.0 * 1000.0, /* .maxSessionTimeout, 1h */
  81. /* Limits for Subscriptions */
  82. {100.0,3600.0 * 1000.0 }, /* .publishingIntervalLimits */
  83. {3, 15000 }, /* .lifeTimeCountLimits */
  84. {1,100}, /* .keepAliveCountLimits */
  85. 1000, /* .maxNotificationsPerPublish */
  86. 0, /* .maxRetransmissionQueueSize, unlimited */
  87. /* Limits for MonitoredItems */
  88. {50.0, 24.0 * 3600.0 * 1000.0 }, /* .samplingIntervalLimits */
  89. {1,100} /* .queueSizeLimits */
  90. #ifdef UA_ENABLE_DISCOVERY
  91. , 60*60 /* .discoveryCleanupTimeout */
  92. #endif
  93. };
  94. /***************************/
  95. /* Default Client Settings */
  96. /***************************/
  97. const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
  98. 5000, /* .timeout, 5 seconds */
  99. 10 * 60 * 1000, /* .secureChannelLifeTime, 10 minutes */
  100. UA_Log_Stdout, /* .logger */
  101. /* .localConnectionConfig */
  102. {0, /* .protocolVersion */
  103. 65535, /* .sendBufferSize, 64k per chunk */
  104. 65535, /* .recvBufferSize, 64k per chunk */
  105. 0, /* .maxMessageSize, 0 -> unlimited */
  106. 0 }, /* .maxChunkCount, 0 -> unlimited */
  107. UA_ClientConnectionTCP, /* .connectionFunc */
  108. 0, /* .customDataTypesSize */
  109. NULL /*.customDataTypes */
  110. };
  111. /****************************************/
  112. /* Default Client Subscription Settings */
  113. /****************************************/
  114. #ifdef UA_ENABLE_SUBSCRIPTIONS
  115. const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
  116. 500.0, /* .requestedPublishingInterval */
  117. 10000, /* .requestedLifetimeCount */
  118. 1, /* .requestedMaxKeepAliveCount */
  119. 10, /* .maxNotificationsPerPublish */
  120. true, /* .publishingEnabled */
  121. 0 /* .priority */
  122. };
  123. #endif