5642
|
1 |
/* $Id$ */
|
|
2 |
|
|
3 |
#ifndef NETWORK_SERVER_H
|
|
4 |
#define NETWORK_SERVER_H
|
|
5 |
|
|
6 |
#ifdef ENABLE_NETWORK
|
|
7 |
|
|
8 |
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP);
|
|
9 |
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR_QUIT)(NetworkClientState *cs, uint16 client_index, NetworkErrorCode errorno);
|
|
10 |
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkClientState *cs, NetworkErrorCode error);
|
|
11 |
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_SHUTDOWN);
|
|
12 |
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_NEWGAME);
|
|
13 |
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkClientState *cs, uint16 color, const char *command);
|
|
14 |
|
|
15 |
bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]);
|
|
16 |
void NetworkServer_HandleChat(NetworkAction action, DestType type, int dest, const char *msg, uint16 from_index);
|
|
17 |
|
|
18 |
bool NetworkServer_ReadPackets(NetworkClientState *cs);
|
|
19 |
void NetworkServer_Tick(bool send_frame);
|
|
20 |
void NetworkServerMonthlyLoop(void);
|
|
21 |
void NetworkServerYearlyLoop(void);
|
|
22 |
|
|
23 |
static inline const char* GetPlayerIP(const NetworkClientInfo* ci)
|
|
24 |
{
|
|
25 |
struct in_addr addr;
|
|
26 |
|
|
27 |
addr.s_addr = ci->client_ip;
|
|
28 |
return inet_ntoa(addr);
|
|
29 |
}
|
|
30 |
|
|
31 |
#else /* ENABLE_NETWORK */
|
|
32 |
/* Network function stubs when networking is disabled */
|
|
33 |
|
|
34 |
static inline void NetworkServerMonthlyLoop(void) {}
|
|
35 |
static inline void NetworkServerYearlyLoop(void) {}
|
|
36 |
|
|
37 |
#endif /* ENABLE_NETWORK */
|
|
38 |
|
|
39 |
#endif /* NETWORK_SERVER_H */
|