10829
|
1 |
/* $Id$ */
|
|
2 |
|
|
3 |
/** @file network_internal.h Variables and function used internally. */
|
|
4 |
|
|
5 |
#ifndef NETWORK_FUNC_H
|
|
6 |
#define NETWORK_FUNC_H
|
|
7 |
|
|
8 |
#ifdef ENABLE_NETWORK
|
|
9 |
|
|
10 |
#include "network_type.h"
|
|
11 |
#include "../console_type.h"
|
|
12 |
|
|
13 |
extern NetworkServerGameInfo _network_game_info;
|
|
14 |
extern NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
|
|
15 |
extern NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
|
|
16 |
|
|
17 |
extern uint16 _network_own_client_index;
|
|
18 |
extern uint16 _redirect_console_to_client;
|
|
19 |
extern bool _network_need_advertise;
|
|
20 |
extern uint32 _network_last_advertise_frame;
|
|
21 |
extern uint8 _network_reconnect;
|
|
22 |
extern char *_network_host_list[10];
|
|
23 |
extern char *_network_ban_list[25];
|
|
24 |
|
|
25 |
byte NetworkSpectatorCount();
|
|
26 |
void CheckMinPlayers();
|
|
27 |
void NetworkUpdatePlayerName();
|
|
28 |
bool NetworkCompanyHasPlayers(PlayerID company);
|
|
29 |
bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
|
|
30 |
void NetworkReboot();
|
|
31 |
void NetworkDisconnect();
|
|
32 |
void NetworkGameLoop();
|
|
33 |
void NetworkUDPGameLoop();
|
|
34 |
void NetworkUDPCloseAll();
|
|
35 |
void ParseConnectionString(const char **player, const char **port, char *connection_string);
|
|
36 |
void NetworkStartDebugLog(const char *hostname, uint16 port);
|
|
37 |
void NetworkPopulateCompanyInfo();
|
|
38 |
|
|
39 |
void NetworkUpdateClientInfo(uint16 client_index);
|
|
40 |
bool NetworkClientConnectGame(const char *host, uint16 port);
|
|
41 |
void NetworkClientSendRcon(const char *password, const char *command);
|
|
42 |
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg);
|
|
43 |
void NetworkClientSetPassword();
|
|
44 |
|
|
45 |
/*** Commands ran by the server ***/
|
|
46 |
void NetworkServerMonthlyLoop();
|
|
47 |
void NetworkServerYearlyLoop();
|
|
48 |
void NetworkServerChangeOwner(PlayerID current_player, PlayerID new_player);
|
|
49 |
void NetworkServerShowStatusToConsole();
|
|
50 |
bool NetworkServerStart();
|
|
51 |
|
|
52 |
NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index);
|
|
53 |
NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
|
|
54 |
const char* GetPlayerIP(const NetworkClientInfo *ci);
|
|
55 |
|
|
56 |
void NetworkServerSendRcon(uint16 client_index, ConsoleColour colour_code, const char *string);
|
|
57 |
void NetworkServerSendError(uint16 client_index, NetworkErrorCode error);
|
|
58 |
void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, uint16 from_index);
|
|
59 |
|
|
60 |
#define FOR_ALL_ACTIVE_CLIENT_INFOS(ci) for (ci = _network_client_info; ci != endof(_network_client_info); ci++) if (ci->client_index != NETWORK_EMPTY_INDEX)
|
|
61 |
|
|
62 |
#endif /* ENABLE_NETWORK */
|
|
63 |
#endif /* NETWORK_FUNC_H */
|