Rise
The Vieneo Province
Loading...
Searching...
No Matches
isteamgameserver.h
Go to the documentation of this file.
1//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. =======
2//
3// Purpose: interface to steam for game servers
4//
5//=============================================================================
6
7#ifndef ISTEAMGAMESERVER_H
8#define ISTEAMGAMESERVER_H
9#ifdef _WIN32
10#pragma once
11#endif
12
13#include "steam_api_common.h"
14
15//-----------------------------------------------------------------------------
16// Purpose: Functions for authenticating users via Steam to play on a game server
17//-----------------------------------------------------------------------------
19{
20public:
21
22//
23// Basic server data. These properties, if set, must be set before before calling LogOn. They
24// may not be changed after logged in.
25//
26
28 STEAM_PRIVATE_API( virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; )
29
32 virtual void SetProduct( const char *pszProduct ) = 0;
33
36 virtual void SetGameDescription( const char *pszGameDescription ) = 0;
37
42 virtual void SetModDir( const char *pszModDir ) = 0;
43
45 virtual void SetDedicatedServer( bool bDedicated ) = 0;
46
47//
48// Login
49//
50
57 virtual void LogOn( const char *pszToken ) = 0;
58
63 virtual void LogOnAnonymous() = 0;
64
66 virtual void LogOff() = 0;
67
68 // status functions
69 virtual bool BLoggedOn() = 0;
70 virtual bool BSecure() = 0;
71 virtual CSteamID GetSteamID() = 0;
72
75 virtual bool WasRestartRequested() = 0;
76
77//
78// Server state. These properties may be changed at any time.
79//
80
82 virtual void SetMaxPlayerCount( int cPlayersMax ) = 0;
83
85 virtual void SetBotPlayerCount( int cBotplayers ) = 0;
86
90 virtual void SetServerName( const char *pszServerName ) = 0;
91
95 virtual void SetMapName( const char *pszMapName ) = 0;
96
98 virtual void SetPasswordProtected( bool bPasswordProtected ) = 0;
99
111 virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0;
112
116 virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0;
117
119 virtual void ClearAllKeyValues() = 0;
120
122 virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0;
123
128 virtual void SetGameTags( const char *pchGameTags ) = 0;
129
134 virtual void SetGameData( const char *pchGameData ) = 0;
135
137 virtual void SetRegion( const char *pszRegion ) = 0;
138
147 virtual void SetAdvertiseServerActive( bool bActive ) = 0;
148
149//
150// Player list management / authentication.
151//
152
153 // Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).
154 // pcbTicket retrieves the length of the actual ticket.
155 // SteamNetworkingIdentity is an optional parameter to hold the public IP address of the entity you are connecting to
156 // if an IP address is passed Steam will only allow the ticket to be used by an entity with that IP address
157 virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSnid ) = 0;
158
159 // Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused
160 // Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
161 virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
162
163 // Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
164 virtual void EndAuthSession( CSteamID steamID ) = 0;
165
166 // Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
167 virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
168
169 // After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function
170 // to determine if the user owns downloadable content specified by the provided AppID.
172
173 // Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t
174 // returns false if we're not connected to the steam servers and thus cannot ask
175 virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0;
176
177
178 // these two functions s are deprecated, and will not return results
179 // they will be removed in a future version of the SDK
180 virtual void GetGameplayStats( ) = 0;
183
184 // Returns the public IP of the server according to Steam, useful when the server is
185 // behind NAT and you want to advertise its IP in a lobby for other clients to directly
186 // connect to
188
189// Server browser related query packet processing for shared socket mode. These are used
190// when you pass STEAMGAMESERVER_QUERY_PORT_SHARED as the query port to SteamGameServer_Init.
191// IP address and port are in host order, i.e 127.0.0.1 == 0x7f000001
192
193 // These are used when you've elected to multiplex the game server's UDP socket
194 // rather than having the master server updater use its own sockets.
195 //
196 // Source games use this to simplify the job of the server admins, so they
197 // don't have to open up more ports on their firewalls.
198
199 // Call this when a packet that starts with 0xFFFFFFFF comes in. That means
200 // it's for us.
201 virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0;
202
203 // AFTER calling HandleIncomingPacket for any packets that came in that frame, call this.
204 // This gets a packet that the master server updater needs to send out on UDP.
205 // It returns the length of the packet it wants to send, or 0 if there are no more packets to send.
206 // Call this each frame until it returns 0.
207 virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0;
208
209//
210// Server clan association
211//
212
213 // associate this game server with this clan for the purposes of computing player compat
215 virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0;
216
217 // ask if any of the current players dont want to play with this new player - or vice versa
220
221
222
223
224 // Handles receiving a new connection from a Steam user. This call will ask the Steam
225 // servers to validate the users identity, app ownership, and VAC status. If the Steam servers
226 // are off-line, then it will validate the cached ticket itself which will validate app ownership
227 // and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection()
228 // and must then be sent up to the game server for authentication.
229 //
230 // Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL
231 // If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication
232 // for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)
233 //
234 // DEPRECATED! This function will be removed from the SDK in an upcoming version.
235 // Please migrate to BeginAuthSession and related functions.
236 virtual bool SendUserConnectAndAuthenticate_DEPRECATED( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0;
237
238 // Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation.
239 //
240 // Return Value: Returns a SteamID for the user to be tracked with, you should call EndAuthSession()
241 // when this user leaves the server just like you would for a real user.
243
244 // Should be called whenever a user leaves our game server, this lets Steam internally
245 // track which users are currently on which servers for the purposes of preventing a single
246 // account being logged into multiple servers, showing who is currently on a server, etc.
247 //
248 // DEPRECATED! This function will be removed from the SDK in an upcoming version.
249 // Please migrate to BeginAuthSession and related functions.
250 virtual void SendUserDisconnect_DEPRECATED( CSteamID steamIDUser ) = 0;
251
252 // Update the data to be displayed in the server browser and matchmaking interfaces for a user
253 // currently connected to the server. For regular users you must call this after you receive a
254 // GSUserValidationSuccess callback.
255 //
256 // Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)
257 virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0;
258
259// Deprecated functions. These will be removed in a future version of the SDK.
260// If you really need these, please contact us and help us understand what you are
261// using them for.
262
264 virtual void SetMasterServerHeartbeatInterval_DEPRECATED( int iHeartbeatInterval ) = 0;
265 virtual void ForceMasterServerHeartbeat_DEPRECATED() = 0;
266 )
267};
268
269#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer015"
270
271// Global accessor
274
275// callbacks
276#if defined( VALVE_CALLBACK_PACK_SMALL )
277#pragma pack( push, 4 )
278#elif defined( VALVE_CALLBACK_PACK_LARGE )
279#pragma pack( push, 8 )
280#else
281#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
282#endif
283
284
285// client has been approved to connect to this game server
287{
289 CSteamID m_SteamID; // SteamID of approved player
290 CSteamID m_OwnerSteamID; // SteamID of original owner for game license
291};
292
293
294// client has been denied to connection to this game server
302
303
304// request the game server should kick the user
311
312// NOTE: callback values 4 and 5 are skipped because they are used for old deprecated callbacks,
313// do not reuse them here.
314
315
316// client achievement info
324
325// received when the game server requests to be displayed as secure (VAC protected)
326// m_bSecure is true if the game server should display itself as secure to users, false otherwise
332
333// GS gameplay stats info
335{
337 EResult m_eResult; // Result of the call
338 int32 m_nRank; // Overall rank of the server (0-based)
339 uint32 m_unTotalConnects; // Total number of clients who have ever connected to the server
340 uint32 m_unTotalMinutesPlayed; // Total number of minutes ever played on the server
341};
342
343// send as a reply to RequestUserGroupStatus()
352
353// Sent as a reply to GetServerReputation()
355{
357 EResult m_eResult; // Result of the call;
358 uint32 m_unReputationScore; // The reputation score for the game server
359 bool m_bBanned; // True if the server is banned from the Steam
360 // master servers
361
362 // The following members are only filled out if m_bBanned is true. They will all
363 // be set to zero otherwise. Master server bans are by IP so it is possible to be
364 // banned even when the score is good high if there is a bad server on another port.
365 // This information can be used to determine which server is bad.
366
367 uint32 m_unBannedIP; // The IP of the banned server
368 uint16 m_usBannedPort; // The port of the banned server
369 uint64 m_ulBannedGameID; // The game ID the banned server is serving
370 uint32 m_unBanExpires; // Time the ban expires, expressed in the Unix epoch (seconds since 1/1/1970)
371};
372
373// Sent as a reply to AssociateWithClan()
375{
377 EResult m_eResult; // Result of the call;
378};
379
380// Sent as a reply to ComputeNewPlayerCompatibility()
390
391
392#pragma pack( pop )
393
394#endif // ISTEAMGAMESERVER_H
virtual SteamIPAddress_t GetPublicIP()=0
virtual void SetSpectatorServerName(const char *pszSpectatorServerName)=0
virtual bool WasRestartRequested()=0
virtual void SetBotPlayerCount(int cBotplayers)=0
Number of bots. Default value is zero.
virtual SteamAPICall_t ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer)=0
virtual bool BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore)=0
virtual bool RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup)=0
virtual void SetGameTags(const char *pchGameTags)=0
virtual void SetProduct(const char *pszProduct)=0
This is called by SteamGameServer_Init, and you will usually not need to call it directly.
virtual bool BLoggedOn()=0
virtual void SetGameDescription(const char *pszGameDescription)=0
virtual bool BSecure()=0
virtual void SetMaxPlayerCount(int cPlayersMax)=0
Max player count that will be reported to server browser and client queries.
virtual bool SendUserConnectAndAuthenticate_DEPRECATED(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser)=0
virtual void SetKeyValue(const char *pKey, const char *pValue)=0
Call this to add/update a key/value pair.
virtual void SetSpectatorPort(uint16 unSpectatorPort)=0
virtual void ClearAllKeyValues()=0
Call this to clear the whole list of key/values that are sent in rules queries.
virtual void SetDedicatedServer(bool bDedicated)=0
Is this is a dedicated server? The default value is false.
virtual void GetGameplayStats()=0
virtual bool HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort)=0
virtual void EndAuthSession(CSteamID steamID)=0
virtual CSteamID CreateUnauthenticatedUserConnection()=0
virtual void SetMapName(const char *pszMapName)=0
virtual SteamAPICall_t AssociateWithClan(CSteamID steamIDClan)=0
virtual void SetRegion(const char *pszRegion)=0
Region identifier. This is an optional field, the default value is empty, meaning the "world" region.
virtual HAuthTicket GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pSnid)=0
virtual void CancelAuthTicket(HAuthTicket hAuthTicket)=0
virtual void SetAdvertiseServerActive(bool bActive)=0
virtual CSteamID GetSteamID()=0
virtual EBeginAuthSessionResult BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID)=0
virtual void LogOnAnonymous()=0
virtual void SetServerName(const char *pszServerName)=0
virtual void SetGameData(const char *pchGameData)=0
virtual void LogOff()=0
Begin process of logging game server out of steam.
virtual EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID)=0
virtual int GetNextOutgoingPacket(void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort)=0
virtual void SetPasswordProtected(bool bPasswordProtected)=0
Let people know if your server will require a password.
virtual SteamAPICall_t GetServerReputation()=0
virtual void LogOn(const char *pszToken)=0
virtual void SetModDir(const char *pszModDir)=0
virtual void SendUserDisconnect_DEPRECATED(CSteamID steamIDUser)=0
ISteamGameServer * SteamGameServer()
#define STEAMGAMESERVER_INTERFACE_VERSION
const char *typedef uint32(S_CALLTYPE *SteamAPI_CheckCallbackRegistered_t)(int iCallbackNum)
#define STEAM_PRIVATE_API(...)
#define STEAM_CALL_RESULT(RESULT_TYPE)
@ k_iSteamUserCallbacks
@ k_iSteamGameServerCallbacks
#define STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(type, name, version)
EBeginAuthSessionResult
uint32 HAuthTicket
EUserHasLicenseForAppResult
uint32 AppId_t
Definition steamtypes.h:81
unsigned short uint16
Definition steamtypes.h:56
unsigned long long uint64
Definition steamtypes.h:60
int int32
Definition steamtypes.h:57
uint64 SteamAPICall_t
Definition steamtypes.h:93
unsigned char uint8
Definition steamtypes.h:11
EDenyReason m_eDenyReason
char m_rgchOptionalText[128]
EDenyReason m_eDenyReason