]> 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 #include "auth/UserRequest.h"
6
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 Ip::Address src_addr;
47 Ip::Address dst_addr;
48 Ip::Address my_addr;
49 struct peer *dst_peer;
50 char *dst_rdns;
51
52 HttpRequest *request;
53 HttpReply *reply;
54
55 char rfc931[USER_IDENT_SZ];
56 AuthUserRequest::Pointer auth_user_request;
57
58 #if SQUID_SNMP
59 char *snmp_community;
60 #endif
61
62 #if USE_SSL
63 int ssl_error;
64 #endif
65
66 ExternalACLEntry *extacl_entry;
67
68 private:
69 virtual void checkCallback(allow_t answer);
70
71 private:
72 CBDATA_CLASS(ACLFilledChecklist);
73
74 ConnStateData * conn_; /**< hack for ident and NTLM */
75 int fd_; /**< may be available when conn_ is not */
76 bool destinationDomainChecked_;
77 bool sourceDomainChecked_;
78
79 private:
80 /// not implemented; will cause link failures if used
81 ACLFilledChecklist(const ACLFilledChecklist &);
82 /// not implemented; will cause link failures if used
83 ACLFilledChecklist &operator=(const ACLFilledChecklist &);
84 };
85
86 /// convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
87 inline
88 ACLFilledChecklist *Filled(ACLChecklist *checklist)
89 {
90 // this should always be safe because ACLChecklist is an abstract class
91 // and ACLFilledChecklist is its only [concrete] child
92 return dynamic_cast<ACLFilledChecklist*>(checklist);
93 }
94
95 #endif /* SQUID_ACLFILLED_CHECKLIST_H */