|
|
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, OS_ERROR = 4, END_OF_FILE = 8, WOULDBLOCK = 16 } | 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]
bool resume ()
| resume |
Resume stopped asynchronous operation.
Returns: true on success, false if no buffers are available.
bool running ()
| running |
[const]
Returns: true if asynchronous I/O is started.
XorpFd fd ()
| fd |
[const]
Returns: file descriptor undergoing asynchronous operation.
int error ()
| error |
[const]
Returns: the last error code returned by the underlying OS.
AsyncFileOperator (EventLoop& e, XorpFd fd,
int priority = XorpTask::PRIORITY_DEFAULT)
| AsyncFileOperator |
[protected]
~AsyncFileOperator ()
| ~AsyncFileOperator |
[protected virtual]
EventLoop& _eventloop | _eventloop |
[protected]
XorpFd _fd | _fd |
[protected]
bool _running | _running |
[protected]
int _last_error | _last_error |
[protected]
int _priority | _priority |
[protected]