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