Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel.h

Issue 1709953002: Revert of Remove GetTransport() from TransportChannelImpl (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/p2ptransport.cc ('k') | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 // P2PTransportChannel wraps up the state management of the connection between 11 // P2PTransportChannel wraps up the state management of the connection between
12 // two P2P clients. Clients have candidate ports for connecting, and 12 // two P2P clients. Clients have candidate ports for connecting, and
13 // connections which are combinations of candidates from each end (Alice and 13 // connections which are combinations of candidates from each end (Alice and
14 // Bob each have candidates, one candidate from Alice and one candidate from 14 // Bob each have candidates, one candidate from Alice and one candidate from
15 // Bob are used to make a connection, repeat to make many connections). 15 // Bob are used to make a connection, repeat to make many connections).
16 // 16 //
17 // When all of the available connections become invalid (non-writable), we 17 // When all of the available connections become invalid (non-writable), we
18 // kick off a process of determining more candidates and more connections. 18 // kick off a process of determining more candidates and more connections.
19 // 19 //
20 #ifndef WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ 20 #ifndef WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
21 #define WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ 21 #define WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
22 22
23 #include <map> 23 #include <map>
24 #include <string> 24 #include <string>
25 #include <vector> 25 #include <vector>
26 #include "webrtc/p2p/base/candidate.h" 26 #include "webrtc/p2p/base/candidate.h"
27 #include "webrtc/p2p/base/p2ptransport.h" 27 #include "webrtc/p2p/base/p2ptransport.h"
28 #include "webrtc/p2p/base/portallocator.h" 28 #include "webrtc/p2p/base/portallocator.h"
29 #include "webrtc/p2p/base/portinterface.h" 29 #include "webrtc/p2p/base/portinterface.h"
30 #include "webrtc/p2p/base/transport.h"
30 #include "webrtc/p2p/base/transportchannelimpl.h" 31 #include "webrtc/p2p/base/transportchannelimpl.h"
31 #include "webrtc/base/asyncpacketsocket.h" 32 #include "webrtc/base/asyncpacketsocket.h"
32 #include "webrtc/base/sigslot.h" 33 #include "webrtc/base/sigslot.h"
33 34
34 namespace cricket { 35 namespace cricket {
35 36
36 extern const uint32_t WEAK_PING_DELAY; 37 extern const uint32_t WEAK_PING_DELAY;
37 38
38 struct IceParameters { 39 struct IceParameters {
39 std::string ufrag; 40 std::string ufrag;
(...skipping 19 matching lines...) Expand all
59 PortInterface* origin_port_; 60 PortInterface* origin_port_;
60 }; 61 };
61 62
62 // P2PTransportChannel manages the candidates and connection process to keep 63 // P2PTransportChannel manages the candidates and connection process to keep
63 // two P2P clients connected to each other. 64 // two P2P clients connected to each other.
64 class P2PTransportChannel : public TransportChannelImpl, 65 class P2PTransportChannel : public TransportChannelImpl,
65 public rtc::MessageHandler { 66 public rtc::MessageHandler {
66 public: 67 public:
67 P2PTransportChannel(const std::string& transport_name, 68 P2PTransportChannel(const std::string& transport_name,
68 int component, 69 int component,
70 P2PTransport* transport,
69 PortAllocator* allocator); 71 PortAllocator* allocator);
70 virtual ~P2PTransportChannel(); 72 virtual ~P2PTransportChannel();
71 73
72 // From TransportChannelImpl: 74 // From TransportChannelImpl:
75 Transport* GetTransport() override { return transport_; }
73 TransportChannelState GetState() const override; 76 TransportChannelState GetState() const override;
74 void SetIceRole(IceRole role) override; 77 void SetIceRole(IceRole role) override;
75 IceRole GetIceRole() const override { return ice_role_; } 78 IceRole GetIceRole() const override { return ice_role_; }
76 void SetIceTiebreaker(uint64_t tiebreaker) override; 79 void SetIceTiebreaker(uint64_t tiebreaker) override;
77 void SetIceCredentials(const std::string& ice_ufrag, 80 void SetIceCredentials(const std::string& ice_ufrag,
78 const std::string& ice_pwd) override; 81 const std::string& ice_pwd) override;
79 void SetRemoteIceCredentials(const std::string& ice_ufrag, 82 void SetRemoteIceCredentials(const std::string& ice_ufrag,
80 const std::string& ice_pwd) override; 83 const std::string& ice_pwd) override;
81 void SetRemoteIceMode(IceMode mode) override; 84 void SetRemoteIceMode(IceMode mode) override;
82 void Connect() override; 85 void Connect() override;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 const IceParameters* FindRemoteIceFromUfrag(const std::string& ufrag, 257 const IceParameters* FindRemoteIceFromUfrag(const std::string& ufrag,
255 uint32_t* generation); 258 uint32_t* generation);
256 // Returns the index of the latest remote ICE parameters, or 0 if no remote 259 // Returns the index of the latest remote ICE parameters, or 0 if no remote
257 // ICE parameters have been received. 260 // ICE parameters have been received.
258 uint32_t remote_ice_generation() { 261 uint32_t remote_ice_generation() {
259 return remote_ice_parameters_.empty() 262 return remote_ice_parameters_.empty()
260 ? 0 263 ? 0
261 : static_cast<uint32_t>(remote_ice_parameters_.size() - 1); 264 : static_cast<uint32_t>(remote_ice_parameters_.size() - 1);
262 } 265 }
263 266
267 P2PTransport* transport_;
264 PortAllocator* allocator_; 268 PortAllocator* allocator_;
265 rtc::Thread* worker_thread_; 269 rtc::Thread* worker_thread_;
266 bool incoming_only_; 270 bool incoming_only_;
267 int error_; 271 int error_;
268 std::vector<PortAllocatorSession*> allocator_sessions_; 272 std::vector<PortAllocatorSession*> allocator_sessions_;
269 std::vector<PortInterface *> ports_; 273 std::vector<PortInterface *> ports_;
270 std::vector<Connection *> connections_; 274 std::vector<Connection *> connections_;
271 Connection* best_connection_; 275 Connection* best_connection_;
272 // Connection selected by the controlling agent. This should be used only 276 // Connection selected by the controlling agent. This should be used only
273 // at controlled side when protocol type is RFC5245. 277 // at controlled side when protocol type is RFC5245.
(...skipping 18 matching lines...) Expand all
292 bool gather_continually_ = false; 296 bool gather_continually_ = false;
293 int weak_ping_delay_ = WEAK_PING_DELAY; 297 int weak_ping_delay_ = WEAK_PING_DELAY;
294 TransportChannelState state_ = TransportChannelState::STATE_INIT; 298 TransportChannelState state_ = TransportChannelState::STATE_INIT;
295 299
296 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); 300 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
297 }; 301 };
298 302
299 } // namespace cricket 303 } // namespace cricket
300 304
301 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ 305 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/p2ptransport.cc ('k') | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698