Barotrauma Client Doc
NetworkEnums.cs
1 using System;
2 
3 namespace Barotrauma.Networking
4 {
5  public enum DeliveryMethod : int
6  {
7  Unreliable = 0x0,
8  Reliable = 0x1,
9  ReliableOrdered = 0x2
10  }
11 
12  public enum ConnectionInitialization : int
13  {
14  //used by all peer implementations
16  ContentPackageOrder = 0x2,
17  Password = 0x3,
18  Success = 0x0,
19 
20  //used only by SteamP2P implementations
21  ConnectionStarted = 0x4
22  }
23 
24  [Flags]
25  public enum PacketHeader : int
26  {
27  //used by all peer implementations
28  None = 0x0,
29  IsCompressed = 0x1,
31 
32  //used only by SteamP2P implementations
33  IsDisconnectMessage = 0x4,
34  IsServerMessage = 0x8,
35  IsHeartbeatMessage = 0x10
36  }
37 
38  public static class NetworkEnumExtensions
39  {
40  public static bool IsCompressed(this PacketHeader h)
41  => h.HasFlag(PacketHeader.IsCompressed);
42 
43  #warning TODO: remove?
44  public static bool IsConnectionInitializationStep(this PacketHeader h)
45  => h.HasFlag(PacketHeader.IsConnectionInitializationStep);
46 
47  public static bool IsDisconnectMessage(this PacketHeader h)
48  => h.HasFlag(PacketHeader.IsDisconnectMessage);
49 
50  public static bool IsServerMessage(this PacketHeader h)
51  => h.HasFlag(PacketHeader.IsServerMessage);
52 
53  public static bool IsHeartbeatMessage(this PacketHeader h)
54  => h.HasFlag(PacketHeader.IsHeartbeatMessage);
55  }
56 }
57