ice_logger.h 1.9 KB

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