Main Page   File List   File Members   Related Pages  

frdi_server.h File Reference

function headers and defines for the server package More...

#include "../shared/frdi.h"

Go to the source code of this file.

Compounds

struct  frdi__server_app
struct  frdi__server_host
struct  frdi__server_client
struct  frdi__server_user
struct  frdi__server_game

Functions

frdi_server_app * frdiServerAppNew (frdi_app *app)
int frdiServerAppRun (frdi_server_app *self)
void frdiServerAppFree (frdi_server_app *self)
char * frdiServerAppDisplay (frdi_server_app *self)
void frdiServerPV (frdi_server_app *self, char *str)
void frdiServerPVF (frdi_server_app *self, char *format, void *arg)
void * frdiServerClientListenerSpawner (void *arg)
void * frdiServerHostListenerSpawner (void *arg)
void frdiServerClientListenerWaitStop (frdi_server_app *self)
void frdiServerHostListenerWaitStop (frdi_server_app *self)
void frdiServerClientListenerTellStop (frdi_server_app *self)
void frdiServerHostListenerTellStop (frdi_server_app *self)
void frdiServerClientListenerTellStart (frdi_server_app *self)
void frdiServerHostListenerTellStart (frdi_server_app *self)
frdi_server_client * frdiServerClientInitialise (frdi_server_app *self, frdi_connection *connection)
frdi_server_host * frdiServerHostInitialise (frdi_server_app *self, frdi_connection *connection)
void frdiServerClientFinalise (frdi_server_app *self, frdi_server_client *client)
void frdiServerHostFinalise (frdi_server_app *self, frdi_server_host *host)
void frdiServerClientRecieve (frdi_server_app *self, frdi_connection *connection, frdi_message *message)
void frdiServerHostRecieve (frdi_server_app *self, frdi_connection *connection, frdi_message *message)
void frdiServerClientMessageSend (frdi_server_app *self, frdi_server_client *client, frdi_message *message)
void frdiServerHostMessageSend (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
char * frdiServerClientDisplay (frdi_server_app *self, frdi_server_client *client)
char * frdiServerHostDisplay (frdi_server_app *self, frdi_server_host *host)
void frdiServerClientMessageRecieve (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void * frdiServerHostMessageRecieve (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
void frdiServerHostMsU (frdi_server_app *self, frdi_server_host *host, frdi_message *old_message)
void frdiServerClientMsU (frdi_server_app *self, frdi_server_client *client, frdi_message *old_message)
void frdiServerTellClientStop (frdi_server_app *self, frdi_server_client *client)
void frdiServerTellHostStop (frdi_server_app *self, frdi_server_host *host)
void frdiServerTellAllStop (frdi_server_app *self)
void frdiServerTellAllStopped (frdi_server_app *self)
void frdiServerGameSendClient (frdi_server_app *self, frdi_server_game *game, frdi_server_client *client, char *str)
void frdiServerGameSendClients (frdi_server_app *self, frdi_server_game *game, char *str)
void frdiServerClientMrD (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void frdiServerClientMrG (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void frdiServerClientMrK (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void frdiServerClientMrL (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void frdiServerClientMrM (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void frdiServerClientMrR (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void frdiServerClientMrU (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void frdiServerClientMrV (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message)
void frdiServerClientMrE (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, frdi_message *message, char c)
void frdiServerGameSendUsers (frdi_server_app *self, frdi_server_game *game, frdi_list *user_list, char *str)
frdi_server_host * frdiServerHostFromGameId (frdi_server_app *self, frdi_server_client *client, char *game_id)
void frdiServerGameSendHost (frdi_server_app *self, frdi_server_game *game, char *str)
void frdiServerHostMrD (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
void frdiServerHostMrF (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
void frdiServerHostMrG (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
void frdiServerHostMrK (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
void frdiServerHostMrL (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
void frdiServerHostMrR (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
void frdiServerHostMrU (frdi_server_app *self, frdi_server_host *host, frdi_message *message)
void frdiServerHostMrE (frdi_server_app *self, frdi_server_host *host, frdi_message *message, char c)
char * frdiServerGameReport (frdi_server_app *self, frdi_server_game *game)
void frdiServerGameInitialiseSeed (frdi_server_app *self, frdi_server_game *game)
void frdiServerGameInitialiseInput (frdi_server_app *self, frdi_server_game *game)
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 * frdiServerGameDescribe (frdi_server_app *self, frdi_server_game *game)
void frdiServerGameRegisterDigest (frdi_server_app *self, frdi_server_game *game, char *user_id, char *digest)
int frdiServerGameIsAllowed (frdi_server_app *self, frdi_server_game *game, char *prefix)
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)
frdi_server_client * frdiServerGameClientFromName (frdi_server_app *self, frdi_server_game *game, char *name)
void frdiServerGameCheckReadyForOutcome (frdi_server_app *self, frdi_server_game *game)
char * frdiServerGameUseridFromClient (frdi_server_app *self, frdi_server_game *game, frdi_server_client *client)
void frdiGameAnnounceOutcomeToHost (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)
void frdiServerEncryptionMode (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, char *str)
void frdiServerAuthenticationMode (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, char *str)
void frdiServerAuthenticationTypePass (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, char *str)
void frdiServerAuthenticationType (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, char *str)
void frdiServerEncodingMode (frdi_server_app *self, frdi_server_host *host, frdi_server_client *client, char *str)


Detailed Description

function headers and defines for the server package

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

Function Documentation

frdi_server_app* frdiServerAppNew frdi_app *    app
 

somewhere to put globals

int frdiServerAppRun frdi_server_app *    self
 

doesn't exist until app ready to close

void frdiServerAppFree frdi_server_app *    self
 

release the object

char* frdiServerAppDisplay frdi_server_app *    self
 

return information about this application as a string

void frdiServerPV frdi_server_app *    self,
char *    str
 

print if verbose

void frdiServerPVF frdi_server_app *    self,
char *    format,
void *    arg
 

print if verbose using format

void* frdiServerClientListenerSpawner void *    arg
 

called in its own thread when the Client listener receives a connection

void* frdiServerHostListenerSpawner void *    arg
 

called in its own thread when the Host listener receives a connection

void frdiServerClientListenerWaitStop frdi_server_app *    self
 

wait for the client listener thread to stop

void frdiServerHostListenerWaitStop frdi_server_app *    self
 

wait for the host listener thread to stop

void frdiServerClientListenerTellStop frdi_server_app *    self
 

send a message to the client listener thread to stop

void frdiServerHostListenerTellStop frdi_server_app *    self
 

send a message to the host listener thread to stop

void frdiServerClientListenerTellStart frdi_server_app *    self
 

launch the thread for the client listener

void frdiServerHostListenerTellStart frdi_server_app *    self
 

launch the thread for the host listener

frdi_server_client* frdiServerClientInitialise frdi_server_app *    self,
frdi_connection *    connection
 

register a client-server connection

frdi_server_host* frdiServerHostInitialise frdi_server_app *    self,
frdi_connection *    connection
 

register a host-server connection

void frdiServerClientFinalise frdi_server_app *    self,
frdi_server_client *    client
 

de-register a client-server connection

void frdiServerHostFinalise frdi_server_app *    self,
frdi_server_host *    host
 

de-register a host-server connection

void frdiServerClientRecieve frdi_server_app *    self,
frdi_connection *    connection,
frdi_message *    message
 

recieve a message from a client-server connection

void frdiServerHostRecieve frdi_server_app *    self,
frdi_connection *    connection,
frdi_message *    message
 

recieve a message from a host-server connection

void frdiServerClientMessageSend frdi_server_app *    self,
frdi_server_client *    client,
frdi_message *    message
 

send a message along a client-server connection

void frdiServerHostMessageSend frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

send a message along a host-server connection

char* frdiServerClientDisplay frdi_server_app *    self,
frdi_server_client *    client
 

return a description of this client-server connection

char* frdiServerHostDisplay frdi_server_app *    self,
frdi_server_host *    host
 

return a description of this host-server connection

void frdiServerClientMessageRecieve frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

recieve a message from a server-client connection

void* frdiServerHostMessageRecieve frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

recieve a message from a server-host connection D Description F Find G Game K Keepalive L Link R Remote U Unknown

void frdiServerHostMsU frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    old_message
 

send a U type message along a host-server connection

void frdiServerClientMsU frdi_server_app *    self,
frdi_server_client *    client,
frdi_message *    old_message
 

send a U type message along a client-server connection

void frdiServerTellClientStop frdi_server_app *    self,
frdi_server_client *    client
 

tell a client connection that they are closing (inform the host connection if one is relevant)

void frdiServerTellHostStop frdi_server_app *    self,
frdi_server_host *    host
 

tell a host connection (and any related client connections) that they are closing

void frdiServerTellAllStop frdi_server_app *    self
 

tell all connections (client and host) that they are closing

void frdiServerTellAllStopped frdi_server_app *    self
 

tell any connections (client and host) that still need telling that they have closed

Note: relies on a particular undocumented behaviour of frdiDictValues that removing one item from the dict does not change the order the rest of the values will be returned when it is next called

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

Send str back to a client as a game message

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

Send str back to all client as a game message

void frdiServerClientMrD frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

Fairdice Client-Server connection message receive : Description CHALLENGE : D is <description> RESPONSE : none ACTION : set description of client

CHALLENGE : D request RESPONSE : D is <description> or RESPONSE : D null ACTION : none

void frdiServerClientMrG frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

Fairdice Client-Server connection message receive : Game

CHALLENGE : G <gamestr> <seperator> <data> RESPONSE : varies ACTION : parse <gamestr> into a frdi_server_game object. pass on to further method

void frdiServerClientMrK frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

Fairdice Client-Server connection message receive : Keepalive

CHALLENGE : K null RESPONSE : none ACTION : none

CHALLENGE : K ping request <integer> RESPONSE : K ping response <integer> ACTION : none

CHALLENGE : K ping response <integer> RESPONSE : none ACTION : record ping delay

CHALLENGE : K time request RESPONSE : K time response <timestamp> ACTION : none

CHALLENGE : K time response <timestamp> RESPONSE : none ACTION : synch time

void frdiServerClientMrL frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

Fairdice Client-Server connection message receive : Link

CHALLENGE : L opening RESPONSE : L opened ACTION : none

CHALLENGE : L opened RESPONSE : none ACTION : none

CHALLENGE : L closing RESPONSE : L closed ACTION : close this end of link

CHALLENGE : L closed RESPONSE : none ACTION : close this end of link

void frdiServerClientMrM frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

Fairdice Client-Server connection message receive : Mode

CHALLENGE : M auth <data> RESPONSE : varies ACTION : pass on to authentication negotiation method

CHALLENGE : M encrypt <data> RESPONSE : varies ACTION : pass on to encryption negotiation method

CHALLENGE : M encode <data> RESPONSE : varies ACTION : pass on to data encoding negotiation method

void frdiServerClientMrR frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

Fairdice Client-Server connection message receive : Remote

CHALLENGE : R <data> RESPONSE : none ACTION : pass on verbatim along the host (keeping the R prefix)

void frdiServerClientMrU frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

Fairdice Client-Server connection message receive : Unknown

CHALLENGE : U null RESPONSE : none ACTION : report the error

CHALLENGE : U <verbatim copy of message client got from us> RESPONSE : none ACTION : report the error

void frdiServerClientMrV frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message
 

Fairdice Client-Server connection message receive : Version

CHALLENGE : V request RESPONSE : V offer <number selection> ACTION : none

CHALLENGE : V offer <number selection> RESPONSE : V select <number> or RESPONSE : V unsupported ACTION : none

CHALLENGE : V select <number> RESPONSE : none or RESPONSE : V unsupported ACTION : none

where <number> is a positive integer identifying a specific version of the server-client link protocol.

where <number range> is "<number>-<number>"

where <number selection> is a comma seperated list of <number> and or <number range>

for example 1,3-5,7

note: implementation incomplete.

void frdiServerClientMrE frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
frdi_message *    message,
char    c
 

Fairdice Client-Server connection message receive : A Mystery

CHALLENGE : <unparsable> RESPONSE : U <unparsable> ACTION : report the error

void frdiServerGameSendUsers frdi_server_app *    self,
frdi_server_game *    game,
frdi_list *    user_list,
char *    str
 

Send str back to all listed users

frdi_server_host* frdiServerHostFromGameId frdi_server_app *    self,
frdi_server_client *    client,
char *    game_id
 

find a host with a game whose id matches

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

Send str back to the host as a game message

void frdiServerHostMrD frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

Fairdice Host-Server connection message receive : Description CHALLENGE : D is <description> RESPONSE : none ACTION : set description of host

CHALLENGE : D request RESPONSE : D is <description> or RESPONSE : D null ACTION : none

void frdiServerHostMrF frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

Fairdice Host-Server connection message receive : Find CHALLENGE : F set host <hoststr> CHALLENGE : F set secret <secret> RESPONSE : none ACTION : register the strings

void frdiServerHostMrG frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

Fairdice Host-Server connection message receive : Game

CHALLENGE : G <gamestr> <seperator> <data> RESPONSE : varies ACTION : parse <gamestr> into a frdi_server_game object. pass on to further method

void frdiServerHostMrK frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

Fairdice Host-Server connection message receive : Keepalive

CHALLENGE : K null RESPONSE : none ACTION : none

CHALLENGE : K ping request <integer> RESPONSE : K ping response <integer> ACTION : none

CHALLENGE : K ping response <integer> RESPONSE : none ACTION : record ping delay

CHALLENGE : K time request RESPONSE : K time response <timestamp> ACTION : none

CHALLENGE : K time response <timestamp> RESPONSE : none ACTION : synch time

void frdiServerHostMrL frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

Fairdice Host-Server connection message receive : Link

CHALLENGE : L opening RESPONSE : L opened ACTION : none

CHALLENGE : L opened RESPONSE : none ACTION : none

CHALLENGE : L closing RESPONSE : L closed ACTION : close this end of link

CHALLENGE : L closed RESPONSE : none ACTION : close this end of link

void frdiServerHostMrR frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

Fairdice Host-Server connection message receive : Remote

CHALLENGE : R <data> RESPONSE : none ACTION : pass on verbatim along to the server (keeping the R prefix)

void frdiServerHostMrU frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message
 

Fairdice Host-Server connection message receive : Unknown

CHALLENGE : U null RESPONSE : none ACTION : report the error

CHALLENGE : U <verbatim copy of message server got from us> RESPONSE : none ACTION : report the error

void frdiServerHostMrE frdi_server_app *    self,
frdi_server_host *    host,
frdi_message *    message,
char    c
 

Fairdice Host-Server connection message receive : A Mystery

CHALLENGE : <unparsable> RESPONSE : U <unparsable> ACTION : report the error

char* frdiServerGameReport frdi_server_app *    self,
frdi_server_game *    game
 

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

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 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* frdiServerGameDescribe frdi_server_app *    self,
frdi_server_game *    game
 

describe it

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

register a digest

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

check whether a response is allowed at a particular stage

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

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 frdiServerGameCheckReadyForOutcome frdi_server_app *    self,
frdi_server_game *    game
 

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

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

void frdiGameAnnounceOutcomeToHost frdi_server_app *    self,
frdi_server_game *    game
 

let the host know what the result is

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

void frdiServerEncryptionMode frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
char *    str
 

negotiate which encryption mode to use

void frdiServerAuthenticationMode frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
char *    str
 

negotiate which authentication mode to use

void frdiServerAuthenticationTypePass frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
char *    str
 

messages specific to the authentication mode "pass"

void frdiServerAuthenticationType frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
char *    str
 

messages specific to a particular authentication mode

void frdiServerEncodingMode frdi_server_app *    self,
frdi_server_host *    host,
frdi_server_client *    client,
char *    str
 

negotiate which encoding mode to use


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