]>
Commit | Line | Data |
---|---|---|
3aac8c26 | 1 | /* |
ef57eb7b | 2 | * Copyright (C) 1996-2016 The Squid Software Foundation and contributors |
3aac8c26 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
9 | #ifndef SQUID_SRC_SECURITY_SESSION_H | |
10 | #define SQUID_SRC_SECURITY_SESSION_H | |
11 | ||
3662819a | 12 | #include "base/CtoCppDtor.h" |
33cc0629 AJ |
13 | #include "security/LockingPointer.h" |
14 | ||
3aac8c26 AJ |
15 | #if USE_OPENSSL |
16 | #if HAVE_OPENSSL_SSL_H | |
17 | #include <openssl/ssl.h> | |
18 | #endif | |
19 | #endif | |
20 | ||
21 | #if USE_GNUTLS | |
22 | #if HAVE_GNUTLS_GNUTLS_H | |
23 | #include <gnutls/gnutls.h> | |
24 | #endif | |
25 | #endif | |
26 | ||
27 | namespace Security { | |
28 | ||
29 | #if USE_OPENSSL | |
33cc0629 AJ |
30 | typedef SSL* SessionPtr; |
31 | CtoCpp1(SSL_free, SSL *); | |
088f0761 | 32 | typedef LockingPointer<SSL, Security::SSL_free_cpp, CRYPTO_LOCK_SSL> SessionPointer; |
3aac8c26 AJ |
33 | |
34 | #elif USE_GNUTLS | |
33cc0629 | 35 | typedef gnutls_session_t SessionPtr; |
48c7e8cb | 36 | CtoCppDtor(gnutls_deinit, gnutls_session_t); |
088f0761 CT |
37 | // TODO: Convert to Locking pointer. |
38 | // Locks can be implemented attaching locks counter to gnutls_session_t | |
cdc1926a | 39 | // objects using the gnutls_session_set_ptr()/gnutls_session_get_ptr () |
088f0761 | 40 | // library functions |
3662819a | 41 | typedef std::unique_ptr<struct gnutls_session_int, Security::gnutls_deinit_cpp> SessionPointer; |
3aac8c26 AJ |
42 | |
43 | #else | |
44 | // use void* so we can check against NULL | |
33cc0629 | 45 | typedef void* SessionPtr; |
48c7e8cb | 46 | // use nullptr_t so default_delete works |
3662819a | 47 | typedef std::unique_ptr<nullptr_t> SessionPointer; |
33cc0629 | 48 | |
3aac8c26 AJ |
49 | #endif |
50 | ||
51 | } // namespace Security | |
52 | ||
53 | #endif /* SQUID_SRC_SECURITY_SESSION_H */ | |
54 |