mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
42
Brutal.RakNet/Manual/APIPartials/SockaddrIn.cs
Normal file
42
Brutal.RakNet/Manual/APIPartials/SockaddrIn.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.RakNetApi
|
||||
{
|
||||
public partial struct SockaddrIn
|
||||
{
|
||||
[FieldOffset(1)]
|
||||
private byte SinFamilyBsd;
|
||||
|
||||
public ushort SinFamily
|
||||
{
|
||||
get => SockAddrUtility.Layout == SockAddrUtility.SockAddrLayout.Bsd ? SinFamilyBsd : SinFamilyNonBsd;
|
||||
set
|
||||
{
|
||||
if (SockAddrUtility.Layout == SockAddrUtility.SockAddrLayout.Bsd)
|
||||
SinFamilyBsd = (byte)value;
|
||||
else
|
||||
SinFamilyNonBsd = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class SockAddrUtility
|
||||
{
|
||||
static SockAddrUtility()
|
||||
{
|
||||
Layout = IsNonBsdSockAddrLayout() ? SockAddrLayout.NonBsd : SockAddrLayout.Bsd;
|
||||
}
|
||||
|
||||
public enum SockAddrLayout : byte
|
||||
{
|
||||
Bsd = 0,
|
||||
NonBsd = 1,
|
||||
};
|
||||
|
||||
[LibraryImport("RakNetDLL", EntryPoint = "IsNonBsdSockAddrLayout")]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
public static partial bool IsNonBsdSockAddrLayout();
|
||||
|
||||
public static SockAddrLayout Layout { get; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue