#include "squid.h"
#include "cbdata.h"
#include "Generic.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 void | cbdataInternalInitType (cbdata_type type, const char *name, int size) |
cbdata_type | cbdataInternalAddType (cbdata_type type, const char *name, int size) |
void | cbdataRegisterWithCacheManager (void) |
void * | cbdataInternalAlloc (cbdata_type type, const char *file, int line) |
static void | cbdataRealFree (cbdata *c, const char *file, const int line) |
void * | cbdataInternalFree (void *p, const char *file, int line) |
void | cbdataInternalLock (const void *p) |
void | cbdataInternalUnlock (const void *p) |
int | cbdataReferenceValid (const void *p) |
int | cbdataInternalReferenceDoneValid (void **pp, void **tp) |
static void | cbdataDump (StoreEntry *sentry) |
Variables | |
static int | cbdataCount = 0 |
static OBJH | cbdataDump |
struct CBDataIndex * | cbdata_index = NULL |
int | cbdata_types = 0 |
static std::map< const void *, cbdata * > | cbdata_htable |
Function Documentation
◆ cbdataDump()
|
static |
Definition at line 467 of file cbdata.cc.
References cbdata_index, cbdata_types, cbdataCount, Mem::Meter::currentLevel(), for_each(), MemAllocator::getMeter(), MemPoolMeter::inuse, MemAllocator::objectSize(), MemAllocator::objectType(), CBDataIndex::pool, and storeAppendPrintf().
◆ 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 196 of file cbdata.cc.
References cbdata_types, and type.
◆ cbdataInternalAlloc()
void* cbdataInternalAlloc | ( | cbdata_type | type, |
const char * | , | ||
int | |||
) |
Allocates a new entry of a registered CBDATA type.
- Note
- For internal CBDATA use only.
Definition at line 223 of file cbdata.cc.
References MemAllocator::alloc(), assert, cbdata_htable, cbdata_index, cbdata_types, cbdataCount, cbdata::cookie, cbdata::Cookie, cbdata::data, debugs, dlinkAdd(), cbdata::locks, CBDataIndex::pool, cbdata::type, type, and cbdata::valid.
◆ cbdataInternalFree()
void* cbdataInternalFree | ( | void * | p, |
const char * | , | ||
int | |||
) |
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.
◆ cbdataInternalInitType()
|
static |
Definition at line 175 of file cbdata.cc.
References assert, cbdata_index, cbdata_types, memPoolCreate, CBDataIndex::pool, size, type, xmalloc, and xrealloc().
◆ cbdataInternalLock()
void cbdataInternalLock | ( | const void * | p | ) |
Definition at line 331 of file cbdata.cc.
References assert, debugs, cbdata::FromUserData(), INT_MAX, and NULL.
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 418 of file cbdata.cc.
References cbdataInternalUnlock(), cbdataReferenceValid(), and NULL.
◆ cbdataInternalUnlock()
void cbdataInternalUnlock | ( | const void * | p | ) |
Definition at line 357 of file cbdata.cc.
References assert, cbdataRealFree(), debugs, cbdata::FromUserData(), and NULL.
Referenced by cbdataInternalReferenceDoneValid(), and logfile_mod_daemon_close().
◆ cbdataRealFree()
Definition at line 264 of file cbdata.cc.
References cbdata_htable, cbdataCount, cbdata::data, debugs, and dlinkDelete().
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 398 of file cbdata.cc.
References assert, debugs, cbdata::FromUserData(), and NULL.
Referenced by CbcPointer< Cbc >::CbcPointer(), ConnStateData::borrowPinnedConnection(), ACLChecklist::calcImplicitAnswer(), store_client::callback(), ACLChecklist::callerGone(), AsyncJob::callException(), AsyncJob::callStart(), StoreIOStateCb::canDial(), EventDialer::canDial(), CommCbFunPtrCallT< Dialer >::canFire(), cbdataInternalReferenceDoneValid(), EventScheduler::checkEvents(), helper_server::checkForTimedOutRequests(), clientGetMoreData(), clientSocketDetach(), clientSocketRecipient(), clientStreamDetach(), ACLFilledChecklist::conn(), diskHandleRead(), downloaderRecipient(), EventScheduler::dump(), esiBufferRecipient(), esiProcessStream(), esiStreamDetach(), esiStreamRead(), esiStreamStatus(), externalAclHandleReply(), ACLChecklist::fastCheck(), ftpSendReply(), CbcPointer< Cbc >::get(), ClientHttpRequest::getConn(), Comm::Connection::getPeer(), DiskdIOStrategy::handle(), helperDispatch(), helperHandleRead(), helperReturnBuffer(), helperStatefulDispatch(), helperStatefulHandleRead(), ClientRequestContext::httpStateIsValid(), idnsCallbackOneWithAnswer(), ConnStateData::isOpen(), TunnelStateData::keepGoingAfterRead(), ClientHttpRequest::noteAdaptationAnswer(), CbcPointer< Cbc >::operator=(), peerCountMcastPeersAbort(), peerDigestCheck(), peerDigestFetchedEnough(), peerDigestHandleReply(), ACLChecklist::prepNonBlocking(), TunnelStateData::ReadClient(), TunnelStateData::ReadServer(), clientReplyContext::sendMoreData(), SslBumpEstablish(), tunnelStartShoveling(), CallbackData::valid(), PeerPoolMgr::validPeer(), TunnelStateData::writeClientDone(), TunnelStateData::WriteClientDone(), TunnelStateData::writeServerDone(), and TunnelStateData::WriteServerDone().
◆ cbdataRegisterWithCacheManager()
void cbdataRegisterWithCacheManager | ( | void | ) |
Create a run-time registration of CBDATA component with the Squid cachemgr
Definition at line 209 of file cbdata.cc.
Referenced by mainInitialize().
Variable Documentation
◆ cbdata_htable
|
static |
Definition at line 142 of file cbdata.cc.
Referenced by cbdataInternalAlloc(), cbdataRealFree(), and cbdata::FromUserData().
◆ cbdata_index
struct CBDataIndex * cbdata_index = NULL |
Referenced by cbdata::~cbdata(), cbdataDump(), cbdataInternalAlloc(), and cbdataInternalInitType().
◆ cbdata_types
int cbdata_types = 0 |
Definition at line 139 of file cbdata.cc.
Referenced by cbdataDump(), cbdataInternalAddType(), cbdataInternalAlloc(), and cbdataInternalInitType().
◆ cbdataCount
|
static |
Definition at line 30 of file cbdata.cc.
Referenced by cbdataDump(), cbdataInternalAlloc(), and cbdataRealFree().
◆ cbdataDump
|
static |
Definition at line 129 of file cbdata.cc.
Referenced by cbdataRegisterWithCacheManager().