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