3 * SQUID Web Proxy Cache http://www.squid-cache.org/
4 * ----------------------------------------------------------
6 * Squid is the result of efforts by numerous individuals from
7 * the Internet community; see the CONTRIBUTORS file for full
8 * details. Many organizations have provided support for Squid's
9 * development; see the SPONSORS file for full details. Squid is
10 * Copyrighted (C) 2001 by the Regents of the University of
11 * California; see the COPYRIGHT file for full details. Squid
12 * incorporates software developed and/or copyrighted by other
13 * sources; see the CREDITS file for full details.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
35 \defgroup ServerProtocolICPAPI ICP
36 \ingroup ServerProtocol
39 #include "comm/forward.h"
40 #include "icp_opcode.h"
41 #include "ip/Address.h"
42 #include "StoreClient.h"
47 \ingroup ServerProtocolICPAPI
49 * This struct is the wire-level header.
50 * DO NOT add more move fields on pain of breakage.
51 * DO NOT add virtual methods.
53 struct _icp_common_t
{
57 unsigned char version
;
58 /** total length (bytes) */
59 unsigned short length
;
60 /** req number (req'd for UDP) */
67 /// \todo I don't believe this header is included in non-c++ code anywhere
68 /// the struct should become a public POD class and kill these ifdef.
72 _icp_common_t(char *buf
, unsigned int len
);
74 void handleReply(char *buf
, Ip::Address
&from
);
75 static _icp_common_t
*createMessage(icp_opcode opcode
, int flags
, const char *url
, int reqnum
, int pad
);
76 icp_opcode
getOpCode() const;
79 typedef struct _icp_common_t icp_common_t
;
83 /// \ingroup ServerProtocolICPAPI
84 inline icp_opcode
& operator++ (icp_opcode
& aCode
)
86 int tmp
= (int) aCode
;
87 aCode
= (icp_opcode
) (++tmp
);
92 \ingroup ServerProtocolICPAPI
99 ICPState(icp_common_t
&aHeader
, HttpRequest
*aRequest
);
102 HttpRequest
*request
;
111 /// \ingroup ServerProtocolICPAPI
114 /// IP address for the remote end. Because we reply to packets from unknown non-peers.
122 struct timeval start
;
127 struct timeval queue_time
;
130 extern Comm::ConnectionPointer icpIncomingConn
;
131 extern Comm::ConnectionPointer icpOutgoingConn
;
132 extern Ip::Address theIcpPublicHostID
;
134 /// \ingroup ServerProtocolICPAPI
135 HttpRequest
* icpGetRequest(char *url
, int reqnum
, int fd
, Ip::Address
&from
);
137 /// \ingroup ServerProtocolICPAPI
138 bool icpAccessAllowed(Ip::Address
&from
, HttpRequest
* icp_request
);
140 /// \ingroup ServerProtocolICPAPI
141 void icpCreateAndSend(icp_opcode
, int flags
, char const *url
, int reqnum
, int pad
, int fd
, const Ip::Address
&from
);
143 /// \ingroup ServerProtocolICPAPI
144 icp_opcode
icpGetCommonOpcode();
146 /// \ingroup ServerProtocolICPAPI
147 int icpUdpSend(int, const Ip::Address
&, icp_common_t
*, log_type
, int);
149 /// \ingroup ServerProtocolICPAPI
150 log_type
icpLogFromICPCode(icp_opcode opcode
);
152 /// \ingroup ServerProtocolICPAPI
153 void icpDenyAccess(Ip::Address
&from
, char *url
, int reqnum
, int fd
);
155 /// \ingroup ServerProtocolICPAPI
158 /// \ingroup ServerProtocolICPAPI
161 /// \ingroup ServerProtocolICPAPI
162 void icpHandleIcpV3(int, Ip::Address
&, char *, int);
164 /// \ingroup ServerProtocolICPAPI
165 int icpCheckUdpHit(StoreEntry
*, HttpRequest
* request
);
167 /// \ingroup ServerProtocolICPAPI
168 void icpOpenPorts(void);
170 /// \ingroup ServerProtocolICPAPI
171 void icpConnectionShutdown(void);
173 /// \ingroup ServerProtocolICPAPI
174 void icpClosePorts(void);
176 /// \ingroup ServerProtocolICPAPI
177 int icpSetCacheKey(const cache_key
* key
);
179 /// \ingroup ServerProtocolICPAPI
180 const cache_key
*icpGetCacheKey(const char *url
, int reqnum
);
182 #endif /* SQUID_ICP_H */