|
|
Asynchronous file transfer operations allow data to be transferred to or from user supplied buffers. A callback is invoked on each transfer. Transfer stops when the available buffers are exhausted.
enum Event { DATA = 1, FLUSHING = 2, ERROR_CHECK_ERRNO = 4, END_OF_FILE = 8 } | Event |
typedef XorpCallback4<void, Event, const uint8_t*, size_t, size_t>::RefPtr Callback | Callback |
Callback type user provides when adding buffers to sub-classes AsyncFileOperator. Callback's are on a per buffer basis and invoked any time some I/O is performed. The offset field refers to the offset of the last byte read, or written, from the start of the buffer.
Callback has arguments: ErrorCode e, uint8_t* buffer, size_t buffer_bytes, size_t offset
size_t buffers_remaining ()
| buffers_remaining |
[const pure virtual]
Returns: the number of buffers available.
void flush_buffers ()
| flush_buffers |
[pure virtual]
Stop asynchronous operation and clear list of buffers.
bool start ()
| start |
[pure virtual]
Start asynchronous operation.
Returns: true on success, false if no buffers are available.
void stop ()
| stop |
[pure virtual]
inline bool resume ()
| resume |
Resume stopped asynchronous operation.
Returns: true on success, false if no buffers are available.
inline bool running ()
| running |
[const]
Returns: true if asynchronous I/O is started.
inline int fd ()
| fd |
[const]
Returns: file descriptor undergoing asynchronous operation.
AsyncFileOperator (EventLoop& e, int fd)
| AsyncFileOperator |
[protected]
~AsyncFileOperator ()
| ~AsyncFileOperator |
[protected virtual]
EventLoop& _eventloop | _eventloop |
[protected]
int _fd | _fd |
[protected]
bool _running | _running |
[protected]