Always require lobby authentication for lobby matches, refs #3549 / rP21520 / D897.
[0ad.git] / source / network / scripting / JSInterface_Network.h
blob852bc47ace5a3cf012bda6ddae90e22c103eb09d
1 /* Copyright (C) 2018 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef INCLUDED_JSI_NETWORK
19 #define INCLUDED_JSI_NETWORK
21 #include "lib/types.h"
22 #include "ps/CStr.h"
23 #include "scriptinterface/ScriptInterface.h"
25 namespace JSI_Network
27 u16 GetDefaultPort(ScriptInterface::CxPrivate* pCxPrivate);
28 bool HasNetServer(ScriptInterface::CxPrivate* pCxPrivate);
29 bool HasNetClient(ScriptInterface::CxPrivate* pCxPrivate);
30 void StartNetworkGame(ScriptInterface::CxPrivate* pCxPrivate);
31 void SetNetworkGameAttributes(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue attribs1);
32 void StartNetworkHost(ScriptInterface::CxPrivate* pCxPrivate, const CStrW& playerName, const u16 serverPort, const CStr& hostLobbyName);
33 void StartNetworkJoin(ScriptInterface::CxPrivate* pCxPrivate, const CStrW& playerName, const CStr& serverAddress, u16 serverPort, bool useSTUN, const CStr& hostJID);
34 JS::Value FindStunEndpoint(ScriptInterface::CxPrivate* pCxPrivate, int port);
35 void DisconnectNetworkGame(ScriptInterface::CxPrivate* pCxPrivate);
36 JS::Value PollNetworkClient(ScriptInterface::CxPrivate* pCxPrivate);
37 CStr GetPlayerGUID(ScriptInterface::CxPrivate* pCxPrivate);
38 void KickPlayer(ScriptInterface::CxPrivate* pCxPrivate, const CStrW& playerName, bool ban);
39 void AssignNetworkPlayer(ScriptInterface::CxPrivate* pCxPrivate, int playerID, const CStr& guid);
40 void ClearAllPlayerReady (ScriptInterface::CxPrivate* pCxPrivate);
41 void SendNetworkChat(ScriptInterface::CxPrivate* pCxPrivate, const CStrW& message);
42 void SendNetworkReady(ScriptInterface::CxPrivate* pCxPrivate, int message);
43 void SetTurnLength(ScriptInterface::CxPrivate* pCxPrivate, int length);
45 void RegisterScriptFunctions(const ScriptInterface& scriptInterface);
48 #endif // INCLUDED_JSI_NETWORK