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"
48 \ingroup ServerProtocolICPAPI
50 * This struct is the wire-level header.
51 * DO NOT add more move fields on pain of breakage.
52 * DO NOT add virtual methods.
54 struct _icp_common_t
{
58 unsigned char version
;
59 /** total length (bytes) */
60 unsigned short length
;
61 /** req number (req'd for UDP) */
68 /// \todo I don't believe this header is included in non-c++ code anywhere
69 /// the struct should become a public POD class and kill these ifdef.
73 _icp_common_t(char *buf
, unsigned int len
);
75 void handleReply(char *buf
, Ip::Address
&from
);
76 static _icp_common_t
*createMessage(icp_opcode opcode
, int flags
, const char *url
, int reqnum
, int pad
);
77 icp_opcode
getOpCode() const;
80 typedef struct _icp_common_t icp_common_t
;
84 /// \ingroup ServerProtocolICPAPI
85 inline icp_opcode
& operator++ (icp_opcode
& aCode
)
87 int tmp
= (int) aCode
;
88 aCode
= (icp_opcode
) (++tmp
);
93 \ingroup ServerProtocolICPAPI
100 ICPState(icp_common_t
&aHeader
, HttpRequest
*aRequest
);
103 HttpRequest
*request
;
112 /// \ingroup ServerProtocolICPAPI
115 /// IP address for the remote end. Because we reply to packets from unknown non-peers.
123 struct timeval start
;
128 struct timeval queue_time
;
131 extern Comm::ConnectionPointer icpIncomingConn
;
132 extern Comm::ConnectionPointer icpOutgoingConn
;
133 extern Ip::Address theIcpPublicHostID
;
135 /// \ingroup ServerProtocolICPAPI
136 HttpRequest
* icpGetRequest(char *url
, int reqnum
, int fd
, Ip::Address
&from
);
138 /// \ingroup ServerProtocolICPAPI
139 bool icpAccessAllowed(Ip::Address
&from
, HttpRequest
* icp_request
);
141 /// \ingroup ServerProtocolICPAPI
142 void icpCreateAndSend(icp_opcode
, int flags
, char const *url
, int reqnum
, int pad
, int fd
, const Ip::Address
&from
);
144 /// \ingroup ServerProtocolICPAPI
145 icp_opcode
icpGetCommonOpcode();
147 /// \ingroup ServerProtocolICPAPI
148 int icpUdpSend(int, const Ip::Address
&, icp_common_t
*, LogTags
, int);
150 /// \ingroup ServerProtocolICPAPI
151 LogTags
icpLogFromICPCode(icp_opcode opcode
);
153 /// \ingroup ServerProtocolICPAPI
154 void icpDenyAccess(Ip::Address
&from
, char *url
, int reqnum
, int fd
);
156 /// \ingroup ServerProtocolICPAPI
159 /// \ingroup ServerProtocolICPAPI
162 /// \ingroup ServerProtocolICPAPI
163 void icpHandleIcpV3(int, Ip::Address
&, char *, int);
165 /// \ingroup ServerProtocolICPAPI
166 int icpCheckUdpHit(StoreEntry
*, HttpRequest
* request
);
168 /// \ingroup ServerProtocolICPAPI
169 void icpOpenPorts(void);
171 /// \ingroup ServerProtocolICPAPI
172 void icpConnectionShutdown(void);
174 /// \ingroup ServerProtocolICPAPI
175 void icpClosePorts(void);
177 /// \ingroup ServerProtocolICPAPI
178 int icpSetCacheKey(const cache_key
* key
);
180 /// \ingroup ServerProtocolICPAPI
181 const cache_key
*icpGetCacheKey(const char *url
, int reqnum
);
183 #endif /* SQUID_ICP_H */