]>
Commit | Line | Data |
---|---|---|
b67e2c8c | 1 | /* |
262a0e14 | 2 | * $Id$ |
b67e2c8c | 3 | * |
4 | * | |
5 | * SQUID Web Proxy Cache http://www.squid-cache.org/ | |
6 | * ---------------------------------------------------------- | |
7 | * | |
8 | * Squid is the result of efforts by numerous individuals from | |
9 | * the Internet community; see the CONTRIBUTORS file for full | |
10 | * details. Many organizations have provided support for Squid's | |
11 | * development; see the SPONSORS file for full details. Squid is | |
12 | * Copyrighted (C) 2001 by the Regents of the University of | |
13 | * California; see the COPYRIGHT file for full details. Squid | |
14 | * incorporates software developed and/or copyrighted by other | |
15 | * sources; see the CREDITS file for full details. | |
16 | * | |
17 | * This program is free software; you can redistribute it and/or modify | |
18 | * it under the terms of the GNU General Public License as published by | |
19 | * the Free Software Foundation; either version 2 of the License, or | |
20 | * (at your option) any later version. | |
26ac0430 | 21 | * |
b67e2c8c | 22 | * This program is distributed in the hope that it will be useful, |
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | * GNU General Public License for more details. | |
26ac0430 | 26 | * |
b67e2c8c | 27 | * You should have received a copy of the GNU General Public License |
28 | * along with this program; if not, write to the Free Software | |
29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
30 | * | |
31 | * | |
32 | * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org> | |
33 | */ | |
34 | ||
35 | #ifndef SQUID_ACL_H | |
36 | #define SQUID_ACL_H | |
63be0a78 | 37 | |
8000a965 | 38 | #include "Array.h" |
aa839030 | 39 | #include "cbdata.h" |
25b6a907 | 40 | #include "dlink.h" |
63be0a78 | 41 | /** |
42 | \todo FIXME: finish splitting out the dependencies here | |
43 | * - typedefs should not be needed to parse this. | |
25b6a907 | 44 | */ |
45 | #include "typedefs.h" | |
29b17d63 | 46 | |
a9f20260 | 47 | class ConfigParser; |
48 | ||
8000a965 | 49 | /* acl.c */ |
63be0a78 | 50 | |
51 | /// \ingroup ACLAPI | |
8000a965 | 52 | SQUIDCEXTERN void aclDestroyAccessList(acl_access **list); |
63be0a78 | 53 | /// \ingroup ACLAPI |
97427e90 | 54 | SQUIDCEXTERN void aclDestroyAcls(ACL **); |
63be0a78 | 55 | /// \ingroup ACLAPI |
76cd39d7 | 56 | SQUIDCEXTERN void aclDestroyAclList(ACLList **); |
63be0a78 | 57 | /// \ingroup ACLAPI |
a9f20260 | 58 | SQUIDCEXTERN void aclParseAccessLine(ConfigParser &parser, acl_access **); |
63be0a78 | 59 | /// \ingroup ACLAPI |
76cd39d7 | 60 | SQUIDCEXTERN void aclParseAclList(ConfigParser &parser, ACLList **); |
63be0a78 | 61 | /// \ingroup ACLAPI |
8000a965 | 62 | SQUIDCEXTERN int aclIsProxyAuth(const char *name); |
63be0a78 | 63 | /// \ingroup ACLAPI |
9ce7856a | 64 | SQUIDCEXTERN err_type aclGetDenyInfoPage(acl_deny_info_list ** head, const char *name, int redirect_allowed); |
62e76326 | 65 | |
63be0a78 | 66 | /// \ingroup ACLAPI |
e1f7507e | 67 | SQUIDCEXTERN void aclParseDenyInfoLine(struct acl_deny_info_list **); |
62e76326 | 68 | |
63be0a78 | 69 | /// \ingroup ACLAPI |
e1f7507e | 70 | SQUIDCEXTERN void aclDestroyDenyInfoList(struct acl_deny_info_list **); |
63be0a78 | 71 | /// \ingroup ACLAPI |
97427e90 | 72 | SQUIDCEXTERN wordlist *aclDumpGeneric(const ACL *); |
63be0a78 | 73 | /// \ingroup ACLAPI |
8000a965 | 74 | SQUIDCEXTERN void aclCacheMatchFlush(dlink_list * cache); |
63be0a78 | 75 | /// \ingroup ACLAPI |
225b7b10 | 76 | extern void dump_acl_access(StoreEntry * entry, const char *name, acl_access * head); |
63be0a78 | 77 | /// \ingroup ACLAPI |
b0dd28ba | 78 | int aclPurgeMethodInUse(acl_access * a); |
63be0a78 | 79 | /// \ingroup ACLAPI |
b0dd28ba | 80 | extern const char *AclMatchedName; /* NULL */ |
8000a965 | 81 | |
63be0a78 | 82 | /// \ingroup ACLAPI |
62e76326 | 83 | class ACL |
84 | { | |
85 | ||
86 | public: | |
29b17d63 | 87 | void *operator new(size_t); |
88 | void operator delete(void *); | |
8000a965 | 89 | |
90 | static ACL *Factory (char const *); | |
a9f20260 | 91 | static void ParseAclLine(ConfigParser &parser, ACL ** head); |
b0dd28ba | 92 | static void Initialize(); |
225b7b10 | 93 | static ACL* FindByName(const char *name); |
94 | ||
8000a965 | 95 | ACL(); |
8000a965 | 96 | virtual ~ACL(); |
b0dd28ba | 97 | virtual ACL *clone()const = 0; |
98 | virtual void parse() = 0; | |
99 | virtual char const *typeString() const = 0; | |
8000a965 | 100 | virtual bool isProxyAuth() const; |
101 | virtual bool requiresRequest() const; | |
b0dd28ba | 102 | virtual bool requiresReply() const; |
103 | virtual int match(ACLChecklist * checklist) = 0; | |
b0dd28ba | 104 | virtual wordlist *dump() const = 0; |
4b0f5de8 | 105 | virtual bool empty () const = 0; |
106 | virtual bool valid () const; | |
8000a965 | 107 | int checklistMatches(ACLChecklist *); |
62e76326 | 108 | |
225b7b10 | 109 | int cacheMatchAcl(dlink_list * cache, ACLChecklist *); |
110 | virtual int matchForCache(ACLChecklist *checklist); | |
8000a965 | 111 | |
b0dd28ba | 112 | virtual void prepareForUse() {} |
113 | ||
8000a965 | 114 | char name[ACL_NAME_SZ]; |
115 | char *cfgline; | |
116 | ACL *next; | |
62e76326 | 117 | |
62e76326 | 118 | public: |
119 | ||
120 | class Prototype | |
121 | { | |
122 | ||
123 | public: | |
124 | Prototype (); | |
125 | Prototype (ACL const *, char const *); | |
126 | ~Prototype(); | |
127 | static bool Registered(char const *); | |
128 | static ACL *Factory (char const *); | |
129 | ||
130 | private: | |
131 | ACL const*prototype; | |
132 | char const *typeString; | |
133 | ||
134 | private: | |
135 | static Vector<Prototype const *> * Registry; | |
136 | static void *Initialized; | |
137 | typedef Vector<Prototype const*>::iterator iterator; | |
138 | typedef Vector<Prototype const*>::const_iterator const_iterator; | |
139 | void registerMe(); | |
8000a965 | 140 | }; |
29b17d63 | 141 | }; |
142 | ||
63be0a78 | 143 | /// \ingroup ACLAPI |
62e76326 | 144 | class acl_access |
145 | { | |
146 | ||
147 | public: | |
8000a965 | 148 | void *operator new(size_t); |
149 | void operator delete(void *); | |
8000a965 | 150 | bool containsPURGE() const; |
151 | allow_t allow; | |
76cd39d7 | 152 | ACLList *aclList; |
8000a965 | 153 | char *cfgline; |
154 | acl_access *next; | |
62e76326 | 155 | |
156 | private: | |
8000a965 | 157 | CBDATA_CLASS(acl_access); |
158 | }; | |
159 | ||
63be0a78 | 160 | /// \ingroup ACLAPI |
62e76326 | 161 | class ACLList |
162 | { | |
163 | ||
164 | public: | |
b001e822 | 165 | MEMPROXY_CLASS(ACLList); |
8000a965 | 166 | |
167 | ACLList(); | |
168 | void negated(bool isNegated); | |
169 | bool matches (ACLChecklist *)const; | |
170 | int op; | |
97427e90 | 171 | ACL *_acl; |
8000a965 | 172 | ACLList *next; |
8000a965 | 173 | }; |
b67e2c8c | 174 | |
63be0a78 | 175 | MEMPROXY_CLASS_INLINE(ACLList); |
b001e822 | 176 | |
63be0a78 | 177 | /// \ingroup ACLAPI |
25b6a907 | 178 | class acl_proxy_auth_match_cache |
179 | { | |
180 | ||
181 | public: | |
182 | MEMPROXY_CLASS(acl_proxy_auth_match_cache); | |
183 | dlink_node link; | |
184 | int matchrv; | |
185 | void *acl_data; | |
186 | }; | |
187 | ||
188 | MEMPROXY_CLASS_INLINE(acl_proxy_auth_match_cache); | |
189 | ||
b67e2c8c | 190 | #endif /* SQUID_ACL_H */ |