]> git.ipfire.org Git - thirdparty/squid.git/blame - src/CacheManager.h
Fix SQUID_YESNO 'syntax error near unexpected token' (#2117)
[thirdparty/squid.git] / src / CacheManager.h
CommitLineData
62ee09ca 1/*
1f7b830e 2 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
62ee09ca 3 *
bbc27441
AJ
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.
62ee09ca 7 */
8
ff9d9458
FC
9#ifndef SQUID_SRC_CACHEMANAGER_H
10#define SQUID_SRC_CACHEMANAGER_H
62ee09ca 11
26e65059 12#include "anyp/forward.h"
5c336a3b 13#include "comm/forward.h"
7e6eabbc 14#include "log/forward.h"
8822ebee
AR
15#include "mgr/Action.h"
16#include "mgr/ActionProfile.h"
17#include "mgr/Command.h"
18#include "mgr/forward.h"
a7458115 19
8822ebee 20#include <vector>
62ee09ca 21
582c2af2 22class HttpRequest;
92a5adb7 23class HttpReply;
5ce18e2a 24
63be0a78 25/**
62ee09ca 26 * a CacheManager - the menu system for interacting with squid.
27 * This is currently just an adapter to the global cachemgr* routines to
28 * provide looser coupling between modules, but once fully transitioned,
29 * an instance of this class will represent a single independent manager.
c83f0bd5 30 * TODO: update documentation to reflect the new singleton model.
62ee09ca 31 */
62ee09ca 32class CacheManager
33{
62ee09ca 34public:
8822ebee
AR
35 typedef std::vector<Mgr::ActionProfilePointer> Menu;
36
3c383cc3
AR
37 /// initial URL path characters that identify cache manager requests
38 static const SBuf &WellKnownUrlPathPrefix();
39
99572608
FC
40 /// remembers the given profile while ignoring attempts to register a same-name duplicate
41 void registerProfile(const Mgr::ActionProfilePointer &);
42
8822ebee
AR
43 Mgr::ActionProfilePointer findAction(char const * action) const;
44 Mgr::Action::Pointer createNamedAction(const char *actionName);
45 Mgr::Action::Pointer createRequestedAction(const Mgr::ActionParams &);
46 const Menu& menu() const { return menu_; }
c83f0bd5 47
7e6eabbc 48 void start(const Comm::ConnectionPointer &client, HttpRequest *request, StoreEntry *entry, const AccessLogEntryPointer &ale);
c83f0bd5
K
49
50 static CacheManager* GetInstance();
8822ebee 51 const char *ActionProtection(const Mgr::ActionProfilePointer &profile);
c83f0bd5 52
92a5adb7
AR
53 /// Add HTTP response headers specific/common to all cache manager replies,
54 /// including cache manager errors and Action reports.
55 /// \param httpOrigin the value of Origin header in the trigger HTTP request (or nil)
56 static void PutCommonResponseHeaders(HttpReply &, const char *httpOrigin);
57
c83f0bd5 58protected:
8822ebee 59 CacheManager() {} ///< use Instance() instead
4b2aa1b4 60
26e65059 61 Mgr::CommandPointer ParseUrl(const AnyP::Uri &);
8822ebee
AR
62 void ParseHeaders(const HttpRequest * request, Mgr::ActionParams &params);
63 int CheckPassword(const Mgr::Command &cmd);
613924ee 64 char *PasswdGet(Mgr::ActionPasswordList *, const char *);
4b2aa1b4 65
8822ebee 66 Menu menu_;
62ee09ca 67};
68
ff9d9458 69#endif /* SQUID_SRC_CACHEMANAGER_H */
f53969cc 70