# network_func.h

Go to the documentation of this file.

    00001 /* $Id: network_func.h 17565 2009-09-18 07:09:11Z rubidium $ */
    00002
    00005 #ifndef NETWORK_FUNC_H
    00006 #define NETWORK_FUNC_H
    00007
    00008 #ifdef ENABLE_NETWORK
    00009
    00010 #include "core/address.h"
    00011 #include "network_type.h"
    00012 #include "../console_type.h"
    00013 #include "../gfx_type.h"
    00014
    00015 extern NetworkServerGameInfo _network_game_info;
    00016 extern NetworkCompanyState *_network_company_states;
    00017
    00018 extern ClientID _network_own_client_id;
    00019 extern ClientID _redirect_console_to_client;
    00020 extern bool _network_need_advertise;
    00021 extern uint32 _network_last_advertise_frame;
    00022 extern uint8 _network_reconnect;
    00023 extern char *_network_host_list[10];
    00024 extern char *_network_ban_list[25];
    00025
    00026 byte NetworkSpectatorCount();
    00027 void NetworkUpdateClientName();
    00028 bool NetworkCompanyHasClients(CompanyID company);
    00029 bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
    00030 void NetworkReboot();
    00031 void NetworkDisconnect(bool blocking = false);
    00032 void NetworkGameLoop();
    00033 void NetworkUDPGameLoop();
    00034 void NetworkUDPCloseAll();
    00035 void ParseConnectionString(const char **company, const char **port, char *connection_string);
    00036 void NetworkStartDebugLog(NetworkAddress address);
    00037 void NetworkPopulateCompanyStats(NetworkCompanyStats *stats);
    00038
    00039 void NetworkUpdateClientInfo(ClientID client_id);
    00040 void NetworkClientConnectGame(NetworkAddress address);
    00041 void NetworkClientRequestMove(CompanyID company, const char *pass = "");
    00042 void NetworkClientSendRcon(const char *password, const char *command);
    00043 void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg, int64 data = 0);
    00044 void NetworkClientSetPassword(const char *password);
    00045 bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
    00046 bool NetworkCompanyIsPassworded(CompanyID company_id);
    00047 bool NetworkMaxCompaniesReached();
    00048 bool NetworkMaxSpectatorsReached();
    00049 void NetworkPrintClients();
    00050
    00051 /*** Commands ran by the server ***/
    00052 void NetworkServerMonthlyLoop();
    00053 void NetworkServerYearlyLoop();
    00054 void NetworkServerChangeOwner(Owner current_owner, Owner new_owner);
    00055 void NetworkServerSendConfigUpdate();
    00056 void NetworkServerShowStatusToConsole();
    00057 bool NetworkServerStart();
    00058 void NetworkServerUpdateCompanyPassworded(CompanyID company_id, bool passworded);
    00059 bool NetworkServerChangeClientName(ClientID client_id, const char *new_name);
    00060
    00061 NetworkClientInfo *NetworkFindClientInfoFromIndex(ClientIndex index);
    00062 NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id);
    00063 NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
    00064 const char *GetClientIP(const NetworkClientInfo *ci);
    00065
    00066 void NetworkServerDoMove(ClientID client_id, CompanyID company_id);
    00067 void NetworkServerSendRcon(ClientID client_id, ConsoleColour colour_code, const char *string);
    00068 void NetworkServerSendError(ClientID client_id, NetworkErrorCode error);
    00069 void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, ClientID from_id, int64 data = 0);
    00070
    00071 void NetworkServerKickClient(ClientID client_id);
    00072 void NetworkServerBanIP(const char *banip);
    00073
    00074 void NetworkInitChatMessage();
    00075 void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *message, ...) WARN_FORMAT(3, 4);
    00076 void NetworkUndrawChatMessage();
    00077 void NetworkChatMessageDailyLoop();
    00078
    00079 void NetworkAfterNewGRFScan();
    00080
    00081 #endif /* ENABLE_NETWORK */
    00082 #endif /* NETWORK_FUNC_H */