#include <glassclient.h>
Public Member Functions | |
GlassClient (Protocol *p, const char *server) throw (Exception) | |
~GlassClient () | |
unsigned int | getTotalNodes (void) |
std::set< nodeId > | getClientList (void) |
bool | isMaster (void) |
void | killAll (void) |
Protected Member Functions | |
void | execute (void) |
void | cleanup (void) |
bool | sendPacket (Packet &p) |
virtual bool | rootPacket (Packet &p) |
virtual nodeId | registerNode (nodeFD fd) |
Protected Attributes | |
string | server |
boost::condition_variable | cond |
boost::mutex | mut |
nodeId | serverId |
Definition at line 35 of file glassclient.h.
Constructor.
p | The protocol to use. | |
server | The server name or IP. |
Exception. |
libglass::GlassClient::~GlassClient | ( | ) |
void libglass::GlassClient::cleanup | ( | void | ) | [protected, virtual] |
Thread method.
Implements libglass::GlassThread.
void libglass::GlassClient::execute | ( | void | ) | [protected, virtual] |
Thread method.
Implements libglass::GlassThread.
std::set<nodeId> libglass::GlassClient::getClientList | ( | void | ) |
Returns the list of all client nodes.
The returned value is not guaranteed to be valid, as nodes may join or leave at any time.
unsigned int libglass::GlassClient::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.
The returned number is not guaranteed to be valid, as nodes may join or leave at any time.
Reimplemented from libglass::Glass.
bool libglass::GlassClient::isMaster | ( | void | ) |
Is this node the master?
true | if this is the node with lowest id. | |
false | otherwise. |
void libglass::GlassClient::killAll | ( | void | ) |
Close all nodes, including this one.
Registers a node.
fd | A valid node descriptor. |
Implements libglass::Glass.
virtual bool libglass::GlassClient::rootPacket | ( | Packet & | p | ) | [protected, virtual] |
Responsible for processing
p | The packet to process. |
True | on success. | |
False | . |
Implements libglass::Glass.
bool libglass::GlassClient::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.
boost::condition_variable libglass::GlassClient::cond [protected] |
initialization condition variable
Definition at line 47 of file glassclient.h.
boost::mutex libglass::GlassClient::mut [protected] |
initialization mutex
Definition at line 48 of file glassclient.h.
string libglass::GlassClient::server [protected] |
server name
Definition at line 45 of file glassclient.h.
nodeId libglass::GlassClient::serverId [protected] |
Definition at line 49 of file glassclient.h.