]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/comm/IoCallback.h
1 #ifndef _SQUID_COMM_IOCALLBACK_H
2 #define _SQUID_COMM_IOCALLBACK_H
4 #include "base/AsyncCall.h"
5 #include "comm/forward.h"
6 #include "comm_err_t.h"
14 /// Type of IO callbacks the Comm layer deals with.
21 /// Details about a particular Comm IO callback event.
26 Comm::ConnectionPointer conn
;
27 AsyncCall::Pointer callback
;
35 unsigned int quotaQueueReserv
; ///< reservation ID from CommQuotaQueue
38 bool active() const { return callback
!= NULL
; }
39 void setCallback(iocb_type type
, AsyncCall::Pointer
&cb
, char *buf
, FREE
*func
, int sz
);
41 /// called when fd needs to write but may need to wait in line for its quota
42 void selectOrQueueWrite();
44 /// Actively cancel the given callback
45 void cancel(const char *reason
);
47 /// finish the IO operation imediately and schedule the callback with the current state.
48 void finish(comm_err_t code
, int xerrn
);
54 /// Entry nodes for the IO callback table: iocb_table
55 /// Keyed off the FD which the event applies to.
64 /// Table of scheduled IO events which have yet to be processed ??
65 /// Callbacks which might be scheduled in future are stored in fd_table.
66 extern CbEntry
*iocb_table
;
68 void CallbackTableInit();
69 void CallbackTableDestruct();
71 #define COMMIO_FD_READCB(fd) (&Comm::iocb_table[(fd)].readcb)
72 #define COMMIO_FD_WRITECB(fd) (&Comm::iocb_table[(fd)].writecb)
76 #endif /* _SQUID_COMM_IOCALLBACK_H */