Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

Cabal::Channel Class Reference

Main cabal callback class. More...

#include <cabal_channel.h>

Inheritance diagram for Cabal::Channel:

Inheritance graph
[legend]
Collaboration diagram for Cabal::Channel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Channel (const long bwidth=0)
void addSocket (Socket *skt)
 Subscribe a socket.

void removeSocket (Socket *skt)
 Unsuscribe a socket.

void schedule (Connection *con, const Priority prio)
 Schedule a connection for immediate or deferred transmission.

void deschedule (const Connection *con, const Priority prio, const bool complete=false)
 Cancels existing schedulation request.

void deschedule (const Connection *con)
 Cancels existing schedulation requests on all the lists.

bool process (MSECS msecs)
 Does a single processing loop, with a maximum given wait.


Detailed Description

Main cabal callback class.

This class provides callback network support.

Todo:
better documentation

Definition at line 38 of file cabal_channel.h.


Member Function Documentation

void Cabal::Channel::deschedule const Connection con  )  [inline]
 

Cancels existing schedulation requests on all the lists.

To be sure...

Definition at line 119 of file cabal_channel.h.

References deschedule().

void Cabal::Channel::deschedule const Connection con,
const Priority  prio,
const bool  complete = false
 

Cancels existing schedulation request.

The priority list indicated with prio parameter is searched for the connection. If found, the connection is removed from the list. If complete is false (default), the function then stop scanning the list and returns, otherwise it continues removing other eventual scheduled references to con.

Notice that having more than one scheduled instance of a connection should be considered a pathological condition, and generally a thing to avoid (by i.e. scheduling the connection only via its transmission).

Definition at line 82 of file ltlib/cabal_channel.cpp.

Referenced by deschedule(), and Cabal::Connection::~Connection().

bool Cabal::Channel::process MSECS  msecs  ) 
 

Does a single processing loop, with a maximum given wait.

All the subscribed sockets having transmissions due to transmit are listened for ready-to-send signal, and all the sockets having receptions are listened for incoming data.

All the sockets having positive test are sent to the relative transmissions an dreceptions.

If msecs expires before any positive output-due sockets are found writable and input-due socket are found readable, the function returns.

If msecs is zero, the function doesn't wait; it just checks for sockets being immediately writeable or readable, and performs operations on that sockets.

If msecs is -1 waits forever until at least one socket is read or written.

Note:
The function is cancelation safe: wait points are engaged being ready to be canceled in multithreading environments. Anyhow, transmission and reception cancelation safety must be granted by the application that defines them.
Parameters:
msecs maximum wait time, 0 for none and -1 for infinite.
Returns:
false if wait time elapse without any I/O operation, true otherwise. May return false also on infinite wait if interrupt signals are caught during waits.

Definition at line 101 of file ltlib/cabal_channel.cpp.

References Cabal::Socket::closed(), Cabal::Socket::decref(), Cabal::Connection::line(), Cabal::Socket::osError(), Cabal::Socket::rawSocket(), Cabal::Socket::reception(), Cabal::Line::remove(), Cabal::Connection::socket(), and Cabal::Connection::transmission().

void Cabal::Channel::schedule Connection con,
const Priority  prio
 

Schedule a connection for immediate or deferred transmission.

Notice that scheduling a connection does not sets an ownership relationship on the channel. The connections are owned by the Cabal::Line class, which is available for be integrated into application data.

Connection (non virtual) destructor deschedule itself from the channel, making sure that the channel doesn't try to call the connection after destruction (except in case of multithreading race conditions that must be handled at application level).

Parameters:
con the connection to be scheduled.
prio the priority level.

Definition at line 58 of file ltlib/cabal_channel.cpp.

References Cabal::Connection::nextSchedule().

Referenced by Cabal::Connection::schedule().


The documentation for this class was generated from the following files:
Generated on Sat Apr 10 17:41:49 2004 for Cabal by doxygen 1.3.5