]> git.ipfire.org Git - thirdparty/squid.git/blob - src/CacheManager.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / CacheManager.h
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 #ifndef SQUID_CACHEMANAGER_H
10 #define SQUID_CACHEMANAGER_H
11
12 #include "comm/forward.h"
13 #include "log/forward.h"
14 #include "mgr/Action.h"
15 #include "mgr/ActionProfile.h"
16 #include "mgr/Command.h"
17 #include "mgr/forward.h"
18
19 #include <vector>
20
21 class HttpRequest;
22
23 /**
24 * a CacheManager - the menu system for interacting with squid.
25 * This is currently just an adapter to the global cachemgr* routines to
26 * provide looser coupling between modules, but once fully transitioned,
27 * an instance of this class will represent a single independent manager.
28 * TODO: update documentation to reflect the new singleton model.
29 */
30 class CacheManager
31 {
32 public:
33 typedef std::vector<Mgr::ActionProfilePointer> Menu;
34
35 void registerProfile(char const * action, char const * desc,
36 OBJH * handler,
37 int pw_req_flag, int atomic);
38 void registerProfile(char const * action, char const * desc,
39 Mgr::ClassActionCreationHandler *handler,
40 int pw_req_flag, int atomic);
41 Mgr::ActionProfilePointer findAction(char const * action) const;
42 Mgr::Action::Pointer createNamedAction(const char *actionName);
43 Mgr::Action::Pointer createRequestedAction(const Mgr::ActionParams &);
44 const Menu& menu() const { return menu_; }
45
46 void start(const Comm::ConnectionPointer &client, HttpRequest *request, StoreEntry *entry, const AccessLogEntryPointer &ale);
47
48 static CacheManager* GetInstance();
49 const char *ActionProtection(const Mgr::ActionProfilePointer &profile);
50
51 protected:
52 CacheManager() {} ///< use Instance() instead
53
54 Mgr::CommandPointer ParseUrl(const char *url);
55 void ParseHeaders(const HttpRequest * request, Mgr::ActionParams &params);
56 int CheckPassword(const Mgr::Command &cmd);
57 char *PasswdGet(Mgr::ActionPasswordList *, const char *);
58
59 void registerProfile(const Mgr::ActionProfilePointer &profile);
60
61 Menu menu_;
62 };
63
64 #endif /* SQUID_CACHEMANAGER_H */
65