Main Page   File List   File Members   Related Pages  

frdi_server_game.c File Reference

interpret the game protocol More...

#include "frdi_server.h"

Functions

void frdiServerGameCheckReadyForOutcome (frdi_server_app *self, frdi_server_game *game)
void frdiGameAnnounceOutcomeToHost (frdi_server_app *self, frdi_server_game *game)
void frdiGameAnnounceOutcomeToPlayers (frdi_server_app *self, frdi_server_game *game)
char * frdiServerGameUseridFromClient (frdi_server_app *self, frdi_server_game *game, frdi_server_client *client)
frdi_server_client * frdiServerGameClientFromName (frdi_server_app *self, frdi_server_game *game, char *name)
void frdiServerGameInitialiseSeed (frdi_server_app *self, frdi_server_game *game)
void frdiServerGameInitialiseInput (frdi_server_app *self, frdi_server_game *game)
void frdiServerGameSetGameStage (frdi_server_app *self, frdi_server_game *game, int stage)
void frdiServerGameSetUserStatus (frdi_server_app *self, frdi_server_game *game, frdi_server_client *client, int status)
int frdiServerGameIsAllowed (frdi_server_app *self, frdi_server_game *game, char *prefix)
void frdiServerGameRegisterDigest (frdi_server_app *self, frdi_server_game *game, char *user_id, char *digest)
void frdiServerGameReceiveClient (frdi_server_app *self, frdi_server_game *game, frdi_server_client *client, char *str)
void frdiServerGameReceiveHost (frdi_server_app *self, frdi_server_game *game, char *str)
frdi_server_game * frdiServerGameNew (frdi_server_app *self, char *game_id)
void frdiServerGameLog (frdi_server_app *self, frdi_server_game *game, char *str)
void frdiServerGameFinish (frdi_server_app *self, frdi_server_game *game)
char * frdiServerGameReport (frdi_server_app *self, frdi_server_game *game)
char * frdiServerGameDescribe (frdi_server_app *self, frdi_server_game *game)
frdi_server_user * frdiServerUserNew (frdi_server_app *self)
frdi_server_user * frdiServerUserGetFromId (frdi_server_game *game, char *user_id)
frdi_server_user * frdiServerUserGetFromClient (frdi_server_game *game, frdi_server_client *client)
frdi_list * frdiServerUserListMatchStatus (frdi_server_game *game, int status)
char * frdiServerUserDescribe (frdi_server_app *self, frdi_server_user *user)


Detailed Description

interpret the game protocol

Author:
Douglas Reay <douglas-legal@reay.org>
Warning:

Function Documentation

void frdiServerGameCheckReadyForOutcome frdi_server_app *    self,
frdi_server_game *    game
 

if all the plaintexts are in, calculate the outcome and tell the host

void frdiGameAnnounceOutcomeToHost frdi_server_app *    self,
frdi_server_game *    game
 

let the host know what the result is

void frdiGameAnnounceOutcomeToPlayers frdi_server_app *    self,
frdi_server_game *    game
 

let the players know what the result was (starts the verification phase)

char* frdiServerGameUseridFromClient frdi_server_app *    self,
frdi_server_game *    game,
frdi_server_client *    client
 

find the char* user_id from the frdi_server_client *client

frdi_server_client* frdiServerGameClientFromName frdi_server_app *    self,
frdi_server_game *    game,
char *    name
 

return a client object, given the name passed to the host

void frdiServerGameInitialiseSeed frdi_server_app *    self,
frdi_server_game *    game
 

sets up properties

void frdiServerGameInitialiseInput frdi_server_app *    self,
frdi_server_game *    game
 

sets up the host's input

void frdiServerGameSetGameStage frdi_server_app *    self,
frdi_server_game *    game,
int    stage
 

set the games's stage to one of: define FRDI_SERVER_GAME_STAGE_UNSET -1 define FRDI_SERVER_GAME_STAGE_OPENING 1 define FRDI_SERVER_GAME_STAGE_INIT 2 define FRDI_SERVER_GAME_STAGE_RAND 3 define FRDI_SERVER_GAME_STAGE_GENR 4 define FRDI_SERVER_GAME_STAGE_VERI 5 define FRDI_SERVER_GAME_STAGE_CLOSING 6

void frdiServerGameSetUserStatus frdi_server_app *    self,
frdi_server_game *    game,
frdi_server_client *    client,
int    status
 

set the user's status to one of: not connected define FRDI_SERVER_GAME_USER_UNSET -1 connected but not yet accepted by the host define FRDI_SERVER_GAME_USER_CLIENT 1 accepted by the host, but no user_num yet define FRDI_SERVER_GAME_USER_HOST 2 has a user_num allocated by the server define FRDI_SERVER_GAME_USER_SERVER 3 has revealed their usertext define FRDI_SERVER_GAME_USER_USER 4 has finished their verification define FRDI_SERVER_GAME_USER_CONTENT 5

int frdiServerGameIsAllowed frdi_server_app *    self,
frdi_server_game *    game,
char *    prefix
 

check whether a response is allowed at a particular stage

void frdiServerGameRegisterDigest frdi_server_app *    self,
frdi_server_game *    game,
char *    user_id,
char *    digest
 

register a digest

void frdiServerGameReceiveClient frdi_server_app *    self,
frdi_server_game *    game,
frdi_server_client *    client,
char *    str
 

deal with a game str from the client (Note: of all the GameReceive method, this has an extra argument, because of the two directions on each of the three links, this is the only many:one link

  • Similarly, frdiServerGameSendClient also has an extra argument)

void frdiServerGameReceiveHost frdi_server_app *    self,
frdi_server_game *    game,
char *    str
 

deal with a game str from the host

frdi_server_game* frdiServerGameNew frdi_server_app *    self,
char *    game_id
 

create a game object (values get filled in by the create object)

void frdiServerGameLog frdi_server_app *    self,
frdi_server_game *    game,
char *    str
 

log it

void frdiServerGameFinish frdi_server_app *    self,
frdi_server_game *    game
 

de-register and destroy a game object

char* frdiServerGameReport frdi_server_app *    self,
frdi_server_game *    game
 

report the outcome of a game to the server in complete terms

char* frdiServerGameDescribe frdi_server_app *    self,
frdi_server_game *    game
 

describe it

frdi_server_user* frdiServerUserNew frdi_server_app *    self
 

create fake user object

frdi_server_user* frdiServerUserGetFromId frdi_server_game *    game,
char *    user_id
 

return a user obj

frdi_server_user* frdiServerUserGetFromClient frdi_server_game *    game,
frdi_server_client *    client
 

return a user obj

frdi_list* frdiServerUserListMatchStatus frdi_server_game *    game,
int    status
 

return a list of all user_objs that have status X

char* frdiServerUserDescribe frdi_server_app *    self,
frdi_server_user *    user
 

return a string describing an frdi_server_user object


Generated on Wed Aug 18 13:24:06 2004 for Project Fairdice by doxygen1.2.18