32 lines
738 B
C#
32 lines
738 B
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace FastArena
|
|
{
|
|
internal enum PacketType : ushort
|
|
{
|
|
Invalid = 0, // not packet
|
|
|
|
ConnectionRequestTCP,
|
|
ConnectionRequestUDP,
|
|
ConnectionResponseTCP,
|
|
ConnectionResponseUDP,
|
|
|
|
TransformUpdate,
|
|
CreateObject
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
|
internal readonly struct PacketHeader
|
|
{
|
|
internal const ushort MAGIC_CONST = 0x6313;
|
|
|
|
internal readonly ushort magic;
|
|
internal readonly PacketType type;
|
|
|
|
internal PacketHeader(PacketType t)
|
|
{
|
|
magic = MAGIC_CONST;
|
|
type = t;
|
|
}
|
|
}
|
|
} |