Rise
The Vieneo Province
Loading...
Searching...
No Matches
steam_gameserver.h
Go to the documentation of this file.
1//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
2//
3// Purpose:
4//
5//=============================================================================
6
7#ifndef STEAM_GAMESERVER_H
8#define STEAM_GAMESERVER_H
9#ifdef _WIN32
10#pragma once
11#endif
12
13#include "steam_api.h"
14#include "isteamgameserver.h"
16
18{
19 eServerModeInvalid = 0, // DO NOT USE
20 eServerModeNoAuthentication = 1, // Don't authenticate user logins and don't list on the server list
21 eServerModeAuthentication = 2, // Authenticate users, list on the server list, don't run VAC on clients that connect
22 eServerModeAuthenticationAndSecure = 3, // Authenticate users, list on the server list and VAC protect clients
23};
24
30
31// DEPRECATED: This old name was really confusing.
33
34// Initialize SteamGameServer client and interface objects, and set server properties which may not be changed.
35//
36// After calling this function, you should set any additional server parameters, and then
37// call ISteamGameServer::LogOnAnonymous() or ISteamGameServer::LogOn()
38//
39// - unIP will usually be zero. If you are on a machine with multiple IP addresses, you can pass a non-zero
40// value here and the relevant sockets will be bound to that IP. This can be used to ensure that
41// the IP you desire is the one used in the server browser.
42// - usGamePort is the port that clients will connect to for gameplay. You will usually open up your
43// own socket bound to this port.
44// - usQueryPort is the port that will manage server browser related duties and info
45// pings from clients. If you pass STEAMGAMESERVER_QUERY_PORT_SHARED for usQueryPort, then it
46// will use "GameSocketShare" mode, which means that the game is responsible for sending and receiving
47// UDP packets for the master server updater. (See ISteamGameServer::HandleIncomingPacket and
48// ISteamGameServer::GetNextOutgoingPacket.)
49// - The version string should be in the form x.x.x.x, and is used by the master server to detect when the
50// server is out of date. (Only servers with the latest version will be listed.)
51//
52// On success k_ESteamAPIInitResult_OK is returned. Otherwise, if pOutErrMsg is non-NULL,
53// it will receive a non-localized message that explains the reason for the failure
54inline ESteamAPIInitResult SteamGameServer_InitEx( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString, SteamErrMsg *pOutErrMsg );
55
56// This function is included for compatibility with older SDK.
57// You can use it if you don't care about decent error handling
58inline bool SteamGameServer_Init( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString )
59{
60 return SteamGameServer_InitEx( unIP, usGamePort, usQueryPort, eServerMode, pchVersionString, NULL ) == k_ESteamAPIInitResult_OK;
61}
62
63// Shutdown SteamGameSeverXxx interfaces, log out, and free resources.
65
66// Most Steam API functions allocate some amount of thread-local memory for
67// parameter storage. Calling SteamGameServer_ReleaseCurrentThreadMemory()
68// will free all API-related memory associated with the calling thread.
69// This memory is released automatically by SteamGameServer_RunCallbacks(),
70// so single-threaded servers do not need to explicitly call this function.
72
75
76// Older SDKs exported this global pointer, but it is no longer supported.
77// You should use SteamGameServerClient() to safely access the ISteamClient
78// APIs from your game server application.
79//S_API ISteamClient *g_pSteamClientGameServer;
80
81// SteamGameServer_InitSafe has been replaced with SteamGameServer_Init and
82// is no longer supported. Use SteamGameServer_Init instead.
83//S_API void S_CALLTYPE SteamGameServer_InitSafe();
84
85//=============================================================================
86//
87// Internal implementation details below
88//
89//=============================================================================
90
91S_API ESteamAPIInitResult S_CALLTYPE SteamInternal_GameServer_Init_V2( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString, const char *pszInternalCheckInterfaceVersions, SteamErrMsg *pOutErrMsg );
92inline ESteamAPIInitResult SteamGameServer_InitEx( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString, SteamErrMsg *pOutErrMsg )
93{
94 const char *pszInternalCheckInterfaceVersions =
97
106 "\0";
107 return SteamInternal_GameServer_Init_V2( unIP, usGamePort, usQueryPort, eServerMode, pchVersionString, pszInternalCheckInterfaceVersions, pOutErrMsg );
108}
113
114#endif // STEAM_GAMESERVER_H
#define STEAMGAMESERVER_INTERFACE_VERSION
#define STEAMGAMESERVERSTATS_INTERFACE_VERSION
#define STEAMHTTP_INTERFACE_VERSION
Definition isteamhttp.h:143
#define STEAMINVENTORY_INTERFACE_VERSION
#define STEAMNETWORKING_INTERFACE_VERSION
#define STEAMNETWORKINGMESSAGES_INTERFACE_VERSION
#define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION
#define STEAMNETWORKINGUTILS_INTERFACE_VERSION
#define STEAMUGC_INTERFACE_VERSION
Definition isteamugc.h:416
#define STEAMUTILS_INTERFACE_VERSION
ESteamAPIInitResult
Definition steam_api.h:58
@ k_ESteamAPIInitResult_OK
Definition steam_api.h:59
S_API void S_CALLTYPE SteamAPI_ReleaseCurrentThreadMemory()
#define S_API
char SteamErrMsg[k_cchMaxSteamErrMsg]
const char *typedef uint32(S_CALLTYPE *SteamAPI_CheckCallbackRegistered_t)(int iCallbackNum)
const uint16 MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE
S_API bool SteamGameServer_BSecure()
const uint16 STEAMGAMESERVER_QUERY_PORT_SHARED
EServerMode
@ eServerModeInvalid
@ eServerModeAuthentication
@ eServerModeNoAuthentication
@ eServerModeAuthenticationAndSecure
void SteamGameServer_ReleaseCurrentThreadMemory()
bool SteamGameServer_Init(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString)
S_API ESteamAPIInitResult S_CALLTYPE SteamInternal_GameServer_Init_V2(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString, const char *pszInternalCheckInterfaceVersions, SteamErrMsg *pOutErrMsg)
S_API void SteamGameServer_Shutdown()
S_API uint64 SteamGameServer_GetSteamID()
ESteamAPIInitResult SteamGameServer_InitEx(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString, SteamErrMsg *pOutErrMsg)
unsigned short uint16
Definition steamtypes.h:56
unsigned long long uint64
Definition steamtypes.h:60
#define S_CALLTYPE
Definition steamtypes.h:6