class AsyncFileOperator

Base class for asynchronous file transfer operations. More...

 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Types

Public Methods

Protected Methods

Protected Members

Detailed Description

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 }


typedef XorpCallback4<void, Event, const uint8_t*, size_t, size_t>::RefPtr 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 ()


[const pure virtual]

Returns: the number of buffers available.

void  flush_buffers ()


[pure virtual]

Stop asynchronous operation and clear list of buffers.

bool  start ()


[pure virtual]

Start asynchronous operation.

Returns: true on success, false if no buffers are available.

void  stop ()


[pure virtual]

Stop asynchronous operation.

bool  resume ()


Resume stopped asynchronous operation.

Returns: true on success, false if no buffers are available.

bool  running ()



Returns: true if asynchronous I/O is started.

XorpFd  fd ()



Returns: file descriptor undergoing asynchronous operation.

int  error ()



Returns: the last error code returned by the underlying OS.

 AsyncFileOperator (EventLoop& e, XorpFd fd, int priority = XorpTask::PRIORITY_DEFAULT)



 ~AsyncFileOperator ()


[protected virtual]

EventLoop& _eventloop



XorpFd _fd



bool _running



int _last_error



int _priority



Generated by: pavlin on on Wed Jan 7 19:10:36 2009, using kdoc 2.0a54+XORP.