]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/FilledChecklist.h
Polish: convert ACLFilledChecklist to CBDATA_CLASS2
[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 ACLFilledChecklist();
26 ACLFilledChecklist(const acl_access *, HttpRequest *, const char *ident);
27 ~ACLFilledChecklist();
28
29 public:
30 /// The client connection manager
31 ConnStateData * conn() const;
32
33 /// The client side fd. It uses conn() if available
34 int fd() const;
35
36 /// set either conn
37 void conn(ConnStateData *);
38 /// set the client side 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 /// The peer certificate
74 Ssl::X509_Pointer serverCert;
75 #endif
76
77 ExternalACLEntry *extacl_entry;
78
79 private:
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 /// not implemented; will cause link failures if used
85 ACLFilledChecklist(const ACLFilledChecklist &);
86 /// not implemented; will cause link failures if used
87 ACLFilledChecklist &operator=(const ACLFilledChecklist &);
88
89 CBDATA_CLASS2(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 */