tor-browser

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

ecn_marking_counter.cc (1073B)


      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 #include "api/test/network_emulation/ecn_marking_counter.h"
     11 
     12 #include "api/transport/ecn_marking.h"
     13 
     14 namespace webrtc {
     15 
     16 void EcnMarkingCounter::Add(EcnMarking ecn) {
     17  switch (ecn) {
     18    case EcnMarking::kNotEct:
     19      ++not_ect_;
     20      break;
     21    case EcnMarking::kEct0:
     22      ++ect_0_;
     23      break;
     24    case EcnMarking::kEct1:
     25      ++ect_1_;
     26      break;
     27    case EcnMarking::kCe:
     28      ++ce_;
     29      break;
     30  }
     31 }
     32 
     33 EcnMarkingCounter& EcnMarkingCounter::operator+=(
     34    const EcnMarkingCounter& counter) {
     35  not_ect_ += counter.not_ect();
     36  ect_0_ += counter.ect_0();
     37  ect_1_ += counter.ect_1();
     38  ce_ += counter.ce();
     39  return *this;
     40 }
     41 
     42 }  // namespace webrtc