ArClientSwitchManager Class Reference

#include <ArClientSwitchManager.h>

Inheritance diagram for ArClientSwitchManager:

ArASyncTask ArThread List of all members.

Detailed Description

The serverInfoFile takes the form of a config file roughly, there are 3 things you can put in it now. 'user user', 'password password' and 'serverKey serverKey'. Note that it loads these files sequentially so if you pass it 5 files it'll read them in the order they were passed in. If you give it just the keyword but not the value (ie 'user') then it'll clear out that value.

Some program command line options can be used to configure this class:


Public Member Functions

 ArClientSwitchManager (ArServerBase *serverBase, ArArgumentParser *parser)
void clientSwitch (ArNetPacket *packet)
 The handler for the response to the switch command.
const char * getCentralServerHostName (void)
 Gets the hostname we're using for the central server (NULL means we're not trying to sue the central server).
bool getDebugLogging (void)
 Gets if this is using debug logging.
bool isConnected (void)
 Returns if we're connected or not.
void logOptions (void) const
 Log the options the simple connector has.
void netCentralHeartbeat (ArServerClient *client, ArNetPacket *packet)
 The handler for the packet to let the server know we're still talking to it.
void netCentralServerHeartbeat (ArServerClient *client, ArNetPacket *packet)
bool parseArgs (void)
 Function to parse the arguments given in the constructor.
bool parseFile (const char *fileName)
 Parses the file for holding the user, password, and server key.
virtual void * runThread (void *arg)
void setDebugLogging (bool debugLogging=false)
 Sets debug logging.

Protected Types

enum  State {
  IDLE, TRYING_CONNECTION, CONNECTING, CONNECTED,
  LOST_CONNECTION
}

Protected Member Functions

bool filePasswordCallback (ArArgumentBuilder *arg)
bool fileServerKeyCallback (ArArgumentBuilder *arg)
bool fileUserCallback (ArArgumentBuilder *arg)
bool processFile (void)
void socketClosed (void)
void switchState (State state)

Protected Attributes

std::string myCentralServer
int myCentralServerPort
ArClientBasemyClient
ArMutex myDataMutex
bool myDebugLogging
ArFileParser myFileParser
ArRetFunctor1C< bool, ArClientSwitchManager,
ArArgumentBuilder * > 
myFilePasswordCB
ArRetFunctor1C< bool, ArClientSwitchManager,
ArArgumentBuilder * > 
myFileServerKeyCB
ArRetFunctor1C< bool, ArClientSwitchManager,
ArArgumentBuilder * > 
myFileUserCB
std::string myIdentifier
ArTime myLastConnectionAttempt
ArTime myLastTcpHeartbeat
ArTime myLastUdpHeartbeat
ArConstFunctorC< ArClientSwitchManagermyLogOptionsCB
ArFunctor2C< ArClientSwitchManager,
ArServerClient *, ArNetPacket * > 
myNetCentralHeartbeatCB
ArFunctor2C< ArClientSwitchManager,
ArServerClient *, ArNetPacket * > 
myNetCentralServerHeartbeatCB
ArRetFunctorC< bool, ArClientSwitchManagermyParseArgsCB
ArArgumentParsermyParser
std::string myPassword
ArRetFunctorC< bool, ArClientSwitchManagermyProcessFileCB
ArServerBasemyServer
double myServerBackupTimeout
ArServerClientmyServerClient
bool myServerHasHeartbeat
double myServerHeartbeatTimeout
std::string myServerKey
double myServerUdpHeartbeatTimeout
ArFunctorC< ArClientSwitchManagermySocketClosedCB
ArTime myStartedState
State myState
ArFunctor1C< ArClientSwitchManager,
ArNetPacket * > 
mySwitchCB
bool myTryConnection
std::string myUser


Member Enumeration Documentation

enum ArClientSwitchManager::State [protected]

Enumerator:
IDLE  Don't want to connect.
TRYING_CONNECTION  If we're trying to connect.
CONNECTING  If we're waiting for the response from the server.
CONNECTED  If we're connected.
LOST_CONNECTION  If we lost a connection... wait a bit and try again.


Member Function Documentation

void ArClientSwitchManager::netCentralServerHeartbeat ( ArServerClient client,
ArNetPacket packet 
)

The handler for the packet that comes from the server so we know we're getting these


The documentation for this class was generated from the following file:
Generated on Thu Aug 6 09:40:12 2009 for ArNetworking by  doxygen 1.5.1