Network Enum cleanup

This commit is contained in:
Garry Newman 2019-05-06 13:38:37 +01:00
parent 9bb5b5178e
commit 533b6ad28d
10 changed files with 121 additions and 111 deletions

View File

@ -0,0 +1,17 @@
namespace Steamworks.Data
{
enum DebugOutputType : int
{
None = 0,
Bug = 1, // You used the API incorrectly, or an internal error happened
Error = 2, // Run-time error condition that isn't the result of a bug. (E.g. we are offline, cannot bind a port, etc)
Important = 3, // Nothing is wrong, but this is an important notification
Warning = 4,
Msg = 5, // Recommended amount
Verbose = 6, // Quite a bit
Debug = 7, // Practically everything
Everything = 8, // Wall of text, detailed packet contents breakdown, etc
Force32Bit = 0x7fffffff
};
}

View File

@ -0,0 +1,57 @@
namespace Steamworks.Data
{
internal enum NetConfig : int
{
Invalid = 0,
FakePacketLoss_Send = 2,
FakePacketLoss_Recv = 3,
FakePacketLag_Send = 4,
FakePacketLag_Recv = 5,
FakePacketReorder_Send = 6,
FakePacketReorder_Recv = 7,
FakePacketReorder_Time = 8,
FakePacketDup_Send = 26,
FakePacketDup_Recv = 27,
FakePacketDup_TimeMax = 28,
TimeoutInitial = 24,
TimeoutConnected = 25,
SendBufferSize = 9,
SendRateMin = 10,
SendRateMax = 11,
NagleTime = 12,
IP_AllowWithoutAuth = 23,
SDRClient_ConsecutitivePingTimeoutsFailInitial = 19,
SDRClient_ConsecutitivePingTimeoutsFail = 20,
SDRClient_MinPingsBeforePingAccurate = 21,
SDRClient_SingleSocket = 22,
SDRClient_ForceRelayCluster = 29,
SDRClient_DebugTicketAddress = 30,
SDRClient_ForceProxyAddr = 31,
LogLevel_AckRTT = 13,
LogLevel_PacketDecode = 14,
LogLevel_Message = 15,
LogLevel_PacketGaps = 16,
LogLevel_P2PRendezvous = 17,
LogLevel_SDRRelayPings = 18,
Force32Bit = 0x7fffffff
}
}

View File

@ -0,0 +1,13 @@
namespace Steamworks.Data
{
enum NetConfigResult
{
BadValue = -1, // No such configuration value
BadScopeObj = -2, // Bad connection handle, etc
BufferTooSmall = -3, // Couldn't fit the result in your buffer
OK = 1,
OKInherited = 2, // A value was not set at this level, but the effective (inherited) value was returned.
Force32Bit = 0x7fffffff
};
}

View File

@ -0,0 +1,13 @@
namespace Steamworks.Data
{
enum NetConfigType
{
Int32 = 1,
Int64 = 2,
Float = 3,
String = 4,
FunctionPtr = 5, // NOTE: When setting callbacks, you should put the pointer into a variable and pass a pointer to that variable.
Force32Bit = 0x7fffffff
};
}

View File

@ -0,0 +1,12 @@
namespace Steamworks.Data
{
internal enum NetScope : int
{
Global = 1,
SocketsInterface = 2,
ListenSocket = 3,
Connection = 4,
Force32Bit = 0x7fffffff
}
}

View File

@ -1,104 +0,0 @@
namespace Steamworks.Data
{
enum SteamNetworkingGetConfigValueResult
{
BadValue = -1, // No such configuration value
BadScopeObj = -2, // Bad connection handle, etc
BufferTooSmall = -3, // Couldn't fit the result in your buffer
OK = 1,
OKInherited = 2, // A value was not set at this level, but the effective (inherited) value was returned.
Force32Bit = 0x7fffffff
};
enum NetConfigType
{
Int32 = 1,
Int64 = 2,
Float = 3,
String = 4,
FunctionPtr = 5, // NOTE: When setting callbacks, you should put the pointer into a variable and pass a pointer to that variable.
Force32Bit = 0x7fffffff
};
enum SteamNetworkingSocketsDebugOutputType : int
{
None = 0,
Bug = 1, // You used the API incorrectly, or an internal error happened
Error = 2, // Run-time error condition that isn't the result of a bug. (E.g. we are offline, cannot bind a port, etc)
Important = 3, // Nothing is wrong, but this is an important notification
Warning = 4,
Msg = 5, // Recommended amount
Verbose = 6, // Quite a bit
Debug = 7, // Practically everything
Everything = 8, // Wall of text, detailed packet contents breakdown, etc
Force32Bit = 0x7fffffff
};
internal enum NetScope : int
{
Global = 1,
SocketsInterface = 2,
ListenSocket = 3,
Connection = 4,
Force32Bit = 0x7fffffff
}
internal enum NetConfig : int
{
Invalid = 0,
FakePacketLoss_Send = 2,
FakePacketLoss_Recv = 3,
FakePacketLag_Send = 4,
FakePacketLag_Recv = 5,
FakePacketReorder_Send = 6,
FakePacketReorder_Recv = 7,
FakePacketReorder_Time = 8,
FakePacketDup_Send = 26,
FakePacketDup_Recv = 27,
FakePacketDup_TimeMax = 28,
TimeoutInitial = 24,
TimeoutConnected = 25,
SendBufferSize = 9,
SendRateMin = 10,
SendRateMax = 11,
NagleTime = 12,
IP_AllowWithoutAuth = 23,
SDRClient_ConsecutitivePingTimeoutsFailInitial = 19,
SDRClient_ConsecutitivePingTimeoutsFail = 20,
SDRClient_MinPingsBeforePingAccurate = 21,
SDRClient_SingleSocket = 22,
SDRClient_ForceRelayCluster = 29,
SDRClient_DebugTicketAddress = 30,
SDRClient_ForceProxyAddr = 31,
LogLevel_AckRTT = 13,
LogLevel_PacketDecode = 14,
LogLevel_Message = 15,
LogLevel_PacketGaps = 16,
LogLevel_P2PRendezvous = 17,
LogLevel_SDRRelayPings = 18,
Force32Bit = 0x7fffffff
}
}

