IgnoranceDefinitions.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Ignorance 1.4.x LTS (Long Term Support)
  2. // https://github.com/SoftwareGuy/Ignorance
  3. // -----------------
  4. // Copyright (c) 2019 - 2021 Matt Coburn (SoftwareGuy/Coburn64)
  5. // Ignorance is licensed under the MIT license. Refer
  6. // to the LICENSE file for more information.
  7. using System;
  8. using System.Collections.Generic;
  9. using ENet;
  10. namespace IgnoranceCore
  11. {
  12. // Snipped from the transport files, as this will help
  13. // me keep things up to date.
  14. [Serializable]
  15. public enum IgnoranceChannelTypes
  16. {
  17. Reliable = PacketFlags.Reliable, // Reliable UDP (TCP-like emulation)
  18. ReliableUnsequenced = PacketFlags.Reliable | PacketFlags.Unsequenced, // Reliable UDP (TCP-like emulation w/o sequencing)
  19. Unreliable = PacketFlags.Unsequenced, // Pure UDP, high velocity packet action.
  20. UnreliableFragmented = PacketFlags.UnreliableFragmented, // Pure UDP, but fragmented.
  21. UnreliableSequenced = PacketFlags.None, // Pure UDP, but sequenced.
  22. Unthrottled = PacketFlags.Unthrottled, // Pure UDP. Literally turbo mode.
  23. }
  24. public class IgnoranceInternals
  25. {
  26. public const string Version = "1.4.0r0 (LTS)";
  27. public const string Scheme = "enet";
  28. public const string BindAnyAddress = "::0";
  29. }
  30. public enum IgnoranceLogType
  31. {
  32. Nothing,
  33. Standard,
  34. Verbose
  35. }
  36. public struct IgnoranceIncomingPacket
  37. {
  38. public byte Channel;
  39. public uint NativePeerId;
  40. public Packet Payload;
  41. }
  42. public struct IgnoranceOutgoingPacket
  43. {
  44. public byte Channel;
  45. public uint NativePeerId;
  46. public Packet Payload;
  47. }
  48. public struct IgnoranceConnectionEvent
  49. {
  50. public byte EventType;
  51. public ushort Port;
  52. public uint NativePeerId;
  53. public string IP;
  54. }
  55. public struct IgnoranceCommandPacket
  56. {
  57. public IgnoranceCommandType Type;
  58. public uint PeerId;
  59. }
  60. // Stats only - may not always be used!
  61. public struct IgnoranceClientStats
  62. {
  63. public uint RTT;
  64. public ulong BytesReceived;
  65. public ulong BytesSent;
  66. public ulong PacketsReceived;
  67. public ulong PacketsSent;
  68. public ulong PacketsLost;
  69. }
  70. public enum IgnoranceCommandType
  71. {
  72. // Client
  73. ClientWantsToStop,
  74. ClientStatusRequest,
  75. // Server
  76. ServerKickPeer,
  77. ServerStatusRequest
  78. }
  79. // Stats only - may not always be used!
  80. public struct IgnoranceServerStats
  81. {
  82. public ulong BytesReceived;
  83. public ulong BytesSent;
  84. public ulong PacketsReceived;
  85. public ulong PacketsSent;
  86. public ulong PeersCount;
  87. public Dictionary<int, IgnoranceClientStats> PeerStats;
  88. }
  89. public struct PeerConnectionData
  90. {
  91. public ushort Port;
  92. public uint NativePeerId;
  93. public string IP;
  94. }
  95. }