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