Main Page | Class List | Directories | File List | Class Members

RNReplicaNet::RNLobby::CodeClient Class Reference

This code client queries for the validity of codes with the RNLobby::CodeServer. More...

#include <CodeClient.h>

List of all members.

Public Member Functions

bool Start (const char *code, const int nOnce1=0, const int nOnce2=0)
bool Stop (bool hardware=false)
bool GetCompleted (void)
CodeServer::Reply GetReply (void)
int GetUserSuppliedReply (void)
void GetNOnces (int &nOnce1, int &nOnce2)
 When there is a successful reply two random integers are generated by the CodeServer.
void SetEncryptionKey (const void *data, const int length)
void SetServer (const XPAddress address)


Detailed Description

This code client queries for the validity of codes with the RNLobby::CodeServer.


Member Function Documentation

bool RNReplicaNet::RNLobby::CodeClient::GetCompleted void   ) 
 

Tests the completion state of the last query. When the query completes the result can be retrieved by using GetReply()

Returns:
A completed query returns true, a pending query returns false.

CodeServer::Reply RNReplicaNet::RNLobby::CodeClient::GetReply void   ) 
 

Returns the last reply from a completed query.

Returns:
The last reply from a completed query.

int RNReplicaNet::RNLobby::CodeClient::GetUserSuppliedReply void   ) 
 

Returns the last user supplied reply value from a completed query. See CodeServer::AddCode() for more details about a user supplied reply.

Returns:
The user supplied reply.

void RNReplicaNet::RNLobby::CodeClient::SetEncryptionKey const void *  data,
const int  length
 

Sets the encryption key to be used by all queries for this client. The same key must be used with any RNLobby::CodeServer responding to queries from this client. The default encryption key is the same for RNLobby::CodeServer and RNLobby::CodeClient.

Parameters:
data the data to use as a seed for the key. This can be NULL to use the default key.
length the length of the data to use for creating the key

void RNReplicaNet::RNLobby::CodeClient::SetServer const XPAddress  address  ) 
 

Sets the address and port of the server. The default for the instance of the class is localhost and port CodeServer::kDefaultPort

Parameters:
address The new address and port number to use for the server

bool RNReplicaNet::RNLobby::CodeClient::Start const char *  code,
const int  nOnce1 = 0,
const int  nOnce2 = 0
 

Starts a code query. This query is asynchronous and can be stopped by using Stop(). If a code is requested for the same key within the CodeServer timeout period without supplying valid nonce values the key query will result in kReply_KeyInUse. If these values are used for future CodeClient::Start() calls with the same code value then the result will be a successful key query.

Parameters:
code The code to query with the server. This buffer must be a null terminated string. The buffer contents is copied by a pending query so it can be deallocated after using this call.
nOnce1 The first nonce.
nOnce2 The second nonce.
Returns:
Success returns true, failure returns false.

bool RNReplicaNet::RNLobby::CodeClient::Stop bool  hardware = false  ) 
 

Stops the current code query thread.

Parameters:
hardware If true this stops the network hardware. The default is false.
Returns:
Success returns true, failure returns false.


The documentation for this class was generated from the following file:
Generated on Sun Oct 30 01:12:44 2005 for RNLobby by  doxygen 1.4.1