ISteamNetworkingUtils

Misc networking utilities for checking the local networking environment and estimating pings.

extern (C++) abstract
class ISteamNetworkingUtils {}

Members

Functions

AllocateMessage
SteamNetworkingMessage_t* AllocateMessage(int cbAllocateBuffer)

Allocate and initialize a message object. Usually the reason you call this is to pass it to ISteamNetworkingSockets::SendMessages. The returned object will have all of the relevant fields cleared to zero.

CheckPingDataUpToDate
bool CheckPingDataUpToDate(float flMaxAgeSeconds)

Check if the ping data of sufficient recency is available, and if it's too old, start refreshing it.

ConvertPingLocationToString
void ConvertPingLocationToString(SteamNetworkPingLocation_t location, char* pszBuf, int cchBufSize)

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.

EstimatePingTimeBetweenTwoLocations
int EstimatePingTimeBetweenTwoLocations(SteamNetworkPingLocation_t location1, SteamNetworkPingLocation_t location2)

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.

EstimatePingTimeFromLocalHost
int EstimatePingTimeFromLocalHost(SteamNetworkPingLocation_t remoteLocation)

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.

GetConfigValue
ESteamNetworkingGetConfigValueResult GetConfigValue(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, ESteamNetworkingConfigDataType* pOutDataType, void* pResult, size_t* cbResult)

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.

GetConfigValueInfo
const(char*) GetConfigValueInfo(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigDataType* pOutDataType, ESteamNetworkingConfigScope* pOutScope)

Get info about a configuration value. Returns the name of the value, or NULL if the value doesn't exist. Other output parameters can be NULL if you do not need them.

GetDirectPingToPOP
int GetDirectPingToPOP(SteamNetworkingPOPID popID)

Get *direct* ping time to the relays at the data center.

GetIPv4FakeIPType
ESteamNetworkingFakeIPType GetIPv4FakeIPType(uint nIPv4)
Undocumented in source.
GetLocalPingLocation
float GetLocalPingLocation(SteamNetworkPingLocation_t result)

Return location info for the current host. Returns the approximate age of the data, in seconds, or -1 if no data is available.

GetLocalTimestamp
SteamNetworkingMicroseconds GetLocalTimestamp()

Fetch current timestamp. This timer has the following properties:

GetPOPCount
int GetPOPCount()

Get number of network points of presence in the config

GetPOPList
int GetPOPList(SteamNetworkingPOPID* list, int nListSz)

Get list of all POP IDs. Returns the number of entries that were filled into your list.

GetPingToDataCenter
int GetPingToDataCenter(SteamNetworkingPOPID popID, SteamNetworkingPOPID* pViaRelayPoP)

Fetch ping time of best available relayed route from this host to the specified data center.

GetRealIdentityForFakeIP
EResult GetRealIdentityForFakeIP(SteamNetworkingIPAddr fakeIP, SteamNetworkingIdentity* pOutRealIdentity)

Get the real identity associated with a given FakeIP.

GetRelayNetworkStatus
ESteamNetworkingAvailability GetRelayNetworkStatus(SteamRelayNetworkStatus_t* pDetails)

Fetch current status of the relay network.

InitRelayNetworkAccess
void InitRelayNetworkAccess()

If you know that you are going to be using the relay network (for example, because you anticipate making P2P connections), call this to initialize the relay network. If you do not call this, the initialization will be delayed until the first time you use a feature that requires access to the relay network, which will delay that first access.

IsFakeIPv4
bool IsFakeIPv4(uint nIPv4)

Return true if an IPv4 address is one that might be used as a "fake" one. This function is fast; it just does some logical tests on the IP and does not need to do any lookup operations.

IterateGenericEditableConfigValues
ESteamNetworkingConfigValue IterateGenericEditableConfigValues(ESteamNetworkingConfigValue eCurrent, bool bEnumerateDevVars)

Iterate the list of all configuration values in the current environment that it might be possible to display or edit using a generic UI. To get the first iterable value, pass k_ESteamNetworkingConfig_Invalid. Returns k_ESteamNetworkingConfig_Invalid to signal end of list.

