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