ua_config_default.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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, const UA_ByteString *certificate);
  29. #ifdef UA_ENABLE_ENCRYPTION
  30. UA_EXPORT UA_ServerConfig *
  31. UA_ServerConfig_new_basic128rsa15(UA_UInt16 portNumber,
  32. const UA_ByteString *certificate,
  33. const UA_ByteString *privateKey,
  34. const UA_ByteString *trustList,
  35. size_t trustListSize,
  36. const UA_ByteString *revocationList,
  37. size_t revocationListSize);
  38. #endif
  39. /* Creates a server config on the default port 4840 with no server
  40. * certificate. */
  41. static UA_INLINE UA_ServerConfig *
  42. UA_ServerConfig_new_default(void) {
  43. return UA_ServerConfig_new_minimal(4840, NULL);
  44. }
  45. /* Set a custom hostname in server configuration
  46. *
  47. * @param config A valid server configuration
  48. * @param customHostname The custom hostname used by the server */
  49. UA_EXPORT void
  50. UA_ServerConfig_set_customHostname(UA_ServerConfig *config,
  51. const UA_String customHostname);
  52. /* Frees allocated memory in the server config */
  53. UA_EXPORT void
  54. UA_ServerConfig_delete(UA_ServerConfig *config);
  55. /*************************/
  56. /* Default Client Config */
  57. /*************************/
  58. extern const UA_EXPORT UA_ClientConfig UA_ClientConfig_default;
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif /* UA_CONFIG_DEFAULT_H_ */