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