1 /*
2  * Copyright (c) Facebook, Inc. and its affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  *
7  */
8 
9 #pragma once
10 
11 #include <chrono>
12 #include <string>
13 
14 #include <folly/SocketAddress.h>
15 #include <quic/QuicConstants.h>
16 
17 namespace quic {
18 
19 struct BbrStats {
20   uint8_t state;
21 };
22 
23 struct CopaStats {
24   double deltaParam;
25   bool useRttStanding;
26 };
27 
28 struct CubicStats {
29   uint8_t state;
30   uint64_t ssthresh;
31 };
32 
33 union CongestionControllerStats {
34   struct BbrStats bbrStats;
35   struct CopaStats copaStats;
36   struct CubicStats cubicStats;
37 };
38 
39 struct QuicConnectionStats {
40   uint8_t workerID{0};
41   uint32_t numConnIDs{0};
42   folly::SocketAddress localAddress;
43   folly::SocketAddress peerAddress;
44   std::chrono::duration<float> duration{0};
45   uint64_t cwnd_bytes{0};
46   CongestionControlType congestionController;
47   CongestionControllerStats congestionControllerStats;
48   uint32_t ptoCount{0};
49   std::chrono::microseconds srtt{0};
50   std::chrono::microseconds rttvar{0};
51   uint64_t peerAckDelayExponent{0};
52   uint64_t udpSendPacketLen{0};
53   uint64_t numStreams{0};
54   std::string clientChosenDestConnectionId;
55   std::string clientConnectionId;
56   std::string serverConnectionId;
57   uint64_t totalBytesSent{0};
58   uint64_t totalBytesReceived{0};
59   uint64_t totalBytesRetransmitted{0};
60   uint32_t version{0};
61 };
62 
63 } // namespace quic
64