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_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
25class AccessLogEntry;
26class HttpRequest;
27
29
36public:
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
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
61class ICPState: public StoreClient
62{
63
64public:
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
79protected:
80 /* StoreClient API */
81 LogTags *loggingTags() const override;
82 void fillChecklist(ACLFilledChecklist &) const override;
83
85 bool confirmAndPrepHit(const StoreEntry &) const;
86};
87
91
93HttpRequest* icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from);
94
96bool icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request);
97
99void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from, AccessLogEntryPointer);
100
103
105void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd);
106
109
111void icpHandleIcpV3(int, Ip::Address &, char *, int);
112
114void icpOpenPorts(void);
115
117void icpConnectionShutdown(void);
118
120void icpClosePorts(void);
121
123int icpSetCacheKey(const cache_key * key);
124
126const cache_key *icpGetCacheKey(const char *url, int reqnum);
127
128#endif /* SQUID_ICP_H */
129
Ip::Address theIcpPublicHostID
Definition: stub_icp.cc:30
RefCount< AccessLogEntry > AccessLogEntryPointer
Definition: ICP.h:28
Definition: ICP.h:62
LogTags * loggingTags() const override
Definition: icp_v2.cc:183
bool isHit() const
whether the cache contains the requested entry
Definition: icp_v2.cc:155
AccessLogEntryPointer al
Definition: ICP.h:77
Ip::Address from
Definition: ICP.h:75
HttpRequest * request
Definition: ICP.h:72
char * url
Definition: ICP.h:76
int fd
Definition: ICP.h:73
void fillChecklist(ACLFilledChecklist &) const override
configure the given checklist (to reflect the current transaction state)
Definition: icp_v2.cc:192
icp_common_t header
Definition: ICP.h:71
~ICPState() override
Definition: icp_v2.cc:148
ICPState(icp_common_t &aHeader, HttpRequest *aRequest)
Definition: icp_v2.cc:139
bool confirmAndPrepHit(const StoreEntry &) const
either confirms and starts processing a cache hit or returns false
Definition: icp_v2.cc:168
a storeGetPublic*() caller
Definition: StoreClient.h:40
uint32_t flags
Definition: ICP.h:45
void handleReply(char *buf, Ip::Address &from)
Definition: icp_v2.cc:540
uint32_t shostid
Definition: ICP.h:48
unsigned char version
Definition: ICP.h:40
icp_common_t()
Definition: icp_v2.cc:104
icp_opcode getOpCode() const
Definition: icp_v2.cc:129
static icp_common_t * CreateMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad)
Definition: icp_v2.cc:271
uint32_t reqnum
Definition: ICP.h:44
uint32_t pad
Definition: ICP.h:46
unsigned char opcode
Definition: ICP.h:38
unsigned short length
Definition: ICP.h:42
void PF(int, void *)
Definition: forward.h:18
icp_opcode icpGetCommonOpcode()
Definition: icp_v2.cc:376
int icpSetCacheKey(const cache_key *key)
Definition: icp_v2.cc:861
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
icp_opcode
Definition: icp_opcode.h:13
PF icpHandleUdp
Definition: ICP.h:108
void icpConnectionShutdown(void)
Definition: icp_v2.cc:779
void icpHandleIcpV3(int, Ip::Address &, char *, int)
Definition: icp_v3.cc:71
void icpOpenPorts(void)
Definition: icp_v2.cc:697
void icpClosePorts(void)
Definition: icp_v2.cc:804
bool icpAccessAllowed(Ip::Address &from, HttpRequest *icp_request)
Definition: icp_v2.cc:444
const cache_key * icpGetCacheKey(const char *url, int reqnum)
Definition: icp_v2.cc:874
void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd)
Definition: icp_v2.cc:428
HttpRequest * icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from)
Definition: icp_v2.cc:457
Comm::ConnectionPointer icpOutgoingConn
Definition: icp_v2.cc:101
Comm::ConnectionPointer icpIncomingConn
Definition: icp_v2.cc:99
unsigned char cache_key
Store key.
Definition: forward.h:29

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors