19
18
* it under the terms of the GNU General Public License as published by
20
19
* the Free Software Foundation; either version 2 of the License, or
21
20
* (at your option) any later version.
23
22
* This program is distributed in the hope that it will be useful,
24
23
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
24
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
25
* GNU General Public License for more details.
28
27
* You should have received a copy of the GNU General Public License
29
28
* along with this program; if not, write to the Free Software
30
29
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
34
33
#ifndef SQUID_ICP_H
35
34
#define SQUID_ICP_H
37
\defgroup ServerProtocolICPAPI ICP
38
\ingroup ServerProtocol
37
41
#include "StoreClient.h"
44
\ingroup ServerProtocolICPAPI
40
46
* This struct is the wire-level header.
41
47
* DO NOT add more move fields on pain of breakage.
42
48
* DO NOT add virtual methods.
46
unsigned char opcode; /* opcode */
47
unsigned char version; /* version number */
48
unsigned short length; /* total length (bytes) */
49
u_int32_t reqnum; /* req number (req'd for UDP) */
50
struct _icp_common_t {
54
unsigned char version;
55
/** total length (bytes) */
56
unsigned short length;
57
/** req number (req'd for UDP) */
52
u_int32_t shostid; /* sender host id */
64
/// \todo I don't believe this header is included in non-c++ code anywhere
65
/// the struct should become a public POD class and kill these ifdef.
56
69
_icp_common_t(char *buf, unsigned int len);
58
void handleReply(char *buf, struct sockaddr_in *from);
71
void handleReply(char *buf, IpAddress &from);
59
72
static _icp_common_t *createMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad);
60
73
icp_opcode getOpCode() const;
105
121
struct timeval queue_time;
109
HttpRequest* icpGetRequest(char *url, int reqnum, int fd, struct sockaddr_in *from);
111
int icpAccessAllowed(struct sockaddr_in *from, HttpRequest * icp_request);
113
SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const struct sockaddr_in *from);
124
/// \ingroup ServerProtocolICPAPI
125
HttpRequest* icpGetRequest(char *url, int reqnum, int fd, IpAddress &from);
127
/// \ingroup ServerProtocolICPAPI
128
int icpAccessAllowed(IpAddress &from, HttpRequest * icp_request);
130
/// \ingroup ServerProtocolICPAPI
131
SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const IpAddress &from);
133
/// \ingroup ServerProtocolICPAPI
114
134
extern icp_opcode icpGetCommonOpcode();
116
SQUIDCEXTERN int icpUdpSend(int, const struct sockaddr_in *, icp_common_t *, log_type, int);
136
/// \ingroup ServerProtocolICPAPI
137
SQUIDCEXTERN int icpUdpSend(int, const IpAddress &, icp_common_t *, log_type, int);
139
/// \ingroup ServerProtocolICPAPI
117
140
SQUIDCEXTERN log_type icpLogFromICPCode(icp_opcode opcode);
119
void icpDenyAccess(struct sockaddr_in *from, char *url, int reqnum, int fd);
142
/// \ingroup ServerProtocolICPAPI
143
void icpDenyAccess(IpAddress &from, char *url, int reqnum, int fd);
145
/// \ingroup ServerProtocolICPAPI
120
146
SQUIDCEXTERN PF icpHandleUdp;
148
/// \ingroup ServerProtocolICPAPI
121
149
SQUIDCEXTERN PF icpUdpSendQueue;
123
SQUIDCEXTERN void icpHandleIcpV3(int, struct sockaddr_in, char *, int);
151
/// \ingroup ServerProtocolICPAPI
152
SQUIDCEXTERN void icpHandleIcpV3(int, IpAddress &, char *, int);
154
/// \ingroup ServerProtocolICPAPI
124
155
SQUIDCEXTERN int icpCheckUdpHit(StoreEntry *, HttpRequest * request);
157
/// \ingroup ServerProtocolICPAPI
125
158
SQUIDCEXTERN void icpConnectionsOpen(void);
160
/// \ingroup ServerProtocolICPAPI
126
161
SQUIDCEXTERN void icpConnectionShutdown(void);
163
/// \ingroup ServerProtocolICPAPI
127
164
SQUIDCEXTERN void icpConnectionClose(void);
166
/// \ingroup ServerProtocolICPAPI
128
167
SQUIDCEXTERN int icpSetCacheKey(const cache_key * key);
169
/// \ingroup ServerProtocolICPAPI
129
170
SQUIDCEXTERN const cache_key *icpGetCacheKey(const char *url, int reqnum);
132
172
#endif /* SQUID_ICP_H */