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 <string> |
| 15 | 15 |
| 16 #include "webrtc/p2p/base/candidate.h" | 16 #include "webrtc/p2p/base/candidate.h" |
| 17 #include "webrtc/p2p/base/candidatepairinterface.h" | 17 #include "webrtc/p2p/base/candidatepairinterface.h" |
| 18 #include "webrtc/p2p/base/jseptransport.h" | 18 #include "webrtc/p2p/base/jseptransport.h" |
| 19 #include "webrtc/p2p/base/packettransportinterface.h" | 19 #include "webrtc/p2p/base/packettransportinterface.h" |
| 20 #include "webrtc/p2p/base/transportdescription.h" | 20 #include "webrtc/p2p/base/transportdescription.h" |
| 21 | 21 |
| 22 namespace webrtc { | 22 namespace webrtc { |
| 23 class MetricsObserverInterface; | 23 class MetricsObserverInterface; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace cricket { | 26 namespace cricket { |
| 27 | 27 |
| 28 enum class TransportState { | 28 enum class TransportState { |
|
Taylor Brandstetter
2016/12/20 03:37:26
Sorry for not catching this earlier, but: if this
Zhi Huang
2016/12/20 20:17:43
Done.
| |
| 29 STATE_INIT, | 29 STATE_INIT, |
| 30 STATE_CONNECTING, // Will enter this state once a connection is created | 30 STATE_CONNECTING, // Will enter this state once a connection is created |
| 31 STATE_COMPLETED, | 31 STATE_COMPLETED, |
| 32 STATE_FAILEDs | 32 STATE_FAILED |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // TODO(zhihuang): Remove this once it's no longer used in | 35 // TODO(zhihuang): Remove this once it's no longer used in |
| 36 // remoting/protocol/libjingle_transport_factory.cc | 36 // remoting/protocol/libjingle_transport_factory.cc |
| 37 enum IceProtocolType { | 37 enum IceProtocolType { |
| 38 ICEPROTO_RFC5245 // Standard RFC 5245 version of ICE. | 38 ICEPROTO_RFC5245 // Standard RFC 5245 version of ICE. |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // IceTransportInternal is an internal abstract class that does ICE. | 41 // IceTransportInternal is an internal abstract class that does ICE. |
| 42 // Once the public interface is supported, | 42 // Once the public interface is supported, |
| 43 // (https://www.w3.org/TR/webrtc/#rtcicetransport-interface) | 43 // (https://www.w3.org/TR/webrtc/#rtcicetransport-interface) |
| 44 // the IceTransportInterface will be split from this class. | 44 // the IceTransportInterface will be split from this class. |
| 45 class IceTransportInternal : public rtc::PacketTransportInterface { | 45 class IceTransportInternal : public rtc::PacketTransportInterface { |
| 46 public: | 46 public: |
| 47 virtual ~IceTransportInternal(); | 47 virtual ~IceTransportInternal(){}; |
|
Taylor Brandstetter
2016/12/20 03:37:26
Does this destructor need a body?
Zhi Huang
2016/12/20 20:17:43
Done.
| |
| 48 | 48 |
| 49 virtual TransportState GetState() const = 0; | 49 virtual TransportState GetState() const = 0; |
| 50 | 50 |
| 51 virtual const std::string& transport_name() const = 0; | 51 virtual const std::string& transport_name() const = 0; |
| 52 | 52 |
| 53 virtual int component() const = 0; | 53 virtual int component() const = 0; |
| 54 | 54 |
| 55 virtual IceRole GetIceRole() const = 0; | 55 virtual IceRole GetIceRole() const = 0; |
| 56 | 56 |
| 57 virtual void SetIceRole(IceRole role) = 0; | 57 virtual void SetIceRole(IceRole role) = 0; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 88 | 88 |
| 89 virtual void SetMetricsObserver( | 89 virtual void SetMetricsObserver( |
| 90 webrtc::MetricsObserverInterface* observer) = 0; | 90 webrtc::MetricsObserverInterface* observer) = 0; |
| 91 | 91 |
| 92 virtual void AddRemoteCandidate(const Candidate& candidate) = 0; | 92 virtual void AddRemoteCandidate(const Candidate& candidate) = 0; |
| 93 | 93 |
| 94 virtual void RemoveRemoteCandidate(const Candidate& candidate) = 0; | 94 virtual void RemoveRemoteCandidate(const Candidate& candidate) = 0; |
| 95 | 95 |
| 96 virtual IceGatheringState gathering_state() const = 0; | 96 virtual IceGatheringState gathering_state() const = 0; |
| 97 | 97 |
| 98 // Returns the current stats for this connection. | |
| 99 virtual bool GetStats(ConnectionInfos* infos) = 0; | |
| 100 | |
| 98 sigslot::signal1<IceTransportInternal*> SignalGatheringState; | 101 sigslot::signal1<IceTransportInternal*> SignalGatheringState; |
| 99 | 102 |
| 100 // Handles sending and receiving of candidates. | 103 // Handles sending and receiving of candidates. |
| 101 sigslot::signal2<IceTransportInternal*, const Candidate&> | 104 sigslot::signal2<IceTransportInternal*, const Candidate&> |
| 102 SignalCandidateGathered; | 105 SignalCandidateGathered; |
| 103 | 106 |
| 104 sigslot::signal2<IceTransportInternal*, const Candidates&> | 107 sigslot::signal2<IceTransportInternal*, const Candidates&> |
| 105 SignalCandidatesRemoved; | 108 SignalCandidatesRemoved; |
| 106 | 109 |
| 107 // Deprecated by SignalSelectedCandidatePairChanged | 110 // Deprecated by SignalSelectedCandidatePairChanged |
| 108 // This signal occurs when there is a change in the way that packets are | 111 // 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 | 112 // being routed, i.e. to a different remote location. The candidate |
| 110 // indicates where and how we are currently sending media. | 113 // indicates where and how we are currently sending media. |
| 111 sigslot::signal2<IceTransportInternal*, const Candidate&> SignalRouteChange; | 114 sigslot::signal2<IceTransportInternal*, const Candidate&> SignalRouteChange; |
| 112 | 115 |
| 113 // Signalled when the current selected candidate pair has changed. | 116 // Signalled when the current selected candidate pair has changed. |
| 114 // The first parameter is the transport that signals the event. | 117 // The first parameter is the transport that signals the event. |
| 115 // The second parameter is the new selected candidate pair. The third | 118 // The second parameter is the new selected candidate pair. The third |
| 116 // parameter is the last packet id sent on the previous candidate pair. | 119 // 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 | 120 // The fourth parameter is a boolean which is true if the Transport |
| 118 // is ready to send with this candidate pair. | 121 // is ready to send with this candidate pair. |
| 119 sigslot::signal4<IceTransportInternal*, CandidatePairInterface*, int, bool> | 122 sigslot::signal4<IceTransportInternal*, CandidatePairInterface*, int, bool> |
| 120 SignalSelectedCandidatePairChanged; | 123 SignalSelectedCandidatePairChanged; |
| 121 | 124 |
| 125 // Invoked when there is conflict in the ICE role between local and remote | |
| 126 // agents. | |
| 127 sigslot::signal1<IceTransportInternal*> SignalRoleConflict; | |
| 128 | |
| 129 // Emitted whenever the transport channel state changed. | |
|
Taylor Brandstetter
2016/12/20 03:37:26
transport channel -> transport
Zhi Huang
2016/12/20 20:17:43
Done.
| |
| 130 sigslot::signal1<IceTransportInternal*> SignalStateChanged; | |
| 131 | |
| 122 // Invoked when the transport is being destroyed. | 132 // Invoked when the transport is being destroyed. |
| 123 sigslot::signal1<IceTransportInternal*> SignalDestroyed; | 133 sigslot::signal1<IceTransportInternal*> SignalDestroyed; |
| 124 | 134 |
| 125 // Debugging description of this transport. | 135 // Debugging description of this transport. |
| 126 std::string ToString() const; | 136 virtual const std::string debug_name() const { |
|
Taylor Brandstetter
2016/12/20 03:37:26
nit: Doesn't need to return a const string.
Zhi Huang
2016/12/20 20:17:43
I meant to override the PacketTransportInterface::
Taylor Brandstetter
2016/12/20 20:27:15
Ah, I see. I think in PacketTransportInterface it
| |
| 137 return transport_name() + " " + std::to_string(component()); | |
| 138 } | |
| 127 }; | 139 }; |
| 128 | 140 |
| 129 } // namespace cricket | 141 } // namespace cricket |
| 130 | 142 |
| 131 #endif // WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ | 143 #endif // WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ |
| OLD | NEW |