ua_config_standard.c 5.2 KB

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