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_EVENTS_RTC_EVENT_ICE_CANDIDATE_PAIR_CONFIG_H_ 12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_ICE_CANDIDATE_PAIR_CONFIG_H_ 13 14 #include <stdint.h> 15 16 #include <memory> 17 18 #include "api/rtc_event_log/rtc_event.h" 19 20 namespace webrtc { 21 22 enum class IceCandidatePairConfigType { 23 kAdded, 24 kUpdated, 25 kDestroyed, 26 kSelected, 27 kNumValues, 28 }; 29 30 // TODO(qingsi): Change the names of candidate types to "host", "srflx", "prflx" 31 // and "relay" after the naming is spec-compliant in the signaling part 32 enum class IceCandidateType { 33 kUnknown, 34 kLocal, 35 kStun, 36 kPrflx, 37 kRelay, 38 kNumValues, 39 }; 40 41 enum class IceCandidatePairProtocol { 42 kUnknown, 43 kUdp, 44 kTcp, 45 kSsltcp, 46 kTls, 47 kNumValues, 48 }; 49 50 enum class IceCandidatePairAddressFamily { 51 kUnknown, 52 kIpv4, 53 kIpv6, 54 kNumValues, 55 }; 56 57 enum class IceCandidateNetworkType { 58 kUnknown, 59 kEthernet, 60 kLoopback, 61 kWifi, 62 kVpn, 63 kCellular, 64 kNumValues, 65 }; 66 67 class IceCandidatePairDescription { 68 public: 69 IceCandidatePairDescription(); 70 explicit IceCandidatePairDescription( 71 const IceCandidatePairDescription& other); 72 73 ~IceCandidatePairDescription(); 74 75 IceCandidateType local_candidate_type; 76 IceCandidatePairProtocol local_relay_protocol; 77 IceCandidateNetworkType local_network_type; 78 IceCandidatePairAddressFamily local_address_family; 79 IceCandidateType remote_candidate_type; 80 IceCandidatePairAddressFamily remote_address_family; 81 IceCandidatePairProtocol candidate_pair_protocol; 82 }; 83 84 class RtcEventIceCandidatePairConfig final : public RtcEvent { 85 public: 86 RtcEventIceCandidatePairConfig( 87 IceCandidatePairConfigType type, 88 uint32_t candidate_pair_id, 89 const IceCandidatePairDescription& candidate_pair_desc); 90 91 ~RtcEventIceCandidatePairConfig() override; 92 93 Type GetType() const override; 94 95 bool IsConfigEvent() const override; 96 97 std::unique_ptr<RtcEventIceCandidatePairConfig> Copy() const; 98 type()99 IceCandidatePairConfigType type() const { return type_; } candidate_pair_id()100 uint32_t candidate_pair_id() const { return candidate_pair_id_; } candidate_pair_desc()101 const IceCandidatePairDescription& candidate_pair_desc() const { 102 return candidate_pair_desc_; 103 } 104 105 private: 106 RtcEventIceCandidatePairConfig(const RtcEventIceCandidatePairConfig& other); 107 108 const IceCandidatePairConfigType type_; 109 const uint32_t candidate_pair_id_; 110 const IceCandidatePairDescription candidate_pair_desc_; 111 }; 112 113 } // namespace webrtc 114 115 #endif // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_ICE_CANDIDATE_PAIR_CONFIG_H_ 116