Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ | 11 #ifndef WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ |
| 12 #define WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ | 12 #define WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ |
| 13 | 13 |
| 14 #include <string> | 14 #include "webrtc/p2p/base/transportchannel.h" |
|
Taylor Brandstetter
2016/12/23 07:12:51
Does this need to include transportchannelimpl.h?
Zhi Huang
2016/12/27 19:10:14
I only included the transportchannelimpl.h since T
| |
| 15 | |
| 16 #include "webrtc/p2p/base/candidate.h" | |
| 17 #include "webrtc/p2p/base/candidatepairinterface.h" | |
| 18 #include "webrtc/p2p/base/jseptransport.h" | |
| 19 #include "webrtc/p2p/base/packettransportinterface.h" | |
| 20 #include "webrtc/p2p/base/transportdescription.h" | |
| 21 | |
| 22 namespace webrtc { | |
| 23 class MetricsObserverInterface; | |
| 24 } | |
| 25 | 15 |
| 26 namespace cricket { | 16 namespace cricket { |
| 27 | 17 typedef TransportChannel IceTransportInternal; |
| 28 enum class TransportState { | 18 typedef TransportChannelImpl IceTransportInternal2; |
| 29 STATE_INIT, | |
| 30 STATE_CONNECTING, // Will enter this state once a connection is created | |
| 31 STATE_COMPLETED, | |
| 32 STATE_FAILEDs | |
| 33 }; | |
|
Taylor Brandstetter
2016/12/23 07:12:51
Again, I'd suggest leaving this code, but commente
Zhi Huang
2016/12/27 19:10:14
Done.
| |
| 34 | |
| 35 // TODO(zhihuang): Remove this once it's no longer used in | |
| 36 // remoting/protocol/libjingle_transport_factory.cc | |
| 37 enum IceProtocolType { | |
| 38 ICEPROTO_RFC5245 // Standard RFC 5245 version of ICE. | |
| 39 }; | |
| 40 | |
| 41 // IceTransportInternal is an internal abstract class that does ICE. | |
| 42 // Once the public interface is supported, | |
| 43 // (https://www.w3.org/TR/webrtc/#rtcicetransport-interface) | |
| 44 // the IceTransportInterface will be split from this class. | |
| 45 class IceTransportInternal : public rtc::PacketTransportInterface { | |
| 46 public: | |
| 47 virtual ~IceTransportInternal(); | |
| 48 | |
| 49 virtual TransportState GetState() const = 0; | |
| 50 | |
| 51 virtual const std::string& transport_name() const = 0; | |
| 52 | |
| 53 virtual int component() const = 0; | |
| 54 | |
| 55 virtual IceRole GetIceRole() const = 0; | |
| 56 | |
| 57 virtual void SetIceRole(IceRole role) = 0; | |
| 58 | |
| 59 virtual void SetIceTiebreaker(uint64_t tiebreaker) = 0; | |
| 60 | |
| 61 // TODO(zhihuang): Remove this once it's no longer called in | |
| 62 // remoting/protocol/libjingle_transport_factory.cc | |
| 63 virtual void SetIceProtocolType(IceProtocolType type) {} | |
| 64 | |
| 65 virtual void SetIceCredentials(const std::string& ice_ufrag, | |
| 66 const std::string& ice_pwd) { | |
| 67 SetIceParameters(IceParameters(ice_ufrag, ice_pwd, false)); | |
| 68 } | |
| 69 | |
| 70 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, | |
| 71 const std::string& ice_pwd) { | |
| 72 SetRemoteIceParameters(IceParameters(ice_ufrag, ice_pwd, false)); | |
| 73 } | |
| 74 | |
| 75 // The ufrag and pwd in |ice_params| must be set | |
| 76 // before candidate gathering can start. | |
| 77 virtual void SetIceParameters(const IceParameters& ice_params) = 0; | |
| 78 | |
| 79 virtual void SetRemoteIceParameters(const IceParameters& ice_params) = 0; | |
| 80 | |
| 81 virtual void SetRemoteIceMode(IceMode mode) = 0; | |
| 82 | |
| 83 virtual void SetIceConfig(const IceConfig& config) = 0; | |
| 84 | |
| 85 // Start gathering candidates if not already started, or if an ICE restart | |
| 86 // occurred. | |
| 87 virtual void MaybeStartGathering() = 0; | |
| 88 | |
| 89 virtual void SetMetricsObserver( | |
| 90 webrtc::MetricsObserverInterface* observer) = 0; | |
| 91 | |
| 92 virtual void AddRemoteCandidate(const Candidate& candidate) = 0; | |
| 93 | |
| 94 virtual void RemoveRemoteCandidate(const Candidate& candidate) = 0; | |
| 95 | |
| 96 virtual IceGatheringState gathering_state() const = 0; | |
| 97 | |
| 98 sigslot::signal1<IceTransportInternal*> SignalGatheringState; | |
| 99 | |
| 100 // Handles sending and receiving of candidates. | |
| 101 sigslot::signal2<IceTransportInternal*, const Candidate&> | |
| 102 SignalCandidateGathered; | |
| 103 | |
| 104 sigslot::signal2<IceTransportInternal*, const Candidates&> | |
| 105 SignalCandidatesRemoved; | |
| 106 | |
| 107 // Deprecated by SignalSelectedCandidatePairChanged | |
| 108 // This signal occurs when there is a change in the way that packets are | |
| 109 // being routed, i.e. to a different remote location. The candidate | |
| 110 // indicates where and how we are currently sending media. | |
| 111 sigslot::signal2<IceTransportInternal*, const Candidate&> SignalRouteChange; | |
| 112 | |
| 113 // Signalled when the current selected candidate pair has changed. | |
| 114 // The first parameter is the transport that signals the event. | |
| 115 // The second parameter is the new selected candidate pair. The third | |
| 116 // parameter is the last packet id sent on the previous candidate pair. | |
| 117 // The fourth parameter is a boolean which is true if the Transport | |
| 118 // is ready to send with this candidate pair. | |
| 119 sigslot::signal4<IceTransportInternal*, CandidatePairInterface*, int, bool> | |
| 120 SignalSelectedCandidatePairChanged; | |
| 121 | |
| 122 // Invoked when the transport is being destroyed. | |
| 123 sigslot::signal1<IceTransportInternal*> SignalDestroyed; | |
| 124 | |
| 125 // Debugging description of this transport. | |
| 126 std::string ToString() const; | |
| 127 }; | |
| 128 | 19 |
| 129 } // namespace cricket | 20 } // namespace cricket |
| 130 | 21 |
| 131 #endif // WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ | 22 #endif // WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ |
| OLD | NEW |