# network_func.h

Go to the documentation of this file.

    00001 /* $Id: network_func.h 15628 2009-03-06 12:42:01Z smatz $ */
    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 CheckMinActiveClients();
    00028 void NetworkUpdateClientName();
    00029 bool NetworkCompanyHasClients(CompanyID company);
    00030 bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
    00031 void NetworkReboot();
    00032 void NetworkDisconnect();
    00033 void NetworkGameLoop();
    00034 void NetworkUDPGameLoop();
    00035 void NetworkUDPCloseAll();
    00036 void ParseConnectionString(const char **company, const char **port, char *connection_string);
    00037 void NetworkStartDebugLog(NetworkAddress address);
    00038 void NetworkPopulateCompanyStats(NetworkCompanyStats *stats);
    00039
    00040 void NetworkUpdateClientInfo(ClientID client_id);
    00041 void NetworkClientConnectGame(NetworkAddress address);
    00042 void NetworkClientRequestMove(CompanyID company, const char *pass = "");
    00043 void NetworkClientSendRcon(const char *password, const char *command);
    00044 void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg, int64 data = 0);
    00045 void NetworkClientSetPassword(const char *password);
    00046 bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
    00047 bool NetworkCompanyIsPassworded(CompanyID company_id);
    00048 bool NetworkMaxCompaniesReached();
    00049 bool NetworkMaxSpectatorsReached();
    00050 void NetworkPrintClients();
    00051
    00052 /*** Commands ran by the server ***/
    00053 void NetworkServerMonthlyLoop();
    00054 void NetworkServerYearlyLoop();
    00055 void NetworkServerChangeOwner(Owner current_owner, Owner new_owner);
    00056 void NetworkServerSendConfigUpdate();
    00057 void NetworkServerShowStatusToConsole();
    00058 bool NetworkServerStart();
    00059 void NetworkServerUpdateCompanyPassworded(CompanyID company_id, bool passworded);
    00060 bool NetworkServerChangeClientName(ClientID client_id, const char *new_name);
    00061
    00062 NetworkClientInfo *NetworkFindClientInfoFromIndex(ClientIndex index);
    00063 NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id);
    00064 NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
    00065 const char *GetClientIP(const NetworkClientInfo *ci);
    00066
    00067 void NetworkServerDoMove(ClientID client_id, CompanyID company_id);
    00068 void NetworkServerSendRcon(ClientID client_id, ConsoleColour colour_code, const char *string);
    00069 void NetworkServerSendError(ClientID client_id, NetworkErrorCode error);
    00070 void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, ClientID from_id, int64 data = 0);
    00071
    00072 void NetworkServerKickClient(ClientID client_id);
    00073 void NetworkServerBanIP(const char *banip);
    00074
    00075 void NetworkInitChatMessage();
    00076 void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *message, ...);
    00077 void NetworkUndrawChatMessage();
    00078 void NetworkChatMessageDailyLoop();
    00079
    00080 #endif /* ENABLE_NETWORK */
    00081 #endif /* NETWORK_FUNC_H */