tor-browser

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

ice_logger.h (1944B)


      1 /*
      2 *  Copyright (c) 2017 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 
     11 #ifndef LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_
     12 #define LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_
     13 
     14 #include <cstdint>
     15 #include <unordered_map>
     16 
     17 #include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h"
     18 #include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
     19 
     20 namespace webrtc {
     21 
     22 class RtcEventLog;
     23 
     24 // IceEventLog wraps RtcEventLog and provides structural logging of ICE-specific
     25 // events. The logged events are serialized with other RtcEvent's if protobuf is
     26 // enabled in the build.
     27 class IceEventLog {
     28 public:
     29  IceEventLog();
     30  ~IceEventLog();
     31 
     32  void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; }
     33 
     34  void LogCandidatePairConfig(
     35      IceCandidatePairConfigType type,
     36      uint32_t candidate_pair_id,
     37      const IceCandidatePairDescription& candidate_pair_desc);
     38 
     39  void LogCandidatePairEvent(IceCandidatePairEventType type,
     40                             uint32_t candidate_pair_id,
     41                             uint32_t transaction_id);
     42 
     43  // This method constructs a config event for each candidate pair with their
     44  // description and logs these config events. It is intended to be called when
     45  // logging starts to ensure that we have at least one config for each
     46  // candidate pair id.
     47  void DumpCandidatePairDescriptionToMemoryAsConfigEvents() const;
     48 
     49 private:
     50  RtcEventLog* event_log_ = nullptr;
     51  std::unordered_map<uint32_t, IceCandidatePairDescription>
     52      candidate_pair_desc_by_id_;
     53 };
     54 
     55 }  // namespace webrtc
     56 
     57 #endif  // LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_