ua_config_default.h 2.0 KB

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