]> git.ipfire.org Git - thirdparty/squid.git/blame - src/security/Session.h
Remove last remains of TidyPointer
[thirdparty/squid.git] / src / security / Session.h
CommitLineData
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
27namespace Security {
28
29#if USE_OPENSSL
33cc0629
AJ
30typedef SSL* SessionPtr;
31CtoCpp1(SSL_free, SSL *);
088f0761 32typedef LockingPointer<SSL, Security::SSL_free_cpp, CRYPTO_LOCK_SSL> SessionPointer;
3aac8c26
AJ
33
34#elif USE_GNUTLS
33cc0629 35typedef gnutls_session_t SessionPtr;
48c7e8cb 36CtoCppDtor(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 41typedef 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 45typedef void* SessionPtr;
48c7e8cb 46// use nullptr_t so default_delete works
3662819a 47typedef 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