NetSSL.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //
  2. // NetSSL.h
  3. //
  4. // $Id: //poco/1.4/NetSSL_OpenSSL/include/Poco/Net/NetSSL.h#2 $
  5. //
  6. // Library: NetSSL_OpenSSL
  7. // Package: SSLCore
  8. // Module: OpenSSL
  9. //
  10. // Basic definitions for the Poco OpenSSL library.
  11. // This file must be the first file included by every other OpenSSL
  12. // header file.
  13. //
  14. // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
  15. // and Contributors.
  16. //
  17. // Permission is hereby granted, free of charge, to any person or organization
  18. // obtaining a copy of the software and accompanying documentation covered by
  19. // this license (the "Software") to use, reproduce, display, distribute,
  20. // execute, and transmit the Software, and to prepare derivative works of the
  21. // Software, and to permit third-parties to whom the Software is furnished to
  22. // do so, all subject to the following:
  23. //
  24. // The copyright notices in the Software and this entire statement, including
  25. // the above license grant, this restriction and the following disclaimer,
  26. // must be included in all copies of the Software, in whole or in part, and
  27. // all derivative works of the Software, unless such copies or derivative
  28. // works are solely in the form of machine-executable object code generated by
  29. // a source language processor.
  30. //
  31. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  32. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33. // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
  34. // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
  35. // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
  36. // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  37. // DEALINGS IN THE SOFTWARE.
  38. //
  39. #ifndef NetSSL_NetSSL_INCLUDED
  40. #define NetSSL_NetSSL_INCLUDED
  41. #include "Poco/Net/Net.h"
  42. //
  43. // The following block is the standard way of creating macros which make exporting
  44. // from a DLL simpler. All files within this DLL are compiled with the NetSSL_EXPORTS
  45. // symbol defined on the command line. this symbol should not be defined on any project
  46. // that uses this DLL. This way any other project whose source files include this file see
  47. // NetSSL_API functions as being imported from a DLL, wheras this DLL sees symbols
  48. // defined with this macro as being exported.
  49. //
  50. #if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL)
  51. #if defined(NetSSL_EXPORTS)
  52. #define NetSSL_API __declspec(dllexport)
  53. #else
  54. #define NetSSL_API __declspec(dllimport)
  55. #endif
  56. #endif
  57. #if !defined(NetSSL_API)
  58. #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
  59. #define NetSSL_API __attribute__ ((visibility ("default")))
  60. #else
  61. #define NetSSL_API
  62. #endif
  63. #endif
  64. //
  65. // Automatically link NetSSL library.
  66. //
  67. #if defined(_MSC_VER)
  68. #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(NetSSL_EXPORTS)
  69. #pragma comment(lib, "PocoNetSSL" POCO_LIB_SUFFIX)
  70. #endif
  71. #endif
  72. namespace Poco {
  73. namespace Net {
  74. void NetSSL_API initializeSSL();
  75. /// Initialize the NetSSL library, as well as the underlying OpenSSL
  76. /// libraries, by calling Poco::Crypto::OpenSSLInitializer::initialize().
  77. ///
  78. /// Should be called before using any class from the NetSSL library.
  79. /// The NetSSL will be initialized automatically, through
  80. /// Poco::Crypto::OpenSSLInitializer instances or similar mechanisms
  81. /// when creating Context or SSLManager instances.
  82. /// However, it is recommended to call initializeSSL()
  83. /// in any case at application startup.
  84. ///
  85. /// Can be called multiple times; however, for every call to
  86. /// initializeSSL(), a matching call to uninitializeSSL()
  87. /// must be performed.
  88. void NetSSL_API uninitializeSSL();
  89. /// Uninitializes the NetSSL library by calling
  90. /// Poco::Crypto::OpenSSLInitializer::uninitialize() and
  91. /// shutting down the SSLManager.
  92. } } // namespace Poco::Net
  93. #endif // NetSSL_NetSSL_INCLUDED