]>
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"
12 /// Type of IO callbacks the Comm layer deals with.
19 /// Details about a particular Comm IO callback event.
24 Comm::ConnectionPointer conn
;
25 AsyncCall::Pointer callback
;
33 unsigned int quotaQueueReserv
; ///< reservation ID from CommQuotaQueue
36 bool active() const { return callback
!= NULL
; }
37 void setCallback(iocb_type type
, AsyncCall::Pointer
&cb
, char *buf
, FREE
*func
, int sz
);
39 /// called when fd needs to write but may need to wait in line for its quota
40 void selectOrQueueWrite();
42 /// Actively cancel the given callback
43 void cancel(const char *reason
);
45 /// finish the IO operation imediately and schedule the callback with the current state.
46 void finish(comm_err_t code
, int xerrn
);
52 /// Entry nodes for the IO callback table: iocb_table
53 /// Keyed off the FD which the event applies to.
62 /// Table of scheduled IO events which have yet to be processed ??
63 /// Callbacks which might be scheduled in future are stored in fd_table.
64 extern CbEntry
*iocb_table
;
66 void CallbackTableInit();
67 void CallbackTableDestruct();
69 #define COMMIO_FD_READCB(fd) (&Comm::iocb_table[(fd)].readcb)
70 #define COMMIO_FD_WRITECB(fd) (&Comm::iocb_table[(fd)].writecb)
74 #endif /* _SQUID_COMM_IOCALLBACK_H */