Update to sdk 1.47
parent
82eaf4f684
commit
262ee1d18f
@ -0,0 +1,144 @@
|
||||
|
||||
#ifndef ISTEAMCLIENT019_H
|
||||
#define ISTEAMCLIENT019_H
|
||||
#ifdef STEAM_WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
class ISteamClient019
|
||||
{
|
||||
public:
|
||||
// Creates a communication pipe to the Steam client.
|
||||
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
|
||||
virtual HSteamPipe CreateSteamPipe() = 0;
|
||||
|
||||
// Releases a previously created communications pipe
|
||||
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
|
||||
virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0;
|
||||
|
||||
// connects to an existing global user, failing if none exists
|
||||
// used by the game to coordinate with the steamUI
|
||||
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
|
||||
virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0;
|
||||
|
||||
// used by game servers, create a steam user that won't be shared with anyone else
|
||||
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
|
||||
virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType ) = 0;
|
||||
|
||||
// removes an allocated user
|
||||
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
|
||||
virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0;
|
||||
|
||||
// retrieves the ISteamUser interface associated with the handle
|
||||
virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// retrieves the ISteamGameServer interface associated with the handle
|
||||
virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// set the local IP and Port to bind to
|
||||
// this must be set before CreateLocalUser()
|
||||
virtual void SetLocalIPBinding( uint32 unIP, uint16 usPort ) = 0;
|
||||
|
||||
// returns the ISteamFriends interface
|
||||
virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns the ISteamUtils interface
|
||||
virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns the ISteamMatchmaking interface
|
||||
virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns the ISteamMatchmakingServers interface
|
||||
virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns the a generic interface
|
||||
virtual void *GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns the ISteamUserStats interface
|
||||
virtual ISteamUserStats *GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns the ISteamGameServerStats interface
|
||||
virtual ISteamGameServerStats *GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns apps interface
|
||||
virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// networking
|
||||
virtual ISteamNetworking *GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// remote storage
|
||||
virtual ISteamRemoteStorage *GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// user screenshots
|
||||
virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// game search
|
||||
virtual ISteamGameSearch *GetISteamGameSearch( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Deprecated. Applications should use SteamAPI_RunCallbacks() or SteamGameServer_RunCallbacks() instead.
|
||||
STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
|
||||
|
||||
// returns the number of IPC calls made since the last time this function was called
|
||||
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
|
||||
// Every IPC call is at minimum a thread context switch if not a process one so you want to rate
|
||||
// control how often you do them.
|
||||
virtual uint32 GetIPCCallCount() = 0;
|
||||
|
||||
// API warning handling
|
||||
// 'int' is the severity; 0 for msg, 1 for warning
|
||||
// 'const char *' is the text of the message
|
||||
// callbacks will occur directly after the API function is called that generated the warning or message.
|
||||
virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
|
||||
|
||||
// Trigger global shutdown for the DLL
|
||||
virtual bool BShutdownIfAllPipesClosed() = 0;
|
||||
|
||||
// Expose HTTP interface
|
||||
virtual ISteamHTTP *GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Deprecated - the ISteamUnifiedMessages interface is no longer intended for public consumption.
|
||||
STEAM_PRIVATE_API( virtual void *DEPRECATED_GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0 ; )
|
||||
|
||||
// Exposes the ISteamController interface - deprecated in favor of Steam Input
|
||||
virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Exposes the ISteamUGC interface
|
||||
virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns app list interface, only available on specially registered apps
|
||||
virtual ISteamAppList *GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Music Player
|
||||
virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Music Player Remote
|
||||
virtual ISteamMusicRemote *GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
|
||||
|
||||
// html page display
|
||||
virtual ISteamHTMLSurface *GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
|
||||
|
||||
// Helper functions for internal Steam usage
|
||||
STEAM_PRIVATE_API( virtual void DEPRECATED_Set_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
|
||||
STEAM_PRIVATE_API( virtual void DEPRECATED_Remove_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
|
||||
STEAM_PRIVATE_API( virtual void Set_SteamAPI_CCheckCallbackRegisteredInProcess( SteamAPI_CheckCallbackRegistered_t func ) = 0; )
|
||||
|
||||
// inventory
|
||||
virtual ISteamInventory *GetISteamInventory( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Video
|
||||
virtual ISteamVideo *GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Parental controls
|
||||
virtual ISteamParentalSettings *GetISteamParentalSettings( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Exposes the Steam Input interface for controller support
|
||||
virtual ISteamInput *GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Steam Parties interface
|
||||
virtual ISteamParties *GetISteamParties( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Steam Remote Play interface
|
||||
virtual ISteamRemotePlay *GetISteamRemotePlay( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
};
|
||||
|
||||
#endif // ISTEAMCLIENT019_H
|
@ -0,0 +1,242 @@
|
||||
|
||||
#ifndef ISTEAMGAMESERVER012_H
|
||||
#define ISTEAMGAMESERVER012_H
|
||||
#ifdef STEAM_WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
class ISteamGameServer012
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
//
|
||||
// Basic server data. These properties, if set, must be set before before calling LogOn. They
|
||||
// may not be changed after logged in.
|
||||
//
|
||||
|
||||
/// This is called by SteamGameServer_Init, and you will usually not need to call it directly
|
||||
virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0;
|
||||
|
||||
/// Game product identifier. This is currently used by the master server for version checking purposes.
|
||||
/// It's a required field, but will eventually will go away, and the AppID will be used for this purpose.
|
||||
virtual void SetProduct( const char *pszProduct ) = 0;
|
||||
|
||||
/// Description of the game. This is a required field and is displayed in the steam server browser....for now.
|
||||
/// This is a required field, but it will go away eventually, as the data should be determined from the AppID.
|
||||
virtual void SetGameDescription( const char *pszGameDescription ) = 0;
|
||||
|
||||
/// If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning
|
||||
/// this application is the original game, not a mod.
|
||||
///
|
||||
/// @see k_cbMaxGameServerGameDir
|
||||
virtual void SetModDir( const char *pszModDir ) = 0;
|
||||
|
||||
/// Is this is a dedicated server? The default value is false.
|
||||
virtual void SetDedicatedServer( bool bDedicated ) = 0;
|
||||
|
||||
//
|
||||
// Login
|
||||
//
|
||||
|
||||
/// Begin process to login to a persistent game server account
|
||||
///
|
||||
/// You need to register for callbacks to determine the result of this operation.
|
||||
/// @see SteamServersConnected_t
|
||||
/// @see SteamServerConnectFailure_t
|
||||
/// @see SteamServersDisconnected_t
|
||||
virtual void LogOn( const char *pszToken ) = 0;
|
||||
|
||||
/// Login to a generic, anonymous account.
|
||||
///
|
||||
/// Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init,
|
||||
/// but this is no longer the case.
|
||||
virtual void LogOnAnonymous() = 0;
|
||||
|
||||
/// Begin process of logging game server out of steam
|
||||
virtual void LogOff() = 0;
|
||||
|
||||
// status functions
|
||||
virtual bool BLoggedOn() = 0;
|
||||
virtual bool BSecure() = 0;
|
||||
virtual CSteamID GetSteamID() = 0;
|
||||
|
||||
/// Returns true if the master server has requested a restart.
|
||||
/// Only returns true once per request.
|
||||
virtual bool WasRestartRequested() = 0;
|
||||
|
||||
//
|
||||
// Server state. These properties may be changed at any time.
|
||||
//
|
||||
|
||||
/// Max player count that will be reported to server browser and client queries
|
||||
virtual void SetMaxPlayerCount( int cPlayersMax ) = 0;
|
||||
|
||||
/// Number of bots. Default value is zero
|
||||
virtual void SetBotPlayerCount( int cBotplayers ) = 0;
|
||||
|
||||
/// Set the name of server as it will appear in the server browser
|
||||
///
|
||||
/// @see k_cbMaxGameServerName
|
||||
virtual void SetServerName( const char *pszServerName ) = 0;
|
||||
|
||||
/// Set name of map to report in the server browser
|
||||
///
|
||||
/// @see k_cbMaxGameServerName
|
||||
virtual void SetMapName( const char *pszMapName ) = 0;
|
||||
|
||||
/// Let people know if your server will require a password
|
||||
virtual void SetPasswordProtected( bool bPasswordProtected ) = 0;
|
||||
|
||||
/// Spectator server. The default value is zero, meaning the service
|
||||
/// is not used.
|
||||
virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0;
|
||||
|
||||
/// Name of the spectator server. (Only used if spectator port is nonzero.)
|
||||
///
|
||||
/// @see k_cbMaxGameServerMapName
|
||||
virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0;
|
||||
|
||||
/// Call this to clear the whole list of key/values that are sent in rules queries.
|
||||
virtual void ClearAllKeyValues() = 0;
|
||||
|
||||
/// Call this to add/update a key/value pair.
|
||||
virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0;
|
||||
|
||||
/// Sets a string defining the "gametags" for this server, this is optional, but if it is set
|
||||
/// it allows users to filter in the matchmaking/server-browser interfaces based on the value
|
||||
///
|
||||
/// @see k_cbMaxGameServerTags
|
||||
virtual void SetGameTags( const char *pchGameTags ) = 0;
|
||||
|
||||
/// Sets a string defining the "gamedata" for this server, this is optional, but if it is set
|
||||
/// it allows users to filter in the matchmaking/server-browser interfaces based on the value
|
||||
/// don't set this unless it actually changes, its only uploaded to the master once (when
|
||||
/// acknowledged)
|
||||
///
|
||||
/// @see k_cbMaxGameServerGameData
|
||||
virtual void SetGameData( const char *pchGameData ) = 0;
|
||||
|
||||
/// Region identifier. This is an optional field, the default value is empty, meaning the "world" region
|
||||
virtual void SetRegion( const char *pszRegion ) = 0;
|
||||
|
||||
//
|
||||
// Player list management / authentication
|
||||
//
|
||||
|
||||
// Handles receiving a new connection from a Steam user. This call will ask the Steam
|
||||
// servers to validate the users identity, app ownership, and VAC status. If the Steam servers
|
||||
// are off-line, then it will validate the cached ticket itself which will validate app ownership
|
||||
// and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection()
|
||||
// and must then be sent up to the game server for authentication.
|
||||
//
|
||||
// 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
|
||||
// If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication
|
||||
// for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)
|
||||
virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0;
|
||||
|
||||
// Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation.
|
||||
//
|
||||
// Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect()
|
||||
// when this user leaves the server just like you would for a real user.
|
||||
virtual CSteamID CreateUnauthenticatedUserConnection() = 0;
|
||||
|
||||
// Should be called whenever a user leaves our game server, this lets Steam internally
|
||||
// track which users are currently on which servers for the purposes of preventing a single
|
||||
// account being logged into multiple servers, showing who is currently on a server, etc.
|
||||
virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0;
|
||||
|
||||
// Update the data to be displayed in the server browser and matchmaking interfaces for a user
|
||||
// currently connected to the server. For regular users you must call this after you receive a
|
||||
// GSUserValidationSuccess callback.
|
||||
//
|
||||
// Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)
|
||||
virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0;
|
||||
|
||||
// New auth system APIs - do not mix with the old auth system APIs.
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
// Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).
|
||||
// pcbTicket retrieves the length of the actual ticket.
|
||||
virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
|
||||
|
||||
// Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused
|
||||
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
|
||||
virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
|
||||
|
||||
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
|
||||
virtual void EndAuthSession( CSteamID steamID ) = 0;
|
||||
|
||||
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
|
||||
virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
|
||||
|
||||
// After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function
|
||||
// to determine if the user owns downloadable content specified by the provided AppID.
|
||||
virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0;
|
||||
|
||||
// Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t
|
||||
// returns false if we're not connected to the steam servers and thus cannot ask
|
||||
virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0;
|
||||
|
||||
|
||||
// these two functions s are deprecated, and will not return results
|
||||
// they will be removed in a future version of the SDK
|
||||
virtual void GetGameplayStats( ) = 0;
|
||||
STEAM_CALL_RESULT( GSReputation_t )
|
||||
virtual SteamAPICall_t GetServerReputation() = 0;
|
||||
|
||||
// Returns the public IP of the server according to Steam, useful when the server is
|
||||
// behind NAT and you want to advertise its IP in a lobby for other clients to directly
|
||||
// connect to
|
||||
virtual uint32 GetPublicIP_old() = 0;
|
||||
|
||||
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
|
||||
// socket to talk to the master server on, it lets the game use its socket to forward messages
|
||||
// back and forth. This prevents us from requiring server ops to open up yet another port
|
||||
// in their firewalls.
|
||||
//
|
||||
// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001
|
||||
|
||||
// These are used when you've elected to multiplex the game server's UDP socket
|
||||
// rather than having the master server updater use its own sockets.
|
||||
//
|
||||
// Source games use this to simplify the job of the server admins, so they
|
||||
// don't have to open up more ports on their firewalls.
|
||||
|
||||
// Call this when a packet that starts with 0xFFFFFFFF comes in. That means
|
||||
// it's for us.
|
||||
virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0;
|
||||
|
||||
// AFTER calling HandleIncomingPacket for any packets that came in that frame, call this.
|
||||
// This gets a packet that the master server updater needs to send out on UDP.
|
||||
// It returns the length of the packet it wants to send, or 0 if there are no more packets to send.
|
||||
// Call this each frame until it returns 0.
|
||||
virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0;
|
||||
|
||||
//
|
||||
// Control heartbeats / advertisement with master server
|
||||
//
|
||||
|
||||
// Call this as often as you like to tell the master server updater whether or not
|
||||
// you want it to be active (default: off).
|
||||
virtual void EnableHeartbeats( bool bActive ) = 0;
|
||||
|
||||
// You usually don't need to modify this.
|
||||
// Pass -1 to use the default value for iHeartbeatInterval.
|
||||
// Some mods change this.
|
||||
virtual void SetHeartbeatInterval( int iHeartbeatInterval ) = 0;
|
||||
|
||||
// Force a heartbeat to steam at the next opportunity
|
||||
virtual void ForceHeartbeat() = 0;
|
||||
|
||||
// associate this game server with this clan for the purposes of computing player compat
|
||||
STEAM_CALL_RESULT( AssociateWithClanResult_t )
|
||||
virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0;
|
||||
|
||||
// ask if any of the current players dont want to play with this new player - or vice versa
|
||||
STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t )
|
||||
virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // ISTEAMGAMESERVER012_H
|
@ -0,0 +1,159 @@
|
||||
|
||||
|
||||
#ifndef ISTEAMNETWORKING005_H
|
||||
#define ISTEAMNETWORKING005_H
|
||||
#ifdef STEAM_WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
class ISteamNetworking005
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// UDP-style (connectionless) networking interface. These functions send messages using
|
||||
// an API organized around the destination. Reliable and unreliable messages are supported.
|
||||
//
|
||||
// For a more TCP-style interface (meaning you have a connection handle), see the functions below.
|
||||
// Both interface styles can send both reliable and unreliable messages.
|
||||
//
|
||||
// Automatically establishes NAT-traversing or Relay server connections
|
||||
|
||||
// Sends a P2P packet to the specified user
|
||||
// UDP-like, unreliable and a max packet size of 1200 bytes
|
||||
// the first packet send may be delayed as the NAT-traversal code runs
|
||||
// if we can't get through to the user, an error will be posted via the callback P2PSessionConnectFail_t
|
||||
// see EP2PSend enum above for the descriptions of the different ways of sending packets
|
||||
//
|
||||
// nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket()
|
||||
// with the same channel number in order to retrieve the data on the other end
|
||||
// using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources
|
||||
virtual bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel = 0 ) = 0;
|
||||
|
||||
// returns true if any data is available for read, and the amount of data that will need to be read
|
||||
virtual bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel = 0 ) = 0;
|
||||
|
||||
// reads in a packet that has been sent from another user via SendP2PPacket()
|
||||
// returns the size of the message and the steamID of the user who sent it in the last two parameters
|
||||
// if the buffer passed in is too small, the message will be truncated
|
||||
// this call is not blocking, and will return false if no data is available
|
||||
virtual bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel = 0 ) = 0;
|
||||
|
||||
// AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback
|
||||
// P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet
|
||||
// if you don't want to talk to the user, just ignore the request
|
||||
// if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically
|
||||
// this may be called multiple times for a single user
|
||||
// (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)
|
||||
virtual bool AcceptP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
|
||||
|
||||
// call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood
|
||||
// if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted
|
||||
virtual bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
|
||||
|
||||
// call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels
|
||||
// open channels to a user have been closed, the open session to the user will be closed and new data from this
|
||||
// user will trigger a P2PSessionRequest_t callback
|
||||
virtual bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) = 0;
|
||||
|
||||
// fills out P2PSessionState_t structure with details about the underlying connection to the user
|
||||
// should only needed for debugging purposes
|
||||
// returns false if no connection exists to the specified user
|
||||
virtual bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState ) = 0;
|
||||
|
||||
// Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection
|
||||
// or NAT-traversal cannot be established. Only applies to connections created after setting this value,
|
||||
// or to existing connections that need to automatically reconnect after this value is set.
|
||||
//
|
||||
// P2P packet relay is allowed by default
|
||||
virtual bool AllowP2PPacketRelay( bool bAllow ) = 0;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LISTEN / CONNECT connection-oriented interface functions
|
||||
//
|
||||
// These functions are more like a client-server TCP API. One side is the "server"
|
||||
// and "listens" for incoming connections, which then must be "accepted." The "client"
|
||||
// initiates a connection by "connecting." Sending and receiving is done through a
|
||||
// connection handle.
|
||||
//
|
||||
// For a more UDP-style interface, where you do not track connection handles but
|
||||
// simply send messages to a SteamID, use the UDP-style functions above.
|
||||
//
|
||||
// Both methods can send both reliable and unreliable methods.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// creates a socket and listens others to connect
|
||||
// will trigger a SocketStatusCallback_t callback on another client connecting
|
||||
// nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports
|
||||
// this can usually just be 0 unless you want multiple sets of connections
|
||||
// unIP is the local IP address to bind to
|
||||
// pass in 0 if you just want the default local IP
|
||||
// unPort is the port to use
|
||||
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
|
||||
virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0;
|
||||
|
||||
// creates a socket and begin connection to a remote destination
|
||||
// can connect via a known steamID (client or game server), or directly to an IP
|
||||
// on success will trigger a SocketStatusCallback_t callback
|
||||
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
|
||||
virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0;
|
||||
virtual SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec ) = 0;
|
||||
|
||||
// disconnects the connection to the socket, if any, and invalidates the handle
|
||||
// any unread data on the socket will be thrown away
|
||||
// if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect
|
||||
virtual bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
|
||||
// destroying a listen socket will automatically kill all the regular sockets generated from it
|
||||
virtual bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
|
||||
|
||||
// sending data
|
||||
// must be a handle to a connected socket
|
||||
// data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets
|
||||
// use the reliable flag with caution; although the resend rate is pretty aggressive,
|
||||
// it can still cause stalls in receiving data (like TCP)
|
||||
virtual bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable ) = 0;
|
||||
|
||||
// receiving data
|
||||
// returns false if there is no data remaining
|
||||
// fills out *pcubMsgSize with the size of the next message, in bytes
|
||||
virtual bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) = 0;
|
||||
|
||||
// fills in pubDest with the contents of the message
|
||||
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
|
||||
// if *pcubMsgSize < cubDest, only partial data is written
|
||||
// returns false if no data is available
|
||||
virtual bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;
|
||||
|
||||
// checks for data from any socket that has been connected off this listen socket
|
||||
// returns false if there is no data remaining
|
||||
// fills out *pcubMsgSize with the size of the next message, in bytes
|
||||
// fills out *phSocket with the socket that data is available on
|
||||
virtual bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
|
||||
|
||||
// retrieves data from any socket that has been connected off this listen socket
|
||||
// fills in pubDest with the contents of the message
|
||||
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
|
||||
// if *pcubMsgSize < cubDest, only partial data is written
|
||||
// returns false if no data is available
|
||||
// fills out *phSocket with the socket that data is available on
|
||||
virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
|
||||
|
||||
// returns information about the specified socket, filling out the contents of the pointers
|
||||
virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote ) = 0;
|
||||
|
||||
// returns which local port the listen socket is bound to
|
||||
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
|
||||
virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort ) = 0;
|
||||
|
||||
// returns true to describe how the socket ended up connecting
|
||||
virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0;
|
||||
|
||||
// max packet size, in bytes
|
||||
virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0;
|
||||
};
|
||||
|
||||
#endif // ISTEAMNETWORKING005_H
|
@ -0,0 +1,463 @@
|
||||
|
||||
#ifndef ISTEAMNETWORKINGSOCKETS003
|
||||
#define ISTEAMNETWORKINGSOCKETS003
|
||||
|
||||
|
||||
class ISteamNetworkingSockets003
|
||||
{
|
||||
public:
|
||||
|
||||
/// Creates a "server" socket that listens for clients to connect to by
|
||||
/// calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6)
|
||||
///
|
||||
/// You must select a specific local port to listen on and set it
|
||||
/// the port field of the local address.
|
||||
///
|
||||
/// Usually you wil set the IP portion of the address to zero, (SteamNetworkingIPAddr::Clear()).
|
||||
/// This means that you will not bind to any particular local interface. In addition,
|
||||
/// if possible the socket will be bound in "dual stack" mode, which means that it can
|
||||
/// accept both IPv4 and IPv6 clients. If you wish to bind a particular interface, then
|
||||
/// set the local address to the appropriate IPv4 or IPv6 IP.
|
||||
///
|
||||
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
|
||||
/// will be posted. The connection will be in the connecting state.
|
||||
virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress ) = 0;
|
||||
|
||||
/// Creates a connection and begins talking to a "server" over UDP at the
|
||||
/// given IPv4 or IPv6 address. The remote host must be listening with a
|
||||
/// matching call to CreateListenSocketIP on the specified port.
|
||||
///
|
||||
/// A SteamNetConnectionStatusChangedCallback_t callback will be triggered when we start
|
||||
/// connecting, and then another one on either timeout or successful connection.
|
||||
///
|
||||
/// If the server does not have any identity configured, then their network address
|
||||
/// will be the only identity in use. Or, the network host may provide a platform-specific
|
||||
/// identity with or without a valid certificate to authenticate that identity. (These
|
||||
/// details will be contained in the SteamNetConnectionStatusChangedCallback_t.) It's
|
||||
/// up to your application to decide whether to allow the connection.
|
||||
///
|
||||
/// By default, all connections will get basic encryption sufficient to prevent
|
||||
/// casual eavesdropping. But note that without certificates (or a shared secret
|
||||
/// distributed through some other out-of-band mechanism), you don't have any
|
||||
/// way of knowing who is actually on the other end, and thus are vulnerable to
|
||||
/// man-in-the-middle attacks.
|
||||
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) = 0;
|
||||
|
||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P
|
||||
///
|
||||
/// nVirtualPort specifies how clients can connect to this socket using
|
||||
/// ConnectP2P. It's very common for applications to only have one listening socket;
|
||||
/// in that case, use zero. If you need to open multiple listen sockets and have clients
|
||||
/// be able to connect to one or the other, then nVirtualPort should be a small integer (<1000)
|
||||
/// unique to each listen socket you create.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
virtual HSteamListenSocket CreateListenSocketP2P( int nVirtualPort ) = 0;
|
||||
|
||||
/// Begin connecting to a server that is identified using a platform-specific identifier.
|
||||
/// This requires some sort of third party rendezvous service, and will depend on the
|
||||
/// platform and what other libraries and services you are integrating with.
|
||||
///
|
||||
/// At the time of this writing, there is only one supported rendezvous service: Steam.
|
||||
/// Set the SteamID (whether "user" or "gameserver") and Steam will determine if the
|
||||
/// client is online and facilitate a relay connection. Note that all P2P connections on
|
||||
/// Steam are currently relayed.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort ) = 0;
|
||||
#endif
|
||||
|
||||
/// Accept an incoming connection that has been received on a listen socket.
|
||||
///
|
||||
/// When a connection attempt is received (perhaps after a few basic handshake
|
||||
/// packets have been exchanged to prevent trivial spoofing), a connection interface
|
||||
/// object is created in the k_ESteamNetworkingConnectionState_Connecting state
|
||||
/// and a SteamNetConnectionStatusChangedCallback_t is posted. At this point, your
|
||||
/// application MUST either accept or close the connection. (It may not ignore it.)
|
||||
/// Accepting the connection will transition it either into the connected state,
|
||||
/// or the finding route state, depending on the connection type.
|
||||
///
|
||||
/// You should take action within a second or two, because accepting the connection is
|
||||
/// what actually sends the reply notifying the client that they are connected. If you
|
||||
/// delay taking action, from the client's perspective it is the same as the network
|
||||
/// being unresponsive, and the client may timeout the connection attempt. In other
|
||||
/// words, the client cannot distinguish between a delay caused by network problems
|
||||
/// and a delay caused by the application.
|
||||
///
|
||||
/// This means that if your application goes for more than a few seconds without
|
||||
/// processing callbacks (for example, while loading a map), then there is a chance
|
||||
/// that a client may attempt to connect in that interval and fail due to timeout.
|
||||
///
|
||||
/// If the application does not respond to the connection attempt in a timely manner,
|
||||
/// and we stop receiving communication from the client, the connection attempt will
|
||||
/// be timed out locally, transitioning the connection to the
|
||||
/// k_ESteamNetworkingConnectionState_ProblemDetectedLocally state. The client may also
|
||||
/// close the connection before it is accepted, and a transition to the
|
||||
/// k_ESteamNetworkingConnectionState_ClosedByPeer is also possible depending the exact
|
||||
/// sequence of events.
|
||||
///
|
||||
/// Returns k_EResultInvalidParam if the handle is invalid.
|
||||
/// Returns k_EResultInvalidState if the connection is not in the appropriate state.
|
||||
/// (Remember that the connection state could change in between the time that the
|
||||
/// notification being posted to the queue and when it is received by the application.)
|
||||
virtual EResult AcceptConnection( HSteamNetConnection hConn ) = 0;
|
||||
|
||||
/// Disconnects from the remote host and invalidates the connection handle.
|
||||
/// Any unread data on the connection is discarded.
|
||||
///
|
||||
/// nReason is an application defined code that will be received on the other
|
||||
/// end and recorded (when possible) in backend analytics. The value should
|
||||
/// come from a restricted range. (See ESteamNetConnectionEnd.) If you don't need
|
||||
/// to communicate any information to the remote host, and do not want analytics to
|
||||
/// be able to distinguish "normal" connection terminations from "exceptional" ones,
|
||||
/// You may pass zero, in which case the generic value of
|
||||
/// k_ESteamNetConnectionEnd_App_Generic will be used.
|
||||
///
|
||||
/// pszDebug is an optional human-readable diagnostic string that will be received
|
||||
/// by the remote host and recorded (when possible) in backend analytics.
|
||||
///
|
||||
/// If you wish to put the socket into a "linger" state, where an attempt is made to
|
||||
/// flush any remaining sent data, use bEnableLinger=true. Otherwise reliable data
|
||||
/// is not flushed.
|
||||
///
|
||||
/// If the connection has already ended and you are just freeing up the
|
||||
/// connection interface, the reason code, debug string, and linger flag are
|
||||
/// ignored.
|
||||
virtual bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDebug, bool bEnableLinger ) = 0;
|
||||
|
||||
/// Destroy a listen socket. All the connections that were accepting on the listen
|
||||
/// socket are closed ungracefully.
|
||||
virtual bool CloseListenSocket( HSteamListenSocket hSocket ) = 0;
|
||||
|
||||
/// Set connection user data. the data is returned in the following places
|
||||
/// - You can query it using GetConnectionUserData.
|
||||
/// - The SteamNetworkingmessage_t structure.
|
||||
/// - The SteamNetConnectionInfo_t structure. (Which is a member of SteamNetConnectionStatusChangedCallback_t.)
|
||||
///
|
||||
/// Returns false if the handle is invalid.
|
||||
virtual bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) = 0;
|
||||
|
||||
/// Fetch connection user data. Returns -1 if handle is invalid
|
||||
/// or if you haven't set any userdata on the connection.
|
||||
virtual int64 GetConnectionUserData( HSteamNetConnection hPeer ) = 0;
|
||||
|
||||
/// Set a name for the connection, used mostly for debugging
|
||||
virtual void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) = 0;
|
||||
|
||||
/// Fetch connection name. Returns false if handle is invalid
|
||||
virtual bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) = 0;
|
||||
|
||||
/// Send a message to the remote host on the specified connection.
|
||||
///
|
||||
/// nSendFlags determines the delivery guarantees that will be provided,
|
||||
/// when data should be buffered, etc. E.g. k_nSteamNetworkingSend_Unreliable
|
||||
///
|
||||
/// Note that the semantics we use for messages are not precisely
|
||||
/// the same as the semantics of a standard "stream" socket.
|
||||
/// (SOCK_STREAM) For an ordinary stream socket, the boundaries
|
||||
/// between chunks are not considered relevant, and the sizes of
|
||||
/// the chunks of data written will not necessarily match up to
|
||||
/// the sizes of the chunks that are returned by the reads on
|
||||
/// the other end. The remote host might read a partial chunk,
|
||||
/// or chunks might be coalesced. For the message semantics
|
||||
/// used here, however, the sizes WILL match. Each send call
|
||||
/// will match a successful read call on the remote host
|
||||
/// one-for-one. If you are porting existing stream-oriented
|
||||
/// code to the semantics of reliable messages, your code should
|
||||
/// work the same, since reliable message semantics are more
|
||||
/// strict than stream semantics. The only caveat is related to
|
||||
/// performance: there is per-message overhead to retain the
|
||||
/// message sizes, and so if your code sends many small chunks
|
||||
/// of data, performance will suffer. Any code based on stream
|
||||
/// sockets that does not write excessively small chunks will
|
||||
/// work without any changes.
|
||||
///
|
||||
/// Returns:
|
||||
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
|
||||
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
|
||||
/// - k_EResultInvalidState: connection is in an invalid state
|
||||
/// - k_EResultNoConnection: connection has ended
|
||||
/// - k_EResultIgnored: You used k_nSteamNetworkingSend_NoDelay, and the message was dropped because
|
||||
/// we were not ready to send it.
|
||||
/// - k_EResultLimitExceeded: there was already too much data queued to be sent.
|
||||
/// (See k_ESteamNetworkingConfig_SendBufferSize)
|
||||
virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags ) = 0;
|
||||
|
||||
/// Flush any messages waiting on the Nagle timer and send them
|
||||
/// at the next transmission opportunity (often that means right now).
|
||||
///
|
||||
/// If Nagle is enabled (it's on by default) then when calling
|
||||
/// SendMessageToConnection the message will be buffered, up to the Nagle time
|
||||
/// before being sent, to merge small messages into the same packet.
|
||||
/// (See k_ESteamNetworkingConfig_NagleTime)
|
||||
///
|
||||
/// Returns:
|
||||
/// k_EResultInvalidParam: invalid connection handle
|
||||
/// k_EResultInvalidState: connection is in an invalid state
|
||||
/// k_EResultNoConnection: connection has ended
|
||||
/// k_EResultIgnored: We weren't (yet) connected, so this operation has no effect.
|
||||
virtual EResult FlushMessagesOnConnection( HSteamNetConnection hConn ) = 0;
|
||||
|
||||
/// Fetch the next available message(s) from the connection, if any.
|
||||
/// Returns the number of messages returned into your array, up to nMaxMessages.
|
||||
/// If the connection handle is invalid, -1 is returned.
|
||||
///
|
||||
/// The order of the messages returned in the array is relevant.
|
||||
/// Reliable messages will be received in the order they were sent (and with the
|
||||
/// same sizes --- see SendMessageToConnection for on this subtle difference from a stream socket).
|
||||
///
|
||||
/// Unreliable messages may be dropped, or delivered out of order withrespect to
|
||||
/// each other or with respect to reliable messages. The same unreliable message
|
||||
/// may be received multiple times.
|
||||
///
|
||||
/// If any messages are returned, you MUST call SteamNetworkingMessage_t::Release() on each
|
||||
/// of them free up resources after you are done. It is safe to keep the object alive for
|
||||
/// a little while (put it into some queue, etc), and you may call Release() from any thread.
|
||||
virtual int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||
|
||||
/// Same as ReceiveMessagesOnConnection, but will return the next message available
|
||||
/// on any connection that was accepted through the specified listen socket. Examine
|
||||
/// SteamNetworkingMessage_t::m_conn to know which client connection.
|
||||
///
|
||||
/// Delivery order of messages among different clients is not defined. They may
|
||||
/// be returned in an order different from what they were actually received. (Delivery
|
||||
/// order of messages from the same client is well defined, and thus the order of the
|
||||
/// messages is relevant!)
|
||||
virtual int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||
|
||||
/// Returns basic information about the high-level state of the connection.
|
||||
virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0;
|
||||
|
||||
/// Returns a small set of information about the real-time state of the connection
|
||||
/// Returns false if the connection handle is invalid, or the connection has ended.
|
||||
virtual bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats ) = 0;
|
||||
|
||||
/// Returns detailed connection stats in text format. Useful
|
||||
/// for dumping to a log, etc.
|
||||
///
|
||||
/// Returns:
|
||||
/// -1 failure (bad connection handle)
|
||||
/// 0 OK, your buffer was filled in and '\0'-terminated
|
||||
/// >0 Your buffer was either nullptr, or it was too small and the text got truncated.
|
||||
/// Try again with a buffer of at least N bytes.
|
||||
virtual int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf ) = 0;
|
||||
|
||||
/// Returns local IP and port that a listen socket created using CreateListenSocketIP is bound to.
|
||||
///
|
||||
/// An IPv6 address of ::0 means "any IPv4 or IPv6"
|
||||
/// An IPv6 address of ::ffff:0000:0000 means "any IPv4"
|
||||
virtual bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address ) = 0;
|
||||
|
||||
/// Create a pair of connections that are talking to each other, e.g. a loopback connection.
|
||||
/// This is very useful for testing, or so that your client/server code can work the same
|
||||
/// even when you are running a local "server".
|
||||
///
|
||||
/// The two connections will immediately be placed into the connected state, and no callbacks
|
||||
/// will be posted immediately. After this, if you close either connection, the other connection
|
||||
/// will receive a callback, exactly as if they were communicating over the network. You must
|
||||
/// close *both* sides in order to fully clean up the resources!
|
||||
///
|
||||
/// By default, internal buffers are used, completely bypassing the network, the chopping up of
|
||||
/// messages into packets, encryption, copying the payload, etc. This means that loopback
|
||||
/// packets, by default, will not simulate lag or loss. Passing true for bUseNetworkLoopback will
|
||||
/// cause the socket pair to send packets through the local network loopback device (127.0.0.1)
|
||||
/// on ephemeral ports. Fake lag and loss are supported in this case, and CPU time is expended
|
||||
/// to encrypt and decrypt.
|
||||
///
|
||||
/// If you wish to assign a specific identity to either connection, you may pass a particular
|
||||
/// identity. Otherwise, if you pass nullptr, the respective connection will assume a generic
|
||||
/// "localhost" identity. If you use real network loopback, this might be translated to the
|
||||
/// actual bound loopback port. Otherwise, the port will be zero.
|
||||
virtual bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity *pIdentity1, const SteamNetworkingIdentity *pIdentity2 ) = 0;
|
||||
|
||||
/// Get the identity assigned to this interface.
|
||||
/// E.g. on Steam, this is the user's SteamID, or for the gameserver interface, the SteamID assigned
|
||||
/// to the gameserver. Returns false and sets the result to an invalid identity if we don't know
|
||||
/// our identity yet. (E.g. GameServer has not logged in. On Steam, the user will know their SteamID
|
||||
/// even if they are not signed into Steam.)
|
||||
virtual bool GetIdentity( SteamNetworkingIdentity *pIdentity ) = 0;
|
||||
|
||||
/// Indicate our desire to be ready participate in authenticated communications.
|
||||
/// If we are currently not ready, then steps will be taken to obtain the necessary
|
||||
/// certificates. (This includes a certificate for us, as well as any CA certificates
|
||||
/// needed to authenticate peers.)
|
||||
///
|
||||
/// You can call this at program init time if you know that you are going to
|
||||
/// be making authenticated connections, so that we will be ready immediately when
|
||||
/// those connections are attempted. (Note that essentially all connections require
|
||||
/// authentication, with the exception of ordinary UDP connections with authentication
|
||||
/// disabled using k_ESteamNetworkingConfig_IP_AllowWithoutAuth.) If you don't call
|
||||
/// this function, we will wait until a feature is utilized that that necessitates
|
||||
/// these resources.
|
||||
///
|
||||
/// You can also call this function to force a retry, if failure has occurred.
|
||||
/// Once we make an attempt and fail, we will not automatically retry.
|
||||
/// In this respect, the behavior of the system after trying and failing is the same
|
||||
/// as before the first attempt: attempting authenticated communication or calling
|
||||
/// this function will call the system to attempt to acquire the necessary resources.
|
||||
///
|
||||
/// You can use GetAuthenticationStatus or listen for SteamNetAuthenticationStatus_t
|
||||
/// to monitor the status.
|
||||
///
|
||||
/// Returns the current value that would be returned from GetAuthenticationStatus.
|
||||
virtual ESteamNetworkingAvailability InitAuthentication() = 0;
|
||||
|
||||
/// Query our readiness to participate in authenticated communications. A
|
||||
/// SteamNetAuthenticationStatus_t callback is posted any time this status changes,
|
||||
/// but you can use this function to query it at any time.
|
||||
///
|
||||
/// The value of SteamNetAuthenticationStatus_t::m_eAvail is returned. If you only
|
||||
/// want this high level status, you can pass NULL for pDetails. If you want further
|
||||
/// details, pass non-NULL to receive them.
|
||||
virtual ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails ) = 0;
|
||||
|
||||
/// Certificate provision by the application. (On Steam, Steam will handle all this automatically)
|
||||
#ifndef STEAMNETWORKINGSOCKETS_STEAM
|
||||
|
||||
/// Get blob that describes a certificate request. You can send this to your game coordinator.
|
||||
/// Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will
|
||||
/// return the number of bytes that were populated. You can pass pBlob=NULL to query for the required
|
||||
/// size. (256 bytes is a very conservative estimate.)
|
||||
///
|
||||
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
|
||||
virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0;
|
||||
|
||||
/// Set the certificate. The certificate blob should be the output of
|
||||
/// SteamDatagram_CreateCert.
|
||||
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
|
||||
//
|
||||
// Clients connecting to dedicated servers hosted in a data center,
|
||||
// using central-authority-granted tickets.
|
||||
//
|
||||
|
||||
/// Call this when you receive a ticket from your backend / matchmaking system. Puts the
|
||||
/// ticket into a persistent cache, and optionally returns the parsed ticket.
|
||||
///
|
||||
/// See stamdatagram_ticketgen.h for more details.
|
||||
virtual bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
|
||||
|
||||
/// Search cache for a ticket to talk to the server on the specified virtual port.
|
||||
/// If found, returns the number of seconds until the ticket expires, and optionally
|
||||
/// the complete cracked ticket. Returns 0 if we don't have a ticket.
|
||||
///
|
||||
/// Typically this is useful just to confirm that you have a ticket, before you
|
||||
/// call ConnectToHostedDedicatedServer to connect to the server.
|
||||
virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
|
||||
|
||||
/// Client call to connect to a server hosted in a Valve data center, on the specified virtual
|
||||
/// port. You must have placed a ticket for this server into the cache, or else this connect attempt will fail!
|
||||
///
|
||||
/// You may wonder why tickets are stored in a cache, instead of simply being passed as an argument
|
||||
/// here. The reason is to make reconnection to a gameserver robust, even if the client computer loses
|
||||
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort ) = 0;
|
||||
|
||||
//
|
||||
// Servers hosted in data centers known to the Valve relay network
|
||||
//
|
||||
|
||||
/// Returns the value of the SDR_LISTEN_PORT environment variable. This
|
||||
/// is the UDP server your server will be listening on. This will
|
||||
/// configured automatically for you in production environments.
|
||||
///
|
||||
/// In development, you'll need to set it yourself. See
|
||||
/// https://partner.steamgames.com/doc/api/ISteamNetworkingSockets
|
||||
/// for more information on how to configure dev environments.
|
||||
virtual uint16 GetHostedDedicatedServerPort() = 0;
|
||||
|
||||
/// Returns 0 if SDR_LISTEN_PORT is not set. Otherwise, returns the data center the server
|
||||
/// is running in. This will be k_SteamDatagramPOPID_dev in non-production envirionment.
|
||||
virtual SteamNetworkingPOPID GetHostedDedicatedServerPOPID() = 0;
|
||||
|
||||
/// Return info about the hosted server. This contains the PoPID of the server,
|
||||
/// and opaque routing information that can be used by the relays to send traffic
|
||||
/// to your server.
|
||||
///
|
||||
/// You will need to send this information to your backend, and put it in tickets,
|
||||
/// so that the relays will know how to forward traffic from
|
||||
/// clients to your server. See SteamDatagramRelayAuthTicket for more info.
|
||||
///
|
||||
/// Also, note that the routing information is contained in SteamDatagramGameCoordinatorServerLogin,
|
||||
/// so if possible, it's preferred to use GetGameCoordinatorServerLogin to send this info
|
||||
/// to your game coordinator service, and also login securely at the same time.
|
||||
///
|
||||
/// On a successful exit, k_EResultOK is returned
|
||||
///
|
||||
/// Unsuccessful exit:
|
||||
/// - Something other than k_EResultOK is returned.
|
||||
/// - k_EResultInvalidState: We are not configured to listen for SDR (SDR_LISTEN_SOCKET
|
||||
/// is not set.)
|
||||
/// - k_EResultPending: we do not (yet) have the authentication information needed.
|
||||
/// (See GetAuthenticationStatus.) If you use environment variables to pre-fetch
|
||||
/// the network config, this data should always be available immediately.
|
||||
/// - A non-localized diagnostic debug message will be placed in m_data that describes
|
||||
/// the cause of the failure.
|
||||
///
|
||||
/// NOTE: The returned blob is not encrypted. Send it to your backend, but don't
|
||||
/// directly share it with clients.
|
||||
virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting ) = 0;
|
||||
|
||||
/// Create a listen socket on the specified virtual port. The physical UDP port to use
|
||||
/// will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not
|
||||
/// configured, this call will fail.
|
||||
///
|
||||
/// Note that this call MUST be made through the SteamGameServerNetworkingSockets() interface
|
||||
virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort ) = 0;
|
||||
|
||||
/// Generate an authentication blob that can be used to securely login with
|
||||
/// your backend, using SteamDatagram_ParseHostedServerLogin. (See
|
||||
/// steamdatagram_gamecoordinator.h)
|
||||
///
|
||||
/// Before calling the function:
|
||||
/// - Populate the app data in pLoginInfo (m_cbAppData and m_appData). You can leave
|
||||
/// all other fields uninitialized.
|
||||
/// - *pcbSignedBlob contains the size of the buffer at pBlob. (It should be
|
||||
/// at least k_cbMaxSteamDatagramGameCoordinatorServerLoginSerialized.)
|
||||
///
|
||||
/// On a successful exit:
|
||||
/// - k_EResultOK is returned
|
||||
/// - All of the remaining fields of pLoginInfo will be filled out.
|
||||
/// - *pcbSignedBlob contains the size of the serialized blob that has been
|
||||
/// placed into pBlob.
|
||||
///
|
||||
/// Unsuccessful exit:
|
||||
/// - Something other than k_EResultOK is returned.
|
||||
/// - k_EResultNotLoggedOn: you are not logged in (yet)
|
||||
/// - See GetHostedDedicatedServerAddress for more potential failure return values.
|
||||
/// - A non-localized diagnostic debug message will be placed in pBlob that describes
|
||||
/// the cause of the failure.
|
||||
///
|
||||
/// This works by signing the contents of the SteamDatagramGameCoordinatorServerLogin
|
||||
/// with the cert that is issued to this server. In dev environments, it's OK if you do
|
||||
/// not have a cert. (You will need to enable insecure dev login in SteamDatagram_ParseHostedServerLogin.)
|
||||
/// Otherwise, you will need a signed cert.
|
||||
///
|
||||
/// NOTE: The routing blob returned here is not encrypted. Send it to your backend
|
||||
/// and don't share it directly with clients.
|
||||
virtual EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob ) = 0;
|
||||
|
||||
#endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
|
||||
// Invoke all callbacks queued for this interface.
|
||||
// On Steam, callbacks are dispatched via the ordinary Steamworks callbacks mechanism.
|
||||
// So if you have code that is also targeting Steam, you should call this at about the
|
||||
// same time you would call SteamAPI_RunCallbacks and SteamGameServer_RunCallbacks.
|
||||
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
|
||||
virtual void RunCallbacks( ISteamNetworkingSocketsCallbacks *pCallbacks ) = 0;
|
||||
#endif
|
||||
protected:
|
||||
// ~ISteamNetworkingSockets(); // Silence some warnings
|
||||
};
|
||||
|
||||
#endif // ISTEAMNETWORKINGSOCKETS003
|
@ -0,0 +1,255 @@
|
||||
|
||||
#ifndef ISTEAMNETWORKINGUTILS002
|
||||
#define ISTEAMNETWORKINGUTILS002
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Misc networking utilities for checking the local networking environment
|
||||
/// and estimating pings.
|
||||
class ISteamNetworkingUtils002
|
||||
{
|
||||
public:
|
||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
|
||||
//
|
||||
// Initialization and status check
|
||||
//
|
||||
|
||||
/// If you know that you are going to be using the relay network, call
|
||||
/// this to initialize the relay network or check if that initialization
|
||||
/// has completed. If you do not call this, the initialization will
|
||||
/// happen the first time you use a feature that requires access to the
|
||||
/// relay network, and that use will be delayed.
|
||||
///
|
||||
/// Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
|
||||
/// callbacks to know when initialization has completed.
|
||||
/// Typically initialization completes in a few seconds.
|
||||
///
|
||||
/// Note: dedicated servers hosted in known data centers do *not* need
|
||||
/// to call this, since they do not make routing decisions. However, if
|
||||
/// the dedicated server will be using P2P functionality, it will act as
|
||||
/// a "client" and this should be called.
|
||||
inline void InitRelayNetworkAccess();
|
||||
|
||||
/// Fetch current status of the relay network.
|
||||
///
|
||||
/// SteamRelayNetworkStatus_t is also a callback. It will be triggered on
|
||||
/// both the user and gameserver interfaces any time the status changes, or
|
||||
/// ping measurement starts or stops.
|
||||
///
|
||||
/// SteamRelayNetworkStatus_t::m_eAvail is returned. If you want
|
||||
/// more details, you can pass a non-NULL value.
|
||||
virtual ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *pDetails ) = 0;
|
||||
|
||||
//
|
||||
// "Ping location" functions
|
||||
//
|
||||
// We use the ping times to the valve relays deployed worldwide to
|
||||
// generate a "marker" that describes the location of an Internet host.
|
||||
// Given two such markers, we can estimate the network latency between
|
||||
// two hosts, without sending any packets. The estimate is based on the
|
||||
// optimal route that is found through the Valve network. If you are
|
||||
// using the Valve network to carry the traffic, then this is precisely
|
||||
// the ping you want. If you are not, then the ping time will probably
|
||||
// still be a reasonable estimate.
|
||||
//
|
||||
// This is extremely useful to select peers for matchmaking!
|
||||
//
|
||||
// The markers can also be converted to a string, so they can be transmitted.
|
||||
// We have a separate library you can use on your app's matchmaking/coordinating
|
||||
// server to manipulate these objects. (See steamdatagram_gamecoordinator.h)
|
||||
|
||||
/// Return location info for the current host. Returns the approximate
|
||||
/// age of the data, in seconds, or -1 if no data is available.
|
||||
///
|
||||
/// It takes a few seconds to initialize access to the relay network. If
|
||||
/// you call this very soon after calling InitRelayNetworkAccess,
|
||||
/// the data may not be available yet.
|
||||
///
|
||||
/// This always return the most up-to-date information we have available
|
||||
/// right now, even if we are in the middle of re-calculating ping times.
|
||||
virtual float GetLocalPingLocation( SteamNetworkPingLocation_t &result ) = 0;
|
||||
|
||||
/// Estimate the round-trip latency between two arbitrary locations, in
|
||||
/// milliseconds. This is a conservative estimate, based on routing through
|
||||
/// the relay network. For most basic relayed connections, this ping time
|
||||
/// will be pretty accurate, since it will be based on the route likely to
|
||||
/// be actually used.
|
||||
///
|
||||
/// If a direct IP route is used (perhaps via NAT traversal), then the route
|
||||
/// will be different, and the ping time might be better. Or it might actually
|
||||
/// be a bit worse! Standard IP routing is frequently suboptimal!
|
||||
///
|
||||
/// But even in this case, the estimate obtained using this method is a
|
||||
/// reasonable upper bound on the ping time. (Also it has the advantage
|
||||
/// of returning immediately and not sending any packets.)
|
||||
///
|
||||
/// In a few cases we might not able to estimate the route. In this case
|
||||
/// a negative value is returned. k_nSteamNetworkingPing_Failed means
|
||||
/// the reason was because of some networking difficulty. (Failure to
|
||||
/// ping, etc) k_nSteamNetworkingPing_Unknown is returned if we cannot
|
||||
/// currently answer the question for some other reason.
|
||||
///
|
||||
/// Do you need to be able to do this from a backend/matchmaking server?
|
||||
/// You are looking for the "ticketgen" library.
|
||||
virtual int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 ) = 0;
|
||||
|
||||
/// Same as EstimatePingTime, but assumes that one location is the local host.
|
||||
/// This is a bit faster, especially if you need to calculate a bunch of
|
||||
/// these in a loop to find the fastest one.
|
||||
///
|
||||
/// In rare cases this might return a slightly different estimate than combining
|
||||
/// GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations. That's because
|
||||
/// this function uses a slightly more complete set of information about what
|
||||
/// route would be taken.
|
||||
virtual int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t &remoteLocation ) = 0;
|
||||
|
||||
/// Convert a ping location into a text format suitable for sending over the wire.
|
||||
/// The format is a compact and human readable. However, it is subject to change
|
||||
/// so please do not parse it yourself. Your buffer must be at least
|
||||
/// k_cchMaxSteamNetworkingPingLocationString bytes.
|
||||
virtual void ConvertPingLocationToString( const SteamNetworkPingLocation_t &location, char *pszBuf, int cchBufSize ) = 0;
|
||||
|
||||
/// Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand
|
||||
/// the string.
|
||||
virtual bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result ) = 0;
|
||||
|
||||
/// Check if the ping data of sufficient recency is available, and if
|
||||
/// it's too old, start refreshing it.
|
||||
///
|
||||
/// Please only call this function when you *really* do need to force an
|
||||
/// immediate refresh of the data. (For example, in response to a specific
|
||||
/// user input to refresh this information.) Don't call it "just in case",
|
||||
/// before every connection, etc. That will cause extra traffic to be sent
|
||||
/// for no benefit. The library will automatically refresh the information
|
||||
/// as needed.
|
||||
///
|
||||
/// Returns true if sufficiently recent data is already available.
|
||||
///
|
||||
/// Returns false if sufficiently recent data is not available. In this
|
||||
/// case, ping measurement is initiated, if it is not already active.
|
||||
/// (You cannot restart a measurement already in progress.)
|
||||
///
|
||||
/// You can use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
|
||||
/// to know when ping measurement completes.
|
||||
virtual bool CheckPingDataUpToDate( float flMaxAgeSeconds ) = 0;
|
||||
|
||||
//
|
||||
// List of Valve data centers, and ping times to them. This might
|
||||
// be useful to you if you are use our hosting, or just need to measure
|
||||
// latency to a cloud data center where we are running relays.
|
||||
//
|
||||
|
||||
/// Fetch ping time of best available relayed route from this host to
|
||||
/// the specified data center.
|
||||
virtual int GetPingToDataCenter( SteamNetworkingPOPID popID, SteamNetworkingPOPID *pViaRelayPoP ) = 0;
|
||||
|
||||
/// Get *direct* ping time to the relays at the data center.
|
||||
virtual int GetDirectPingToPOP( SteamNetworkingPOPID popID ) = 0;
|
||||
|
||||
/// Get number of network points of presence in the config
|
||||
virtual int GetPOPCount() = 0;
|
||||
|
||||
/// Get list of all POP IDs. Returns the number of entries that were filled into
|
||||
/// your list.
|
||||
virtual int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) = 0;
|
||||
#endif // #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
||||
/// Fetch current timestamp. This timer has the following properties:
|
||||
///
|
||||
/// - Monotonicity is guaranteed.
|
||||
/// - The initial value will be at least 24*3600*30*1e6, i.e. about
|
||||
/// 30 days worth of microseconds. In this way, the timestamp value of
|
||||
/// 0 will always be at least "30 days ago". Also, negative numbers
|
||||
/// will never be returned.
|
||||
/// - Wraparound / overflow is not a practical concern.
|
||||
///
|
||||
/// If you are running under the debugger and stop the process, the clock
|
||||
/// might not advance the full wall clock time that has elapsed between
|
||||
/// calls. If the process is not blocked from normal operation, the
|
||||
/// timestamp values will track wall clock time, even if you don't call
|
||||
/// the function frequently.
|
||||
///
|
||||
/// The value is only meaningful for this run of the process. Don't compare
|
||||
/// it to values obtained on another computer, or other runs of the same process.
|
||||
virtual SteamNetworkingMicroseconds GetLocalTimestamp() = 0;
|
||||
|
||||
/// Set a function to receive network-related information that is useful for debugging.
|
||||
/// This can be very useful during development, but it can also be useful for troubleshooting
|
||||
/// problems with tech savvy end users. If you have a console or other log that customers
|
||||
/// can examine, these log messages can often be helpful to troubleshoot network issues.
|
||||
/// (Especially any warning/error messages.)
|
||||
///
|
||||
/// The detail level indicates what message to invoke your callback on. Lower numeric
|
||||
/// value means more important, and the value you pass is the lowest priority (highest
|
||||
/// numeric value) you wish to receive callbacks for.
|
||||
///
|
||||
/// Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg
|
||||
/// or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT
|
||||
/// request a high detail level and then filter out messages in your callback. Instead,
|
||||
/// call function function to adjust the desired level of detail.
|
||||
///
|
||||
/// IMPORTANT: This may be called from a service thread, while we own a mutex, etc.
|
||||
/// Your output function must be threadsafe and fast! Do not make any other
|
||||
/// Steamworks calls from within the handler.
|
||||
virtual void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc ) = 0;
|
||||
|
||||
//
|
||||
// Set and get configuration values, see ESteamNetworkingConfigValue for individual descriptions.
|
||||
//
|
||||
|
||||
// Shortcuts for common cases. (Implemented as inline functions below)
|
||||
bool SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val );
|
||||
bool SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val );
|
||||
bool SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val );
|
||||
bool SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val );
|
||||
bool SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val );
|
||||
bool SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val );
|
||||
|
||||
/// Set a configuration value.
|
||||
/// - eValue: which value is being set
|
||||
/// - eScope: Onto what type of object are you applying the setting?
|
||||
/// - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc.
|
||||
/// - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly!
|
||||
/// - pArg: Value to set it to. You can pass NULL to remove a non-global sett at this scope,
|
||||
/// causing the value for that object to use global defaults. Or at global scope, passing NULL
|
||||
/// will reset any custom value and restore it to the system default.
|
||||
/// NOTE: When setting callback functions, do not pass the function pointer directly.
|
||||
/// Your argument should be a pointer to a function pointer.
|
||||
virtual bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
|
||||
ESteamNetworkingConfigDataType eDataType, const void *pArg ) = 0;
|
||||
|
||||
/// Get a configuration value.
|
||||
/// - eValue: which value to fetch
|
||||
/// - eScopeType: query setting on what type of object
|
||||
/// - eScopeArg: the object to query the setting for
|
||||
/// - pOutDataType: If non-NULL, the data type of the value is returned.
|
||||
/// - pResult: Where to put the result. Pass NULL to query the required buffer size. (k_ESteamNetworkingGetConfigValue_BufferTooSmall will be returned.)
|
||||
/// - cbResult: IN: the size of your buffer. OUT: the number of bytes filled in or required.
|
||||
virtual ESteamNetworkingGetConfigValueResult GetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
|
||||
ESteamNetworkingConfigDataType *pOutDataType, void *pResult, size_t *cbResult ) = 0;
|
||||
|
||||
/// Returns info about a configuration value. Returns false if the value does not exist.
|
||||
/// pOutNextValue can be used to iterate through all of the known configuration values.
|
||||
/// (Use GetFirstConfigValue() to begin the iteration, will be k_ESteamNetworkingConfig_Invalid on the last value)
|
||||
/// Any of the output parameters can be NULL if you do not need that information.
|
||||
virtual bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutName, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope, ESteamNetworkingConfigValue *pOutNextValue ) = 0;
|
||||
|
||||
/// Return the lowest numbered configuration value available in the current environment.
|
||||
virtual ESteamNetworkingConfigValue GetFirstConfigValue() = 0;
|
||||
|
||||
// String conversions. You'll usually access these using the respective
|
||||
// inline methods.
|
||||
virtual void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *buf, size_t cbBuf, bool bWithPort ) = 0;
|
||||
virtual bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr ) = 0;
|
||||
virtual void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf ) = 0;
|
||||
virtual bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr ) = 0;
|
||||
|
||||
protected:
|
||||
// ~ISteamNetworkingUtils(); // Silence some warnings
|
||||
};
|
||||
|
||||
#endif // ISTEAMNETWORKINGUTILS002
|
@ -0,0 +1,164 @@
|
||||
|
||||
#ifndef ISTEAMUGC013_H
|
||||
#define ISTEAMUGC013_H
|
||||
#ifdef STEAM_WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
class ISteamUGC013
|
||||
{
|
||||
public:
|
||||
// Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
|
||||
virtual UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
|
||||
|
||||
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
|
||||
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
|
||||
|
||||
// Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.
|
||||
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char *pchCursor = NULL ) = 0;
|
||||
|
||||
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
|
||||
virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
|
||||
|
||||
// Send the query to Steam
|
||||
STEAM_CALL_RESULT( SteamUGCQueryCompleted_t )
|
||||
virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
|
||||
|
||||
// Retrieve an individual result after receiving the callback for querying UGC
|
||||
virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0;
|
||||
virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0;
|
||||
virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0;
|
||||
virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0;
|
||||
virtual bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint64 *pStatValue ) = 0;
|
||||
virtual uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index ) = 0;
|
||||
virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType ) = 0;
|
||||
virtual uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index ) = 0;
|
||||
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, STEAM_OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
|
||||
// Return the first value matching the pchKey. Note that a key may map to multiple values. Returns false if there was an error or no matching value was found.
|
||||
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *pchKey, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
|
||||
|
||||
// Release the request to free up memory, after retrieving results
|
||||
virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
|
||||
|
||||
// Options to set for querying UGC
|
||||
virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
|
||||
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
|
||||
virtual bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs ) = 0;
|
||||
virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0;
|
||||
virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
|
||||
virtual bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) = 0;
|
||||
virtual bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) = 0;
|
||||
virtual bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) = 0;
|
||||
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0;
|
||||
virtual bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays ) = 0;
|
||||
virtual bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage ) = 0;
|
||||
virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
// Options only for querying user UGC
|
||||
virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0;
|
||||
|
||||
// Options only for querying all UGC
|
||||
virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0;
|
||||
virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0;
|
||||
virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0;
|
||||
virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0;
|
||||
|
||||
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
|
||||
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
// Steam Workshop Creator API
|
||||
STEAM_CALL_RESULT( CreateItemResult_t )
|
||||
virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet
|
||||
|
||||
virtual UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID ) = 0; // start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()
|
||||
|
||||
virtual bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) = 0; // change the title of an UGC item
|
||||
virtual bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) = 0; // change the description of an UGC item
|
||||
virtual bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
|
||||
virtual bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)
|
||||
virtual bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; // change the visibility of an UGC item
|
||||
virtual bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags ) = 0; // change the tags of an UGC item
|
||||
virtual bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) = 0; // update item content from this local folder
|
||||
virtual bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) = 0; // change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size
|
||||
virtual bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload ) = 0; // use legacy upload for a single small file. The parameter to SetItemContent() should either be a directory with one file or the full path to the file. The file must also be less than 10MB in size.
|
||||
virtual bool RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle ) = 0; // remove all existing key-value tags (you can add new ones via the AddItemKeyValueTag function)
|
||||
virtual bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key
|
||||
virtual bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue ) = 0; // add new key-value tags for the item. Note that there can be multiple values for a tag.
|
||||
virtual bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, EItemPreviewType type ) = 0; // add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
|
||||
virtual bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID ) = 0; // add preview video for this item
|
||||
virtual bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
|
||||
virtual bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
|
||||
virtual bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
|
||||
|
||||
STEAM_CALL_RESULT( SubmitItemUpdateResult_t )
|
||||
virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate()
|
||||
virtual EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal ) = 0;
|
||||
|
||||
// Steam Workshop Consumer API
|
||||
STEAM_CALL_RESULT( SetUserItemVoteResult_t )
|
||||
virtual SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) = 0;
|
||||
STEAM_CALL_RESULT( GetUserItemVoteResult_t )
|
||||
virtual SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
|
||||
virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
|
||||
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
|
||||
virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
|
||||
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP
|
||||
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
|
||||
virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits
|
||||
virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items
|
||||
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs
|
||||
|
||||
// get EItemState flags about item on this client
|
||||
virtual uint32 GetItemState( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
|
||||
// get info about currently installed content on disc for items that have k_EItemStateInstalled set
|
||||
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
|
||||
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0;
|
||||
|
||||
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
|
||||
virtual bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
|
||||
|
||||
// download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,
|
||||
// then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.
|
||||
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
|
||||
virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0;
|
||||
|
||||
// game servers can set a specific workshop folder before issuing any UGC commands.
|
||||
// This is helpful if you want to support multiple game servers running out of the same install folder
|
||||
virtual bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) = 0;
|
||||
|
||||
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
|
||||
virtual void SuspendDownloads( bool bSuspend ) = 0;
|
||||
|
||||
// usage tracking
|
||||
STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t )
|
||||
virtual SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
|
||||
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
|
||||
virtual SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
|
||||
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
|
||||
virtual SteamAPICall_t StopPlaytimeTrackingForAllItems() = 0;
|
||||
|
||||
// parent-child relationship or dependency management
|
||||
STEAM_CALL_RESULT( AddUGCDependencyResult_t )
|
||||
virtual SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
|
||||
STEAM_CALL_RESULT( RemoveUGCDependencyResult_t )
|
||||
virtual SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
|
||||
|
||||
// add/remove app dependence/requirements (usually DLC)
|
||||
STEAM_CALL_RESULT( AddAppDependencyResult_t )
|
||||
virtual SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
|
||||
STEAM_CALL_RESULT( RemoveAppDependencyResult_t )
|
||||
virtual SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
|
||||
// request app dependencies. note that whatever callback you register for GetAppDependenciesResult_t may be called multiple times
|
||||
// until all app dependencies have been returned
|
||||
STEAM_CALL_RESULT( GetAppDependenciesResult_t )
|
||||
virtual SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
|
||||
// delete the item without prompting the user
|
||||
STEAM_CALL_RESULT( DeleteItemResult_t )
|
||||
virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
};
|
||||
|
||||
#endif // ISTEAMUGC013_H
|
@ -0,0 +1,113 @@
|
||||
//====== Copyright Valve Corporation, All rights reserved. ====================
|
||||
//
|
||||
// Kludge adapter that's used for the transition standalone library.
|
||||
// This is not the opensource code, or the one in the Steamworks SDK.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef STEAMNETWORKINGSOCKETS
|
||||
#define STEAMNETWORKINGSOCKETS
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "isteamnetworkingsockets.h"
|
||||
struct SteamRelayNetworkStatus_t;
|
||||
struct P2PSessionRequest_t;
|
||||
struct P2PSessionConnectFail_t;
|
||||
|
||||
#if !defined( STEAMNETWORKINGSOCKETS_PARTNER ) && !defined( STEAMNETWORKINGSOCKETS_STREAMINGCLIENT )
|
||||
#error "Shouldn't be including this!"
|
||||
#endif
|
||||
|
||||
#ifdef STEAMNETWORKINGSOCKETS_STEAM
|
||||
|
||||
// #KLUDGE! So we don't have to link with steam_api.lib
|
||||
#include <steam/steam_api.h>
|
||||
#include <steam/steam_gameserver.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Temp internal gross stuff you should ignore
|
||||
|
||||
typedef void * ( S_CALLTYPE *FSteamInternal_CreateInterface )( const char *);
|
||||
typedef void ( S_CALLTYPE *FSteamAPI_RegisterCallback)( class CCallbackBase *pCallback, int iCallback );
|
||||
typedef void ( S_CALLTYPE *FSteamAPI_UnregisterCallback)( class CCallbackBase *pCallback );
|
||||
typedef void ( S_CALLTYPE *FSteamAPI_RegisterCallResult)( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
|
||||
typedef void ( S_CALLTYPE *FSteamAPI_UnregisterCallResult)( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_SetLauncher( const char *pszLauncher ); // Call this before SteamDatagramClient_Init
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_SetUniverse( EUniverse eUniverse ); // Call this before SteamDatagramClient_Init, to run without steam support
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_Internal_SteamAPIKludge( FSteamAPI_RegisterCallback fnRegisterCallback, FSteamAPI_UnregisterCallback fnUnregisterCallback, FSteamAPI_RegisterCallResult fnRegisterCallResult, FSteamAPI_UnregisterCallResult fnUnregisterCallResult );
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamDatagramClient_Init_InternalV9( bool bNoSteamSupport, SteamNetworkingErrMsg &errMsg, FSteamInternal_CreateInterface fnCreateInterface, HSteamUser hSteamUser, HSteamPipe hSteamPipe );
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamDatagramServer_Init_InternalV2( bool bNoSteamSupport, SteamNetworkingErrMsg &errMsg, FSteamInternal_CreateInterface fnCreateInterface, HSteamUser hSteamUser, HSteamPipe hSteamPipe );
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Initialize the user interface.
|
||||
inline bool SteamDatagramClient_Init( bool bNoSteamSupport, SteamNetworkingErrMsg &errMsg )
|
||||
{
|
||||
SteamDatagramClient_Internal_SteamAPIKludge( &::SteamAPI_RegisterCallback, &::SteamAPI_UnregisterCallback, &::SteamAPI_RegisterCallResult, &::SteamAPI_UnregisterCallResult );
|
||||
return SteamDatagramClient_Init_InternalV9( bNoSteamSupport, errMsg, ::SteamInternal_CreateInterface, ::SteamAPI_GetHSteamUser(), ::SteamAPI_GetHSteamPipe() );
|
||||
}
|
||||
|
||||
/// Initialize the game server interface
|
||||
inline bool SteamDatagramServer_Init( bool bNoSteamSupport, SteamNetworkingErrMsg &errMsg )
|
||||
{
|
||||
SteamDatagramClient_Internal_SteamAPIKludge( &::SteamAPI_RegisterCallback, &::SteamAPI_UnregisterCallback, &::SteamAPI_RegisterCallResult, &::SteamAPI_UnregisterCallResult );
|
||||
return SteamDatagramServer_Init_InternalV2( bNoSteamSupport, errMsg, &SteamInternal_CreateInterface, ::SteamGameServer_GetHSteamUser(), ::SteamGameServer_GetHSteamPipe() );
|
||||
}
|
||||
|
||||
#else // #ifdef STEAMNETWORKINGSOCKETS_STEAM
|
||||
|
||||
/// Initialize client interface
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamDatagramClient_Init( bool /* ignored */, SteamNetworkingErrMsg &errMsg );
|
||||
|
||||
/// Initialize gameserver interface
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamDatagramServer_Init( bool /* ignored */, SteamNetworkingErrMsg &errMsg );
|
||||
|
||||
#endif
|
||||
|
||||
/// Shutdown the client interface
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_Kill();
|
||||
|
||||
/// Shutdown the game server interface
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramServer_Kill();
|
||||
|
||||
/// Call before initializing the library, to set the AppID. This is only needed
|
||||
/// when running without Steam support. (Either on other platforms, or when
|
||||
/// intentionally not using steam client.)
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_SetAppID( AppId_t nAppID );
|
||||
|
||||
/// Manual polling mode. You should call this before initialize the lib.
|
||||
/// This will prevent the library from opening up its own service thread,
|
||||
/// allowing you to pump sockets and stuff from your own thread.
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingSockets_SetManualPollMode( bool bFlag );
|
||||
|
||||
/// If you call SteamNetworkingSockets_SetManualPollMode, then you need to
|
||||
/// call this frequently. Any time spent between calls is essentially
|
||||
/// guaranteed to delay time-sensitive processing, so whatever you are
|
||||
/// doing, make it quick. If you pass a nonzero wait time, then this
|
||||
/// function will sleep efficiently, waiting for incoming packets,
|
||||
/// up to the maximum time you specify. It may return prematurely
|
||||
/// if packets arrive earlier than your timeout.
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingSockets_Poll( int msMaxWaitTime );
|
||||
|
||||
/// TEMP callback dispatch mechanism.
|
||||
/// You'll override this guy and hook any callbacks you are interested in,
|
||||
/// and then use ISteamNetworkingSockets::RunCallbacks. Eventually this will go away,
|
||||
/// and you will register for the callbacks you want using the normal SteamWorks callback
|
||||
/// mechanisms, and they will get dispatched along with other Steamworks callbacks
|
||||
/// when you call SteamAPI_RunCallbacks and SteamGameServer_RunCallbacks.
|
||||
class ISteamNetworkingSocketsCallbacks
|
||||
{
|
||||
public:
|
||||
inline ISteamNetworkingSocketsCallbacks() {}
|
||||
virtual void OnSteamNetConnectionStatusChanged( SteamNetConnectionStatusChangedCallback_t * ) {}
|
||||
virtual void OnP2PSessionRequest( P2PSessionRequest_t * ) {}
|
||||
virtual void OnP2PSessionConnectFail( P2PSessionConnectFail_t * ) {}
|
||||
virtual void OnAuthenticationStatusChanged( SteamNetAuthenticationStatus_t * ) {}
|
||||
virtual void OnRelayNetworkStatusChanged( SteamRelayNetworkStatus_t * ) {}
|
||||
protected:
|
||||
inline ~ISteamNetworkingSocketsCallbacks() {}
|
||||
};
|
||||
|
||||
#endif // ISTEAMNETWORKINGSOCKETS
|
Loading…
Reference in New Issue