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