]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/FilledChecklist.h
Merged from trunk (r12065, v3.2.0.15+).
[thirdparty/squid.git] / src / acl / FilledChecklist.h
1 #ifndef SQUID_ACLFILLED_CHECKLIST_H
2 #define SQUID_ACLFILLED_CHECKLIST_H
3
4 #include "acl/Checklist.h"
5 #if USE_AUTH
6 #include "auth/UserRequest.h"
7 #endif
8 #if USE_SSL
9 #include "ssl/support.h"
10 #endif
11
12 class ExternalACLEntry;
13 class ConnStateData;
14
15 /** \ingroup ACLAPI
16 ACLChecklist filled with specific data, representing Squid and transaction
17 state for access checks along with some data-specific checking methods */
18 class ACLFilledChecklist: public ACLChecklist
19 {
20 public:
21 void *operator new(size_t);
22 void operator delete(void *);
23
24 ACLFilledChecklist();
25 ACLFilledChecklist(const acl_access *, HttpRequest *, const char *ident);
26 ~ACLFilledChecklist();
27
28 public:
29 ConnStateData * conn() const;
30
31 /// uses conn() if available
32 int fd() const;
33
34 /// set either conn
35 void conn(ConnStateData *);
36 /// set FD
37 void fd(int aDescriptor);
38
39 //int authenticated();
40
41 bool destinationDomainChecked() const;
42 void markDestinationDomainChecked();
43 bool sourceDomainChecked() const;
44 void markSourceDomainChecked();
45
46 // ACLChecklist API
47 virtual bool hasRequest() const { return request != NULL; }
48 virtual bool hasReply() const { return reply != NULL; }
49
50 public:
51 Ip::Address src_addr;
52 Ip::Address dst_addr;
53 Ip::Address my_addr;
54 struct peer *dst_peer;
55 char *dst_rdns;
56
57 HttpRequest *request;
58 HttpReply *reply;
59
60 char rfc931[USER_IDENT_SZ];
61 #if USE_AUTH
62 Auth::UserRequest::Pointer auth_user_request;
63 #endif
64 #if SQUID_SNMP
65 char *snmp_community;
66 #endif
67
68 #if USE_SSL
69 Ssl::Errors *sslErrorList;
70 #endif
71
72 ExternalACLEntry *extacl_entry;
73
74 private:
75 virtual void checkCallback(allow_t answer);
76
77 private:
78 CBDATA_CLASS(ACLFilledChecklist);
79
80 ConnStateData * conn_; /**< hack for ident and NTLM */
81 int fd_; /**< may be available when conn_ is not */
82 bool destinationDomainChecked_;
83 bool sourceDomainChecked_;
84
85 private:
86 /// not implemented; will cause link failures if used
87 ACLFilledChecklist(const ACLFilledChecklist &);
88 /// not implemented; will cause link failures if used
89 ACLFilledChecklist &operator=(const ACLFilledChecklist &);
90 };
91
92 /// convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
93 inline
94 ACLFilledChecklist *Filled(ACLChecklist *checklist)
95 {
96 // this should always be safe because ACLChecklist is an abstract class
97 // and ACLFilledChecklist is its only [concrete] child
98 return dynamic_cast<ACLFilledChecklist*>(checklist);
99 }
100
101 #endif /* SQUID_ACLFILLED_CHECKLIST_H */