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