ua_config_standard.c 5.8 KB

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