ICP.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_SRC_ICP_H
10 #define SQUID_SRC_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  ~ICPState() override;
67 
69  bool isHit() const;
70 
73  int fd;
74 
76  char *url;
78 
79 protected:
80  /* StoreClient API */
81  LogTags *loggingTags() const override;
82  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_SRC_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:442
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
LogTags * loggingTags() const override
Definition: icp_v2.cc:183
void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd)
Definition: icp_v2.cc:428
int fd
Definition: ICP.h:73
ICPState(icp_common_t &aHeader, HttpRequest *aRequest)
Definition: icp_v2.cc:139
Comm::ConnectionPointer icpOutgoingConn
Definition: icp_v2.cc:101
~ICPState() override
Definition: icp_v2.cc:148
void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from, AccessLogEntryPointer)
Definition: icp_v2.cc:418
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:461
a storeGetPublic*() caller
Definition: StoreClient.h:40
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:376
bool isHit() const
whether the cache contains the requested entry
Definition: icp_v2.cc:155
const cache_key * icpGetCacheKey(const char *url, int reqnum)
Definition: icp_v2.cc:855
void icpConnectionShutdown(void)
Definition: icp_v2.cc:760
void fillChecklist(ACLFilledChecklist &) const override
configure the given checklist (to reflect the current transaction state)
Definition: icp_v2.cc:192
icp_opcode getOpCode() const
Definition: icp_v2.cc:129
Comm::ConnectionPointer icpIncomingConn
Definition: icp_v2.cc:99
unsigned char version
Definition: ICP.h:40
void icpOpenPorts(void)
Definition: icp_v2.cc:678
uint32_t pad
Definition: ICP.h:46
Ip::Address theIcpPublicHostID
Definition: stub_icp.cc:30
void icpClosePorts(void)
Definition: icp_v2.cc:785
void handleReply(char *buf, Ip::Address &from)
Definition: icp_v2.cc:544
icp_common_t()
Definition: icp_v2.cc:104
static icp_common_t * CreateMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad)
Definition: icp_v2.cc:271
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:842
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:168

 

Introduction

Documentation

Support

Miscellaneous