version 1.25 | | version 1.26 |
---|
| | |
| | |
/* | | /* |
* static char *rcsid_loop_c = | | * static char *rcsid_loop_c = |
* "$Id: loop.c,v 1.25 2003/09/13 05:02:14 mwedel Exp $"; | | * "$Id: loop.c,v 1.26 2003/12/02 18:51:44 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
The author can be reached via e-mail to crossfire-devel@real-time.com | | The author can be reached via e-mail to crossfire-devel@real-time.com |
*/ | | */ |
| | |
/* socket.c mainly deals with initialization and higher level socket | | /** |
| | * \file |
| | * Main client/server loops. |
| | * |
| | * \date 2003-12-02 |
| | * |
| | * loop.c mainly deals with initialization and higher level socket |
* maintenance (checking for lost connections and if data has arrived.) | | * maintenance (checking for lost connections and if data has arrived.) |
* The reading of data is handled in ericserver.c | | * The reading of data is handled in ericserver.c |
*/ | | */ |
| | |
uint8 flag; | | uint8 flag; |
}; | | }; |
| | |
/* | | /** |
| | * Dispatch table for the server. |
| | * |
* CmdMapping is the dispatch table for the server, used in HandleClient, | | * CmdMapping is the dispatch table for the server, used in HandleClient, |
* which gets called when the client has input. All commands called here | | * which gets called when the client has input. All commands called here |
* use the same parameter form (char* data, int len, int clientnum. | | * use the same parameter form (char* data, int len, int clientnum. |
| | |
{ NULL, NULL} /* terminator */ | | { NULL, NULL} /* terminator */ |
}; | | }; |
| | |
| | /** Face-related commands */ |
static struct NsCmdMapping nscommands[] = { | | static struct NsCmdMapping nscommands[] = { |
{ "addme", AddMeCmd }, | | { "addme", AddMeCmd }, |
{ "askface", SendFaceCmd}, /* Added: phil */ | | { "askface", SendFaceCmd}, /* Added: phil */ |
| | |
{ NULL, NULL} /* terminator */ | | { NULL, NULL} /* terminator */ |
}; | | }; |
| | |
/* RequestInfo is sort of a meta command - there is some specific | | /** |
| | * RequestInfo is sort of a meta command. There is some specific |
* request of information, but we call other functions to provide | | * request of information, but we call other functions to provide |
* that information. | | * that information. |
*/ | | */ |
| | |
else Write_String_To_Socket(ns, bigbuf, len); | | else Write_String_To_Socket(ns, bigbuf, len); |
} | | } |
| | |
| | /** |
| | * Handles old socket format. |
| | */ |
void Handle_Oldsocket(NewSocket *ns) | | void Handle_Oldsocket(NewSocket *ns) |
{ | | { |
int stat,i; | | int stat,i; |
| | |
} | | } |
| | |
| | |
/* HandleClient is actually not named really well - we only get here once | | /** |
| | * Handle client input. |
| | * |
| | * HandleClient is actually not named really well - we only get here once |
* there is input, so we don't do exception or other stuff here. | | * there is input, so we don't do exception or other stuff here. |
* sock is the output socket information. pl is the player associated | | * sock is the output socket information. pl is the player associated |
* with this socket, null if no player (one of the init_sockets for just | | * with this socket, null if no player (one of the init_sockets for just |
| | |
******************************************************************************/ | | ******************************************************************************/ |
| | |
#ifdef WATCHDOG | | #ifdef WATCHDOG |
/* | | /** |
* Tell watchdog that we are still alive | | * Tell watchdog that we are still alive |
| | * |
* I put the function here since we should hopefully already be getting | | * I put the function here since we should hopefully already be getting |
* all the needed include files for socket support | | * all the needed include files for socket support |
*/ | | */ |
| | |
| | |
extern unsigned long todtick; | | extern unsigned long todtick; |
| | |
| | /** Waits for new connection */ |
static void block_until_new_connection() | | static void block_until_new_connection() |
{ | | { |
| | |
| | |
} | | } |
| | |
| | |
/* This checks the sockets for input and exceptions, does the right thing. A | | /** |
* bit of this code is grabbed out of socket.c | | * This checks the sockets for input and exceptions, does the right thing. |
| | * |
| | * A bit of this code is grabbed out of socket.c |
* There are 2 lists we need to look through - init_sockets is a list | | * There are 2 lists we need to look through - init_sockets is a list |
* | | * |
*/ | | */ |