serverQuery.h
Engine/source/app/net/serverQuery.h
Classes:
class
Public Variables
Public Functions
queryFavoriteServers(U8 flags)
querySingleServer(const NetAddress * addr, U8 flags)
sendHeartbeat(U8 flags)
Detailed Description
Public Variables
bool gServerBrowserDirty
Vector< ServerInfo > gServerList
Public Functions
clearServerList()
queryFavoriteServers(U8 flags)
queryLanServers(U32 port, U8 flags, const char * gameType, const char * missionType, U8 minPlayers, U8 maxPlayers, U8 maxBots, U32 regionMask, U32 maxPing, U16 minCPU, U8 filterFlags)
queryMasterGameTypes()
queryMasterServer(U8 flags, const char * gameType, const char * missionType, U8 minPlayers, U8 maxPlayers, U8 maxBots, U32 regionMask, U32 maxPing, U16 minCPU, U8 filterFlags, U8 buddyCount, U32 * buddyList)
querySingleServer(const NetAddress * addr, U8 flags)
sendHeartbeat(U8 flags)
startHeartbeat()
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _SERVERQUERY_H_ 25#define _SERVERQUERY_H_ 26 27#ifndef _PLATFORM_H_ 28#include "platform/platform.h" 29#endif 30#ifndef _BITSET_H_ 31#include "core/bitSet.h" 32#endif 33 34#include "platform/platformNet.h" 35 36//----------------------------------------------------------------------------- 37// Game Server Information 38 39struct ServerInfo 40{ 41 enum StatusFlags 42 { 43 // Info flags (0-7): 44 Status_Dedicated = BIT(0), 45 Status_Passworded = BIT(1), 46 Status_Linux = BIT(2), 47 48 // Status flags: 49 Status_New = 0, 50 Status_Querying = BIT(28), 51 Status_Updating = BIT(29), 52 Status_Responded = BIT(30), 53 Status_TimedOut = BIT(31), 54 }; 55 56 U8 numPlayers; 57 U8 maxPlayers; 58 U8 numBots; 59 char* name; 60 char* gameType; 61 char* missionName; 62 char* missionType; 63 char* statusString; 64 char* infoString; 65 NetAddress address; 66 U32 version; 67 U32 ping; 68 U32 cpuSpeed; 69 bool isFavorite; 70 BitSet32 status; 71 72 ServerInfo() 73 { 74 numPlayers = 0; 75 maxPlayers = 0; 76 numBots = 0; 77 name = NULL; 78 gameType = NULL; 79 missionType = NULL; 80 missionName = NULL; 81 statusString = NULL; 82 infoString = NULL; 83 version = 0; 84 dMemset(&address, '\0', sizeof(NetAddress)); 85 ping = 0; 86 cpuSpeed = 0; 87 isFavorite = false; 88 status = Status_New; 89 } 90 ~ServerInfo(); 91 92 bool isNew() { return( status == Status_New ); } 93 bool isQuerying() { return( status.test( Status_Querying ) ); } 94 bool isUpdating() { return( status.test( Status_Updating ) ); } 95 bool hasResponded() { return( status.test( Status_Responded ) ); } 96 bool isTimedOut() { return( status.test( Status_TimedOut ) ); } 97 98 bool isDedicated() { return( status.test( Status_Dedicated ) ); } 99 bool isPassworded() { return( status.test( Status_Passworded ) ); } 100 bool isLinux() { return( status.test( Status_Linux ) ); } 101 102}; 103 104 105//----------------------------------------------------------------------------- 106 107extern Vector<ServerInfo> gServerList; 108extern bool gServerBrowserDirty; 109extern void clearServerList(); 110extern void queryLanServers(U32 port, U8 flags, const char* gameType, const char* missionType, 111 U8 minPlayers, U8 maxPlayers, U8 maxBots, U32 regionMask, U32 maxPing, U16 minCPU, 112 U8 filterFlags); 113extern void queryMasterGameTypes(); 114extern void queryMasterServer(U8 flags, const char* gameType, const char* missionType, 115 U8 minPlayers, U8 maxPlayers, U8 maxBots, U32 regionMask, U32 maxPing, U16 minCPU, 116 U8 filterFlags, U8 buddyCount, U32* buddyList ); 117extern void queryFavoriteServers( U8 flags ); 118extern void querySingleServer(const NetAddress* addr, U8 flags); 119extern void startHeartbeat(); 120extern void sendHeartbeat( U8 flags ); 121 122#ifdef TORQUE_DEBUG 123extern void addFakeServers( S32 howMany ); 124#endif // DEBUG 125 126#endif 127