2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_CACHEMANAGER_H
10 #define SQUID_CACHEMANAGER_H
12 #include "comm/forward.h"
13 #include "mgr/Action.h"
14 #include "mgr/ActionProfile.h"
15 #include "mgr/Command.h"
16 #include "mgr/forward.h"
23 * a CacheManager - the menu system for interacting with squid.
24 * This is currently just an adapter to the global cachemgr* routines to
25 * provide looser coupling between modules, but once fully transitioned,
26 * an instance of this class will represent a single independent manager.
27 * TODO: update documentation to reflect the new singleton model.
32 typedef std::vector
<Mgr::ActionProfilePointer
> Menu
;
34 void registerProfile(char const * action
, char const * desc
,
36 int pw_req_flag
, int atomic
);
37 void registerProfile(char const * action
, char const * desc
,
38 Mgr::ClassActionCreationHandler
*handler
,
39 int pw_req_flag
, int atomic
);
40 Mgr::ActionProfilePointer
findAction(char const * action
) const;
41 Mgr::Action::Pointer
createNamedAction(const char *actionName
);
42 Mgr::Action::Pointer
createRequestedAction(const Mgr::ActionParams
&);
43 const Menu
& menu() const { return menu_
; }
45 void Start(const Comm::ConnectionPointer
&client
, HttpRequest
* request
, StoreEntry
* entry
);
47 static CacheManager
* GetInstance();
48 const char *ActionProtection(const Mgr::ActionProfilePointer
&profile
);
51 CacheManager() {} ///< use Instance() instead
53 Mgr::CommandPointer
ParseUrl(const char *url
);
54 void ParseHeaders(const HttpRequest
* request
, Mgr::ActionParams
¶ms
);
55 int CheckPassword(const Mgr::Command
&cmd
);
56 char *PasswdGet(Mgr::ActionPasswordList
*, const char *);
58 void registerProfile(const Mgr::ActionProfilePointer
&profile
);
63 static CacheManager
* instance
;
66 #endif /* SQUID_CACHEMANAGER_H */