5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
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.
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.
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.
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.
32 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
54 void *operator new(size_t);
55 void operator delete(void *);
57 static ACL
*Factory (char const *);
58 static void ParseAclLine(ConfigParser
&parser
, ACL
** head
);
59 static void Initialize();
60 static ACL
* FindByName(const char *name
);
64 virtual ACL
*clone()const = 0;
65 virtual void parse() = 0;
66 virtual char const *typeString() const = 0;
67 virtual bool isProxyAuth() const;
68 virtual bool requiresRequest() const;
69 virtual bool requiresReply() const;
70 virtual int match(ACLChecklist
* checklist
) = 0;
71 virtual wordlist
*dump() const = 0;
72 virtual bool empty () const = 0;
73 virtual bool valid () const;
74 int checklistMatches(ACLChecklist
*);
76 int cacheMatchAcl(dlink_list
* cache
, ACLChecklist
*);
77 virtual int matchForCache(ACLChecklist
*checklist
);
79 virtual void prepareForUse() {}
81 char name
[ACL_NAME_SZ
];
92 Prototype (ACL
const *, char const *);
94 static bool Registered(char const *);
95 static ACL
*Factory (char const *);
99 char const *typeString
;
102 static Vector
<Prototype
const *> * Registry
;
103 static void *Initialized
;
104 typedef Vector
<Prototype
const*>::iterator iterator
;
105 typedef Vector
<Prototype
const*>::const_iterator const_iterator
;
112 // Authorization ACL result states
117 // Authentication ACL result states
118 ACCESS_AUTH_REQUIRED
, // Missing Credentials
119 ACCESS_AUTH_EXPIRED_OK
, // Expired now. Were Okay.
120 ACCESS_AUTH_EXPIRED_BAD
// Expired now. Were Failed.
124 /// ACL check answer; TODO: Rename to Acl::Answer
127 // not explicit: allow "aclMatchCode to allow_t" conversions (for now)
128 allow_t(const aclMatchCode aCode
): code(aCode
), kind(0) {}
130 allow_t(): code(ACCESS_DUNNO
), kind(0) {}
132 bool operator ==(const aclMatchCode aCode
) const {
133 return code
== aCode
;
136 bool operator !=(const aclMatchCode aCode
) const {
137 return !(*this == aCode
);
140 operator aclMatchCode() const {
144 aclMatchCode code
; ///< ACCESS_* code
145 int kind
; ///< which custom access list verb matched
149 inline std::ostream
&
150 operator <<(std::ostream
&o
, const allow_t a
)
162 case ACCESS_AUTH_REQUIRED
:
163 o
<< "AUTH_REQUIRED";
165 case ACCESS_AUTH_EXPIRED_OK
:
166 o
<< "AUTH_EXPIRED_OK";
168 case ACCESS_AUTH_EXPIRED_BAD
:
169 o
<< "AUTH_EXPIRED_BAD";
180 void *operator new(size_t);
181 void operator delete(void *);
188 CBDATA_CLASS(acl_access
);
196 MEMPROXY_CLASS(ACLList
);
199 void negated(bool isNegated
);
200 bool matches (ACLChecklist
*)const;
206 MEMPROXY_CLASS_INLINE(ACLList
);
209 class acl_proxy_auth_match_cache
213 MEMPROXY_CLASS(acl_proxy_auth_match_cache
);
219 MEMPROXY_CLASS_INLINE(acl_proxy_auth_match_cache
);
223 extern const char *AclMatchedName
; /* NULL */
225 #endif /* SQUID_ACL_H */