~ubuntu-branches/ubuntu/oneiric/squid3/oneiric-security

« back to all changes in this revision

Viewing changes to src/ICAP/ICAPInitiate.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2007-05-13 16:03:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513160316-2h6kn6h1z0q1fvyo
Tags: 3.0.PRE6-1
* New upstream release
  - Removed patches integrated upsteam:
    + 04-m68k-ftbfs

* debian/rules
  - Enable delay pools (Closes: #410785)
  - Enable cache digests (Closes: #416631)
  - Enable ICAP client
  - Raised Max Filedescriptor limit to 65536

* debian/control
  - Added real package dependency for httpd in squid3-cgi

* debian/patches/02-makefile-defaults
  - Fix default configuration file for cachemgr.cgi (Closes: #416630)

* debian/squid3.postinst
  - Fixed bashish in postinst (Closes: #411797)

* debian/patches/05-helpers-typo
  - Added upstream patch fixing compilation error in src/helpers.cc

* debian/patches/06-mem-obj-reference
  - Added upstream patch fixing a mem_obj reference in src/store.cc

* debian/patches/07-close-icap-connections
  - Added upstream patch fixing icap connection starvation

* debian/squid3.rc
  - Added LSB-compliant description to rc script

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * $Id: ICAPInitiate.h,v 1.1 2007/05/08 16:32:11 rousskov 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_ICAPINITIATE_H
 
35
#define SQUID_ICAPINITIATE_H
 
36
 
 
37
#include "comm.h"
 
38
#include "MemBuf.h"
 
39
#include "ICAPServiceRep.h"
 
40
#include "AsyncJob.h"
 
41
 
 
42
class HttpMsg;
 
43
class ICAPInitiator;
 
44
 
 
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 {
 
48
public:
 
49
    ICAPInitiatorHolder(ICAPInitiator *anInitiator);
 
50
    ICAPInitiatorHolder(const ICAPInitiatorHolder &anInitiator);
 
51
    ~ICAPInitiatorHolder();
 
52
 
 
53
 
 
54
    void clear();
 
55
 
 
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; }
 
61
 
 
62
    ICAPInitiator *ptr;
 
63
    void *cbdata;
 
64
 
 
65
private:
 
66
    ICAPInitiatorHolder &operator =(const ICAPInitiatorHolder &anInitiator);
 
67
};
 
68
 
 
69
/*
 
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.
 
75
 *
 
76
 * ICAPInitiate implementations must cbdata-protect themselves.
 
77
 *
 
78
 * This class could have been named ICAPInitiatee.
 
79
 */
 
80
class ICAPInitiate: public AsyncJob
 
81
{
 
82
 
 
83
public:
 
84
    ICAPInitiate(const char *aTypeName, ICAPInitiator *anInitiator, ICAPServiceRep::Pointer &aService);
 
85
    virtual ~ICAPInitiate();
 
86
 
 
87
    // communication with the initiator
 
88
    virtual void noteInitiatorAborted() = 0;
 
89
    AsyncCallWrapper(93,3, ICAPInitiate, noteInitiatorAborted)
 
90
 
 
91
protected:
 
92
    ICAPServiceRep &service();
 
93
 
 
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
 
97
 
 
98
    virtual void swanSong(); // internal cleanup
 
99
 
 
100
    virtual const char *status() const; // for debugging
 
101
 
 
102
    ICAPInitiatorHolder theInitiator;
 
103
    ICAPServiceRep::Pointer theService;
 
104
};
 
105
 
 
106
#endif /* SQUID_ICAPINITIATE_H */