]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ACL.h
Summary: Ran astyle over src subtree.
[thirdparty/squid.git] / src / ACL.h
1
2 /*
3 * $Id: ACL.h,v 1.7 2003/02/21 22:50:04 robertc Exp $
4 *
5 *
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
8 *
9 * Squid is the result of efforts by numerous individuals from
10 * the Internet community; see the CONTRIBUTORS file for full
11 * details. Many organizations have provided support for Squid's
12 * development; see the SPONSORS file for full details. Squid is
13 * Copyrighted (C) 2001 by the Regents of the University of
14 * California; see the COPYRIGHT file for full details. Squid
15 * incorporates software developed and/or copyrighted by other
16 * sources; see the CREDITS file for full details.
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
31 *
32 *
33 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
34 */
35
36 #ifndef SQUID_ACL_H
37 #define SQUID_ACL_H
38 #include "Array.h"
39
40 /* acl.c */
41 SQUIDCEXTERN int aclMatchAclList(const acl_list * list, ACLChecklist * checklist);
42 SQUIDCEXTERN void aclDestroyAccessList(acl_access **list);
43 SQUIDCEXTERN void aclDestroyAcls(acl **);
44 SQUIDCEXTERN void aclDestroyAclList(acl_list **);
45 SQUIDCEXTERN void aclParseAccessLine(acl_access **);
46 SQUIDCEXTERN void aclParseAclList(acl_list **);
47 SQUIDCEXTERN int aclIsProxyAuth(const char *name);
48 SQUIDCEXTERN err_type aclGetDenyInfoPage(acl_deny_info_list ** head, const char *name);
49
50 SQUIDCEXTERN void aclParseDenyInfoLine(struct _acl_deny_info_list **);
51
52 SQUIDCEXTERN void aclDestroyDenyInfoList(struct _acl_deny_info_list **);
53
54 SQUIDCEXTERN void aclDestroyRegexList(struct _relist *data);
55 SQUIDCEXTERN int aclMatchRegex(relist * data, const char *word);
56 wordlist *aclDumpRegexList(relist * data);
57 SQUIDCEXTERN void aclParseRegexList(void *curlist);
58 SQUIDCEXTERN wordlist *aclDumpGeneric(const acl *);
59 SQUIDCEXTERN int aclPurgeMethodInUse(acl_access *);
60 SQUIDCEXTERN void aclCacheMatchFlush(dlink_list * cache);
61 extern void dump_acl_access(StoreEntry * entry, const char *name, acl_access * head);
62
63 class ACL
64 {
65
66 public:
67 void *operator new(size_t);
68 void operator delete(void *);
69 virtual void deleteSelf() const;
70
71 static ACL *Factory (char const *);
72 static void ParseAclLine(acl ** head);
73 static ACL* FindByName(const char *name);
74
75 /* temporary until we subclass external acl's */
76 static void ExternalAclLookup(ACLChecklist * ch, ACL *, EAH * callback, void *callback_data);
77
78 ACL();
79 ACL (squid_acl const);
80 virtual ~ACL();
81 virtual ACL *clone()const;
82 virtual void parse();
83 virtual char const *typeString() const;
84 virtual squid_acl aclType() const { return type;}
85
86 virtual bool isProxyAuth() const;
87 virtual bool requiresRequest() const;
88 virtual int match(ACLChecklist * checklist);
89 virtual wordlist *dumpGeneric() const;
90 virtual wordlist *dump() const;
91 virtual bool valid () const;
92 int checklistMatches(ACLChecklist *);
93
94 /* only relevant to METHOD acl's */
95 virtual bool containsPURGE() const;
96
97 /* only relecant to ASN acl's */
98 void startCache();
99
100 int cacheMatchAcl(dlink_list * cache, ACLChecklist *);
101 virtual int matchForCache(ACLChecklist *checklist);
102
103 char name[ACL_NAME_SZ];
104 char *cfgline;
105 ACL *next;
106
107 private:
108 static MemPool *Pool;
109 squid_acl type;
110
111 protected:
112 void *data;
113
114 public:
115
116 class Prototype
117 {
118
119 public:
120 Prototype ();
121 Prototype (ACL const *, char const *);
122 ~Prototype();
123 static bool Registered(char const *);
124 static ACL *Factory (char const *);
125
126 private:
127 ACL const*prototype;
128 char const *typeString;
129
130 private:
131 static Vector<Prototype const *> * Registry;
132 static void *Initialized;
133 typedef Vector<Prototype const*>::iterator iterator;
134 typedef Vector<Prototype const*>::const_iterator const_iterator;
135 void registerMe();
136 };
137 };
138
139 class acl_access
140 {
141
142 public:
143 void *operator new(size_t);
144 void operator delete(void *);
145 virtual void deleteSelf() const;
146 bool containsPURGE() const;
147 allow_t allow;
148 acl_list *aclList;
149 char *cfgline;
150 acl_access *next;
151
152 private:
153 CBDATA_CLASS(acl_access);
154 };
155
156 class ACLList
157 {
158
159 public:
160 void *operator new(size_t);
161 void operator delete(void *);
162 virtual void deleteSelf() const;
163
164 ACLList();
165 void negated(bool isNegated);
166 bool matches (ACLChecklist *)const;
167 int op;
168 acl *_acl;
169 ACLList *next;
170
171 private:
172 static MemPool *Pool;
173 };
174
175 typedef ACLList acl_list;
176 #endif /* SQUID_ACL_H */