libglass::GlassServer Class Reference

#include <glassserver.h>

Inheritance diagram for libglass::GlassServer:

libglass::Glass libglass::GlassServerPeer

List of all members.

Classes

class  GlassServerConnection

Public Member Functions

 GlassServer (Protocol *p) throw (Exception)
 ~GlassServer ()
void stop (void)
unsigned int getTotalNodes (void)

Protected Member Functions

ProtocolgetProtocol (void) const
bool updateClients (void)
int start (void)
virtual bool rootPacket (Packet &p)
virtual bool sendPacket (Packet &p)
virtual nodeId registerNode (nodeFD fd)
virtual bool unregisterNode (nodeId id)
virtual bool unregisterNode (nodeFD fd)

Protected Attributes

unsigned int clientnum
nodeId master
GlassServerConnectionsc

Friends

class GlassServerConnection


Detailed Description

Glass Server class.

Definition at line 38 of file glassserver.h.


Constructor & Destructor Documentation

libglass::GlassServer::GlassServer ( Protocol p  )  throw (Exception)

Constructor.

Parameters:
p The protocol to use.
Exceptions:
Exception. 

libglass::GlassServer::~GlassServer (  ) 


Member Function Documentation

Protocol* libglass::GlassServer::getProtocol ( void   )  const [protected]

Returns our protocol. Used by GlassServerConnection.

Returns:
The protocol.

unsigned int libglass::GlassServer::getTotalNodes ( void   )  [virtual]

Returns the number CLIENT nodes connected to the network.

This function returns the number CLIENT nodes connected to the network. There's only one server around.

Returns:
The number of CLIENT nodes connected to the network, or zero if an error occurred.

Reimplemented from libglass::Glass.

virtual nodeId libglass::GlassServer::registerNode ( nodeFD  fd  )  [protected, virtual]

Registers a node.

Parameters:
fd A valid node descriptor.
Returns:
A new node Id, or nobodyId if an error occurred.
See also:
unregisterNode().

Implements libglass::Glass.

virtual bool libglass::GlassServer::rootPacket ( Packet p  )  [protected, virtual]

Responsible for processing

Parameters:
p The packet to process.
Return values:
True on success.
False .

Implements libglass::Glass.

virtual bool libglass::GlassServer::sendPacket ( Packet p  )  [protected, virtual]

Forwards the packet to the Protocol, guaranteeing protectedness. It is also responsible for translating the Packet's nodeIds to nodeFDs.

Parameters:
p The packet to send.
Return values:
True on success.
False if packet couldn't be sent for some reason.

Reimplemented from libglass::Glass.

int libglass::GlassServer::start ( void   )  [protected]

Main loop.

Returns:

void libglass::GlassServer::stop ( void   ) 

virtual bool libglass::GlassServer::unregisterNode ( nodeFD  fd  )  [protected, virtual]

Reimplemented from libglass::Glass.

virtual bool libglass::GlassServer::unregisterNode ( nodeId  id  )  [protected, virtual]

Unregisters a id/fd association.

Unregisters the relationship too.

Parameters:
id The node id.
Return values:
True if successful.
False if not in list.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
fd The node fd.

Reimplemented from libglass::Glass.

bool libglass::GlassServer::updateClients ( void   )  [protected]

Updates data relevant to clients (number, list)

Return values:
true 
false 


Friends And Related Function Documentation

friend class GlassServerConnection [friend]

Definition at line 56 of file glassserver.h.


Member Data Documentation

unsigned int libglass::GlassServer::clientnum [protected]

Number of connected clients.

Definition at line 40 of file glassserver.h.

current master id

Definition at line 41 of file glassserver.h.

our server listener

Definition at line 58 of file glassserver.h.


The documentation for this class was generated from the following file:

Generated on Fri May 28 13:19:01 2010 for libGlass by  doxygen 1.5.8