#include <LockingPointer.h>
![Inheritance graph](classSecurity_1_1LockingPointer__inherit__graph.png)
![Collaboration graph](classSecurity_1_1LockingPointer__coll__graph.png)
Public Types | |
typedef Security::LockingPointer< T, UnLocker, Locker > | SelfType |
a helper label to simplify this objects API definitions below More... | |
Public Member Functions | |
constexpr | LockingPointer () |
constructs a nil smart pointer More... | |
constexpr | LockingPointer (std::nullptr_t) |
constructs a nil smart pointer from nullptr More... | |
LockingPointer (T *t) | |
~LockingPointer () | |
use the custom UnLocker to unlock any value still stored. More... | |
LockingPointer (const SelfType &o) | |
const SelfType & | operator= (const SelfType &o) |
LockingPointer (SelfType &&o) | |
SelfType & | operator= (SelfType &&o) |
bool | operator! () const |
operator bool () const | |
bool | operator== (const SelfType &o) const |
bool | operator!= (const SelfType &o) const |
T & | operator* () const |
T * | operator-> () const |
T * | get () const |
Returns raw and possibly nullptr pointer. More... | |
void | resetWithoutLocking (T *t) |
Reset raw pointer - unlock any previous one and save new one without locking. More... | |
void | resetAndLock (T *t) |
void | reset () |
Forget the raw pointer - unlock if any value was set. Become a nil pointer. More... | |
T * | release () |
Forget the raw pointer without unlocking it. Become a nil pointer. More... | |
Private Member Functions | |
void | lock (T *t) |
The lock() method increments Object's reference counter. More... | |
void | unlock () |
Private Attributes | |
T * | raw |
Detailed Description
template<typename T, void(*)(T *t) UnLocker, class Locker = NilFunctor>
class Security::LockingPointer< T, UnLocker, Locker >
A shared pointer to a reference-counting Object with library-specific absorption, locking, and unlocking implementations. The API largely follows std::shared_ptr.
The constructor and the resetWithoutLocking() method import a raw Object pointer. Normally, reset() would lock(), but libraries like OpenSSL pre-lock objects before they are fed to LockingPointer, necessitating this resetWithoutLocking() customization hook.
Definition at line 50 of file LockingPointer.h.
Member Typedef Documentation
◆ SelfType
typedef Security::LockingPointer<T, UnLocker, Locker> Security::LockingPointer< T, UnLocker, Locker >::SelfType |
Definition at line 54 of file LockingPointer.h.
Constructor & Destructor Documentation
◆ LockingPointer() [1/5]
|
inlineconstexpr |
Definition at line 57 of file LockingPointer.h.
◆ LockingPointer() [2/5]
|
inlineconstexpr |
Definition at line 60 of file LockingPointer.h.
◆ LockingPointer() [3/5]
|
inlineexplicit |
Construct directly from a (possibly nil) raw pointer. If the supplied pointer is not nil, it is expected that its producer has already created one reference lock for the object pointed to, and our destructor will do the matching unlock.
Definition at line 68 of file LockingPointer.h.
◆ ~LockingPointer()
|
inline |
Definition at line 74 of file LockingPointer.h.
◆ LockingPointer() [4/5]
|
inline |
Definition at line 77 of file LockingPointer.h.
◆ LockingPointer() [5/5]
|
inline |
Definition at line 85 of file LockingPointer.h.
Member Function Documentation
◆ get()
|
inline |
Definition at line 103 of file LockingPointer.h.
Referenced by addAltNameWithSubjectCn(), Ssl::CertificateDb::addCertAndPrivateKey(), Ssl::appendCertToMemory(), Security::ErrorDetail::brokenCert(), buildCertificate(), ConnStateData::buildSslCertGenerationParams(), Ssl::certificateMatchesProperties(), Ssl::CertificatesCmp(), Ssl::chainCertificatesToSSLContext(), completeIssuers(), Ssl::CrtdMessage::composeRequest(), Ssl::configureSSL(), Ssl::configureSSLUsingPkeyAndCertFromMemory(), Ssl::createSSLContext(), generateFakeSslCertificate(), Ssl::generateUntrustedCert(), Ssl::InRamCertificateDbKey(), Security::ServerOptions::loadDhParams(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::LockingPointer(), Acl::ServerCertificateCheck::match(), mimicAuthorityKeyId(), mimicExtensions(), Ssl::OnDiskCertificateDbKey(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator!=(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator=(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator==(), Security::ErrorDetail::peerCert(), replaceCommonName(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::resetAndLock(), Ssl::PeekingPeerConnector::serverCertificateVerified(), ssl_verify_cb(), Ssl::writeCertAndPrivateKeyToMemory(), Ssl::WriteX509Certificate(), Ssl::X509_get_signature(), x509Digest(), and x509Pubkeydigest().
◆ lock()
|
inlineprivate |
Definition at line 130 of file LockingPointer.h.
Referenced by Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::resetAndLock().
◆ operator bool()
|
inlineexplicit |
Definition at line 95 of file LockingPointer.h.
◆ operator!()
|
inline |
Definition at line 94 of file LockingPointer.h.
◆ operator!=()
|
inline |
Definition at line 97 of file LockingPointer.h.
◆ operator*()
|
inline |
Definition at line 99 of file LockingPointer.h.
◆ operator->()
|
inline |
Definition at line 100 of file LockingPointer.h.
◆ operator=() [1/2]
|
inline |
Definition at line 80 of file LockingPointer.h.
◆ operator=() [2/2]
|
inline |
Definition at line 88 of file LockingPointer.h.
◆ operator==()
|
inline |
Definition at line 96 of file LockingPointer.h.
◆ release()
|
inline |
Definition at line 122 of file LockingPointer.h.
◆ reset()
|
inline |
Definition at line 119 of file LockingPointer.h.
Referenced by createSerial(), Security::KeyData::loadCertificates(), Ssl::readCertAndPrivateKeyFromMemory(), and ssl_verify_cb().
◆ resetAndLock()
|
inline |
Definition at line 111 of file LockingPointer.h.
Referenced by ConnStateData::buildSslCertGenerationParams(), completeIssuers(), Ssl::generateUntrustedCert(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::LockingPointer(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator=(), Ssl::PeekingPeerConnector::serverCertificateVerified(), and ssl_verify_cb().
◆ resetWithoutLocking()
|
inline |
Definition at line 106 of file LockingPointer.h.
Referenced by Security::PeerConnector::fillChecklist(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::LockingPointer(), Acl::ServerCertificateCheck::match(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator=(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::resetAndLock(), and Ssl::PeekingPeerConnector::serverCertificateVerified().
◆ unlock()
|
inlineprivate |
Become a nil pointer. Decrements any pointed-to Object's reference counter using UnLocker which ideally destroys the object when the counter reaches zero.
Definition at line 139 of file LockingPointer.h.
Referenced by Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::reset(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::resetWithoutLocking(), and Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::~LockingPointer().
Member Data Documentation
◆ raw
|
private |
Normally, no other code will have this raw pointer.
However, OpenSSL does some strange and not always consistent things. OpenSSL library may keep its own internal raw pointers and manage their reference counts independently, or it may not. This varies between API functions, though it is usually documented.
This means the caller code needs to be carefully written to use the correct reset method and avoid the raw-pointer constructor unless OpenSSL function producing the pointer is clearly documented as incrementing a lock for it.
Definition at line 158 of file LockingPointer.h.
Referenced by Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::get(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator bool(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator!(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator!=(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator*(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator->(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator=(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::operator==(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::release(), Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::resetWithoutLocking(), and Security::LockingPointer< DH, DH_free_cpp, HardFun< int, DH *, DH_up_ref > >::unlock().
The documentation for this class was generated from the following file:
- src/security/LockingPointer.h
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products