tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ecn_marking_counter.h (1458B)


      1 /*
      2 *  Copyright 2024 The WebRTC Project Authors. All rights reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 #ifndef API_TEST_NETWORK_EMULATION_ECN_MARKING_COUNTER_H_
     11 #define API_TEST_NETWORK_EMULATION_ECN_MARKING_COUNTER_H_
     12 
     13 #include "api/transport/ecn_marking.h"
     14 
     15 namespace webrtc {
     16 
     17 // Counts Explicit Congestion Notifaction marks in IP packets.
     18 // https://www.rfc-editor.org/rfc/rfc9331.html
     19 class EcnMarkingCounter {
     20 public:
     21  // Number of packets without ECT explicitly set sent through the network.
     22  int not_ect() const { return not_ect_; }
     23  // Number of packets with ECT(1) sent through the network.
     24  int ect_0() const { return ect_0_; }
     25  // Number of packets with ECT(1) sent through the network.
     26  int ect_1() const { return ect_1_; }
     27  // Number of packets the network has marked as CE (congestion experienced).
     28  int ce() const { return ce_; }
     29 
     30  void Add(EcnMarking ecn);
     31  EcnMarkingCounter& operator+=(const EcnMarkingCounter& counter);
     32 
     33 private:
     34  int not_ect_ = 0;
     35  int ect_0_ = 0;  // Not used by WebRTC or L4S.
     36  int ect_1_ = 0;
     37  int ce_ = 0;
     38 };
     39 
     40 }  // namespace webrtc
     41 #endif  // API_TEST_NETWORK_EMULATION_ECN_MARKING_COUNTER_H_