class SelectorList

A class to provide an interface to I/O multiplexing. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Methods

Protected Methods


Detailed Description

A SelectorList provides an entity where callbacks for pending I/O operations on file descriptors may be registered. The callbacks are invoked when one of the wait_and_dispatch methods is called and I/O is pending on the particular descriptors.

 SelectorList (ClockBase* clock)

SelectorList

Default constructor.

 ~SelectorList ()

~SelectorList

[virtual]

Destructor.

bool  add_ioevent_cb (XorpFd fd, IoEventType type, const IoEventCb& cb)

add_ioevent_cb

Add a hook for pending I/O operations on a callback.

Only one callback may be registered for each possible I/O event type (read, write, exception).

Multiple event types may share the same callback. If multiple event types share the same callback and multiple types of event are pending, the callback is invoked just once and the mask argument to the callback shows which events are pending.

Parameters:

filedescriptor.
maskmask of I/O event types that should invoke callback. An OR'ed combination of the available SelectorMask values.
scbcallback object that will be invoked when the descriptor.

Returns: true if function succeeds, false otherwise.

void  remove_ioevent_cb (XorpFd fd, IoEventType type = IOT_ANY)

remove_ioevent_cb

Remove hooks for pending I/O operations.

Parameters:

fdthe file descriptor.
maskof event types to be removed, e.g. an OR'ed combination of the available SelectorMask values.
int  wait_and_dispatch (TimeVal *timeout)

wait_and_dispatch

Wait for a pending I/O events and invoke callbacks when they become ready.

Parameters:

timeoutthe maximum period to wait for.

Returns: the number of callbacks that were made.

int  wait_and_dispatch (int millisecs)

wait_and_dispatch

Wait for a pending I/O events and invoke callbacks when they become ready.

Parameters:

millisecsthe maximum period in milliseconds to wait for.

Returns: the number of callbacks that were made.

inline size_t  descriptor_count ()

descriptor_count

[const]

void  get_fd_set (SelectorMask selected_mask, fd_set& fds)

get_fd_set

[const]

Get a copy of the current list of monitored file descriptors in Unix fd_set format

Parameters:

theselected mask as SelectorMask (SEL_RD, SEL_WR, or SEL_EX)

Returns: the selected fd_set.

int  get_max_fd ()

get_max_fd

[const]

Get a the value of the largest monitored file descriptor

Returns: the maximum fd.

void  set_observer (SelectorListObserverBase& obs)

set_observer

Set the SelectorObserver object that will receive notifications

Returns: void

void  remove_observer ()

remove_observer

Remove the SelectorObserver object that receives notifications

Returns: void

void  callback_bad_descriptors ()

callback_bad_descriptors

[protected]


Generated by: pavlin on possum.icir.org on Thu Mar 9 04:41:55 2006, using kdoc $.