3 * SQUID Web Proxy Cache http://www.squid-cache.org/
4 * ----------------------------------------------------------
6 * Squid is the result of efforts by numerous individuals from
7 * the Internet community; see the CONTRIBUTORS file for full
8 * details. Many organizations have provided support for Squid's
9 * development; see the SPONSORS file for full details. Squid is
10 * Copyrighted (C) 2001 by the Regents of the University of
11 * California; see the COPYRIGHT file for full details. Squid
12 * incorporates software developed and/or copyrighted by other
13 * sources; see the CREDITS file for full details.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
30 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
55 void *operator new(size_t);
56 void operator delete(void *);
58 static ACL
*Factory (char const *);
59 static void ParseAclLine(ConfigParser
&parser
, ACL
** head
);
60 static void Initialize();
61 static ACL
* FindByName(const char *name
);
65 virtual ACL
*clone()const = 0;
66 virtual void parse() = 0;
67 virtual char const *typeString() const = 0;
68 virtual bool isProxyAuth() const;
69 virtual bool requiresRequest() const;
70 virtual bool requiresReply() const;
71 virtual int match(ACLChecklist
* checklist
) = 0;
72 virtual wordlist
*dump() const = 0;
73 virtual bool empty () const = 0;
74 virtual bool valid () const;
75 int checklistMatches(ACLChecklist
*);
77 int cacheMatchAcl(dlink_list
* cache
, ACLChecklist
*);
78 virtual int matchForCache(ACLChecklist
*checklist
);
80 virtual void prepareForUse() {}
82 char name
[ACL_NAME_SZ
];
93 Prototype (ACL
const *, char const *);
95 static bool Registered(char const *);
96 static ACL
*Factory (char const *);
100 char const *typeString
;
103 static Vector
<Prototype
const *> * Registry
;
104 static void *Initialized
;
105 typedef Vector
<Prototype
const*>::iterator iterator
;
106 typedef Vector
<Prototype
const*>::const_iterator const_iterator
;
113 // Authorization ACL result states
118 // Authentication ACL result states
119 ACCESS_AUTH_REQUIRED
, // Missing Credentials
123 /// 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
148 inline std::ostream
&
149 operator <<(std::ostream
&o
, const allow_t a
)
161 case ACCESS_AUTH_REQUIRED
:
162 o
<< "AUTH_REQUIRED";
173 void *operator new(size_t);
174 void operator delete(void *);
181 CBDATA_CLASS(acl_access
);
189 MEMPROXY_CLASS(ACLList
);
192 void negated(bool isNegated
);
193 bool matches (ACLChecklist
*)const;
199 MEMPROXY_CLASS_INLINE(ACLList
);
202 class acl_proxy_auth_match_cache
206 MEMPROXY_CLASS(acl_proxy_auth_match_cache
);
212 MEMPROXY_CLASS_INLINE(acl_proxy_auth_match_cache
);
215 extern const char *AclMatchedName
; /* NULL */
217 #endif /* SQUID_ACL_H */