ua_config_standard.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. /* Access Control */
  28. #define ENABLEANONYMOUSLOGIN true
  29. #define ENABLEUSERNAMEPASSWORDLOGIN true
  30. const UA_Boolean enableAnonymousLogin = ENABLEANONYMOUSLOGIN;
  31. const UA_Boolean enableUsernamePasswordLogin = ENABLEUSERNAMEPASSWORDLOGIN;
  32. const size_t usernamePasswordsSize = 2;
  33. const UA_UsernamePasswordLogin *usernamePasswords = (UA_UsernamePasswordLogin[2]){
  34. { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") },
  35. { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } };
  36. const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard = {
  37. .nThreads = 1,
  38. .logger = UA_Log_Stdout,
  39. /* Server Description */
  40. .buildInfo = {
  41. .productUri = UA_STRING_STATIC(PRODUCT_URI),
  42. .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME),
  43. .productName = UA_STRING_STATIC(PRODUCT_NAME),
  44. .softwareVersion = UA_STRING_STATIC(UA_GIT_COMMIT_ID),
  45. .buildNumber = UA_STRING_STATIC(__DATE__ " " __TIME__),
  46. .buildDate = 0 },
  47. .applicationDescription = {
  48. .applicationUri = UA_STRING_STATIC(APPLICATION_URI),
  49. .productUri = UA_STRING_STATIC(PRODUCT_URI),
  50. .applicationName = { .locale = UA_STRING_STATIC("en"),
  51. .text = UA_STRING_STATIC(APPLICATION_NAME) },
  52. .applicationType = UA_APPLICATIONTYPE_SERVER,
  53. .gatewayServerUri = UA_STRING_STATIC_NULL,
  54. .discoveryProfileUri = UA_STRING_STATIC_NULL,
  55. .discoveryUrlsSize = 0,
  56. .discoveryUrls = NULL },
  57. .serverCertificate = UA_STRING_STATIC_NULL,
  58. /* Networking */
  59. .networkLayersSize = 0,
  60. .networkLayers = NULL,
  61. /* Access Control */
  62. .accessControl = (UA_AccessControl) {
  63. .enableAnonymousLogin = ENABLEANONYMOUSLOGIN,
  64. .enableUsernamePasswordLogin = ENABLEUSERNAMEPASSWORDLOGIN,
  65. .activateSession = activateSession_default,
  66. .closeSession = closeSession_default,
  67. .getUserRightsMask = getUserRightsMask_default,
  68. .getUserAccessLevel = getUserAccessLevel_default,
  69. .getUserExecutable = getUserExecutable_default,
  70. .allowAddNode = allowAddNode_default,
  71. .allowAddReference = allowAddReference_default,
  72. .allowDeleteNode = allowDeleteNode_default,
  73. .allowDeleteReference = allowDeleteReference_default
  74. },
  75. /* Limits for SecureChannels */
  76. .maxSecureChannels = 40,
  77. .maxSecurityTokenLifetime = 10 * 60 * 1000, /* 10 minutes */
  78. /* Limits for Sessions */
  79. .maxSessions = 100,
  80. .maxSessionTimeout = 60.0 * 60.0 * 1000.0, /* 1h */
  81. /* Limits for Subscriptions */
  82. .publishingIntervalLimits = { .min = 100.0, .max = 3600.0 * 1000.0 },
  83. .lifeTimeCountLimits = { .max = 15000, .min = 3 },
  84. .keepAliveCountLimits = { .max = 100, .min = 1 },
  85. .maxNotificationsPerPublish = 1000,
  86. /* Limits for MonitoredItems */
  87. .samplingIntervalLimits = { .min = 50.0, .max = 24.0 * 3600.0 * 1000.0 },
  88. .queueSizeLimits = { .max = 100, .min = 1 }
  89. #ifdef UA_ENABLE_DISCOVERY
  90. ,.discoveryCleanupTimeout = 60*60
  91. #endif
  92. };
  93. /***************************/
  94. /* Default Client Settings */
  95. /***************************/
  96. const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
  97. .timeout = 5000, /* 5 seconds */
  98. .secureChannelLifeTime = 10 * 60 * 1000, /* 10 minutes */
  99. .logger = UA_Log_Stdout,
  100. .localConnectionConfig = {
  101. .protocolVersion = 0,
  102. .sendBufferSize = 65535, /* 64k per chunk */
  103. .recvBufferSize = 65535, /* 64k per chunk */
  104. .maxMessageSize = 0, /* 0 -> unlimited */
  105. .maxChunkCount = 0 /* 0 -> unlimited */
  106. },
  107. .connectionFunc = UA_ClientConnectionTCP
  108. };
  109. /****************************************/
  110. /* Default Client Subscription Settings */
  111. /****************************************/
  112. #ifdef UA_ENABLE_SUBSCRIPTIONS
  113. const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
  114. .requestedPublishingInterval = 500.0,
  115. .requestedLifetimeCount = 10000,
  116. .requestedMaxKeepAliveCount = 1,
  117. .maxNotificationsPerPublish = 10,
  118. .publishingEnabled = true,
  119. .priority = 0
  120. };
  121. #endif