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

« back to all changes in this revision

Viewing changes to src/adaptation/Initiate.h

  • Committer: Bazaar Package Importer
  • Author(s): Mahyuddin Susanto
  • Date: 2011-02-15 18:46:13 UTC
  • mfrom: (21.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110215184613-1u3dh5sz4i055flk
Tags: 3.1.10-1ubuntu1
* Merge from debian unstable. (LP: #719283)  Remaining changes:
  - debian/patches/18-fix-ftbfs-binutils-gold.dpatch: Add library linker into
    LIBS instead to LDFLAGS to fixing FTBFS binutils-gold.
* Drop Ubuntu configuration for ufw which landed in Debian and sync it: 
  - debian/squid3.ufw.profile.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef SQUID_ADAPTATION__INITIATE_H
2
2
#define SQUID_ADAPTATION__INITIATE_H
3
3
 
4
 
#include "base/AsyncCall.h"
5
4
#include "base/AsyncJob.h"
 
5
#include "base/CbcPointer.h"
6
6
#include "adaptation/forward.h"
7
7
 
8
8
class HttpMsg;
10
10
namespace Adaptation
11
11
{
12
12
 
13
 
/* Initiator holder associtates an initiator with its cbdata. It is used as
14
 
 * a temporary hack to make cbdata work with multiple inheritance. We need
15
 
 * this hack because we cannot know whether the initiator pointer is still
16
 
 * valid without dereferencing it to call toCbdata()
17
 
 * TODO: JobDialer uses the same trick. Factor out or move this code. */
18
 
class InitiatorHolder
19
 
{
20
 
public:
21
 
    InitiatorHolder(Initiator *anInitiator);
22
 
    InitiatorHolder(const InitiatorHolder &anInitiator);
23
 
    ~InitiatorHolder();
24
 
 
25
 
    void clear();
26
 
 
27
 
    // to make comparison with NULL possible
28
 
    operator void*() { return prime; }
29
 
    bool operator == (void *) const { return prime == NULL; }
30
 
    bool operator != (void *) const { return prime != NULL; }
31
 
    bool operator !() const { return !prime; }
32
 
 
33
 
    bool isThere(); // we have a valid initiator pointer
34
 
    Initiator *ptr(); // asserts isThere()
35
 
    void *theCbdata() { return cbdata;}
36
 
 
37
 
private:
38
 
    InitiatorHolder &operator =(const InitiatorHolder &anInitiator);
39
 
 
40
 
    Initiator *prime;
41
 
    void *cbdata;
42
 
};
43
 
 
44
13
/*
45
14
 * The  Initiate is a common base for  queries or transactions
46
15
 * initiated by an Initiator. This interface exists to allow an
56
25
{
57
26
 
58
27
public:
59
 
    Initiate(const char *aTypeName, Initiator *anInitiator);
 
28
    Initiate(const char *aTypeName);
60
29
    virtual ~Initiate();
61
30
 
 
31
    void initiator(const CbcPointer<Initiator> &i); ///< sets initiator
 
32
 
62
33
    // communication with the initiator
63
34
    virtual void noteInitiatorAborted() = 0;
64
35
 
71
42
 
72
43
    virtual const char *status() const; // for debugging
73
44
 
74
 
    InitiatorHolder theInitiator;
 
45
    CbcPointer<Initiator> theInitiator;
75
46
 
76
47
private:
77
48
    Initiate(const Initiate &); // no definition