ICP.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 "comm/forward.h"
18 #include "icp_opcode.h"
19 #include "ip/Address.h"
20 #include "LogTags.h"
21 #include "store_key_md5.h"
22 #include "StoreClient.h"
23 
24 class HttpRequest;
25 
33 struct _icp_common_t {
35  unsigned char opcode;
37  unsigned char version;
39  unsigned short length;
41  uint32_t reqnum;
42  uint32_t flags;
43  uint32_t pad;
45  uint32_t shostid;
46 
49 #ifdef __cplusplus
50 
51  _icp_common_t();
52  _icp_common_t(char *buf, unsigned int len);
53 
54  void handleReply(char *buf, Ip::Address &from);
55  static _icp_common_t *createMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad);
56  icp_opcode getOpCode() const;
57 #endif
58 };
59 typedef struct _icp_common_t icp_common_t;
60 
61 #ifdef __cplusplus
62 
67 class ICPState
68 {
69 
70 public:
71  ICPState(icp_common_t &aHeader, HttpRequest *aRequest);
72  virtual ~ICPState();
75  int fd;
76 
78  char *url;
79 };
80 
81 #endif
82 
84 struct icpUdpData {
85 
88 
89  void *msg;
90  size_t len;
92 #ifndef LESS_TIMING
93 
94  struct timeval start;
95 #endif
96 
98 
99  struct timeval queue_time;
100 };
101 
105 
107 HttpRequest* icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from);
108 
110 bool icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request);
111 
113 void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from);
114 
117 
119 int icpUdpSend(int, const Ip::Address &, icp_common_t *, const LogTags &, int);
120 
123 
125 void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd);
126 
129 
132 
134 void icpHandleIcpV3(int, Ip::Address &, char *, int);
135 
138 
140 void icpOpenPorts(void);
141 
143 void icpConnectionShutdown(void);
144 
146 void icpClosePorts(void);
147 
149 int icpSetCacheKey(const cache_key * key);
150 
152 const cache_key *icpGetCacheKey(const char *url, int reqnum);
153 
154 #endif /* SQUID_ICP_H */
155 
Definition: ICP.h:67
Comm::ConnectionPointer icpIncomingConn
Definition: icp_v2.cc:71
PF icpHandleUdp
Definition: ICP.h:128
Ip::Address from
Definition: ICP.h:77
icp_opcode icpGetCommonOpcode()
Definition: icp_v2.cc:352
const cache_key * icpGetCacheKey(const char *url, int reqnum)
Definition: icp_v2.cc:829
uint32_t shostid
Definition: ICP.h:45
unsigned char cache_key
Store key.
Definition: forward.h:29
Definition: ICP.h:84
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
void icpConnectionShutdown(void)
Definition: icp_v2.cc:734
int fd
Definition: ICP.h:75
bool icpAccessAllowed(Ip::Address &from, HttpRequest *icp_request)
Definition: icp_v2.cc:411
static _icp_common_t * createMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad)
Definition: icp_v2.cc:232
int icpSetCacheKey(const cache_key *key)
Definition: icp_v2.cc:816
void icpOpenPorts(void)
Definition: icp_v2.cc:651
size_t len
Definition: ICP.h:90
PF icpUdpSendQueue
Definition: ICP.h:131
unsigned char opcode
Definition: ICP.h:35
icp_opcode getOpCode() const
Definition: icp_v2.cc:101
int icpCheckUdpHit(StoreEntry *, HttpRequest *request)
Definition: icp_v2.cc:328
_icp_common_t()
Definition: icp_v2.cc:76
void icpClosePorts(void)
Definition: icp_v2.cc:759
char * url
Definition: ICP.h:78
void PF(int, void *)
Definition: forward.h:18
LogTags logcode
Definition: ICP.h:97
icp_opcode
Definition: icp_opcode.h:13
Comm::ConnectionPointer icpOutgoingConn
Definition: icp_v2.cc:73
icp_common_t header
Definition: ICP.h:73
Ip::Address theIcpPublicHostID
Definition: stub_icp.cc:28
struct timeval queue_time
Definition: ICP.h:99
void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from)
Definition: icp_v2.cc:388
void * msg
Definition: ICP.h:89
virtual ~ICPState()
Definition: icp_v2.cc:120
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:433
uint32_t flags
Definition: ICP.h:42
void const char * buf
Definition: stub_helper.cc:16
int icpUdpSend(int, const Ip::Address &, icp_common_t *, const LogTags &, int)
Definition: icp_v2.cc:277
void handleReply(char *buf, Ip::Address &from)
Definition: icp_v2.cc:496
Ip::Address address
IP address for the remote end. Because we reply to packets from unknown non-peers.
Definition: ICP.h:87
void icpHandleIcpV3(int, Ip::Address &, char *, int)
Definition: icp_v3.cc:84
void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd)
Definition: icp_v2.cc:395
void const cache_key * key
unsigned char version
Definition: ICP.h:37
icpUdpData * next
Definition: ICP.h:91
HttpRequest * request
Definition: ICP.h:74
LogTags icpLogFromICPCode(icp_opcode opcode)
Definition: icp_v2.cc:365
unsigned short length
Definition: ICP.h:39
uint32_t reqnum
Definition: ICP.h:41
struct timeval start
Definition: ICP.h:94
uint32_t pad
Definition: ICP.h:43
ICPState(icp_common_t &aHeader, HttpRequest *aRequest)
Definition: icp_v2.cc:111

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors