ICP.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_ICP_H
10 #define SQUID_ICP_H
11 
17 #include "base/RefCount.h"
18 #include "comm/forward.h"
19 #include "icp_opcode.h"
20 #include "ip/Address.h"
21 #include "LogTags.h"
22 #include "store_key_md5.h"
23 #include "StoreClient.h"
24 
25 class AccessLogEntry;
27 
29 
35 class icp_common_t {
36 public:
38  unsigned char opcode;
40  unsigned char version;
42  unsigned short length;
44  uint32_t reqnum;
45  uint32_t flags;
46  uint32_t pad;
48  uint32_t shostid;
49 
50  icp_common_t();
51  icp_common_t(char *buf, unsigned int len);
52 
53  void handleReply(char *buf, Ip::Address &from);
54  icp_opcode getOpCode() const;
55 
57  static icp_common_t *CreateMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad);
58 };
59 
60 // TODO: mempool this
61 class ICPState: public StoreClient
62 {
63 
64 public:
65  ICPState(icp_common_t &aHeader, HttpRequest *aRequest);
66  virtual ~ICPState();
67 
69  bool isHit() const;
70 
73  int fd;
74 
76  char *url;
78 
79 protected:
80  /* StoreClient API */
81  virtual LogTags *loggingTags() const override;
82  virtual void fillChecklist(ACLFilledChecklist &) const override;
83 
85  bool confirmAndPrepHit(const StoreEntry &) const;
86 };
87 
91 
93 HttpRequest* icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from);
94 
96 bool icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request);
97 
99 void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from, AccessLogEntryPointer);
100 
103 
105 void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd);
106 
109 
111 void icpHandleIcpV3(int, Ip::Address &, char *, int);
112 
114 void icpOpenPorts(void);
115 
117 void icpConnectionShutdown(void);
118 
120 void icpClosePorts(void);
121 
123 int icpSetCacheKey(const cache_key * key);
124 
126 const cache_key *icpGetCacheKey(const char *url, int reqnum);
127 
128 #endif /* SQUID_ICP_H */
129 
AccessLogEntryPointer al
Definition: ICP.h:77
void icpHandleIcpV3(int, Ip::Address &, char *, int)
Definition: icp_v3.cc:71
bool icpAccessAllowed(Ip::Address &from, HttpRequest *icp_request)
Definition: icp_v2.cc:447
char * url
Definition: ICP.h:76
uint32_t reqnum
Definition: ICP.h:44
icp_common_t header
Definition: ICP.h:71
unsigned char cache_key
Store key.
Definition: forward.h:29
virtual LogTags * loggingTags() const override
Definition: icp_v2.cc:186
void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd)
Definition: icp_v2.cc:431
int fd
Definition: ICP.h:73
ICPState(icp_common_t &aHeader, HttpRequest *aRequest)
Definition: icp_v2.cc:142
Comm::ConnectionPointer icpOutgoingConn
Definition: icp_v2.cc:104
void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from, AccessLogEntryPointer)
Definition: icp_v2.cc:421
RefCount< AccessLogEntry > AccessLogEntryPointer
Definition: ICP.h:26
HttpRequest * request
Definition: ICP.h:72
unsigned short length
Definition: ICP.h:42
HttpRequest * icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from)
Definition: icp_v2.cc:469
a storeGetPublic*() caller
Definition: StoreClient.h:24
uint32_t shostid
Definition: ICP.h:48
unsigned char opcode
Definition: ICP.h:38
Ip::Address from
Definition: ICP.h:75
PF icpHandleUdp
Definition: ICP.h:108
icp_opcode icpGetCommonOpcode()
Definition: icp_v2.cc:379
virtual ~ICPState()
Definition: icp_v2.cc:151
bool isHit() const
whether the cache contains the requested entry
Definition: icp_v2.cc:158
const cache_key * icpGetCacheKey(const char *url, int reqnum)
Definition: icp_v2.cc:887
void icpConnectionShutdown(void)
Definition: icp_v2.cc:792
virtual void fillChecklist(ACLFilledChecklist &) const override
configure the ACL checklist with the current transaction state
Definition: icp_v2.cc:195
icp_opcode getOpCode() const
Definition: icp_v2.cc:132
Comm::ConnectionPointer icpIncomingConn
Definition: icp_v2.cc:102
unsigned char version
Definition: ICP.h:40
void icpOpenPorts(void)
Definition: icp_v2.cc:709
uint32_t pad
Definition: ICP.h:46
Ip::Address theIcpPublicHostID
Definition: stub_icp.cc:30
void icpClosePorts(void)
Definition: icp_v2.cc:817
void handleReply(char *buf, Ip::Address &from)
Definition: icp_v2.cc:552
icp_common_t()
Definition: icp_v2.cc:107
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
static icp_common_t * CreateMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad)
Definition: icp_v2.cc:274
uint32_t flags
Definition: ICP.h:45
icp_opcode
Definition: icp_opcode.h:13
Definition: ICP.h:61
int icpSetCacheKey(const cache_key *key)
Definition: icp_v2.cc:874
void const char * buf
Definition: stub_helper.cc:16
void PF(int, void *)
Definition: forward.h:18
bool confirmAndPrepHit(const StoreEntry &) const
either confirms and starts processing a cache hit or returns false
Definition: icp_v2.cc:171

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors