ua_config_default.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. *
  4. * Copyright 2017 (c) Julius Pfrommer, Fraunhofer IOSB
  5. * Copyright 2017 (c) Stefan Profanter, fortiss GmbH
  6. * Copyright 2018 (c) Mark Giraud, Fraunhofer IOSB
  7. */
  8. #ifndef UA_CONFIG_DEFAULT_H_
  9. #define UA_CONFIG_DEFAULT_H_
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #include "ua_server.h"
  14. #include "ua_server_config.h"
  15. #include "ua_client.h"
  16. /**********************/
  17. /* Default Connection */
  18. /**********************/
  19. extern const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_default;
  20. /*************************/
  21. /* Default Server Config */
  22. /*************************/
  23. /* Creates a new server config with one endpoint.
  24. *
  25. * The config will set the tcp network layer to the given port and adds a single
  26. * endpoint with the security policy ``SecurityPolicy#None`` to the server. A
  27. * server certificate may be supplied but is optional.
  28. *
  29. * @param portNumber The port number for the tcp network layer
  30. * @param certificate Optional certificate for the server endpoint. Can be
  31. * ``NULL``. */
  32. UA_EXPORT UA_ServerConfig *
  33. UA_ServerConfig_new_minimal(UA_UInt16 portNumber, const UA_ByteString *certificate);
  34. #ifdef UA_ENABLE_ENCRYPTION
  35. UA_EXPORT UA_ServerConfig *
  36. UA_ServerConfig_new_basic128rsa15(UA_UInt16 portNumber,
  37. const UA_ByteString *certificate,
  38. const UA_ByteString *privateKey,
  39. const UA_ByteString *trustList,
  40. size_t trustListSize,
  41. const UA_ByteString *revocationList,
  42. size_t revocationListSize);
  43. #endif
  44. /* Creates a server config on the default port 4840 with no server
  45. * certificate. */
  46. static UA_INLINE UA_ServerConfig *
  47. UA_ServerConfig_new_default(void) {
  48. return UA_ServerConfig_new_minimal(4840, NULL);
  49. }
  50. /* Set a custom hostname in server configuration
  51. *
  52. * @param config A valid server configuration
  53. * @param customHostname The custom hostname used by the server */
  54. UA_EXPORT void
  55. UA_ServerConfig_set_customHostname(UA_ServerConfig *config,
  56. const UA_String customHostname);
  57. /* Frees allocated memory in the server config */
  58. UA_EXPORT void
  59. UA_ServerConfig_delete(UA_ServerConfig *config);
  60. /*************************/
  61. /* Default Client Config */
  62. /*************************/
  63. extern const UA_EXPORT UA_ClientConfig UA_ClientConfig_default;
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif /* UA_CONFIG_DEFAULT_H_ */