]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ExternalACL.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / ExternalACL.h
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_EXTERNALACL_H
10 #define SQUID_EXTERNALACL_H
11
12 #include "acl/Checklist.h"
13 #include "base/RefCount.h"
14
15 class external_acl;
16 class external_acl_data;
17 class StoreEntry;
18
19 class ExternalACLLookup : public ACLChecklist::AsyncState
20 {
21
22 public:
23 static ExternalACLLookup *Instance();
24 virtual void checkForAsync(ACLChecklist *)const;
25
26 // If possible, starts an asynchronous lookup of an external ACL.
27 // Otherwise, asserts (or bails if background refresh is requested).
28 static void Start(ACLChecklist *checklist, external_acl_data *acl, bool bg);
29
30 private:
31 static ExternalACLLookup instance_;
32 static void LookupDone(void *data, const ExternalACLEntryPointer &result);
33 };
34
35 #include "acl/Acl.h"
36
37 class ACLExternal : public ACL
38 {
39 MEMPROXY_CLASS(ACLExternal);
40
41 public:
42 static void ExternalAclLookup(ACLChecklist * ch, ACLExternal *);
43
44 ACLExternal(char const *);
45 ACLExternal(ACLExternal const &);
46 ~ACLExternal();
47 ACLExternal&operator=(ACLExternal const &);
48
49 virtual ACL *clone()const;
50 virtual char const *typeString() const;
51 virtual void parse();
52 virtual int match(ACLChecklist *checklist);
53 /* This really should be dynamic based on the external class defn */
54 virtual bool requiresAle() const {return true;}
55 virtual bool requiresRequest() const {return true;}
56
57 /* when requiresRequest is made dynamic, review this too */
58 // virtual bool requiresReply() const {return true;}
59 virtual bool isProxyAuth() const;
60 virtual SBufList dump() const;
61 virtual bool valid () const;
62 virtual bool empty () const;
63
64 protected:
65 external_acl_data *data;
66 char const *class_;
67 };
68
69 void parse_externalAclHelper(external_acl **);
70 void dump_externalAclHelper(StoreEntry * sentry, const char *name, const external_acl *);
71 void free_externalAclHelper(external_acl **);
72 typedef void EAH(void *data, const ExternalACLEntryPointer &result);
73 void externalAclLookup(ACLChecklist * ch, void *acl_data, EAH * handler, void *data);
74 void externalAclInit(void);
75 void externalAclShutdown(void);
76
77 #endif /* SQUID_EXTERNALACL_H */
78