3 * $Id: ICP.h,v 1.10 2007/12/14 23:11:45 amosjeffries Exp $
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
9 * Squid is the result of efforts by numerous individuals from
10 * the Internet community; see the CONTRIBUTORS file for full
11 * details. Many organizations have provided support for Squid's
12 * development; see the SPONSORS file for full details. Squid is
13 * Copyrighted (C) 2001 by the Regents of the University of
14 * California; see the COPYRIGHT file for full details. Squid
15 * incorporates software developed and/or copyrighted by other
16 * sources; see the CREDITS file for full details.
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
37 #include "StoreClient.h"
40 * This struct is the wire-level header.
41 * DO NOT add more move fields on pain of breakage.
42 * 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) */
52 u_int32_t shostid
; /* sender host id */
56 _icp_common_t(char *buf
, unsigned int len
);
58 void handleReply(char *buf
, IPAddress
&from
);
59 static _icp_common_t
*createMessage(icp_opcode opcode
, int flags
, const char *url
, int reqnum
, int pad
);
60 icp_opcode
getOpCode() const;
66 inline icp_opcode
& operator++ (icp_opcode
& aCode
)
68 int tmp
= (int) aCode
;
69 aCode
= (icp_opcode
) (++tmp
);
74 /** \todo mempool this */
79 ICPState(icp_common_t
&, HttpRequest
*);
104 struct timeval queue_time
;
108 HttpRequest
* icpGetRequest(char *url
, int reqnum
, int fd
, IPAddress
&from
);
110 int icpAccessAllowed(IPAddress
&from
, HttpRequest
* icp_request
);
112 SQUIDCEXTERN
void icpCreateAndSend(icp_opcode
, int flags
, char const *url
, int reqnum
, int pad
, int fd
, const IPAddress
&from
);
113 extern icp_opcode
icpGetCommonOpcode();
115 SQUIDCEXTERN
int icpUdpSend(int, const IPAddress
&, icp_common_t
*, log_type
, int);
116 SQUIDCEXTERN log_type
icpLogFromICPCode(icp_opcode opcode
);
118 void icpDenyAccess(IPAddress
&from
, char *url
, int reqnum
, int fd
);
119 SQUIDCEXTERN PF icpHandleUdp
;
120 SQUIDCEXTERN PF icpUdpSendQueue
;
122 SQUIDCEXTERN
void icpHandleIcpV3(int, IPAddress
&, char *, int);
123 SQUIDCEXTERN
int icpCheckUdpHit(StoreEntry
*, HttpRequest
* request
);
124 SQUIDCEXTERN
void icpConnectionsOpen(void);
125 SQUIDCEXTERN
void icpConnectionShutdown(void);
126 SQUIDCEXTERN
void icpConnectionClose(void);
127 SQUIDCEXTERN
int icpSetCacheKey(const cache_key
* key
);
128 SQUIDCEXTERN
const cache_key
*icpGetCacheKey(const char *url
, int reqnum
);
131 #endif /* SQUID_ICP_H */