2
#ifndef SQUID_BODY_READER_H
3
#define SQUID_BODY_READER_H
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 *);
10
class BodyReader : public RefCountable
14
typedef RefCount<BodyReader> Pointer;
15
BodyReader(size_t len, BodyReadFunc *r, BodyAbortFunc *a, BodyKickFunc *k, void *d);
17
void read(CBCB *, void *);
18
void notify(size_t now_available);
19
size_t remaining() { return _remaining; }
21
bool callbackPending();
22
bool consume(size_t size);
26
/* reduce the number of bytes that the BodyReader is looking for.
27
* Will trigger an assertion if it tries to reduce below zero
29
void reduce_remaining(size_t size);
37
* These are for interacting with things that
38
* "provide" body content. ie, ConnStateData and
39
* ICAPReqMod after adapation.
41
BodyReadFunc *read_func;
42
BodyAbortFunc *abort_func;
43
BodyKickFunc *kick_func;
47
* These are for interacting with things that
48
* "consume" body content. ie, HttpStateData and
49
* ICAPReqMod before adaptation.
52
void *read_callback_data;