#include <CacheManager.h>

Collaboration diagram for CacheManager:

Public Types

typedef std::vector< Mgr::ActionProfilePointerMenu
 

Public Member Functions

void registerProfile (char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
 
void registerProfile (char const *action, char const *desc, Mgr::ClassActionCreationHandler *handler, int pw_req_flag, int atomic)
 
Mgr::ActionProfilePointer findAction (char const *action) const
 
Mgr::Action::Pointer createNamedAction (const char *actionName)
 
Mgr::Action::Pointer createRequestedAction (const Mgr::ActionParams &)
 
const Menumenu () const
 
void start (const Comm::ConnectionPointer &client, HttpRequest *request, StoreEntry *entry, const AccessLogEntryPointer &ale)
 
const char * ActionProtection (const Mgr::ActionProfilePointer &profile)
 

Static Public Member Functions

static CacheManagerGetInstance ()
 

Protected Member Functions

 CacheManager ()
 use Instance() instead More...
 
Mgr::CommandPointer ParseUrl (const char *url)
 
void ParseHeaders (const HttpRequest *request, Mgr::ActionParams &params)
 
int CheckPassword (const Mgr::Command &cmd)
 
char * PasswdGet (Mgr::ActionPasswordList *, const char *)
 
void registerProfile (const Mgr::ActionProfilePointer &profile)
 Registers new profiles, ignoring attempts to register a duplicate. More...
 

Protected Attributes

Menu menu_
 

Detailed Description

a CacheManager - the menu system for interacting with squid. This is currently just an adapter to the global cachemgr* routines to provide looser coupling between modules, but once fully transitioned, an instance of this class will represent a single independent manager. TODO: update documentation to reflect the new singleton model.

Definition at line 30 of file CacheManager.h.

Member Typedef Documentation

◆ Menu

Constructor & Destructor Documentation

◆ CacheManager()

CacheManager::CacheManager ( )
inlineprotected

Definition at line 52 of file CacheManager.h.

References CheckPassword(), ParseHeaders(), ParseUrl(), PasswdGet(), and registerProfile().

Member Function Documentation

◆ ActionProtection()

const char * CacheManager::ActionProtection ( const Mgr::ActionProfilePointer profile)

Definition at line 424 of file cache_manager.cc.

References assert, Config, NULL, and SquidConfig::passwd_list.

Referenced by Mgr::MenuAction::dump(), and menu().

◆ CheckPassword()

int CacheManager::CheckPassword ( const Mgr::Command cmd)
protected
Return values
0if mgr->password is good or "none"
1if mgr->password is "disable"
!0if mgr->password does not match configured password

Definition at line 276 of file cache_manager.cc.

References action(), assert, Config, debugs, NULL, Mgr::Command::params, SquidConfig::passwd_list, Mgr::ActionParams::password, Mgr::Command::profile, and String::size().

Referenced by CacheManager().

◆ createNamedAction()

Mgr::Action::Pointer CacheManager::createNamedAction ( const char *  actionName)

Definition at line 128 of file cache_manager.cc.

References Must, and NULL.

Referenced by Mgr::Response::Response(), and testCacheManager::testRegister().

◆ createRequestedAction()

Mgr::Action::Pointer CacheManager::createRequestedAction ( const Mgr::ActionParams params)

◆ findAction()

Mgr::ActionProfile::Pointer CacheManager::findAction ( char const *  action) const

Locates an action in the actions registry ActionsList.

Return values
NULLif Action not found
CacheManagerAction*if the action was found

Definition at line 110 of file cache_manager.cc.

References a, debugs, Must, and NULL.

Referenced by registerProfile().

◆ GetInstance()

◆ menu()

const Menu& CacheManager::menu ( ) const
inline

Definition at line 44 of file CacheManager.h.

References ActionProtection(), GetInstance(), menu_, request(), and start().

Referenced by Mgr::MenuAction::dump().

◆ ParseHeaders()

◆ ParseUrl()

Mgr::Command::Pointer CacheManager::ParseUrl ( const char *  url)
protected

define whether the URL is a cache-manager URL and parse the action requested by the user. Checks via CacheManager::ActionProtection() that the item is accessible by the user.

Return values
CacheManager::cachemgrStateDatastate object for the following handling
NULLif the action can't be found or can't be accessed by the user

Definition at line 159 of file cache_manager.cc.

References DBG_IMPORTANT, debugs, HERE(), len, LOCAL_ARRAY, MAX_URL, Must, NULL, Mgr::QueryParams::Parse(), request(), and xstrncpy().

Referenced by CacheManager().

◆ PasswdGet()

char * CacheManager::PasswdGet ( Mgr::ActionPasswordList a,
const char *  action 
)
protected

◆ registerProfile() [1/3]

void CacheManager::registerProfile ( char const *  action,
char const *  desc,
OBJH handler,
int  pw_req_flag,
int  atomic 
)

Registers a C-style action, which is implemented as a pointer to a function taking as argument a pointer to a StoreEntry and returning void. Implemented via CacheManagerActionLegacy.

Definition at line 79 of file cache_manager.cc.

References action(), ClassActionCreator::ClassActionCreator(), debugs, ClassActionCreator::handler, and HERE().

Referenced by CacheManager(), Mgr::RegisterAction(), and testCacheManager::testRegister().

◆ registerProfile() [2/3]

void CacheManager::registerProfile ( char const *  action,
char const *  desc,
Mgr::ClassActionCreationHandler handler,
int  pw_req_flag,
int  atomic 
)

◆ registerProfile() [3/3]

void CacheManager::registerProfile ( const Mgr::ActionProfilePointer profile)
protected

Definition at line 61 of file cache_manager.cc.

References debugs, findAction(), HERE(), Must, and NULL.

◆ start()

Member Data Documentation

◆ menu_

Menu CacheManager::menu_
protected

Definition at line 61 of file CacheManager.h.

Referenced by menu().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors