2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2004-12-04 17:54:56 +00:00
|
|
|
#ifndef NETWORK_SERVER_H
|
|
|
|
#define NETWORK_SERVER_H
|
|
|
|
|
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
|
|
|
|
|
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP);
|
2004-12-19 10:17:26 +00:00
|
|
|
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR_QUIT)(NetworkClientState *cs, uint16 client_index, NetworkErrorCode errorno);
|
|
|
|
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkClientState *cs, NetworkErrorCode error);
|
2004-12-04 17:54:56 +00:00
|
|
|
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_SHUTDOWN);
|
|
|
|
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_NEWGAME);
|
2005-01-15 20:09:16 +00:00
|
|
|
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkClientState *cs, uint16 color, const char *command);
|
2004-12-04 17:54:56 +00:00
|
|
|
|
2006-04-22 09:46:31 +00:00
|
|
|
bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]);
|
2005-01-01 16:34:54 +00:00
|
|
|
void NetworkServer_HandleChat(NetworkAction action, DestType desttype, int dest, const char *msg, uint16 from_index);
|
2004-12-04 17:54:56 +00:00
|
|
|
|
2004-12-19 10:17:26 +00:00
|
|
|
bool NetworkServer_ReadPackets(NetworkClientState *cs);
|
2005-07-29 21:55:49 +00:00
|
|
|
void NetworkServer_Tick(bool send_frame);
|
2004-12-19 10:17:26 +00:00
|
|
|
void NetworkServerMonthlyLoop(void);
|
2004-12-23 17:37:26 +00:00
|
|
|
void NetworkServerYearlyLoop(void);
|
2004-12-04 17:54:56 +00:00
|
|
|
|
2005-10-22 06:39:32 +00:00
|
|
|
static inline const char* GetPlayerIP(const NetworkClientInfo* ci)
|
|
|
|
{
|
2006-08-31 14:51:50 +00:00
|
|
|
struct in_addr addr;
|
|
|
|
|
|
|
|
addr.s_addr = ci->client_ip;
|
|
|
|
return inet_ntoa(addr);
|
2005-10-22 06:39:32 +00:00
|
|
|
}
|
2005-10-19 19:38:35 +00:00
|
|
|
|
2006-10-12 14:59:27 +00:00
|
|
|
#else /* ENABLE_NETWORK */
|
|
|
|
/* Network function stubs when networking is disabled */
|
|
|
|
|
|
|
|
static inline void NetworkServerMonthlyLoop(void) {}
|
|
|
|
static inline void NetworkServerYearlyLoop(void) {}
|
|
|
|
|
2004-12-04 17:54:56 +00:00
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
|
|
2005-09-18 20:56:44 +00:00
|
|
|
#endif /* NETWORK_SERVER_H */
|