]>
Commit | Line | Data |
---|---|---|
62ee09ca | 1 | |
2 | /* | |
62ee09ca | 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. | |
26ac0430 | 20 | * |
62ee09ca | 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. | |
26ac0430 | 25 | * |
62ee09ca | 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 | ||
5c336a3b | 35 | #include "comm/forward.h" |
8822ebee AR |
36 | #include "mgr/Action.h" |
37 | #include "mgr/ActionProfile.h" | |
38 | #include "mgr/Command.h" | |
39 | #include "mgr/forward.h" | |
40 | #include <vector> | |
62ee09ca | 41 | |
63be0a78 | 42 | /** |
43 | \defgroup CacheManagerAPI Cache Manager API | |
44 | \ingroup Components | |
af6a12ee | 45 | * |
d154d3ec FC |
46 | \defgroup CacheManagerInternal Cache Manager intenal API (not for public use) |
47 | \ingroup CacheManagerAPI | |
63be0a78 | 48 | */ |
62ee09ca | 49 | |
582c2af2 | 50 | class HttpRequest; |
63be0a78 | 51 | /** |
52 | \ingroup CacheManagerAPI | |
62ee09ca | 53 | * a CacheManager - the menu system for interacting with squid. |
54 | * This is currently just an adapter to the global cachemgr* routines to | |
55 | * provide looser coupling between modules, but once fully transitioned, | |
56 | * an instance of this class will represent a single independent manager. | |
c83f0bd5 | 57 | * TODO: update documentation to reflect the new singleton model. |
62ee09ca | 58 | */ |
62ee09ca | 59 | class CacheManager |
60 | { | |
62ee09ca | 61 | public: |
8822ebee AR |
62 | typedef std::vector<Mgr::ActionProfilePointer> Menu; |
63 | ||
64 | void registerProfile(char const * action, char const * desc, | |
d9fc6862 A |
65 | OBJH * handler, |
66 | int pw_req_flag, int atomic); | |
8822ebee | 67 | void registerProfile(char const * action, char const * desc, |
d9fc6862 A |
68 | Mgr::ClassActionCreationHandler *handler, |
69 | int pw_req_flag, int atomic); | |
8822ebee AR |
70 | Mgr::ActionProfilePointer findAction(char const * action) const; |
71 | Mgr::Action::Pointer createNamedAction(const char *actionName); | |
72 | Mgr::Action::Pointer createRequestedAction(const Mgr::ActionParams &); | |
73 | const Menu& menu() const { return menu_; } | |
c83f0bd5 | 74 | |
5c336a3b | 75 | void Start(const Comm::ConnectionPointer &client, HttpRequest * request, StoreEntry * entry); |
c83f0bd5 K |
76 | |
77 | static CacheManager* GetInstance(); | |
8822ebee | 78 | const char *ActionProtection(const Mgr::ActionProfilePointer &profile); |
c83f0bd5 K |
79 | |
80 | protected: | |
8822ebee | 81 | CacheManager() {} ///< use Instance() instead |
4b2aa1b4 | 82 | |
8822ebee AR |
83 | Mgr::CommandPointer ParseUrl(const char *url); |
84 | void ParseHeaders(const HttpRequest * request, Mgr::ActionParams ¶ms); | |
85 | int CheckPassword(const Mgr::Command &cmd); | |
bdaaf1a1 | 86 | char *PasswdGet(cachemgr_passwd *, const char *); |
4b2aa1b4 | 87 | |
8822ebee | 88 | void registerProfile(const Mgr::ActionProfilePointer &profile); |
afea465e | 89 | |
8822ebee | 90 | Menu menu_; |
afea465e | 91 | |
c83f0bd5 K |
92 | private: |
93 | static CacheManager* instance; | |
62ee09ca | 94 | }; |
95 | ||
96 | #endif /* SQUID_CACHEMANAGER_H */ |