~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/BodyReader.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#ifndef SQUID_BODY_READER_H
 
3
#define SQUID_BODY_READER_H
 
4
 
 
5
typedef void CBCB (MemBuf &mb, void *data);
 
6
typedef size_t BodyReadFunc (void *, MemBuf &mb, size_t size);
 
7
typedef void BodyAbortFunc (void *, size_t);
 
8
typedef void BodyKickFunc (void *);
 
9
 
 
10
class BodyReader : public RefCountable
 
11
{
 
12
 
 
13
public:
 
14
    typedef RefCount<BodyReader> Pointer;
 
15
    BodyReader(size_t len, BodyReadFunc *r, BodyAbortFunc *a, BodyKickFunc *k, void *d);
 
16
    ~BodyReader();
 
17
    void read(CBCB *, void *);
 
18
    void notify(size_t now_available);
 
19
    size_t remaining() { return _remaining; }
 
20
 
 
21
    bool callbackPending();
 
22
    bool consume(size_t size);
 
23
 
 
24
    int bytes_read;
 
25
 
 
26
    /* reduce the number of bytes that the BodyReader is looking for.
 
27
     * Will trigger an assertion if it tries to reduce below zero
 
28
     */
 
29
    void reduce_remaining(size_t size);
 
30
 
 
31
private:
 
32
    size_t _remaining;
 
33
    size_t _available;
 
34
    MemBuf theBuf;
 
35
 
 
36
    /*
 
37
     * These are for interacting with things that
 
38
     * "provide" body content.  ie, ConnStateData and
 
39
     * ICAPReqMod after adapation.
 
40
     */
 
41
    BodyReadFunc *read_func;
 
42
    BodyAbortFunc *abort_func;
 
43
    BodyKickFunc *kick_func;
 
44
    void *read_func_data;
 
45
 
 
46
    /*
 
47
     * These are for interacting with things that
 
48
     * "consume" body content. ie, HttpStateData and
 
49
     * ICAPReqMod before adaptation.
 
50
     */
 
51
    CBCB *read_callback;
 
52
    void *read_callback_data;
 
53
    bool doCallback();
 
54
};
 
55
 
 
56
#endif