View File

@ -169,11 +169,11 @@ internal long GetLocalTimestamp()
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FSetDebugOutputFunction( IntPtr self, SteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc );
private delegate void FSetDebugOutputFunction( IntPtr self, DebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc );
private FSetDebugOutputFunction _SetDebugOutputFunction;
#endregion
internal void SetDebugOutputFunction( SteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc )
internal void SetDebugOutputFunction( DebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc )
{
_SetDebugOutputFunction( Self, eDetailLevel, pfnFunc );
}
@ -192,11 +192,11 @@ internal bool SetConfigValue( NetConfig eValue, NetScope eScopeType, long scopeO
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate SteamNetworkingGetConfigValueResult FGetConfigValue( IntPtr self, NetConfig eValue, NetScope eScopeType, long scopeObj, ref NetConfigType pOutDataType, IntPtr pResult, ref ulong cbResult );
private delegate NetConfigResult FGetConfigValue( IntPtr self, NetConfig eValue, NetScope eScopeType, long scopeObj, ref NetConfigType pOutDataType, IntPtr pResult, ref ulong cbResult );
private FGetConfigValue _GetConfigValue;
#endregion
internal SteamNetworkingGetConfigValueResult GetConfigValue( NetConfig eValue, NetScope eScopeType, long scopeObj, ref NetConfigType pOutDataType, IntPtr pResult, ref ulong cbResult )
internal NetConfigResult GetConfigValue( NetConfig eValue, NetScope eScopeType, long scopeObj, ref NetConfigType pOutDataType, IntPtr pResult, ref ulong cbResult )
{
return _GetConfigValue( Self, eValue, eScopeType, scopeObj, ref pOutDataType, pResult, ref cbResult );
}

View File

@ -133,7 +133,7 @@ internal unsafe static int GetConfigInt( NetConfig type )
int* ptr = &value;
ulong size = sizeof( int );
var result = Internal.GetConfigValue( type, NetScope.Global, 0, ref dtype, (IntPtr) ptr, ref size );
if ( result != SteamNetworkingGetConfigValueResult.OK )
if ( result != NetConfigResult.OK )
return 0;
return value;
@ -152,7 +152,7 @@ internal unsafe static float GetConfigFloat( NetConfig type )
float* ptr = &value;
ulong size = sizeof( float );
var result = Internal.GetConfigValue( type, NetScope.Global, 0, ref dtype, (IntPtr)ptr, ref size );
if ( result != SteamNetworkingGetConfigValueResult.OK )
if ( result != NetConfigResult.OK )
return 0;
return value;

View File

@ -5,7 +5,7 @@
namespace Steamworks.Data
{
delegate void FSteamNetworkingSocketsDebugOutput (SteamNetworkingSocketsDebugOutputType nType, string pszMsg );
delegate void FSteamNetworkingSocketsDebugOutput (DebugOutputType nType, string pszMsg );
public struct SteamNetworkingPOPID
{

View File

@ -37,6 +37,8 @@ public static string ConvertType( string type )
type = type.Replace( "SteamNetConnectionInfo_t", "ConnectionInfo" );
type = type.Replace( "SteamNetworkingConnectionState", "ConnectionState" );
type = type.Replace( "SteamNetworkingMicroseconds", "long" );
type = type.Replace( "SteamNetworkingSocketsDebugOutputType", "DebugOutputType" );
type = type.Replace( "SteamNetworkingGetConfigValueResult", "NetConfigResult" );
return type;
}