NetSSL.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #include "Poco/Crypto/Crypto.h"
  21. //
  22. // The following block is the standard way of creating macros which make exporting
  23. // from a DLL simpler. All files within this DLL are compiled with the NetSSL_EXPORTS
  24. // symbol defined on the command line. this symbol should not be defined on any project
  25. // that uses this DLL. This way any other project whose source files include this file see
  26. // NetSSL_API functions as being imported from a DLL, wheras this DLL sees symbols
  27. // defined with this macro as being exported.
  28. //
  29. #if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL)
  30. #if defined(NetSSL_EXPORTS)
  31. #define NetSSL_API __declspec(dllexport)
  32. #else
  33. #define NetSSL_API __declspec(dllimport)
  34. #endif
  35. #endif
  36. #if !defined(NetSSL_API)
  37. #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
  38. #define NetSSL_API __attribute__ ((visibility ("default")))
  39. #else
  40. #define NetSSL_API
  41. #endif
  42. #endif
  43. //
  44. // Automatically link NetSSL and OpenSSL libraries.
  45. //
  46. #if defined(_MSC_VER)
  47. #if !defined(POCO_NO_AUTOMATIC_LIBS)
  48. #if !defined(NetSSL_EXPORTS)
  49. #pragma comment(lib, "PocoNetSSL" POCO_LIB_SUFFIX)
  50. #endif
  51. #endif // POCO_NO_AUTOMATIC_LIBS
  52. #endif
  53. namespace Poco {
  54. namespace Net {
  55. void NetSSL_API initializeSSL();
  56. /// Initialize the NetSSL library, as well as the underlying OpenSSL
  57. /// libraries, by calling Poco::Crypto::OpenSSLInitializer::initialize().
  58. ///
  59. /// Should be called before using any class from the NetSSL library.
  60. /// The NetSSL will be initialized automatically, through
  61. /// Poco::Crypto::OpenSSLInitializer instances or similar mechanisms
  62. /// when creating Context or SSLManager instances.
  63. /// However, it is recommended to call initializeSSL()
  64. /// in any case at application startup.
  65. ///
  66. /// Can be called multiple times; however, for every call to
  67. /// initializeSSL(), a matching call to uninitializeSSL()
  68. /// must be performed.
  69. void NetSSL_API uninitializeSSL();
  70. /// Uninitializes the NetSSL library by calling
  71. /// Poco::Crypto::OpenSSLInitializer::uninitialize() and
  72. /// shutting down the SSLManager.
  73. } } // namespace Poco::Net
  74. #endif // NetSSL_NetSSL_INCLUDED