ua_config_standard.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. UA_UsernamePasswordLogin usernamePasswords[2] = {
  27. { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") },
  28. { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } };
  29. const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard = {
  30. .nThreads = 1,
  31. .logger = UA_Log_Stdout,
  32. /* Server Description */
  33. .buildInfo = {
  34. .productUri = UA_STRING_STATIC(PRODUCT_URI),
  35. .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME),
  36. .productName = UA_STRING_STATIC(PRODUCT_NAME),
  37. .softwareVersion = UA_STRING_STATIC(UA_GIT_COMMIT_ID),
  38. .buildNumber = UA_STRING_STATIC(__DATE__ " " __TIME__),
  39. .buildDate = 0 },
  40. .applicationDescription = {
  41. .applicationUri = UA_STRING_STATIC(APPLICATION_URI),
  42. .productUri = UA_STRING_STATIC(PRODUCT_URI),
  43. .applicationName = { .locale = UA_STRING_STATIC("en"),
  44. .text = UA_STRING_STATIC(APPLICATION_NAME) },
  45. .applicationType = UA_APPLICATIONTYPE_SERVER,
  46. .gatewayServerUri = UA_STRING_STATIC_NULL,
  47. .discoveryProfileUri = UA_STRING_STATIC_NULL,
  48. .discoveryUrlsSize = 0,
  49. .discoveryUrls = NULL },
  50. .serverCertificate = UA_STRING_STATIC_NULL,
  51. /* Networking */
  52. .networkLayersSize = 0,
  53. .networkLayers = NULL,
  54. /* Login */
  55. .enableAnonymousLogin = true,
  56. .enableUsernamePasswordLogin = true,
  57. .usernamePasswordLogins = usernamePasswords,
  58. .usernamePasswordLoginsSize = 2,
  59. /* Limits for SecureChannels */
  60. .maxSecureChannels = 40,
  61. .maxSecurityTokenLifetime = 10 * 60 * 1000, /* 10 minutes */
  62. /* Limits for Sessions */
  63. .maxSessions = 100,
  64. .maxSessionTimeout = 60.0 * 60.0 * 1000.0, /* 1h */
  65. /* Limits for Subscriptions */
  66. .publishingIntervalLimits = { .min = 100.0, .max = 3600.0 * 1000.0 },
  67. .lifeTimeCountLimits = { .max = 15000, .min = 3 },
  68. .keepAliveCountLimits = { .max = 100, .min = 1 },
  69. .maxNotificationsPerPublish = 1000,
  70. /* Limits for MonitoredItems */
  71. .samplingIntervalLimits = { .min = 50.0, .max = 24.0 * 3600.0 * 1000.0 },
  72. .queueSizeLimits = { .max = 100, .min = 1 }
  73. };
  74. /***************************/
  75. /* Default Client Settings */
  76. /***************************/
  77. const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
  78. .timeout = 5000, /* 5 seconds */
  79. .secureChannelLifeTime = 10 * 60 * 1000, /* 10 minutes */
  80. .logger = UA_Log_Stdout,
  81. .localConnectionConfig = {
  82. .protocolVersion = 0,
  83. .sendBufferSize = 65535, /* 64k per chunk */
  84. .recvBufferSize = 65535, /* 64k per chunk */
  85. .maxMessageSize = 0, /* 0 -> unlimited */
  86. .maxChunkCount = 0 /* 0 -> unlimited */
  87. },
  88. .connectionFunc = UA_ClientConnectionTCP
  89. };
  90. /****************************************/
  91. /* Default Client Subscription Settings */
  92. /****************************************/
  93. #ifdef UA_ENABLE_SUBSCRIPTIONS
  94. const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
  95. .requestedPublishingInterval = 500.0,
  96. .requestedLifetimeCount = 10000,
  97. .requestedMaxKeepAliveCount = 1,
  98. .maxNotificationsPerPublish = 10,
  99. .publishingEnabled = true,
  100. .priority = 0
  101. };
  102. #endif