OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2016 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 WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ | |
12 #define WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ | |
13 | |
14 #include <string> | |
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 | |
26 namespace cricket { | |
27 | |
28 enum class TransportState { | |
29 STATE_INIT, | |
30 STATE_CONNECTING, // Will enter this state once a connection is created | |
31 STATE_COMPLETED, | |
32 STATE_FAILEDs | |
33 }; | |
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, the IceTransportInterface will be | |
43 // split from this class. | |
Taylor Brandstetter
2016/12/19 16:36:06
Could add a link to "https://www.w3.org/TR/webrtc/
| |
44 class IceTransportInternal : public rtc::PacketTransportInterface { | |
45 public: | |
46 virtual ~IceTransportInternal(); | |
47 | |
48 virtual TransportState GetState() const = 0; | |
49 | |
50 virtual const std::string& transport_name() const = 0; | |
51 | |
52 virtual int component() const = 0; | |
53 | |
54 virtual IceRole GetIceRole() const = 0; | |
55 | |
56 virtual void SetIceRole(IceRole role) = 0; | |
57 | |
58 virtual void SetIceTiebreaker(uint64_t tiebreaker) = 0; | |
59 | |
60 // TODO(zhihuang): Remove this once it's no longer called in | |
61 // remoting/protocol/libjingle_transport_factory.cc | |
62 virtual void SetIceProtocolType(IceProtocolType type) {} | |
63 | |
64 virtual void SetIceCredentials(const std::string& ice_ufrag, | |
65 const std::string& ice_pwd) { | |
66 SetIceParameters(IceParameters(ice_ufrag, ice_pwd, false)); | |
67 } | |
68 | |
69 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, | |
70 const std::string& ice_pwd) { | |
71 SetRemoteIceParameters(IceParameters(ice_ufrag, ice_pwd, false)); | |
72 } | |
73 | |
74 // The ufrag and pwd in |ice_params| must be set | |
75 // before candidate gathering can start. | |
76 virtual void SetIceParameters(const IceParameters& ice_params) = 0; | |
77 | |
78 virtual void SetRemoteIceParameters(const IceParameters& ice_params) = 0; | |
79 | |
80 virtual void SetRemoteIceMode(IceMode mode) = 0; | |
81 | |
82 virtual void SetIceConfig(const IceConfig& config) = 0; | |
83 | |
84 // Start gathering candidates if not already started, or if an ICE restart | |
85 // occurred. | |
86 virtual void MaybeStartGathering() = 0; | |
87 | |
88 virtual void SetMetricsObserver( | |
89 webrtc::MetricsObserverInterface* observer) = 0; | |
90 | |
91 virtual void AddRemoteCandidate(const Candidate& candidate) = 0; | |
92 | |
93 virtual void RemoveRemoteCandidate(const Candidate& candidate) = 0; | |
94 | |
95 virtual IceGatheringState gathering_state() const = 0; | |
96 | |
97 sigslot::signal1<IceTransportInternal*> SignalGatheringState; | |
98 | |
99 // Handles sending and receiving of candidates. | |
100 sigslot::signal2<IceTransportInternal*, const Candidate&> | |
101 SignalCandidateGathered; | |
102 | |
103 sigslot::signal2<IceTransportInternal*, const Candidates&> | |
104 SignalCandidatesRemoved; | |
105 | |
106 // Deprecated by SignalSelectedCandidatePairChanged | |
107 // This signal occurs when there is a change in the way that packets are | |
108 // being routed, i.e. to a different remote location. The candidate | |
109 // indicates where and how we are currently sending media. | |
110 sigslot::signal2<IceTransportInternal*, const Candidate&> SignalRouteChange; | |
111 | |
112 // Signalled when the current selected candidate pair has changed. | |
113 // The first parameter is the transport that signals the event. | |
114 // The second parameter is the new selected candidate pair. The third | |
115 // parameter is the last packet id sent on the previous candidate pair. | |
116 // The fourth parameter is a boolean which is true if the Transport | |
117 // is ready to send with this candidate pair. | |
118 sigslot::signal4<IceTransportInternal*, CandidatePairInterface*, int, bool> | |
119 SignalSelectedCandidatePairChanged; | |
120 | |
121 // Invoked when the transport is being destroyed. | |
122 sigslot::signal1<IceTransportInternal*> SignalDestroyed; | |
123 | |
124 // Debugging description of this transport. | |
125 std::string ToString() const; | |
126 }; | |
127 | |
128 } // namespace cricket | |
129 | |
130 #endif // WEBRTC_P2P_BASE_ICETRANSPORTINTERNAL_H_ | |
OLD | NEW |