ParsePingLocationString
bool ParsePingLocationString(char* pszString, SteamNetworkPingLocation_t result)

Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand the string.

SetConfigValue
bool SetConfigValue(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, ESteamNetworkingConfigDataType eDataType, void* pArg)

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 setting 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 pointers (e.g. callback functions), do not pass the function pointer directly. Your argument should be a pointer to a function pointer.

SetConfigValueStruct
bool SetConfigValueStruct(SteamNetworkingConfigValue_t opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj)

Set a configuration value, using a struct to pass the value. (This is just a convenience shortcut; see below for the implementation and a little insight into how SteamNetworkingConfigValue_t is used when setting config options during listen socket and connection creation.)

SetConnectionConfigValueFloat
bool SetConnectionConfigValueFloat(HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val)
Undocumented in source.
SetConnectionConfigValueInt32
bool SetConnectionConfigValueInt32(HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int val)
Undocumented in source.
SetConnectionConfigValueString
bool SetConnectionConfigValueString(HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, char* val)
Undocumented in source.
SetDebugOutputFunction
void SetDebugOutputFunction(ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc)

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.)

SetGlobalCallback_FakeIPResult
bool SetGlobalCallback_FakeIPResult(FnSteamNetworkingFakeIPResult fnCallback)
Undocumented in source.
SetGlobalCallback_MessagesSessionFailed
bool SetGlobalCallback_MessagesSessionFailed(FnSteamNetworkingMessagesSessionFailed fnCallback)
Undocumented in source.
SetGlobalCallback_MessagesSessionRequest
bool SetGlobalCallback_MessagesSessionRequest(FnSteamNetworkingMessagesSessionRequest fnCallback)
Undocumented in source.
SetGlobalCallback_SteamNetAuthenticationStatusChanged
bool SetGlobalCallback_SteamNetAuthenticationStatusChanged(FnSteamNetAuthenticationStatusChanged fnCallback)
Undocumented in source.
SetGlobalCallback_SteamNetConnectionStatusChanged
bool SetGlobalCallback_SteamNetConnectionStatusChanged(FnSteamNetConnectionStatusChanged fnCallback)
Undocumented in source.
SetGlobalCallback_SteamRelayNetworkStatusChanged
bool SetGlobalCallback_SteamRelayNetworkStatusChanged(FnSteamRelayNetworkStatusChanged fnCallback)
Undocumented in source.
SetGlobalConfigValueFloat
bool SetGlobalConfigValueFloat(ESteamNetworkingConfigValue eValue, float val)
Undocumented in source.
SetGlobalConfigValueInt32
bool SetGlobalConfigValueInt32(ESteamNetworkingConfigValue eValue, int val)
Undocumented in source.
SetGlobalConfigValuePtr
bool SetGlobalConfigValuePtr(ESteamNetworkingConfigValue eValue, void* val)
Undocumented in source.
SetGlobalConfigValueString
bool SetGlobalConfigValueString(ESteamNetworkingConfigValue eValue, char* val)
Undocumented in source.
SteamNetworkingIPAddr_GetFakeIPType
ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType(SteamNetworkingIPAddr addr)
Undocumented in source.
SteamNetworkingIPAddr_ParseString
bool SteamNetworkingIPAddr_ParseString(SteamNetworkingIPAddr* pAddr, char* pszStr)
Undocumented in source.
SteamNetworkingIPAddr_ToString
void SteamNetworkingIPAddr_ToString(SteamNetworkingIPAddr addr, char* buf, size_t cbBuf, bool bWithPort)
Undocumented in source.
SteamNetworkingIdentity_ParseString
bool SteamNetworkingIdentity_ParseString(SteamNetworkingIdentity* pIdentity, char* pszStr)
Undocumented in source.
SteamNetworkingIdentity_ToString
void SteamNetworkingIdentity_ToString(SteamNetworkingIdentity identity, char* buf, size_t cbBuf)
Undocumented in source.

Meta