]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/comm/IoCallback.h
b8e60c8b2a63e4148b2c8e05d20621538359edeb
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
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.
9 #ifndef _SQUID_COMM_IOCALLBACK_H
10 #define _SQUID_COMM_IOCALLBACK_H
12 #include "base/AsyncCall.h"
13 #include "comm/Flag.h"
14 #include "comm/forward.h"
15 #include "mem/forward.h"
16 #include "sbuf/forward.h"
21 /// Type of IO callbacks the Comm layer deals with.
28 /// Details about a particular Comm IO callback event.
33 Comm::ConnectionPointer conn
;
34 AsyncCall::Pointer callback
;
42 unsigned int quotaQueueReserv
; ///< reservation ID from CommQuotaQueue
45 bool active() const { return callback
!= NULL
; }
46 void setCallback(iocb_type type
, AsyncCall::Pointer
&cb
, char *buf
, FREE
*func
, int sz
);
48 /// called when fd needs to write but may need to wait in line for its quota
49 void selectOrQueueWrite();
51 /// Actively cancel the given callback
52 void cancel(const char *reason
);
54 /// finish the IO operation imediately and schedule the callback with the current state.
55 void finish(Comm::Flag code
, int xerrn
);
61 /// Entry nodes for the IO callback table: iocb_table
62 /// Keyed off the FD which the event applies to.
71 /// Table of scheduled IO events which have yet to be processed ??
72 /// Callbacks which might be scheduled in future are stored in fd_table.
73 extern CbEntry
*iocb_table
;
75 void CallbackTableInit();
76 void CallbackTableDestruct();
78 #define COMMIO_FD_READCB(fd) (&Comm::iocb_table[(fd)].readcb)
79 #define COMMIO_FD_WRITECB(fd) (&Comm::iocb_table[(fd)].writecb)
83 #endif /* _SQUID_COMM_IOCALLBACK_H */