]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/icap/Launcher.h
Real quiet cache.log when TPROXY and NAT both active
[thirdparty/squid.git] / src / adaptation / icap / Launcher.h
CommitLineData
c824c43b 1
2/*
262a0e14 3 * $Id$
c824c43b 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.
26ac0430 22 *
c824c43b 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.
26ac0430 27 *
c824c43b 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_ICAPLAUNCHER_H
35#define SQUID_ICAPLAUNCHER_H
36
0bef8dd7
AR
37#include "adaptation/Initiator.h"
38#include "adaptation/Initiate.h"
26cc52cb 39#include "adaptation/icap/ServiceRep.h"
c824c43b 40
41/*
42 * The ICAP Launcher starts an ICAP transaction. If the transaction fails
43 * due to what looks like a persistent connection race condition, the launcher
44 * starts a new ICAP transaction using a freshly opened connection.
45 *
46 * ICAPLauncher and one or more ICAP transactions initiated by it form an
47 * ICAP "query".
48 *
49 * An ICAP Initiator deals with the ICAP Launcher and not an individual ICAP
50 * transaction because the latter may disappear and be replaced by another
51 * transaction.
52 *
53 * Specific ICAP launchers implement the createXaction() method to create
54 * REQMOD, RESPMOD, or OPTIONS transaction from initiator-supplied data.
55 *
26ac0430
AJ
56 * TODO: This class might be the right place to initiate ICAP ACL checks or
57 * implement more sophisticated ICAP transaction handling like chaining of
c824c43b 58 * ICAP transactions.
59 */
60
c824c43b 61
26cc52cb
AR
62namespace Adaptation {
63namespace Icap {
64
65class Xaction;
66
67// Note: Initiate must be the first parent for cbdata to work. We use
68// a temporary InitaitorHolder/toCbdata hacks and do not call cbdata
c824c43b 69// operations on the initiator directly.
26cc52cb 70class Launcher: public Adaptation::Initiate, public Adaptation::Initiator
c824c43b 71{
72public:
26cc52cb
AR
73 Launcher(const char *aTypeName, Adaptation::Initiator *anInitiator, Adaptation::ServicePointer &aService);
74 virtual ~Launcher();
c824c43b 75
0bef8dd7 76 // Adaptation::Initiate: asynchronous communication with the initiator
c824c43b 77 void noteInitiatorAborted();
78
0bef8dd7
AR
79 // Adaptation::Initiator: asynchronous communication with the current transaction
80 virtual void noteAdaptationAnswer(HttpMsg *message);
81 virtual void noteAdaptationQueryAbort(bool final);
c824c43b 82
c824c43b 83protected:
0bef8dd7 84 // Adaptation::Initiate API implementation
c824c43b 85 virtual void start();
86 virtual bool doneAll() const;
87 virtual void swanSong();
88
89 // creates the right ICAP transaction using stored configuration params
26cc52cb 90 virtual Xaction *createXaction() = 0;
c824c43b 91
92 void launchXaction(bool final);
93
0bef8dd7 94 Adaptation::Initiate *theXaction; // current ICAP transaction
c824c43b 95 int theLaunches; // the number of transaction launches
96};
97
26cc52cb
AR
98
99} // namespace Icap
100} // namespace Adaptation
101
c824c43b 102#endif /* SQUID_ICAPLAUNCHER_H */