ua_config_standard.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. /* Networking */
  66. .networkLayersSize = 0,
  67. .networkLayers = NULL,
  68. /* Access Control */
  69. .accessControl = {
  70. .enableAnonymousLogin = ENABLEANONYMOUSLOGIN,
  71. .enableUsernamePasswordLogin = ENABLEUSERNAMEPASSWORDLOGIN,
  72. .activateSession = activateSession_default,
  73. .closeSession = closeSession_default,
  74. .getUserRightsMask = getUserRightsMask_default,
  75. .getUserAccessLevel = getUserAccessLevel_default,
  76. .getUserExecutable = getUserExecutable_default,
  77. .getUserExecutableOnObject = getUserExecutableOnObject_default,
  78. .allowAddNode = allowAddNode_default,
  79. .allowAddReference = allowAddReference_default,
  80. .allowDeleteNode = allowDeleteNode_default,
  81. .allowDeleteReference = allowDeleteReference_default
  82. },
  83. /* Limits for SecureChannels */
  84. .maxSecureChannels = 40,
  85. .maxSecurityTokenLifetime = 10 * 60 * 1000, /* 10 minutes */
  86. /* Limits for Sessions */
  87. .maxSessions = 100,
  88. .maxSessionTimeout = 60.0 * 60.0 * 1000.0, /* 1h */
  89. /* Limits for Subscriptions */
  90. .publishingIntervalLimits = { .min = 100.0, .max = 3600.0 * 1000.0 },
  91. .lifeTimeCountLimits = { .max = 15000, .min = 3 },
  92. .keepAliveCountLimits = { .max = 100, .min = 1 },
  93. .maxNotificationsPerPublish = 1000,
  94. .maxRetransmissionQueueSize = 0, /* unlimited */
  95. /* Limits for MonitoredItems */
  96. .samplingIntervalLimits = { .min = 50.0, .max = 24.0 * 3600.0 * 1000.0 },
  97. .queueSizeLimits = { .max = 100, .min = 1 }
  98. #ifdef UA_ENABLE_DISCOVERY
  99. ,.discoveryCleanupTimeout = 60*60
  100. #endif
  101. };
  102. /***************************/
  103. /* Default Client Settings */
  104. /***************************/
  105. const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
  106. .timeout = 5000, /* 5 seconds */
  107. .secureChannelLifeTime = 10 * 60 * 1000, /* 10 minutes */
  108. .logger = UA_Log_Stdout,
  109. .localConnectionConfig = {
  110. .protocolVersion = 0,
  111. .sendBufferSize = 65535, /* 64k per chunk */
  112. .recvBufferSize = 65535, /* 64k per chunk */
  113. .maxMessageSize = 0, /* 0 -> unlimited */
  114. .maxChunkCount = 0 /* 0 -> unlimited */
  115. },
  116. .connectionFunc = UA_ClientConnectionTCP
  117. };
  118. /****************************************/
  119. /* Default Client Subscription Settings */
  120. /****************************************/
  121. #ifdef UA_ENABLE_SUBSCRIPTIONS
  122. const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
  123. .requestedPublishingInterval = 500.0,
  124. .requestedLifetimeCount = 10000,
  125. .requestedMaxKeepAliveCount = 1,
  126. .maxNotificationsPerPublish = 10,
  127. .publishingEnabled = true,
  128. .priority = 0
  129. };
  130. #endif