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