]> git.ipfire.org Git - thirdparty/squid.git/blob - src/CommRead.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / CommRead.h
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /* DEBUG: section 05 Comm */
10
11 #ifndef COMMREAD_H
12 #define COMMREAD_H
13
14 #include "base/CbDataList.h"
15 #include "comm.h"
16 #include "comm/forward.h"
17 #include "CommCalls.h"
18
19 class CommRead
20 {
21
22 public:
23 CommRead();
24 CommRead(const Comm::ConnectionPointer &c, char *buf, int len, AsyncCall::Pointer &callback);
25 Comm::ConnectionPointer conn;
26 char *buf;
27 int len;
28 AsyncCall::Pointer callback;
29 };
30
31 class DeferredRead
32 {
33
34 public:
35 typedef void DeferrableRead(void *context, CommRead const &);
36 DeferredRead ();
37 DeferredRead (DeferrableRead *, void *, CommRead const &);
38 void markCancelled();
39 DeferrableRead *theReader;
40 void *theContext;
41 CommRead theRead;
42 bool cancelled;
43 AsyncCall::Pointer closer; ///< internal close handler used by Comm
44
45 private:
46 };
47
48 class DeferredReadManager
49 {
50
51 public:
52 ~DeferredReadManager();
53 void delayRead(DeferredRead const &);
54 void kickReads(int const count);
55
56 private:
57 static CLCB CloseHandler;
58 static DeferredRead popHead(CbDataListContainer<DeferredRead> &deferredReads);
59 void kickARead(DeferredRead const &);
60 void flushReads();
61 CbDataListContainer<DeferredRead> deferredReads;
62 };
63
64 #endif /* COMMREAD_H */
65