swiftlys2/docs/api/releases/features/ai/
API Reference › SteamAPI

SteamNetworkingIdentity

Struct
Namespace: SwiftlyS2.Shared.SteamAPI · Assembly: SwiftlyS2.CS2.dll
[Serializable]
public struct SteamNetworkingIdentity : IEquatable<SteamNetworkingIdentity>

An abstract way to represent the identity of a network host. All identities can be represented as simple string. Furthermore, this string representation is actually used on the wire in several places, even though it is less efficient, in order to facilitate forward compatibility. (Old client code can handle an identity type that it doesn't understand.)

View source

Methods

Clear()

public void Clear()

Equals(SteamNetworkingIdentity)

See if two identities are identical

public bool Equals(SteamNetworkingIdentity x)
Returns

GetFakeIPType()

public ESteamNetworkingFakeIPType GetFakeIPType()

GetGenericBytes(out int)

Returns null if not generic bytes type

public byte[] GetGenericBytes(out int cbLen)
Parameters
Returns

GetGenericString()

Returns nullptr if not generic string type

public string GetGenericString()
Returns

GetIPAddr()

returns null if we are not an IP address.

public SteamNetworkingIPAddr GetIPAddr()

GetIPv4()

returns 0 if we are not an IPv4 address.

public uint GetIPv4()
Returns

GetPSNID()

Returns 0 if not PSN

public ulong GetPSNID()
Returns

GetStadiaID()

Returns 0 if not Stadia

public ulong GetStadiaID()
Returns

GetSteamID()

Return black CSteamID (!IsValid()) if identity is not a SteamID

public CSteamID GetSteamID()
Returns

GetSteamID64()

Returns 0 if identity is not SteamID

public ulong GetSteamID64()
Returns

GetXboxPairwiseID()

Returns nullptr if not Xbox ID

public string GetXboxPairwiseID()
Returns

IsFakeIP()

public bool IsFakeIP()
Returns

IsInvalid()

Return true if we are the invalid type. Does not make any other validity checks (e.g. is SteamID actually valid)

public bool IsInvalid()
Returns

IsLocalHost()

Return true if this identity is localhost.

public bool IsLocalHost()
Returns

ParseString(string)

Parse back a string that was generated using ToString. If we don't understand the string, but it looks "reasonable" (it matches the pattern type:<type-data> and doesn't have any funky characters, etc), then we will return true, and the type is set to k_ESteamNetworkingIdentityType_UnknownType. false will only be returned if the string looks invalid.

public bool ParseString(string pszStr)
Parameters
Returns

SetGenericBytes(byte[], uint)

Returns false if invalid size.

public bool SetGenericBytes(byte[] data, uint cbLen)
Parameters
Returns

SetGenericString(string)

Returns false if invalid length

public bool SetGenericString(string pszString)
Parameters
Returns

SetIPAddr(SteamNetworkingIPAddr)

Set to specified IP:port

public void SetIPAddr(SteamNetworkingIPAddr addr)
Parameters

SetIPv4Addr(uint, ushort)

public void SetIPv4Addr(uint nIPv4, ushort nPort)
Parameters

SetLocalHost()

"localhost" is equivalent for many purposes to "anonymous." Our remote will identify us by the network address we use. Set to localhost. (We always use IPv6 ::1 for this, not 127.0.0.1)

public void SetLocalHost()

SetPSNID(ulong)

public void SetPSNID(ulong id)
Parameters

SetStadiaID(ulong)

public void SetStadiaID(ulong id)
Parameters

SetSteamID(CSteamID)

public void SetSteamID(CSteamID steamID)
Parameters

SetSteamID64(ulong)

Takes SteamID as raw 64-bit number

public void SetSteamID64(ulong steamID)
Parameters

SetXboxPairwiseID(string)

Returns false if invalid length

public bool SetXboxPairwiseID(string pszString)
Parameters
Returns

ToString(out string)

Print to a human-readable string. This is suitable for debug messages or any other time you need to encode the identity as a string. It has a URL-like format (type:<type-data>). Your buffer should be at least k_cchMaxString bytes big to avoid truncation. See also SteamNetworkingIPAddrRender

public void ToString(out string buf)
Parameters

Fields

k_cbMaxGenericBytes

public const int k_cbMaxGenericBytes = 32
Field Value

k_cchMaxGenericString

Max length of the string for generic string identities. Including terminating '\0'

public const int k_cchMaxGenericString = 32
Field Value

k_cchMaxString

Max sizes Max length of the buffer needed to hold any identity, formatted in string format by ToString

public const int k_cchMaxString = 128
Field Value

k_cchMaxXboxPairwiseID

Including terminating '\0'

public const int k_cchMaxXboxPairwiseID = 33
Field Value

m_eType

Type of identity.

public ESteamNetworkingIdentityType m_eType