Skip to content

Commit

Permalink
Add ISteamNetworkingUtils::InitRelayNetworkAccess; fixes #403
Browse files Browse the repository at this point in the history
  • Loading branch information
rlabrecque committed Mar 21, 2021
1 parent 24b710f commit 5f78ac7
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Plugins/Steamworks.NET/autogen/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2131,6 +2131,9 @@ internal static class NativeMethods {
[DllImport(NativeLibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_AllocateMessage", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ISteamNetworkingUtils_AllocateMessage(IntPtr instancePtr, int cbAllocateBuffer);

[DllImport(NativeLibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_InitRelayNetworkAccess", CallingConvention = CallingConvention.Cdecl)]
public static extern void ISteamNetworkingUtils_InitRelayNetworkAccess(IntPtr instancePtr);

[DllImport(NativeLibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_GetRelayNetworkStatus", CallingConvention = CallingConvention.Cdecl)]
public static extern ESteamNetworkingAvailability ISteamNetworkingUtils_GetRelayNetworkStatus(IntPtr instancePtr, out SteamRelayNetworkStatus_t pDetails);

Expand Down
29 changes: 29 additions & 0 deletions Plugins/Steamworks.NET/autogen/isteamgameservernetworkingutils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,35 @@ public static IntPtr AllocateMessage(int cbAllocateBuffer) {
return NativeMethods.ISteamNetworkingUtils_AllocateMessage(CSteamGameServerAPIContext.GetSteamNetworkingUtils(), cbAllocateBuffer);
}

/// <summary>
/// <para> Access to Steam Datagram Relay (SDR) network</para>
/// <para> Initialization and status check</para>
/// <para>/ If you know that you are going to be using the relay network (for example,</para>
/// <para>/ because you anticipate making P2P connections), call this to initialize the</para>
/// <para>/ relay network. If you do not call this, the initialization will</para>
/// <para>/ be delayed until the first time you use a feature that requires access</para>
/// <para>/ to the relay network, which will delay that first access.</para>
/// <para>/</para>
/// <para>/ You can also call this to force a retry if the previous attempt has failed.</para>
/// <para>/ Performing any action that requires access to the relay network will also</para>
/// <para>/ trigger a retry, and so calling this function is never strictly necessary,</para>
/// <para>/ but it can be useful to call it a program launch time, if access to the</para>
/// <para>/ relay network is anticipated.</para>
/// <para>/</para>
/// <para>/ Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t</para>
/// <para>/ callbacks to know when initialization has completed.</para>
/// <para>/ Typically initialization completes in a few seconds.</para>
/// <para>/</para>
/// <para>/ Note: dedicated servers hosted in known data centers do *not* need</para>
/// <para>/ to call this, since they do not make routing decisions. However, if</para>
/// <para>/ the dedicated server will be using P2P functionality, it will act as</para>
/// <para>/ a "client" and this should be called.</para>
/// </summary>
public static void InitRelayNetworkAccess() {
InteropHelp.TestIfAvailableGameServer();
NativeMethods.ISteamNetworkingUtils_InitRelayNetworkAccess(CSteamGameServerAPIContext.GetSteamNetworkingUtils());
}

/// <summary>
/// <para>/ Fetch current status of the relay network.</para>
/// <para>/</para>
Expand Down
29 changes: 29 additions & 0 deletions Plugins/Steamworks.NET/autogen/isteamnetworkingutils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,35 @@ public static IntPtr AllocateMessage(int cbAllocateBuffer) {
return NativeMethods.ISteamNetworkingUtils_AllocateMessage(CSteamAPIContext.GetSteamNetworkingUtils(), cbAllocateBuffer);
}

/// <summary>
/// <para> Access to Steam Datagram Relay (SDR) network</para>
/// <para> Initialization and status check</para>
/// <para>/ If you know that you are going to be using the relay network (for example,</para>
/// <para>/ because you anticipate making P2P connections), call this to initialize the</para>
/// <para>/ relay network. If you do not call this, the initialization will</para>
/// <para>/ be delayed until the first time you use a feature that requires access</para>
/// <para>/ to the relay network, which will delay that first access.</para>
/// <para>/</para>
/// <para>/ You can also call this to force a retry if the previous attempt has failed.</para>
/// <para>/ Performing any action that requires access to the relay network will also</para>
/// <para>/ trigger a retry, and so calling this function is never strictly necessary,</para>
/// <para>/ but it can be useful to call it a program launch time, if access to the</para>
/// <para>/ relay network is anticipated.</para>
/// <para>/</para>
/// <para>/ Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t</para>
/// <para>/ callbacks to know when initialization has completed.</para>
/// <para>/ Typically initialization completes in a few seconds.</para>
/// <para>/</para>
/// <para>/ Note: dedicated servers hosted in known data centers do *not* need</para>
/// <para>/ to call this, since they do not make routing decisions. However, if</para>
/// <para>/ the dedicated server will be using P2P functionality, it will act as</para>
/// <para>/ a "client" and this should be called.</para>
/// </summary>
public static void InitRelayNetworkAccess() {
InteropHelp.TestIfAvailableClient();
NativeMethods.ISteamNetworkingUtils_InitRelayNetworkAccess(CSteamAPIContext.GetSteamNetworkingUtils());
}

/// <summary>
/// <para>/ Fetch current status of the relay network.</para>
/// <para>/</para>
Expand Down

0 comments on commit 5f78ac7

Please sign in to comment.