ua_config_standard.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. /*******************************/
  7. /* Default Connection Settings */
  8. /*******************************/
  9. const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard = {
  10. .protocolVersion = 0,
  11. .sendBufferSize = 65535, /* 64k per chunk */
  12. .recvBufferSize = 65535, /* 64k per chunk */
  13. .maxMessageSize = 0, /* 0 -> unlimited */
  14. .maxChunkCount = 0 /* 0 -> unlimited */
  15. };
  16. /***************************/
  17. /* Default Server Settings */
  18. /***************************/
  19. #define MANUFACTURER_NAME "open62541"
  20. #define PRODUCT_NAME "open62541 OPC UA Server"
  21. #define PRODUCT_URI "http://open62541.org"
  22. #define APPLICATION_NAME "open62541-based OPC UA Application"
  23. #define APPLICATION_URI "urn:unconfigured:application"
  24. #define UA_STRING_STATIC(s) {sizeof(s)-1, (UA_Byte*)s}
  25. #define UA_STRING_STATIC_NULL {0, NULL}
  26. #define STRINGIFY(arg) #arg
  27. #define VERSION(MAJOR, MINOR, PATCH, LABEL) \
  28. STRINGIFY(MAJOR) "." STRINGIFY(MINOR) "." STRINGIFY(PATCH) LABEL
  29. UA_UsernamePasswordLogin usernamePasswords[2] = {
  30. { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") },
  31. { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } };
  32. const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard = {
  33. .nThreads = 1,
  34. .logger = UA_Log_Stdout,
  35. /* Server Description */
  36. .buildInfo = {
  37. .productUri = UA_STRING_STATIC(PRODUCT_URI),
  38. .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME),
  39. .productName = UA_STRING_STATIC(PRODUCT_NAME),
  40. .softwareVersion = UA_STRING_STATIC(VERSION(UA_OPEN62541_VER_MAJOR,
  41. UA_OPEN62541_VER_MINOR,
  42. UA_OPEN62541_VER_PATCH,
  43. UA_OPEN62541_VER_LABEL)),
  44. .buildNumber = UA_STRING_STATIC(__DATE__ " " __TIME__),
  45. .buildDate = 0 },
  46. .applicationDescription = {
  47. .applicationUri = UA_STRING_STATIC(APPLICATION_URI),
  48. .productUri = UA_STRING_STATIC(PRODUCT_URI),
  49. .applicationName = { .locale = UA_STRING_STATIC("en"),
  50. .text = UA_STRING_STATIC(APPLICATION_NAME) },
  51. .applicationType = UA_APPLICATIONTYPE_SERVER,
  52. .gatewayServerUri = UA_STRING_STATIC_NULL,
  53. .discoveryProfileUri = UA_STRING_STATIC_NULL,
  54. .discoveryUrlsSize = 0,
  55. .discoveryUrls = NULL },
  56. .serverCertificate = UA_STRING_STATIC_NULL,
  57. /* Networking */
  58. .networkLayersSize = 0,
  59. .networkLayers = NULL,
  60. /* Login */
  61. .enableAnonymousLogin = true,
  62. .enableUsernamePasswordLogin = true,
  63. .usernamePasswordLogins = usernamePasswords,
  64. .usernamePasswordLoginsSize = 2,
  65. /* Limits for SecureChannels */
  66. .maxSecureChannels = 40,
  67. .maxSecurityTokenLifetime = 10 * 60 * 1000, /* 10 minutes */
  68. /* Limits for Sessions */
  69. .maxSessions = 100,
  70. .maxSessionTimeout = 60.0 * 60.0 * 1000.0, /* 1h */
  71. /* Limits for Subscriptions */
  72. .publishingIntervalLimits = { .min = 100.0, .max = 3600.0 * 1000.0 },
  73. .lifeTimeCountLimits = { .max = 15000, .min = 3 },
  74. .keepAliveCountLimits = { .max = 100, .min = 1 },
  75. .maxNotificationsPerPublish = 1000,
  76. .maxRetransmissionQueueSize = 0, /* unlimited */
  77. /* Limits for MonitoredItems */
  78. .samplingIntervalLimits = { .min = 50.0, .max = 24.0 * 3600.0 * 1000.0 },
  79. .queueSizeLimits = { .max = 100, .min = 1 }
  80. };
  81. /***************************/
  82. /* Default Client Settings */
  83. /***************************/
  84. const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
  85. .timeout = 5000, /* 5 seconds */
  86. .secureChannelLifeTime = 10 * 60 * 1000, /* 10 minutes */
  87. .logger = UA_Log_Stdout,
  88. .localConnectionConfig = {
  89. .protocolVersion = 0,
  90. .sendBufferSize = 65535, /* 64k per chunk */
  91. .recvBufferSize = 65535, /* 64k per chunk */
  92. .maxMessageSize = 0, /* 0 -> unlimited */
  93. .maxChunkCount = 0 /* 0 -> unlimited */
  94. },
  95. .connectionFunc = UA_ClientConnectionTCP
  96. };
  97. /****************************************/
  98. /* Default Client Subscription Settings */
  99. /****************************************/
  100. #ifdef UA_ENABLE_SUBSCRIPTIONS
  101. const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
  102. .requestedPublishingInterval = 500.0,
  103. .requestedLifetimeCount = 10000,
  104. .requestedMaxKeepAliveCount = 1,
  105. .maxNotificationsPerPublish = 10,
  106. .publishingEnabled = true,
  107. .priority = 0
  108. };
  109. #endif