diff --git a/include/steam/isteamnetworkingutils.h b/include/steam/isteamnetworkingutils.h index 002be0f..f393e6a 100644 --- a/include/steam/isteamnetworkingutils.h +++ b/include/steam/isteamnetworkingutils.h @@ -180,6 +180,25 @@ protected: ) #endif +/// Utility class for printing a SteamNetworkingIdentity. +/// E.g. printf( "Identity is '%s'\n", SteamNetworkingIdentityRender( identity ).c_str() ); +struct SteamNetworkingIdentityRender +{ + SteamNetworkingIdentityRender( const SteamNetworkingIdentity &x ) { x.ToString( buf, sizeof(buf) ); } + inline const char *c_str() const { return buf; } +private: + char buf[ SteamNetworkingIdentity::k_cchMaxString ]; +}; + +/// Utility class for printing a SteamNetworkingIPAddrRender. +struct SteamNetworkingIPAddrRender +{ + SteamNetworkingIPAddrRender( const SteamNetworkingIPAddr &x, bool bWithPort = true ) { x.ToString( buf, sizeof(buf), bWithPort ); } + inline const char *c_str() const { return buf; } +private: + char buf[ SteamNetworkingIPAddr::k_cchMaxString ]; +}; + /////////////////////////////////////////////////////////////////////////////// // // Internal stuff diff --git a/include/steam/steamnetworkingtypes.h b/include/steam/steamnetworkingtypes.h index 25d2f51..797b344 100644 --- a/include/steam/steamnetworkingtypes.h +++ b/include/steam/steamnetworkingtypes.h @@ -1300,25 +1300,6 @@ inline void GetSteamNetworkingLocationPOPStringFromID( SteamNetworkingPOPID id, /// The POPID "dev" is used in non-production environments for testing. const SteamNetworkingPOPID k_SteamDatagramPOPID_dev = ( (uint32)'d' << 16U ) | ( (uint32)'e' << 8U ) | (uint32)'v'; -/// Utility class for printing a SteamNetworkingIdentity. -/// E.g. printf( "Identity is '%s'\n", SteamNetworkingIdentityRender( identity ).c_str() ); -struct SteamNetworkingIdentityRender -{ - SteamNetworkingIdentityRender( const SteamNetworkingIdentity &x ) { x.ToString( buf, sizeof(buf) ); } - inline const char *c_str() const { return buf; } -private: - char buf[ SteamNetworkingIdentity::k_cchMaxString ]; -}; - -/// Utility class for printing a SteamNetworkingIPAddrRender. -struct SteamNetworkingIPAddrRender -{ - SteamNetworkingIPAddrRender( const SteamNetworkingIPAddr &x, bool bWithPort = true ) { x.ToString( buf, sizeof(buf), bWithPort ); } - inline const char *c_str() const { return buf; } -private: - char buf[ SteamNetworkingIPAddr::k_cchMaxString ]; -}; - /// Utility class for printing a SteamNetworkingPOPID. struct SteamNetworkingPOPIDRender { diff --git a/src/steamnetworkingsockets/steamnetworkingsockets_internal.h b/src/steamnetworkingsockets/steamnetworkingsockets_internal.h index 650d00c..04a8aec 100644 --- a/src/steamnetworkingsockets/steamnetworkingsockets_internal.h +++ b/src/steamnetworkingsockets/steamnetworkingsockets_internal.h @@ -57,6 +57,7 @@ #include "keypair.h" #include #include +#include // for the rendering helpers // Running against Steam? Then we have some default signaling. // Otherwise, we don't