ICP.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 
64 class ICPState: public StoreClient
65 {
66 
67 public:
68  ICPState(icp_common_t &aHeader, HttpRequest *aRequest);
69  virtual ~ICPState();
70 
72  bool foundHit(const StoreEntry &) const;
73 
76  int fd;
77 
79  char *url;
80 
81 protected:
82  /* StoreClient API */
83  virtual void fillChecklist(ACLFilledChecklist &) const override;
85 };
86 
88 struct icpUdpData {
89 
92 
93  void *msg;
94  size_t len;
96 #ifndef LESS_TIMING
97 
98  struct timeval start;
99 #endif
100 
102 
103  struct timeval queue_time;
104 };
105 
109 
111 HttpRequest* icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from);
112 
114 bool icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request);
115 
117 void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from, AccessLogEntryPointer);
118 
121 
123 int icpUdpSend(int, const Ip::Address &, icp_common_t *, const LogTags &, int, AccessLogEntryPointer);
124 
127 
129 void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd);
130 
133 
136 
138 void icpHandleIcpV3(int, Ip::Address &, char *, int);
139 
141 void icpOpenPorts(void);
142 
144 void icpConnectionShutdown(void);
145 
147 void icpClosePorts(void);
148 
150 int icpSetCacheKey(const cache_key * key);
151 
153 const cache_key *icpGetCacheKey(const char *url, int reqnum);
154 
155 #endif /* SQUID_ICP_H */
156 
Definition: ICP.h:64
icp_common_t()
Definition: icp_v2.cc:93
Comm::ConnectionPointer icpIncomingConn
Definition: icp_v2.cc:88
PF icpHandleUdp
Definition: ICP.h:132
Ip::Address from
Definition: ICP.h:78
icp_opcode icpGetCommonOpcode()
Definition: icp_v2.cc:368
const cache_key * icpGetCacheKey(const char *url, int reqnum)
Definition: icp_v2.cc:845
unsigned char cache_key
Store key.
Definition: forward.h:29
int icpUdpSend(int, const Ip::Address &, icp_common_t *, const LogTags &, int, AccessLogEntryPointer)
Definition: icp_v2.cc:310
Definition: ICP.h:88
void icpConnectionShutdown(void)
Definition: icp_v2.cc:750
unsigned char version
Definition: ICP.h:40
virtual void fillChecklist(ACLFilledChecklist &) const override
configure the ACL checklist with the current transaction state
Definition: icp_v2.cc:162
int fd
Definition: ICP.h:76
void handleReply(char *buf, Ip::Address &from)
Definition: icp_v2.cc:512
unsigned short length
Definition: ICP.h:42
bool icpAccessAllowed(Ip::Address &from, HttpRequest *icp_request)
Definition: icp_v2.cc:427
int icpSetCacheKey(const cache_key *key)
Definition: icp_v2.cc:832
uint32_t reqnum
Definition: ICP.h:44
void icpOpenPorts(void)
Definition: icp_v2.cc:667
size_t len
Definition: ICP.h:94
PF icpUdpSendQueue
Definition: ICP.h:135
unsigned char opcode
Definition: ICP.h:38
void icpClosePorts(void)
Definition: icp_v2.cc:775
char * url
Definition: ICP.h:79
void PF(int, void *)
Definition: forward.h:18
LogTags logcode
Definition: ICP.h:101
icp_opcode
Definition: icp_opcode.h:13
Comm::ConnectionPointer icpOutgoingConn
Definition: icp_v2.cc:90
icp_common_t header
Definition: ICP.h:74
Ip::Address theIcpPublicHostID
Definition: stub_icp.cc:29
struct timeval queue_time
Definition: ICP.h:103
void * msg
Definition: ICP.h:93
virtual ~ICPState()
Definition: icp_v2.cc:137
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
HttpRequest * icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from)
Definition: icp_v2.cc:449
void const char * buf
Definition: stub_helper.cc:16
uint32_t flags
Definition: ICP.h:45
void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from, AccessLogEntryPointer)
Definition: icp_v2.cc:404
uint32_t pad
Definition: ICP.h:46
AccessLogEntryPointer al
Definition: ICP.h:84
icp_opcode getOpCode() const
Definition: icp_v2.cc:118
uint32_t shostid
Definition: ICP.h:48
Ip::Address address
IP address for the remote end. Because we reply to packets from unknown non-peers.
Definition: ICP.h:91
void icpHandleIcpV3(int, Ip::Address &, char *, int)
Definition: icp_v3.cc:88
void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd)
Definition: icp_v2.cc:411
icpUdpData * next
Definition: ICP.h:95
HttpRequest * request
Definition: ICP.h:75
LogTags icpLogFromICPCode(icp_opcode opcode)
Definition: icp_v2.cc:381
struct timeval start
Definition: ICP.h:98
RefCount< AccessLogEntry > AccessLogEntryPointer
Definition: ICP.h:26
ICPState(icp_common_t &aHeader, HttpRequest *aRequest)
Definition: icp_v2.cc:128
static icp_common_t * CreateMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad)
Definition: icp_v2.cc:265
bool foundHit(const StoreEntry &) const
whether the found entry warrants an ICP_HIT response
Definition: icp_v2.cc:144
A StoreEntry::getPublic*() caller.
Definition: StoreClient.h:22

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors