]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ICAP/ICAPClientVector.h
- Replaced BodyReader with BodyPipe. BodyReader was a
[thirdparty/squid.git] / src / ICAP / ICAPClientVector.h
1
2 /*
3 * $Id: ICAPClientVector.h,v 1.1 2006/10/31 23:30:58 wessels Exp $
4 *
5 *
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
8 *
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.
17 *
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.
22 *
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.
27 *
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.
31 *
32 */
33
34 #ifndef SQUID_ICAPVECTOR_H
35 #define SQUID_ICAPVECTOR_H
36
37 #include "MsgPipe.h"
38 #include "MsgPipeSource.h"
39 #include "MsgPipeSink.h"
40 #include "ICAPServiceRep.h"
41
42 /*
43 * The ICAP Vector helps its Owner to talk to the ICAP transaction, which
44 * implements asynchronous communication with the ICAP server. The Owner
45 * is either the HTTP client side (ClientHttpRequest) or the HTTP server
46 * side (ServerStateData). The Vector marshals the incoming/virgin HTTP
47 * message to the ICAP transaction, via the MsgPipe interface. The same
48 * interface is used to get the adapted HTTP message back.
49 *
50 * ICAPClientReqmodPrecache and ICAPClientRespmodPrecache classes use
51 * ICAPVector as a base and cover specifics of their vectoring point.
52 */
53
54 class ICAPClientVector: public MsgPipeSource, public MsgPipeSink
55 {
56
57 public:
58 ICAPClientVector(ICAPServiceRep::Pointer, const char *aPoint);
59 virtual ~ICAPClientVector();
60
61 // synchronous calls called by Owner
62 void sendMoreData(StoreIOBuffer buf);
63 void doneSending();
64 void ownerAbort();
65 int potentialSpaceSize(); /* how much data can we accept? */
66
67 // pipe source methods; called by ICAP while receiving the virgin message
68 virtual void noteSinkNeed(MsgPipe *p);
69 virtual void noteSinkAbort(MsgPipe *p);
70
71 // pipe sink methods; called by ICAP while sending the adapted message
72 virtual void noteSourceStart(MsgPipe *p) = 0;
73 virtual void noteSourceProgress(MsgPipe *p) = 0;
74 virtual void noteSourceFinish(MsgPipe *p);
75 virtual void noteSourceAbort(MsgPipe *p);
76
77 protected:
78 typedef enum { notifyNone, notifyOwner, notifyIcap } Notify;
79
80 // implemented by kids because we do not have a common Owner parent
81 virtual void tellSpaceAvailable() = 0;
82 virtual void tellDoneAdapting() = 0; // may delete us
83 virtual void tellAbortAdapting() = 0; // may delete us
84 virtual void stop(Notify notify); // may delete us
85
86 void startMod(void *anOwner, HttpRequest *cause, HttpMsg *header);
87 void clean(Notify notify, bool cleanAdapted = true);
88
89 private:
90 void checkDoneAdapting();
91
92 public:
93 void *theOwner;
94 const char *vPoint; // unmanaged vectoring point name for debugging
95
96 ICAPServiceRep::Pointer service;
97 MsgPipe::Pointer virgin;
98 MsgPipe::Pointer adapted;
99 };
100
101 #endif /* SQUID_ICAPVECTOR_H */