1 /// Transcription of isteamnetworkingutils.h to D.
2 ///
3 /// Translated by hand, based on v1.3.0 6be41e3
4 ///
5 /// Copyright: Valve Corporation, all rights reserved
6 module steam_gns.utils;
7 
8 import steam_gns.misc;
9 import steam_gns.types;
10 import steam_gns.client_public;
11 
12 extern (C++):
13 align(4):
14 
15 version = STEAMNETWORKINGSOCKETS_STANDALONELIB;
16 
17 private alias intptr_t = size_t;
18 
19 //-----------------------------------------------------------------------------
20 /// Misc networking utilities for checking the local networking environment
21 /// and estimating pings.
22 abstract class ISteamNetworkingUtils {
23 public:
24     //
25     // Efficient message sending
26     //
27 
28     /// Allocate and initialize a message object.  Usually the reason
29     /// you call this is to pass it to ISteamNetworkingSockets::SendMessages.
30     /// The returned object will have all of the relevant fields cleared to zero.
31     ///
32     /// Optionally you can also request that this system allocate space to
33     /// hold the payload itself.  If cbAllocateBuffer is nonzero, the system
34     /// will allocate memory to hold a payload of at least cbAllocateBuffer bytes.
35     /// m_pData will point to the allocated buffer, m_cbSize will be set to the
36     /// size, and m_pfnFreeData will be set to the proper function to free up
37     /// the buffer.
38     ///
39     /// If cbAllocateBuffer=0, then no buffer is allocated.  m_pData will be NULL,
40     /// m_cbSize will be zero, and m_pfnFreeData will be NULL.  You will need to
41     /// set each of these.
42     SteamNetworkingMessage_t* AllocateMessage(int cbAllocateBuffer);
43 
44     //
45     // Access to Steam Datagram Relay (SDR) network
46     //
47 
48     //
49     // Initialization and status check
50     //
51 
52     /// If you know that you are going to be using the relay network (for example,
53     /// because you anticipate making P2P connections), call this to initialize the
54     /// relay network.  If you do not call this, the initialization will
55     /// be delayed until the first time you use a feature that requires access
56     /// to the relay network, which will delay that first access.
57     ///
58     /// You can also call this to force a retry if the previous attempt has failed.
59     /// Performing any action that requires access to the relay network will also
60     /// trigger a retry, and so calling this function is never strictly necessary,
61     /// but it can be useful to call it a program launch time, if access to the
62     /// relay network is anticipated.
63     ///
64     /// Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
65     /// callbacks to know when initialization has completed.
66     /// Typically initialization completes in a few seconds.
67     ///
68     /// Note: dedicated servers hosted in known data centers do *not* need
69     /// to call this, since they do not make routing decisions.  However, if
70     /// the dedicated server will be using P2P functionality, it will act as
71     /// a "client" and this should be called.
72     void InitRelayNetworkAccess();
73 
74     /// Fetch current status of the relay network.
75     ///
76     /// SteamRelayNetworkStatus_t is also a callback.  It will be triggered on
77     /// both the user and gameserver interfaces any time the status changes, or
78     /// ping measurement starts or stops.
79     ///
80     /// SteamRelayNetworkStatus_t::m_eAvail is returned.  If you want
81     /// more details, you can pass a non-NULL value.
82     ESteamNetworkingAvailability GetRelayNetworkStatus(SteamRelayNetworkStatus_t* pDetails);
83 
84     //
85     // "Ping location" functions
86     //
87     // We use the ping times to the valve relays deployed worldwide to
88     // generate a "marker" that describes the location of an Internet host.
89     // Given two such markers, we can estimate the network latency between
90     // two hosts, without sending any packets.  The estimate is based on the
91     // optimal route that is found through the Valve network.  If you are
92     // using the Valve network to carry the traffic, then this is precisely
93     // the ping you want.  If you are not, then the ping time will probably
94     // still be a reasonable estimate.
95     //
96     // This is extremely useful to select peers for matchmaking!
97     //
98     // The markers can also be converted to a string, so they can be transmitted.
99     // We have a separate library you can use on your app's matchmaking/coordinating
100     // server to manipulate these objects.  (See steamdatagram_gamecoordinator.h)
101 
102     /// Return location info for the current host.  Returns the approximate
103     /// age of the data, in seconds, or -1 if no data is available.
104     ///
105     /// It takes a few seconds to initialize access to the relay network.  If
106     /// you call this very soon after calling InitRelayNetworkAccess,
107     /// the data may not be available yet.
108     ///
109     /// This always return the most up-to-date information we have available
110     /// right now, even if we are in the middle of re-calculating ping times.
111     float GetLocalPingLocation(ref SteamNetworkPingLocation_t result);
112 
113     /// Estimate the round-trip latency between two arbitrary locations, in
114     /// milliseconds.  This is a conservative estimate, based on routing through
115     /// the relay network.  For most basic relayed connections, this ping time
116     /// will be pretty accurate, since it will be based on the route likely to
117     /// be actually used.
118     ///
119     /// If a direct IP route is used (perhaps via NAT traversal), then the route
120     /// will be different, and the ping time might be better.  Or it might actually
121     /// be a bit worse!  Standard IP routing is frequently suboptimal!
122     ///
123     /// But even in this case, the estimate obtained using this method is a
124     /// reasonable upper bound on the ping time.  (Also it has the advantage
125     /// of returning immediately and not sending any packets.)
126     ///
127     /// In a few cases we might not able to estimate the route.  In this case
128     /// a negative value is returned.  k_nSteamNetworkingPing_Failed means
129     /// the reason was because of some networking difficulty.  (Failure to
130     /// ping, etc)  k_nSteamNetworkingPing_Unknown is returned if we cannot
131     /// currently answer the question for some other reason.
132     ///
133     /// Do you need to be able to do this from a backend/matchmaking server?
134     /// You are looking for the "game coordinator" library.
135     int EstimatePingTimeBetweenTwoLocations(const ref SteamNetworkPingLocation_t location1,
136     const ref SteamNetworkPingLocation_t location2);
137 
138     /// Same as EstimatePingTime, but assumes that one location is the local host.
139     /// This is a bit faster, especially if you need to calculate a bunch of
140     /// these in a loop to find the fastest one.
141     ///
142     /// In rare cases this might return a slightly different estimate than combining
143     /// GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations.  That's because
144     /// this function uses a slightly more complete set of information about what
145     /// route would be taken.
146     int EstimatePingTimeFromLocalHost(const ref SteamNetworkPingLocation_t remoteLocation);
147 
148     /// Convert a ping location into a text format suitable for sending over the wire.
149     /// The format is a compact and human readable.  However, it is subject to change
150     /// so please do not parse it yourself.  Your buffer must be at least
151     /// k_cchMaxSteamNetworkingPingLocationString bytes.
152     void ConvertPingLocationToString(const ref SteamNetworkPingLocation_t location, char* pszBuf, int cchBufSize);
153 
154     /// Parse back SteamNetworkPingLocation_t string.  Returns false if we couldn't understand
155     /// the string.
156     bool ParsePingLocationString(const char* pszString, ref SteamNetworkPingLocation_t result);
157 
158     /// Check if the ping data of sufficient recency is available, and if
159     /// it's too old, start refreshing it.
160     ///
161     /// Please only call this function when you *really* do need to force an
162     /// immediate refresh of the data.  (For example, in response to a specific
163     /// user input to refresh this information.)  Don't call it "just in case",
164     /// before every connection, etc.  That will cause extra traffic to be sent
165     /// for no benefit. The library will automatically refresh the information
166     /// as needed.
167     ///
168     /// Returns true if sufficiently recent data is already available.
169     ///
170     /// Returns false if sufficiently recent data is not available.  In this
171     /// case, ping measurement is initiated, if it is not already active.
172     /// (You cannot restart a measurement already in progress.)
173     ///
174     /// You can use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
175     /// to know when ping measurement completes.
176     bool CheckPingDataUpToDate(float flMaxAgeSeconds);
177 
178     //
179     // List of Valve data centers, and ping times to them.  This might
180     // be useful to you if you are use our hosting, or just need to measure
181     // latency to a cloud data center where we are running relays.
182     //
183 
184     /// Fetch ping time of best available relayed route from this host to
185     /// the specified data center.
186     int GetPingToDataCenter(SteamNetworkingPOPID popID, SteamNetworkingPOPID* pViaRelayPoP);
187 
188     /// Get *direct* ping time to the relays at the data center.
189     int GetDirectPingToPOP(SteamNetworkingPOPID popID);
190 
191     /// Get number of network points of presence in the config
192     int GetPOPCount();
193 
194     /// Get list of all POP IDs.  Returns the number of entries that were filled into
195     /// your list.
196     int GetPOPList(SteamNetworkingPOPID* list, int nListSz);
197 
198     //
199     // Misc
200     //
201 
202     /// Fetch current timestamp.  This timer has the following properties:
203     ///
204     /// - Monotonicity is guaranteed.
205     /// - The initial value will be at least 24*3600*30*1e6, i.e. about
206     ///   30 days worth of microseconds.  In this way, the timestamp value of
207     ///   0 will always be at least "30 days ago".  Also, negative numbers
208     ///   will never be returned.
209     /// - Wraparound / overflow is not a practical concern.
210     ///
211     /// If you are running under the debugger and stop the process, the clock
212     /// might not advance the full wall clock time that has elapsed between
213     /// calls.  If the process is not blocked from normal operation, the
214     /// timestamp values will track wall clock time, even if you don't call
215     /// the function frequently.
216     ///
217     /// The value is only meaningful for this run of the process.  Don't compare
218     /// it to values obtained on another computer, or other runs of the same process.
219     SteamNetworkingMicroseconds GetLocalTimestamp();
220 
221     /// Set a function to receive network-related information that is useful for debugging.
222     /// This can be very useful during development, but it can also be useful for troubleshooting
223     /// problems with tech savvy end users.  If you have a console or other log that customers
224     /// can examine, these log messages can often be helpful to troubleshoot network issues.
225     /// (Especially any warning/error messages.)
226     ///
227     /// The detail level indicates what message to invoke your callback on.  Lower numeric
228     /// value means more important, and the value you pass is the lowest priority (highest
229     /// numeric value) you wish to receive callbacks for.
230     ///
231     /// The value here controls the detail level for most messages.  You can control the
232     /// detail level for various subsystems (perhaps only for certain connections) by
233     /// adjusting the configuration values k_ESteamNetworkingConfig_LogLevel_Xxxxx.
234     ///
235     /// Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg
236     /// or k_ESteamNetworkingSocketsDebugOutputType_Warning.  For best performance, do NOT
237     /// request a high detail level and then filter out messages in your callback.  This incurs
238     /// all of the expense of formatting the messages, which are then discarded.  Setting a high
239     /// priority value (low numeric value) here allows the library to avoid doing this work.
240     ///
241     /// IMPORTANT: This may be called from a service thread, while we own a mutex, etc.
242     /// Your output function must be threadsafe and fast!  Do not make any other
243     /// Steamworks calls from within the handler.
244     void SetDebugOutputFunction(ESteamNetworkingSocketsDebugOutputType eDetailLevel,
245     FSteamNetworkingSocketsDebugOutput pfnFunc);
246 
247     //
248     // Fake IP
249     //
250     // Useful for interfacing with code that assumes peers are identified using an IPv4 address
251     //
252 
253     /// Return true if an IPv4 address is one that might be used as a "fake" one.
254     /// This function is fast; it just does some logical tests on the IP and does
255     /// not need to do any lookup operations.
256     bool IsFakeIPv4(uint nIPv4 ) {
257         return GetIPv4FakeIPType( nIPv4 ) > ESteamNetworkingFakeIPType.NotFake;
258     }
259     ESteamNetworkingFakeIPType GetIPv4FakeIPType(uint nIPv4);
260 
261     /// Get the real identity associated with a given FakeIP.
262     ///
263     /// On failure, returns:
264     /// - k_EResultInvalidParam: the IP is not a FakeIP.
265     /// - k_EResultNoMatch: we don't recognize that FakeIP and don't know the corresponding identity.
266     ///
267     /// FakeIP's used by active connections, or the FakeIPs assigned to local identities,
268     /// will always work.  FakeIPs for recently destroyed connections will continue to
269     /// return results for a little while, but not forever.  At some point, we will forget
270     /// FakeIPs to save space.  It's reasonably safe to assume that you can read back the
271     /// real identity of a connection very soon after it is destroyed.  But do not wait
272     /// indefinitely.
273     EResult GetRealIdentityForFakeIP(const ref SteamNetworkingIPAddr fakeIP, SteamNetworkingIdentity* pOutRealIdentity);
274 
275     //
276     // Set and get configuration values, see ESteamNetworkingConfigValue for individual descriptions.
277     //
278 
279     // Shortcuts for common cases.  (Implemented as inline functions below)
280     bool SetGlobalConfigValueInt32(ESteamNetworkingConfigValue eValue, int val);
281     bool SetGlobalConfigValueFloat(ESteamNetworkingConfigValue eValue, float val);
282     bool SetGlobalConfigValueString(ESteamNetworkingConfigValue eValue, const char* val);
283     bool SetGlobalConfigValuePtr(ESteamNetworkingConfigValue eValue, void* val);
284     bool SetConnectionConfigValueInt32(HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int val);
285     bool SetConnectionConfigValueFloat(HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val);
286     bool SetConnectionConfigValueString(HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char* val);
287 
288     //
289     // Set global callbacks.  If you do not want to use Steam's callback dispatch mechanism and you
290     // want to use the same callback on all (or most) listen sockets and connections, then
291     // simply install these callbacks first thing, and you are good to go.
292     // See ISteamNetworkingSockets::RunCallbacks
293     //
294     bool SetGlobalCallback_SteamNetConnectionStatusChanged(FnSteamNetConnectionStatusChanged fnCallback);
295     bool SetGlobalCallback_SteamNetAuthenticationStatusChanged(FnSteamNetAuthenticationStatusChanged fnCallback);
296     bool SetGlobalCallback_SteamRelayNetworkStatusChanged(FnSteamRelayNetworkStatusChanged fnCallback);
297     bool SetGlobalCallback_FakeIPResult(FnSteamNetworkingFakeIPResult fnCallback);
298     bool SetGlobalCallback_MessagesSessionRequest(FnSteamNetworkingMessagesSessionRequest fnCallback);
299     bool SetGlobalCallback_MessagesSessionFailed(FnSteamNetworkingMessagesSessionFailed fnCallback);
300 
301     /// Set a configuration value.
302     /// - eValue: which value is being set
303     /// - eScope: Onto what type of object are you applying the setting?
304     /// - scopeArg: Which object you want to change?  (Ignored for global scope).  E.g. connection handle, listen socket handle, interface pointer, etc.
305     /// - eDataType: What type of data is in the buffer at pValue?  This must match the type of the variable exactly!
306     /// - pArg: Value to set it to.  You can pass NULL to remove a non-global setting at this scope,
307     ///   causing the value for that object to use global defaults.  Or at global scope, passing NULL
308     ///   will reset any custom value and restore it to the system default.
309     ///   NOTE: When setting pointers (e.g. callback functions), do not pass the function pointer directly.
310     ///   Your argument should be a pointer to a function pointer.
311     bool SetConfigValue(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
312         ESteamNetworkingConfigDataType eDataType, const void* pArg);
313 
314     /// Set a configuration value, using a struct to pass the value.
315     /// (This is just a convenience shortcut; see below for the implementation and
316     /// a little insight into how SteamNetworkingConfigValue_t is used when
317     /// setting config options during listen socket and connection creation.)
318     bool SetConfigValueStruct(const ref SteamNetworkingConfigValue_t opt, ESteamNetworkingConfigScope eScopeType,
319     intptr_t scopeObj);
320 
321     /// Get a configuration value.
322     /// - eValue: which value to fetch
323     /// - eScopeType: query setting on what type of object
324     /// - eScopeArg: the object to query the setting for
325     /// - pOutDataType: If non-NULL, the data type of the value is returned.
326     /// - pResult: Where to put the result.  Pass NULL to query the required buffer size.  (k_ESteamNetworkingGetConfigValue_BufferTooSmall will be returned.)
327     /// - cbResult: IN: the size of your buffer.  OUT: the number of bytes filled in or required.
328     ESteamNetworkingGetConfigValueResult GetConfigValue(ESteamNetworkingConfigValue eValue,
329     ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, ESteamNetworkingConfigDataType* pOutDataType,
330     void* pResult, size_t* cbResult);
331 
332     /// Get info about a configuration value.  Returns the name of the value,
333     /// or NULL if the value doesn't exist.  Other output parameters can be NULL
334     /// if you do not need them.
335     const(char*) GetConfigValueInfo(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigDataType* pOutDataType,
336     ESteamNetworkingConfigScope* pOutScope);
337 
338     /// Iterate the list of all configuration values in the current environment that it might
339     /// be possible to display or edit using a generic UI.  To get the first iterable value,
340     /// pass k_ESteamNetworkingConfig_Invalid.  Returns k_ESteamNetworkingConfig_Invalid
341     /// to signal end of list.
342     ///
343     /// The bEnumerateDevVars argument can be used to include "dev" vars.  These are vars that
344     /// are recommended to only be editable in "debug" or "dev" mode and typically should not be
345     /// shown in a retail environment where a malicious local user might use this to cheat.
346     ESteamNetworkingConfigValue IterateGenericEditableConfigValues(ESteamNetworkingConfigValue eCurrent,
347     bool bEnumerateDevVars);
348 
349     //
350     // String conversions.  You'll usually access these using the respective
351     // inline methods.
352     //
353     void SteamNetworkingIPAddr_ToString(const ref SteamNetworkingIPAddr addr, char* buf, size_t cbBuf, bool bWithPort);
354     bool SteamNetworkingIPAddr_ParseString(SteamNetworkingIPAddr* pAddr, const char* pszStr);
355     ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType(const ref SteamNetworkingIPAddr addr);
356     void SteamNetworkingIdentity_ToString(const ref SteamNetworkingIdentity identity, char* buf, size_t cbBuf);
357     bool SteamNetworkingIdentity_ParseString(SteamNetworkingIdentity* pIdentity, const char* pszStr);
358 
359 }
360 
361 enum STEAMNETWORKINGUTILS_INTERFACE_VERSION = "SteamNetworkingUtils004";
362 
363 // Global accessors
364 // Using standalone lib
365 version (STEAMNETWORKINGSOCKETS_STANDALONELIB) {
366 
367     // Standalone lib
368     static assert(STEAMNETWORKINGUTILS_INTERFACE_VERSION[22] == '4', "Version mismatch");
369 
370     extern (C) ISteamNetworkingUtils SteamNetworkingUtils_LibV4();
371 
372     ISteamNetworkingUtils SteamNetworkingUtils_Lib() { return SteamNetworkingUtils_LibV4(); }
373 
374     version (STEAMNETWORKINGSOCKETS_STEAMAPI) { }
375     else {
376         ISteamNetworkingUtils SteamNetworkingUtils() { return SteamNetworkingUtils_LibV4(); }
377     }
378 
379 }
380 
381 /// A struct used to describe our readiness to use the relay network.
382 /// To do this we first need to fetch the network configuration,
383 /// which describes what POPs are available.
384 struct SteamRelayNetworkStatus_t {
385 
386     enum { k_iCallback = k_iSteamNetworkingUtilsCallbacks + 1 };
387 
388     /// Summary status.  When this is "current", initialization has
389     /// completed.  Anything else means you are not ready yet, or
390     /// there is a significant problem.
391     ESteamNetworkingAvailability m_eAvail;
392 
393     /// Nonzero if latency measurement is in progress (or pending,
394     /// awaiting a prerequisite).
395     int m_bPingMeasurementInProgress;
396 
397     /// Status obtaining the network config.  This is a prerequisite
398     /// for relay network access.
399     ///
400     /// Failure to obtain the network config almost always indicates
401     /// a problem with the local internet connection.
402     ESteamNetworkingAvailability m_eAvailNetworkConfig;
403 
404     /// Current ability to communicate with ANY relay.  Note that
405     /// the complete failure to communicate with any relays almost
406     /// always indicates a problem with the local Internet connection.
407     /// (However, just because you can reach a single relay doesn't
408     /// mean that the local connection is in perfect health.)
409     ESteamNetworkingAvailability m_eAvailAnyRelay;
410 
411     /// Non-localized English language status.  For diagnostic/debugging
412     /// purposes only.
413     char[256] m_debugMsg;
414 
415 }
416 
417 /// Utility class for printing a SteamNetworkingIdentity.
418 /// E.g. printf( "Identity is '%s'\n", SteamNetworkingIdentityRender( identity ).c_str() );
419 struct SteamNetworkingIdentityRender {
420 
421     this(const ref SteamNetworkingIdentity x) { x.ToString(buf.ptr, buf.sizeof); }
422     const(char)* c_str() const return { return buf.ptr; }
423 private:
424     char[SteamNetworkingIdentity.k_cchMaxString] buf;
425 
426 }
427 
428 /// Utility class for printing a SteamNetworkingIPAddrRender.
429 struct SteamNetworkingIPAddrRender {
430 
431     this(const ref SteamNetworkingIPAddr x, bool bWithPort = true) { x.ToString(buf.ptr, buf.sizeof, bWithPort); }
432     const(char*) c_str() const return { return buf.ptr; }
433 private:
434     char[SteamNetworkingIPAddr.k_cchMaxString] buf;
435 };
436 
437 ///////////////////////////////////////////////////////////////////////////////
438 //
439 // Internal stuff
440 
441 /+ which I hope I don't have to transcribe
442 
443 inline void ISteamNetworkingUtils::InitRelayNetworkAccess() { CheckPingDataUpToDate( 1e10f ); }
444 inline bool ISteamNetworkingUtils::SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Int32, &val ); }
445 inline bool ISteamNetworkingUtils::SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Float, &val ); }
446 inline bool ISteamNetworkingUtils::SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_String, val ); }
447 inline bool ISteamNetworkingUtils::SetGlobalConfigValuePtr( ESteamNetworkingConfigValue eValue, void *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Ptr, &val ); } // Note: passing pointer to pointer.
448 inline bool ISteamNetworkingUtils::SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Int32, &val ); }
449 inline bool ISteamNetworkingUtils::SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Float, &val ); }
450 inline bool ISteamNetworkingUtils::SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_String, val ); }
451 inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetConnectionStatusChanged( FnSteamNetConnectionStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, (void*)fnCallback ); }
452 inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetAuthenticationStatusChanged( FnSteamNetAuthenticationStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_AuthStatusChanged, (void*)fnCallback ); }
453 inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamRelayNetworkStatusChanged( FnSteamRelayNetworkStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged, (void*)fnCallback ); }
454 inline bool ISteamNetworkingUtils::SetGlobalCallback_FakeIPResult( FnSteamNetworkingFakeIPResult fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_FakeIPResult, (void*)fnCallback ); }
455 inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionRequest( FnSteamNetworkingMessagesSessionRequest fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_MessagesSessionRequest, (void*)fnCallback ); }
456 inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionFailed( FnSteamNetworkingMessagesSessionFailed fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_MessagesSessionFailed, (void*)fnCallback ); }
457 
458 inline bool ISteamNetworkingUtils::SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj )
459 {
460     // Locate the argument.  Strings are a special case, since the
461     // "value" (the whole string buffer) doesn't fit in the struct
462     // NOTE: for pointer values, we pass a pointer to the pointer,
463     // we do not pass the pointer directly.
464     const void *pVal = ( opt.m_eDataType == k_ESteamNetworkingConfig_String ) ? (const void *)opt.m_val.m_string : (const void *)&opt.m_val;
465     return SetConfigValue( opt.m_eValue, eScopeType, scopeObj, opt.m_eDataType, pVal );
466 }
467 
468 // How to get helper functions.
469 #if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) || defined( STEAMNETWORKINGSOCKETS_STANDALONELIB )
470 
471     // Call direct to static functions
472     STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr *pAddr, char *buf, size_t cbBuf, bool bWithPort );
473     STEAMNETWORKINGSOCKETS_INTERFACE bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr );
474     STEAMNETWORKINGSOCKETS_INTERFACE ESteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType( const SteamNetworkingIPAddr *pAddr );
475     STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity *pIdentity, char *buf, size_t cbBuf );
476     STEAMNETWORKINGSOCKETS_INTERFACE bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, size_t sizeofIdentity, const char *pszStr );
477     inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamNetworkingIPAddr_ToString( this, buf, cbBuf, bWithPort ); }
478     inline bool SteamNetworkingIPAddr::ParseString( const char *pszStr ) { return SteamNetworkingIPAddr_ParseString( this, pszStr ); }
479     inline ESteamNetworkingFakeIPType SteamNetworkingIPAddr::GetFakeIPType() const { return SteamNetworkingIPAddr_GetFakeIPType( this ); }
480     inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const { SteamNetworkingIdentity_ToString( this, buf, cbBuf ); }
481     inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamNetworkingIdentity_ParseString( this, sizeof(*this), pszStr ); }
482 
483 #elif defined( STEAMNETWORKINGSOCKETS_STEAMAPI )
484     // Using steamworks SDK - go through SteamNetworkingUtils()
485     inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamNetworkingUtils()->SteamNetworkingIPAddr_ToString( *this, buf, cbBuf, bWithPort ); }
486     inline bool SteamNetworkingIPAddr::ParseString( const char *pszStr ) { return SteamNetworkingUtils()->SteamNetworkingIPAddr_ParseString( this, pszStr ); }
487     inline ESteamNetworkingFakeIPType SteamNetworkingIPAddr::GetFakeIPType() const { return SteamNetworkingUtils()->SteamNetworkingIPAddr_GetFakeIPType( *this ); }
488     inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const { SteamNetworkingUtils()->SteamNetworkingIdentity_ToString( *this, buf, cbBuf ); }
489     inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamNetworkingUtils()->SteamNetworkingIdentity_ParseString( this, pszStr ); }
490 #else
491     #error "Invalid config"
492 #endif
493 
494 #
495 
496 +/