-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathILagQuery.cs
More file actions
120 lines (104 loc) · 4.76 KB
/
ILagQuery.cs
File metadata and controls
120 lines (104 loc) · 4.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using System.Collections.Generic;
namespace SS.Core.ComponentInterfaces
{
public struct PingSummary
{
public int Current, Average, Min, Max;
}
public struct ClientPingSummary
{
public int Current, Average, Min, Max;
public uint S2CSlowTotal, S2CFastTotal;
public ushort S2CSlowCurrent, S2CFastCurrent;
}
public struct PacketlossSummary
{
public double S2C, C2S, S2CWeapon;
}
public struct PacketlossDetails
{
public uint ServerPacketsSent, ClientPacketsReceived;
public uint ClientPacketsSent, ServerPacketsReceived;
public uint WeaponSentCount, WeaponReceiveCount;
}
public record struct TimeSyncRecord()
{
public required uint ServerTime;
public required uint ClientTime;
}
public record struct PingHistogramBucket()
{
public required int Start;
public required int End;
public required int Count;
}
/// <summary>
/// Interface for querying player lag data.
/// </summary>
public interface ILagQuery : IComponentInterface
{
/// <summary>
/// Gets a player's ping info (from position packets).
/// </summary>
/// <param name="player">The player to get data about.</param>
/// <param name="ping">The data.</param>
void QueryPositionPing(Player player, out PingSummary ping);
/// <summary>
/// Get a player's ping info (reported by the client).
/// </summary>
/// <param name="player">The player to get data about.</param>
/// <param name="ping">The data.</param>
void QueryClientPing(Player player, out ClientPingSummary ping);
/// <summary>
/// Gets a player's ping info (from reliable packets).
/// </summary>
/// <param name="player">The player to get data about.</param>
/// <param name="ping">The data.</param>
void QueryReliablePing(Player player, out PingSummary ping);
/// <summary>
/// Gets a <paramref name="player"/>'s packetloss <paramref name="summary"/>.
/// </summary>
/// <param name="player">The player to get data about.</param>
/// <param name="summary">The packetloss summary.</param>
void QueryPacketloss(Player player, out PacketlossSummary summary);
/// <summary>
/// Gets a <paramref name="player"/>'s packetloss <paramref name="summary"/> and <paramref name="details"/>.
/// </summary>
/// <param name="player">The player to get data about.</param>
/// <param name="summary">The packetloss summary.</param>
/// <param name="details">The packetloss details.</param>
void QueryPacketloss(Player player, out PacketlossSummary summary, out PacketlossDetails details);
/// <summary>
/// Gets a player's reliable lag info.
/// </summary>
/// <param name="player">The player to get data about.</param>
/// <param name="reliableLag">The data.</param>
void QueryReliableLag(Player player, out ReliableLagData reliableLag);
/// <summary>
/// Gets a player's history of time sync requests (0x00 0x05 core packet).
/// </summary>
/// <param name="player">The player to get data about.</param>
/// <param name="records">A collection to be filled with a copy of the data.</param>
void QueryTimeSyncHistory(Player player, ICollection<TimeSyncRecord> records);
/// <summary>
/// Gets a player's average drift in time sync request.
/// </summary>
/// <param name="player">The player to get data about.</param>
/// <returns>The average drift in time sync. <see langword="null"/> if not available.</returns>
int? QueryTimeSyncDrift(Player player);
/// <summary>
/// Gets a player's ping histogram data based on C2S position packets.
/// </summary>
/// <param name="player">The player to get data for.</param>
/// <param name="data">A collection to populate with data.</param>
/// <returns><see langword="true"/> if <paramref name="data"/> was populated with data. Otherwise, <see langword="false"/>.</returns>
bool GetPositionPingHistogram(Player player, ICollection<PingHistogramBucket> data);
/// <summary>
/// Gets a player's ping histogram data based on reliable packets.
/// </summary>
/// <param name="player">The player to get data for.</param>
/// <param name="data">A collection to populate with data.</param>
/// <returns><see langword="true"/> if <paramref name="data"/> was populated with data. Otherwise, <see langword="false"/>.</returns>
bool GetReliablePingHistogram(Player player, ICollection<PingHistogramBucket> data);
}
}