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 Status_Xenon = BIT(6), 48 49 // Status flags: 50 Status_New = 0, 51 Status_Querying = BIT(28), 52 Status_Updating = BIT(29), 53 Status_Responded = BIT(30), 54 Status_TimedOut = BIT(31), 55 }; 56 57 U8 numPlayers; 58 U8 maxPlayers; 59 U8 numBots; 60 char* name; 61 char* gameType; 62 char* missionName; 63 char* missionType; 64 char* statusString; 65 char* infoString; 66 NetAddress address; 67 U32 version; 68 U32 ping; 69 U32 cpuSpeed; 70 bool isFavorite; 71 BitSet32 status; 72 73 ServerInfo() 74 { 75 numPlayers = 0; 76 maxPlayers = 0; 77 numBots = 0; 78 name = NULL; 79 gameType = NULL; 80 missionType = NULL; 81 missionName = NULL; 82 statusString = NULL; 83 infoString = NULL; 84 version = 0; 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 bool isXenon() { return( status.test( Status_Xenon ) ); } 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
