class WinDispatcher

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

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Methods

Protected Methods


Detailed Description

A WinDispatcher provides an entity where callbacks for pending I/O operations on Windows sockets and other Windows system objects may be registered. The callbacks are invoked when the wait_and_dispatch method is called, and I/O is pending on a descriptor, or a Windows object's state has been set to signalled.

WinDispatcher should only be exposed to EventLoop.

 WinDispatcher (ClockBase *clock)

WinDispatcher

Default constructor.

 ~WinDispatcher ()

~WinDispatcher

[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 IoEventType.

If the XorpFd corresponds to a Windows socket handle, multiple callbacks may be registered for different IoEventTypes, but one and only one callback may be registered for the handle if a callback is registered for the IOT_ACCEPT event.

If the XorpFd corresponds to any other kind of Windows object handle, only a single callback may be registered, and the IoEventType must be IOT_READ. This is because Windows object handles can have a signalled or non-signalled state, and there is no way of telling specific I/O events apart without actually trying to service the I/O, which is beyond the scope of this class's responsibilities.

Parameters:

fda Windows object handle encapsulated in a XorpFd .
typethe IoEventType which should trigger the callback.
cbcallback object which shall be invoked when the event is triggered.

Returns: true if function succeeds, false otherwise.

bool  remove_ioevent_cb (XorpFd fd, IoEventType type)

remove_ioevent_cb

Remove hooks for pending I/O operations.

Parameters:

fdthe file descriptor.
typethe IoEventType to remove the callback for; the special value IOT_ANY may be specified to remove all such callbacks.

Returns: true if function succeeds, false otherwise.

inline void  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.
void  wait_and_dispatch (int ms)

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.
size_t  descriptor_count ()

descriptor_count

[const]

Get the count of the descriptors that have been added.

Returns: the count of the descriptors that have been added.

void  dispatch_sockevent (HANDLE hevent, XorpFd fd)

dispatch_sockevent

[protected]


Generated by: pavlin on possum.icir.org on Wed Aug 2 15:35:43 2006, using kdoc $.