#include "squid.h"
#include "cbdata.h"
#include "Generic.h"
#include "mem/Allocator.h"
#include "mem/Pool.h"
#include "mgr/Registration.h"
#include "Store.h"
#include <climits>
#include <cstddef>
#include <map>
Go to the source code of this file.
Classes | |
class | cbdata |
struct | CBDataIndex |
Functions | |
static auto & | CbdataTable () |
cbdata_type | cbdataInternalAddType (cbdata_type type, const char *name, int size) |
void * | cbdataInternalAlloc (cbdata_type type) |
static void | cbdataRealFree (cbdata *c) |
void * | cbdataInternalFree (void *p) |
void | cbdataInternalLock (const void *p) |
void | cbdataInternalUnlock (const void *p) |
int | cbdataReferenceValid (const void *p) |
int | cbdataInternalReferenceDoneValid (void **pp, void **tp) |
Variables | |
static int | cbdataCount = 0 |
struct CBDataIndex * | cbdata_index = nullptr |
int | cbdata_types = 0 |
Function Documentation
◆ cbdataInternalAddType()
cbdata_type cbdataInternalAddType | ( | cbdata_type | type, |
const char * | label, | ||
int | size | ||
) |
Create a run-time registration for the class type with cbdata memory allocator.
- Note
- For internal CBDATA use only.
Definition at line 122 of file cbdata.cc.
References assert, cbdata_index, cbdata_types, memPoolCreate, CBDataIndex::pool, size, xmalloc, and xrealloc().
◆ cbdataInternalAlloc()
void* cbdataInternalAlloc | ( | cbdata_type | type | ) |
Allocates a new entry of a registered CBDATA type.
- Note
- For internal CBDATA use only.
Definition at line 150 of file cbdata.cc.
References Mem::Allocator::alloc(), assert, cbdata_index, cbdata_types, cbdataCount, CbdataTable(), cbdata::cookie, cbdata::Cookie, cbdata::data, debugs, cbdata::locks, CBDataIndex::pool, cbdata::type, and cbdata::valid.
◆ cbdataInternalFree()
void* cbdataInternalFree | ( | void * | p | ) |
Frees a entry allocated by cbdataInternalAlloc().
Once this has been called cbdataReferenceValid() and cbdataReferenceValidDone() will return false regardless of whether there are remaining cbdata references.
cbdataReferenceDone() must still be called for any active references to the cbdata entry. The cbdata entry will be freed only when the last reference is removed.
- Note
- For internal CBDATA use only.
Definition at line 208 of file cbdata.cc.
References assert, cbdataRealFree(), debugs, and cbdata::FromUserData().
◆ cbdataInternalLock()
void cbdataInternalLock | ( | const void * | p | ) |
Definition at line 226 of file cbdata.cc.
References assert, debugs, cbdata::FromUserData(), and INT_MAX.
Referenced by logfile_mod_daemon_open().
◆ cbdataInternalReferenceDoneValid()
int cbdataInternalReferenceDoneValid | ( | void ** | p, |
void ** | tp | ||
) |
Removes a reference created by cbdataReference() and checks it for validity. Meant to be used on the last dereference, usually to make a callback.
- Parameters
-
var The reference variable. Will be automatically cleared to nullptr ptr A temporary pointer to the referenced data (if valid).
Definition at line 287 of file cbdata.cc.
References cbdataInternalUnlock(), and cbdataReferenceValid().
◆ cbdataInternalUnlock()
void cbdataInternalUnlock | ( | const void * | p | ) |
Definition at line 243 of file cbdata.cc.
References assert, cbdataRealFree(), debugs, and cbdata::FromUserData().
Referenced by cbdataInternalReferenceDoneValid(), and logfile_mod_daemon_close().
◆ cbdataRealFree()
|
static |
Definition at line 178 of file cbdata.cc.
References cbdataCount, CbdataTable(), cbdata::data, and debugs.
Referenced by cbdataInternalFree(), and cbdataInternalUnlock().
◆ cbdataReferenceValid()
int cbdataReferenceValid | ( | const void * | p | ) |
- Parameters
-
p A cbdata entry reference pointer.
- Return values
-
0 A reference is stale. The pointer refers to a entry already freed. true The reference is valid and active.
Definition at line 270 of file cbdata.cc.
References assert, debugs, and cbdata::FromUserData().
Referenced by ACLExternal::aclMatchExternal(), ConnStateData::borrowPinnedConnection(), ACLChecklist::callerGone(), AsyncJob::callException(), AsyncJob::callStart(), EventDialer::canDial(), StoreIOStateCb::canDial(), CommCbFunPtrCallT< Dialer >::canFire(), CbcPointer< CbDataList >::CbcPointer(), cbdataInternalReferenceDoneValid(), EventScheduler::checkEvents(), Helper::Session::checkForTimedOutRequests(), clientGetMoreData(), clientSocketDetach(), clientSocketRecipient(), clientStreamDetach(), ACLFilledChecklist::conn(), diskHandleRead(), downloaderRecipient(), EventScheduler::dump(), externalAclHandleReply(), ftpSendReply(), CbcPointer< CbDataList >::get(), ClientHttpRequest::getConn(), Comm::Connection::getPeer(), DiskdIOStrategy::handle(), helperDispatch(), helperHandleRead(), helperReturnBuffer(), helperStatefulDispatch(), helperStatefulHandleRead(), ClientRequestContext::httpStateIsValid(), idnsCallbackOneWithAnswer(), ConnStateData::isOpen(), TunnelStateData::keepGoingAfterRead(), ClientHttpRequest::noteAdaptationAnswer(), CbcPointer< CbDataList >::operator=(), peerCountMcastPeersAbort(), peerDigestHandleReply(), TunnelStateData::ReadClient(), TunnelStateData::ReadServer(), clientReplyContext::sendMoreData(), SslBumpEstablish(), tunnelStartShoveling(), CallbackData::valid(), PeerPoolMgr::validPeer(), TunnelStateData::WriteClientDone(), TunnelStateData::writeClientDone(), TunnelStateData::WriteServerDone(), and TunnelStateData::writeServerDone().
◆ CbdataTable()
|
static |
Definition at line 94 of file cbdata.cc.
Referenced by cbdataInternalAlloc(), cbdataRealFree(), and cbdata::FromUserData().
Variable Documentation
◆ cbdata_index
struct CBDataIndex * cbdata_index = nullptr |
Referenced by cbdataInternalAddType(), cbdataInternalAlloc(), and cbdata::~cbdata().
◆ cbdata_types
int cbdata_types = 0 |
Definition at line 90 of file cbdata.cc.
Referenced by cbdataInternalAddType(), and cbdataInternalAlloc().
◆ cbdataCount
|
static |
Definition at line 26 of file cbdata.cc.
Referenced by cbdataInternalAlloc(), and cbdataRealFree().
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