3
* $Id: ICAPInitiate.h,v 1.1 2007/05/08 16:32:11 rousskov 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.
34
#ifndef SQUID_ICAPINITIATE_H
35
#define SQUID_ICAPINITIATE_H
39
#include "ICAPServiceRep.h"
45
/* Initiator holder associtates an initiator with its cbdata. It is used as
46
* a temporary hack to make cbdata work with multiple inheritance */
47
class ICAPInitiatorHolder {
49
ICAPInitiatorHolder(ICAPInitiator *anInitiator);
50
ICAPInitiatorHolder(const ICAPInitiatorHolder &anInitiator);
51
~ICAPInitiatorHolder();
56
// to make comparison with NULL possible
57
operator void*() { return ptr; }
58
bool operator == (void *) const { return ptr == NULL; }
59
bool operator != (void *) const { return ptr != NULL; }
60
bool operator !() const { return !ptr; }
66
ICAPInitiatorHolder &operator =(const ICAPInitiatorHolder &anInitiator);
70
* The ICAP Initiate is a common base for ICAP queries or transactions
71
* initiated by an ICAPInitiator. This interface exists to allow an ICAP
72
* initiator to signal its "initiatees" that it is aborting and no longer
73
* expecting an answer. The class is also handy for implementing common
74
* initiate actions such as maintaining and notifying the initiator.
76
* ICAPInitiate implementations must cbdata-protect themselves.
78
* This class could have been named ICAPInitiatee.
80
class ICAPInitiate: public AsyncJob
84
ICAPInitiate(const char *aTypeName, ICAPInitiator *anInitiator, ICAPServiceRep::Pointer &aService);
85
virtual ~ICAPInitiate();
87
// communication with the initiator
88
virtual void noteInitiatorAborted() = 0;
89
AsyncCallWrapper(93,3, ICAPInitiate, noteInitiatorAborted)
92
ICAPServiceRep &service();
94
void sendAnswer(HttpMsg *msg); // send to the initiator
95
void tellQueryAborted(bool final); // tell initiator
96
void clearInitiator(); // used by noteInitiatorAborted; TODO: make private
98
virtual void swanSong(); // internal cleanup
100
virtual const char *status() const; // for debugging
102
ICAPInitiatorHolder theInitiator;
103
ICAPServiceRep::Pointer theService;
106
#endif /* SQUID_ICAPINITIATE_H */