]> git.ipfire.org Git - thirdparty/squid.git/blob - src/CacheManager.h
Various audit updates
[thirdparty/squid.git] / src / CacheManager.h
1
2 /*
3 *
4 * SQUID Web Proxy Cache http://www.squid-cache.org/
5 * ----------------------------------------------------------
6 *
7 * Squid is the result of efforts by numerous individuals from
8 * the Internet community; see the CONTRIBUTORS file for full
9 * details. Many organizations have provided support for Squid's
10 * development; see the SPONSORS file for full details. Squid is
11 * Copyrighted (C) 2001 by the Regents of the University of
12 * California; see the COPYRIGHT file for full details. Squid
13 * incorporates software developed and/or copyrighted by other
14 * sources; see the CREDITS file for full details.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
29 *
30 */
31
32 #ifndef SQUID_CACHEMANAGER_H
33 #define SQUID_CACHEMANAGER_H
34
35 #include "comm/forward.h"
36 #include "mgr/Action.h"
37 #include "mgr/ActionProfile.h"
38 #include "mgr/Command.h"
39 #include "mgr/forward.h"
40 #include "typedefs.h"
41
42 #include <vector>
43
44 /**
45 \defgroup CacheManagerAPI Cache Manager API
46 \ingroup Components
47 *
48 \defgroup CacheManagerInternal Cache Manager intenal API (not for public use)
49 \ingroup CacheManagerAPI
50 */
51
52 class HttpRequest;
53 namespace Mgr
54 {
55 class ActionPasswordList;
56 } //namespace Mgr
57 /**
58 \ingroup CacheManagerAPI
59 * a CacheManager - the menu system for interacting with squid.
60 * This is currently just an adapter to the global cachemgr* routines to
61 * provide looser coupling between modules, but once fully transitioned,
62 * an instance of this class will represent a single independent manager.
63 * TODO: update documentation to reflect the new singleton model.
64 */
65 class CacheManager
66 {
67 public:
68 typedef std::vector<Mgr::ActionProfilePointer> Menu;
69
70 void registerProfile(char const * action, char const * desc,
71 OBJH * handler,
72 int pw_req_flag, int atomic);
73 void registerProfile(char const * action, char const * desc,
74 Mgr::ClassActionCreationHandler *handler,
75 int pw_req_flag, int atomic);
76 Mgr::ActionProfilePointer findAction(char const * action) const;
77 Mgr::Action::Pointer createNamedAction(const char *actionName);
78 Mgr::Action::Pointer createRequestedAction(const Mgr::ActionParams &);
79 const Menu& menu() const { return menu_; }
80
81 void Start(const Comm::ConnectionPointer &client, HttpRequest * request, StoreEntry * entry);
82
83 static CacheManager* GetInstance();
84 const char *ActionProtection(const Mgr::ActionProfilePointer &profile);
85
86 protected:
87 CacheManager() {} ///< use Instance() instead
88
89 Mgr::CommandPointer ParseUrl(const char *url);
90 void ParseHeaders(const HttpRequest * request, Mgr::ActionParams &params);
91 int CheckPassword(const Mgr::Command &cmd);
92 char *PasswdGet(Mgr::ActionPasswordList *, const char *);
93
94 void registerProfile(const Mgr::ActionProfilePointer &profile);
95
96 Menu menu_;
97
98 private:
99 static CacheManager* instance;
100 };
101
102 #endif /* SQUID_CACHEMANAGER_H */