using System.Runtime.InteropServices;
namespace Facepunch.Steamworks.Data
{
///
/// Describe the state of a connection
///
[StructLayout( LayoutKind.Sequential, Size = 696 )]
public struct ConnectionInfo
{
internal NetIdentity identity;
internal long userData;
internal Socket listenSocket;
internal NetAddress address;
internal ushort pad;
internal SteamNetworkingPOPID popRemote;
internal SteamNetworkingPOPID popRelay;
internal ConnectionState state;
internal int endReason;
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 128 )]
internal string endDebug;
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 128 )]
internal string connectionDescription;
///
/// High level state of the connection
///
public ConnectionState State => state;
///
/// Remote address. Might be all 0's if we don't know it, or if this is N/A.
///
public NetAddress Address => address;
///
/// Who is on the other end? Depending on the connection type and phase of the connection, we might not know
///
public NetIdentity Identity => identity;
///
/// Basic cause of the connection termination or problem.
///
public NetConnectionEnd EndReason => (NetConnectionEnd)endReason;
}
}