NetSSL.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // NetSSL.h
  3. //
  4. // Library: NetSSL_OpenSSL
  5. // Package: SSLCore
  6. // Module: OpenSSL
  7. //
  8. // Basic definitions for the Poco OpenSSL library.
  9. // This file must be the first file included by every other OpenSSL
  10. // header file.
  11. //
  12. // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
  13. // and Contributors.
  14. //
  15. // SPDX-License-Identifier: BSL-1.0
  16. //
  17. #ifndef NetSSL_NetSSL_INCLUDED
  18. #define NetSSL_NetSSL_INCLUDED
  19. #include "Poco/Net/Net.h"
  20. //
  21. // The following block is the standard way of creating macros which make exporting
  22. // from a DLL simpler. All files within this DLL are compiled with the NetSSL_EXPORTS
  23. // symbol defined on the command line. this symbol should not be defined on any project
  24. // that uses this DLL. This way any other project whose source files include this file see
  25. // NetSSL_API functions as being imported from a DLL, wheras this DLL sees symbols
  26. // defined with this macro as being exported.
  27. //
  28. #if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL)
  29. #if defined(NetSSL_EXPORTS)
  30. #define NetSSL_API __declspec(dllexport)
  31. #else
  32. #define NetSSL_API __declspec(dllimport)
  33. #endif
  34. #endif
  35. #if !defined(NetSSL_API)
  36. #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
  37. #define NetSSL_API __attribute__ ((visibility ("default")))
  38. #else
  39. #define NetSSL_API
  40. #endif
  41. #endif
  42. //
  43. // Automatically link NetSSL and OpenSSL libraries.
  44. //
  45. #if defined(_MSC_VER)
  46. #if !defined(POCO_NO_AUTOMATIC_LIBS)
  47. #if !defined(POCO_EXTERNAL_OPENSSL)
  48. #pragma comment(lib, "libcrypto.lib")
  49. #pragma comment(lib, "libssl.lib")
  50. #endif // POCO_EXTERNAL_OPENSSL
  51. #if !defined(NetSSL_EXPORTS)
  52. #pragma comment(lib, "PocoNetSSL" POCO_LIB_SUFFIX)
  53. #endif
  54. #endif // POCO_NO_AUTOMATIC_LIBS
  55. #endif
  56. namespace Poco {
  57. namespace Net {
  58. void NetSSL_API initializeSSL();
  59. /// Initialize the NetSSL library, as well as the underlying OpenSSL
  60. /// libraries, by calling Poco::Crypto::OpenSSLInitializer::initialize().
  61. ///
  62. /// Should be called before using any class from the NetSSL library.
  63. /// The NetSSL will be initialized automatically, through
  64. /// Poco::Crypto::OpenSSLInitializer instances or similar mechanisms
  65. /// when creating Context or SSLManager instances.
  66. /// However, it is recommended to call initializeSSL()
  67. /// in any case at application startup.
  68. ///
  69. /// Can be called multiple times; however, for every call to
  70. /// initializeSSL(), a matching call to uninitializeSSL()
  71. /// must be performed.
  72. void NetSSL_API uninitializeSSL();
  73. /// Uninitializes the NetSSL library by calling
  74. /// Poco::Crypto::OpenSSLInitializer::uninitialize() and
  75. /// shutting down the SSLManager.
  76. } } // namespace Poco::Net
  77. #endif // NetSSL_NetSSL_INCLUDED