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