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