using System.Runtime.InteropServices;
namespace Steamworks.Data
{
///
/// Describe the status of a connection
///
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
public struct ConnectionStatus
{
internal ConnectionState state; // m_eState ESteamNetworkingConnectionState
internal int ping; // m_nPing int
internal float connectionQualityLocal; // m_flConnectionQualityLocal float
internal float connectionQualityRemote; // m_flConnectionQualityRemote float
internal float outPacketsPerSec; // m_flOutPacketsPerSec float
internal float outBytesPerSec; // m_flOutBytesPerSec float
internal float inPacketsPerSec; // m_flInPacketsPerSec float
internal float inBytesPerSec; // m_flInBytesPerSec float
internal int sendRateBytesPerSecond; // m_nSendRateBytesPerSecond int
internal int cbPendingUnreliable; // m_cbPendingUnreliable int
internal int cbPendingReliable; // m_cbPendingReliable int
internal int cbSentUnackedReliable; // m_cbSentUnackedReliable int
internal long ecQueueTime; // m_usecQueueTime SteamNetworkingMicroseconds
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4 )]
internal uint[] reserved; // reserved uint32 [16]
///
/// Current ping (ms)
///
public int Ping => ping;
///
/// Outgoing packets per second
///
public float OutPacketsPerSec => outPacketsPerSec;
///
/// Outgoing bytes per second
///
public float OutBytesPerSec => outBytesPerSec;
///
/// Incoming packets per second
///
public float InPacketsPerSec => inPacketsPerSec;
///
/// Incoming bytes per second
///
public float InBytesPerSec => inBytesPerSec;
///
/// Connection quality measured locally, 0...1 (percentage of packets delivered end-to-end in order).
///
public float ConnectionQualityLocal => connectionQualityLocal;
///
/// Packet delivery success rate as observed from remote host, 0...1 (percentage of packets delivered end-to-end in order).
///
public float ConnectionQualityRemote => connectionQualityRemote;
///
/// Number of bytes unreliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire.
///
public int PendingUnreliable => cbPendingUnreliable;
///
/// Number of bytes reliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire.
///
public int PendingReliable => cbPendingReliable;
///
/// Number of bytes of reliable data that has been placed the wire, but for which we have not yet received an acknowledgment, and thus we may have to re-transmit.
///
public int SentUnackedReliable => cbSentUnackedReliable;
}
}