#include <glassserver.h>
Classes | |
class | GlassServerConnection |
Public Member Functions | |
GlassServer (Protocol *p) throw (Exception) | |
~GlassServer () | |
void | stop (void) |
unsigned int | getTotalNodes (void) |
Protected Member Functions | |
Protocol * | getProtocol (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 |
GlassServerConnection * | sc |
Friends | |
class | GlassServerConnection |
Definition at line 38 of file glassserver.h.
Constructor.
p | The protocol to use. |
Exception. |
libglass::GlassServer::~GlassServer | ( | ) |
Protocol* libglass::GlassServer::getProtocol | ( | void | ) | const [protected] |
Returns our protocol. Used by GlassServerConnection.
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.
Reimplemented from libglass::Glass.
Registers a node.
fd | A valid node descriptor. |
Implements libglass::Glass.
virtual bool libglass::GlassServer::rootPacket | ( | Packet & | p | ) | [protected, virtual] |
Responsible for processing
p | The packet to process. |
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.
p | The packet to send. |
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.
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.
id | The node id. |
True | if successful. | |
False | if not in list. |
fd | The node fd. |
Reimplemented from libglass::Glass.
bool libglass::GlassServer::updateClients | ( | void | ) | [protected] |
Updates data relevant to clients (number, list)
true | ||
false |
friend class GlassServerConnection [friend] |
Definition at line 56 of file glassserver.h.
unsigned int libglass::GlassServer::clientnum [protected] |
Number of connected clients.
Definition at line 40 of file glassserver.h.
nodeId libglass::GlassServer::master [protected] |
current master id
Definition at line 41 of file glassserver.h.
GlassServerConnection* libglass::GlassServer::sc [protected] |
our server listener
Definition at line 58 of file glassserver.h.