]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/comm/Read.h
1 #ifndef _SQUID_COMM_READ_H
2 #define _SQUID_COMM_READ_H
4 #include "base/AsyncCall.h"
6 #include "comm/forward.h"
14 * Start monitoring for read.
16 * callback is scheduled when the read is possible,
17 * or on file descriptor close.
19 void Read(const Comm::ConnectionPointer
&conn
, AsyncCall::Pointer
&callback
);
21 /// whether the FD socket is being monitored for read
22 bool MonitorsRead(int fd
);
25 * Perform a read(2) on a connection immediately.
27 * The returned flag is also placed in params.flag.
29 * \retval COMM_OK data has been read and placed in buf, amount in params.size
30 * \retval COMM_ERROR an error occured, the code is placed in params.xerrno
31 * \retval COMM_INPROGRESS unable to read at this time, or a minor error occured
32 * \retval COMM_ERR_CLOSING 0-byte read has occured.
33 * Usually indicates the remote end has disconnected.
35 comm_err_t
ReadNow(CommIoCbParams
¶ms
, SBuf
&buf
);
37 /// Cancel the read pending on FD. No action if none pending.
38 void ReadCancel(int fd
, AsyncCall::Pointer
&callback
);
40 /// callback handler to process an FD which is available for reading
45 // Legacy API to be removed
46 void comm_read_base(const Comm::ConnectionPointer
&conn
, char *buf
, int len
, AsyncCall::Pointer
&callback
);
47 inline void comm_read(const Comm::ConnectionPointer
&conn
, char *buf
, int len
, AsyncCall::Pointer
&callback
)
50 comm_read_base(conn
, buf
, len
, callback
);
52 void comm_read_cancel(int fd
, IOCB
*callback
, void *data
);
54 #endif /* _SQUID_COMM_READ_H */