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

« back to all changes in this revision

Viewing changes to src/AsyncCall.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: AsyncCall.h,v 1.2 2007/05/08 16:15:50 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_ASYNCCALL_H
 
35
#define SQUID_ASYNCCALL_H
 
36
 
 
37
//#include "cbdata.h"
 
38
#include "event.h"
 
39
 
 
40
// A call is asynchronous if the caller proceeds after the call is made,
 
41
// and the callee receives the call during the next main loop iteration.
 
42
// Asynchronous calls help avoid nasty call-me-when-I-call-you loops
 
43
// that humans often have trouble understanding or implementing correctly.
 
44
 
 
45
// Asynchronous calls are currently implemented via Squid events. The call
 
46
// event stores the pointer to the callback function and cbdata-protected
 
47
// callback data. To call a method of an object, the method is wrapped
 
48
// in a method-specific, static callback function and the pointer to the
 
49
// object is passed to the wrapper. For the method call to be safe, the 
 
50
// class must be cbdata-enabled.
 
51
 
 
52
// You do not have to use the macros below to make or receive asynchronous
 
53
// method calls, but they give you a uniform interface and handy call 
 
54
// debugging.
 
55
 
 
56
// See AsyncCall.cc for a usage sketch.
 
57
 
 
58
 
 
59
// Make an asynchronous object->callName() call.
 
60
#define AsyncCall(debugSection, debugLevel, objectPtr, callName) \
 
61
    scheduleAsyncCall((debugSection), (debugLevel), __FILE__, __LINE__, \
 
62
        (objectPtr), #callName, \
 
63
        &(callName ## Wrapper))
 
64
 
 
65
// Declare and define a wrapper for an asynchronous call handler method
 
66
#define AsyncCallWrapper(debugSection, debugLevel, ClassName, callName) \
 
67
static \
 
68
void callName ## Wrapper(void *data) { \
 
69
    ClassName *objectPtr = static_cast<ClassName*>(data); \
 
70
    if (enterAsyncCallWrapper((debugSection), (debugLevel), data, #ClassName, #callName)) { \
 
71
        objectPtr->callName(); \
 
72
        exitAsyncCallWrapper((debugSection), (debugLevel), data, #ClassName, #callName); \
 
73
    } \
 
74
}
 
75
 
 
76
 
 
77
// Hint: to customize debugging of asynchronous messages in a class, provide
 
78
// class method called scheduleAsyncCall, enterAsyncCallWrapper, and/or
 
79
// exitAsyncCallWrapper. Class method will take priority over these globals.
 
80
 
 
81
extern void scheduleAsyncCall(int debugSection, int debugLevel,
 
82
    const char *fileName, int fileLine, void *objectPtr, const char *callName,
 
83
    EVH *wrapper, bool cbdataProtected = true);
 
84
 
 
85
extern bool enterAsyncCallWrapper(int debugSection, int debugLevel,
 
86
    void *objectPtr, const char *className, const char *methodName);
 
87
 
 
88
extern void exitAsyncCallWrapper(int debugSection, int debugLevel,
 
89
    void *objectPtr, const char *className, const char *methodName);
 
90
 
 
91
 
 
92
#endif /* SQUID_ASYNCCALL_H */